| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #ifndef MEGACELL_H |
| 20 | #define MEGACELL_H |
| 21 | |
| 22 | #include "pstypes.h" |
| 23 | #include "manage.h" |
| 24 | #include "gametexture.h" |
| 25 | |
| 26 | #define MAX_MEGACELLS 100 |
| 27 | |
| 28 | #define DEFAULT_MEGACELL_WIDTH 8 |
| 29 | #define DEFAULT_MEGACELL_HEIGHT 8 |
| 30 | |
| 31 | #define MAX_MEGACELL_WIDTH 8 |
| 32 | #define MAX_MEGACELL_HEIGHT 8 |
| 33 | |
| 34 | struct megacell { |
| 35 | char name[PAGENAME_LEN]; |
| 36 | int8_t width; |
| 37 | int8_t height; |
| 38 | |
| 39 | int16_t texture_handles[MAX_MEGACELL_WIDTH * MAX_MEGACELL_HEIGHT]; |
| 40 | int flags; |
| 41 | uint8_t used; |
| 42 | }; |
| 43 | |
| 44 | extern int Num_megacells; |
| 45 | extern megacell Megacells[MAX_MEGACELLS]; |
| 46 | |
| 47 | // Sets all MEGACELLs to unused |
| 48 | void InitMegacells(); |
| 49 | |
| 50 | // Allocs a MEGACELL for use, returns -1 if error, else index on success |
| 51 | int AllocMegacell(); |
| 52 | |
| 53 | // Frees MEGACELL index n |
| 54 | void FreeMegacell(int n); |
| 55 | |
| 56 | // Gets next MEGACELL from n that has actually been alloced |
| 57 | int GetNextMegacell(int n); |
| 58 | |
| 59 | // Gets previous MEGACELL from n that has actually been alloced |
| 60 | int GetPrevMegacell(int n); |
| 61 | |
| 62 | // Searches thru all MEGACELLs for a specific name, returns -1 if not found |
| 63 | // or index of MEGACELL with name |
| 64 | int FindMegacellName(char *name); |
| 65 | |
| 66 | #endif |