| 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 TEXPAGE_H |
| 20 | #define TEXPAGE_Hcxx . . $ `manage/texpage.h:20:9`! |
| 21 | |
| 22 | #include "manage.h"cxx . . $ `<file>/lib/manage.h`/ |
| 23 | #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/ |
| 24 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 25 | #include "procedurals.h"cxx . . $ `<file>/Descent3/procedurals.h`/ |
| 26 | |
| 27 | struct mngs_texture_pagecxx . . $ mngs_texture_page# { |
| 28 | char bitmap_namecxx . . $ mngs_texture_page#bitmap_name.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!]; // filename for the bitmap associated with this texture |
| 29 | char destroy_namecxx . . $ mngs_texture_page#destroy_name.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!]; // filename for the destroyed bitmap |
| 30 | char sound_namecxx . . $ mngs_texture_page#sound_name.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!]; // filename for the destroyed bitmap |
| 31 | texturecxx . . $ texture# tex_structcxx . . $ mngs_texture_page#tex_struct.; |
| 32 | |
| 33 | int num_proc_elementscxx . . $ mngs_texture_page#num_proc_elements.; |
| 34 | |
| 35 | uint8_tcxx . . $ uint8_t# proc_heatcxx . . $ mngs_texture_page#proc_heat., proc_lightcxx . . $ mngs_texture_page#proc_light., proc_thicknesscxx . . $ mngs_texture_page#proc_thickness., osc_valuecxx . . $ mngs_texture_page#osc_value.; |
| 36 | |
| 37 | float proc_evaluation_timecxx . . $ mngs_texture_page#proc_evaluation_time., osc_timecxx . . $ mngs_texture_page#osc_time.; |
| 38 | |
| 39 | uint8_tcxx . . $ uint8_t# proc_typecxx . . $ mngs_texture_page#proc_type.[MAX_PROC_ELEMENTScxx . . $ `Descent3/procedurals.h:26:9`!]; |
| 40 | |
| 41 | uint8_tcxx . . $ uint8_t# proc_frequencycxx . . $ mngs_texture_page#proc_frequency.[MAX_PROC_ELEMENTScxx . . $ `Descent3/procedurals.h:26:9`!]; |
| 42 | uint8_tcxx . . $ uint8_t# proc_speedcxx . . $ mngs_texture_page#proc_speed.[MAX_PROC_ELEMENTScxx . . $ `Descent3/procedurals.h:26:9`!]; |
| 43 | |
| 44 | uint8_tcxx . . $ uint8_t# proc_sizecxx . . $ mngs_texture_page#proc_size.[MAX_PROC_ELEMENTScxx . . $ `Descent3/procedurals.h:26:9`!]; |
| 45 | |
| 46 | uint8_tcxx . . $ uint8_t# proc_x1cxx . . $ mngs_texture_page#proc_x1.[MAX_PROC_ELEMENTScxx . . $ `Descent3/procedurals.h:26:9`!]; |
| 47 | uint8_tcxx . . $ uint8_t# proc_y1cxx . . $ mngs_texture_page#proc_y1.[MAX_PROC_ELEMENTScxx . . $ `Descent3/procedurals.h:26:9`!]; |
| 48 | uint8_tcxx . . $ uint8_t# proc_x2cxx . . $ mngs_texture_page#proc_x2.[MAX_PROC_ELEMENTScxx . . $ `Descent3/procedurals.h:26:9`!]; |
| 49 | uint8_tcxx . . $ uint8_t# proc_y2cxx . . $ mngs_texture_page#proc_y2.[MAX_PROC_ELEMENTScxx . . $ `Descent3/procedurals.h:26:9`!]; |
| 50 | |
| 51 | uint16_tcxx . . $ uint16_t# proc_palettecxx . . $ mngs_texture_page#proc_palette.[256]; |
| 52 | }; |
| 53 | |
| 54 | // Texture page functions |
| 55 | //--------------------------------------------------------------- |
| 56 | |
| 57 | // Reads a texture page from an open file. Returns 0 on error. |
| 58 | |
| 59 | int mng_ReadTexturePagecxx . . $ mng_ReadTexturePage(3fd8847e45b480a6).(CFILEcxx . . $ CFILE# *infile, mngs_texture_pagecxx . . $ mngs_texture_page# *texpage); |
| 60 | |
| 61 | // Given an open file pointer and a texture handle, writes that texture page out |
| 62 | void mng_WriteTexturePagecxx . . $ mng_WriteTexturePage(ba0e418ed632d802).(CFILEcxx . . $ CFILE# *outfile, mngs_texture_pagecxx . . $ mngs_texture_page# *texpage); |
| 63 | |
| 64 | // Reads a texture page from an open file. Returns 0 on error. |
| 65 | |
| 66 | int mng_ReadNewTexturePagecxx . . $ mng_ReadNewTexturePage(3fd8847e45b480a6).(CFILEcxx . . $ CFILE# *infile, mngs_texture_pagecxx . . $ mngs_texture_page# *texpage); |
| 67 | |
| 68 | // Given an open file pointer and a texture handle, writes that texture page out |
| 69 | void mng_WriteNewTexturePagecxx . . $ mng_WriteNewTexturePage(ba0e418ed632d802).(CFILEcxx . . $ CFILE# *outfile, mngs_texture_pagecxx . . $ mngs_texture_page# *texpage); |
| 70 | |
| 71 | // Given a texture page, allocs a texture and loads that textures associated bitmap |
| 72 | // returns texture handle on success, -1 if fail |
| 73 | int mng_SetAndLoadTexturecxx . . $ mng_SetAndLoadTexture(9787a10128a4cfde).(mngs_texture_pagecxx . . $ mngs_texture_page# *texpage); |
| 74 | |
| 75 | // Reads in a texture page from the local table file, superseding any texture |
| 76 | // already in RAM with that same name |
| 77 | void mng_LoadLocalTexturePagecxx . . $ mng_LoadLocalTexturePage(3639e799710acb68).(CFILEcxx . . $ CFILE# *); |
| 78 | |
| 79 | // Reads in a page off the net |
| 80 | void mng_LoadNetTexturePagecxx . . $ mng_LoadNetTexturePage(5a5441f2f69caf20).(CFILEcxx . . $ CFILE# *, bool overlay = false); |
| 81 | |
| 82 | // Reads in the texpage named "name" into texpage struct |
| 83 | // Returns 0 on error, else 1 if all is good |
| 84 | int mng_FindSpecificTexPagecxx . . $ mng_FindSpecificTexPage(c515c31a8f24d4fa).(char *name, mngs_texture_pagecxx . . $ mngs_texture_page# *texpage, int offset = 0); |
| 85 | |
| 86 | // Given a texpage and a texture handle, attempts to make texture n correspond to |
| 87 | // to the texpage. |
| 88 | int mng_AssignTexPageToTexturecxx . . $ mng_AssignTexPageToTexture(728768d0b263a36e).(mngs_texture_pagecxx . . $ mngs_texture_page# *texpage, int n, CFILEcxx . . $ CFILE# *infile = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 89 | |
| 90 | // Copies values from a texture_page into a texture |
| 91 | void mng_AssignTextureToTexPagecxx . . $ mng_AssignTextureToTexPage(a870206c076b2873).(int n, mngs_texture_pagecxx . . $ mngs_texture_page# *texpage); |
| 92 | |
| 93 | // First searches through the texture index to see if the texture is already |
| 94 | // loaded. If not, searches in the table file and loads it. |
| 95 | // Returns index of texture found, -1 if not |
| 96 | int mng_GetGuaranteedTexturePagecxx . . $ mng_GetGuaranteedTexturePage(a1d8d01c9983cd45).(char *name, CFILEcxx . . $ CFILE# *infile = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 97 | |
| 98 | // Given some texture names, finds them in the table file and deletes them |
| 99 | // If local is 1, deletes from the local table file |
| 100 | int mng_DeleteTexPageSeriescxx . . $ mng_DeleteTexPageSeries(6f6099c1eba6c17c).(char *names[], int num_textures, int local); |
| 101 | |
| 102 | #endif |