| 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 BUMPMAP_H |
| 20 | #define BUMPMAP_Hcxx . . $ `lib/bumpmap.h:20:9`! |
| 21 | |
| 22 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 23 | |
| 24 | #define MAX_BUMPMAPScxx . . $ `lib/bumpmap.h:24:9`! 500 |
| 25 | #define BAD_BUMP_INDEXcxx . . $ `lib/bumpmap.h:25:9`! 65535 |
| 26 | |
| 27 | #define BUMPF_USEDcxx . . $ `lib/bumpmap.h:27:9`! 1 |
| 28 | #define BUMPF_CHANGEDcxx . . $ `lib/bumpmap.h:28:9`! 2 |
| 29 | |
| 30 | struct bms_bumpmapcxx . . $ bms_bumpmap# { |
| 31 | uint16_tcxx . . $ uint16_t# *datacxx . . $ bms_bumpmap#data.; // 8bit data |
| 32 | int16_t cache_slotcxx . . $ bms_bumpmap#cache_slot.; // for the renderers use |
| 33 | uint8_tcxx . . $ uint8_t# widthcxx . . $ bms_bumpmap#width., heightcxx . . $ bms_bumpmap#height.; |
| 34 | uint8_tcxx . . $ uint8_t# flagscxx . . $ bms_bumpmap#flags., padcxx . . $ bms_bumpmap#pad.; |
| 35 | }; |
| 36 | |
| 37 | extern bms_bumpmapcxx . . $ bms_bumpmap# GameBumpmapscxx . . $ GameBumpmaps.[MAX_BUMPMAPScxx . . $ `lib/bumpmap.h:24:9`!]; |
| 38 | |
| 39 | // Sets all the bumpmaps to unused |
| 40 | void bump_InitBumpmapscxx . . $ bump_InitBumpmaps(49f6e7a06ebc5aa8).(); |
| 41 | |
| 42 | void bump_ShutdownBumpmapscxx . . $ bump_ShutdownBumpmaps(49f6e7a06ebc5aa8).(void); |
| 43 | |
| 44 | // Allocs a bumpmap of BUMP_WIDTH * BUMP_HEIGHT size |
| 45 | // Returns bumpmap handle if successful, -1 if otherwise |
| 46 | int bump_AllocBumpmapcxx . . $ bump_AllocBumpmap(9b79fb6aee4c0440).(int w, int h); |
| 47 | |
| 48 | // Given a handle, frees the bumpmap memory and flags this bumpmap as unused |
| 49 | void bump_FreeBumpmapcxx . . $ bump_FreeBumpmap(d4f767463ce0a6b3).(int handle); |
| 50 | |
| 51 | // returns a bumpmaps data else NULL if something is wrong |
| 52 | uint16_tcxx . . $ uint16_t# *bump_datacxx . . $ bump_data(2fbd6a760478ca0f).(int handle); |
| 53 | |
| 54 | // returns width or height of the passed in bumpmap |
| 55 | uint8_tcxx . . $ uint8_t# bump_wcxx . . $ bump_w(bc0fba5608a0bfe7).(int handle); |
| 56 | uint8_tcxx . . $ uint8_t# bump_hcxx . . $ bump_h(bc0fba5608a0bfe7).(int handle); |
| 57 | |
| 58 | #endif |