| 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 _AIAMBIENT_H_ |
| 20 | #define _AIAMBIENT_H_ |
| 21 | |
| 22 | #include "cfile.h" |
| 23 | |
| 24 | #define MAX_AL_TYPES 6 |
| 25 | #define MAX_ALS_PER_TYPE 130 |
| 26 | |
| 27 | #define ALF_INSIDE 0x01 |
| 28 | |
| 29 | #define ALI_TYPE 0 |
| 30 | #define ALI_TOTAL 1 |
| 31 | #define ALI_MAX 2 |
| 32 | #define ALI_MIN 3 |
| 33 | #define ALI_FLAGS 4 |
| 34 | |
| 35 | #define CHECK_INTERVAL_MIN 5.0f |
| 36 | #define CHECK_INTERVAL_MAX 10.0f |
| 37 | |
| 38 | class ambient_life { |
| 39 | // Editor settable values |
| 40 | int m_type[MAX_AL_TYPES]; |
| 41 | uint8_t m_total[MAX_AL_TYPES]; |
| 42 | uint8_t m_max[MAX_AL_TYPES]; |
| 43 | uint8_t m_min[MAX_AL_TYPES]; |
| 44 | uint8_t m_flags[MAX_AL_TYPES]; |
| 45 | |
| 46 | // These are never set or gotten from outside of the class |
| 47 | uint8_t m_cur_num[MAX_AL_TYPES]; |
| 48 | int m_handle[MAX_AL_TYPES][MAX_ALS_PER_TYPE]; |
| 49 | |
| 50 | // Don't save these... |
| 51 | uint8_t m_next_size[MAX_AL_TYPES]; |
| 52 | float m_next_do_time[MAX_AL_TYPES]; |
| 53 | |
| 54 | void ComputeNextSize(char index); |
| 55 | |
| 56 | public: |
| 57 | ambient_life() { ALReset(); } |
| 58 | |
| 59 | void GetALValue(char index, char field, void *ptr); |
| 60 | void SetALValue(char index, char field, void *ptr); |
| 61 | void SaveData(CFILE *fptr); |
| 62 | void LoadData(CFILE *fptr); |
| 63 | |
| 64 | void DoFrame(); |
| 65 | void InitForLevel(void); |
| 66 | void ALReset(); |
| 67 | }; |
| 68 | |
| 69 | extern ambient_life a_life; |
| 70 | |
| 71 | #endif |