| 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 GAMEFILE_H |
| 20 | #define GAMEFILE_H |
| 21 | |
| 22 | #include "pstypes.h" |
| 23 | #include "manage.h" |
| 24 | |
| 25 | #define MAX_GAMEFILES 1500 |
| 26 | |
| 27 | struct gamefile { |
| 28 | char name[PAGENAME_LEN]; |
| 29 | char dir_name[PAGENAME_LEN]; |
| 30 | uint8_t used; |
| 31 | }; |
| 32 | |
| 33 | extern int Num_gamefiles; |
| 34 | extern gamefile Gamefiles[MAX_GAMEFILES]; |
| 35 | |
| 36 | // Sets all gamefiles to unused |
| 37 | void InitGamefiles(); |
| 38 | |
| 39 | // Allocs a gamefile for use, returns -1 if error, else index on success |
| 40 | int AllocGamefile(); |
| 41 | |
| 42 | // Frees gamefile index n |
| 43 | void FreeGamefile(int n); |
| 44 | |
| 45 | // Gets next gamefile from n that has actually been alloced |
| 46 | int GetNextGamefile(int n); |
| 47 | |
| 48 | // Gets previous gamefile from n that has actually been alloced |
| 49 | int GetPrevGamefile(int n); |
| 50 | |
| 51 | // Searches thru all gamefile for a specific name, returns -1 if not found |
| 52 | // or index of gamefile with name |
| 53 | int FindGamefileName(char *name); |
| 54 | |
| 55 | #endif |