1 /* 2 3 Copyright (C) 2015-2018 Night Dive Studios, LLC. 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 __TEXTMAPS_H 20 #define __TEXTMAPS_H 21 22 /* 23 * $Source: r:/prj/cit/src/inc/RCS/textmaps.h $ 24 * $Revision: 1.45 $ 25 * $Author: xemu $ 26 * $Date: 1994/11/01 09:19:48 $ 27 * 28 * 29 * 30 */ 31 32 // Includes 33 34 // Defines 35 36 #define NUM_TEXTURE_SIZES 4 37 38 //#define NUM_LOADED_TEXTURES 64 39 #define NUM_LOADED_TEXTURES 54 40 #define GAME_TEXTURES 400 41 #define NUM_ANIMATING_TEXTURES 0 42 #define NUM_STATIC_TEXTURES (GAME_TEXTURES - NUM_ANIMATING_TEXTURES) 43 #define MAX_LOADED_BITMAPS NUM_LOADED_TEXTURES *NUM_TEXTURE_SIZES 44 45 /* These are for reference, in case the #defines below need to be recomputed. 46 They are hardwired to avoid needless dependencies. 47 48 #define TEXTURE_128_ID RES_bmTextureMap128 49 #define TEXTURE_64_ID RES_bmTextureMap64 50 #define TEXTURE_32_ID RES_bmTextureMap32 51 #define TEXTURE_16_ID RES_bmTextureMap16 52 53 #define TEXTURE_SMALL_ID RES_smallTextureMaps 54 */ 55 56 #define TEXTURE_128_ID 1000 57 #define TEXTURE_64_ID 707 58 #define TEXTURE_32_ID 77 59 #define TEXTURE_16_ID 76 60 61 #define MAX_SMALL_TMAPS 128 62 #define TEXTURE_SMALL_ID 321 63 64 #define TEXTURE_128_INDEX 0 65 #define TEXTURE_64_INDEX 1 66 #define TEXTURE_32_INDEX 2 67 #define TEXTURE_16_INDEX 3 68 69 #define SMALLEST_SIZE_INDEX TEXTURE_128_INDEX 70 #define LARGEST_SIZE_INDEX TEXTURE_16_INDEX 71 72 #define TEXTPROP_VERSION_NUMBER 9 73 #define TEXTPROP_FILENAME "textprop.dat" 74 75 #define NUM_ANIM_TEXTURE_GROUPS 4 76 77 // for new regieme 78 #define NUM_STATIC_TMAPS NUM_LOADED_TEXTURES 79 #define SIZE_STATIC_TMAP ((64 * 64) + (32 * 32) + (16 * 16)) 80 #define SIZE_BIG_TMAP (128 * 128) 81 82 typedef struct { 83 // These are indices into the texture_bitmaps array 84 // Note that for animating textures, the entry and the 85 // next 7 are all reserved for that texture. 86 int size_index[NUM_TEXTURE_SIZES]; 87 ubyte sizes_loaded; 88 } TextureMap; 89 90 typedef struct { 91 char family_texture; 92 char target_texture; 93 short resilience; 94 short distance_mod; 95 char friction_climb; 96 char friction_walk; 97 char force_dir; 98 char anim_group; 99 char group_pos; 100 } TextureProp; 101 102 #define ANIMTEXTURE_CYCLE 0x01 103 104 #define ANIMTEXTURE_REVERSED 0x80 105 106 typedef struct { 107 short anim_speed; 108 short time_remainder; 109 char current_frame; 110 char num_frames; 111 char flags; 112 } AnimTextureData; 113 114 #define SUPER_MOD(val, modval) ((modval) ? (val % modval) : val) // make sure modval is non-zero before moding 115 116 // new rob 117 #define ANIMTEXT_BASE(tid) (tid - textprops[(tid)].group_pos) 118 #define ANIMTEXT_FRAME(tid) \ 119 SUPER_MOD((animtextures[textprops[(tid)].anim_group].current_frame + textprops[(tid)].group_pos), \ 120 animtextures[textprops[(tid)].anim_group].num_frames) 121 #define GET_TEXTURE_INDEX(tid, size) texture_array[ANIMTEXT_BASE(tid) + ANIMTEXT_FRAME(tid)].size_index[(size)] 122 123 // Prototypes 124 void load_textures(); 125 errtype load_alternate_textures(); 126 errtype bitmap_array_unload(int *num_bitmaps, grs_bitmap *arr[]); 127 errtype Init_Lighting(void); 128 errtype load_master_texture_properties(); 129 errtype unload_master_texture_properties(); 130 errtype clear_texture_properties(); 131 132 #define SHADING_TABLE_FNAME "shadtabl.dat" 133 #define SHADING_TABLE_AMBER_FNAME "ambrtabl.dat" 134 #define SHADING_TABLE_BW_FNAME "bwtabl.dat" 135 136 // Globals 137 138 #ifdef __TEXTMAPS_SRC 139 short loved_textures[NUM_LOADED_TEXTURES]; 140 TextureProp textprops[NUM_LOADED_TEXTURES]; 141 AnimTextureData animtextures[NUM_ANIM_TEXTURE_GROUPS]; 142 uchar shading_table[256 * 16]; 143 uchar bw_shading_table[256 * 16]; 144 TextureProp *texture_properties; 145 #else 146 extern short loved_textures[NUM_LOADED_TEXTURES]; 147 extern TextureProp textprops[NUM_LOADED_TEXTURES]; 148 extern AnimTextureData animtextures[NUM_ANIM_TEXTURE_GROUPS]; 149 extern uchar shading_table[256 * 16]; 150 extern uchar bw_shading_table[256 * 16]; 151 extern TextureProp *texture_properties; 152 #endif 153 154 #endif // __TEXTMAPS_H 155