| 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 TERRAIN_H |
| 20 | #define TERRAIN_Hcxx . . $ `Descent3/terrain.h:20:9`! |
| 21 | |
| 22 | #include "vecmat.h"cxx . . $ `<file>/lib/vecmat.h`/ |
| 23 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 24 | #include "3d.h"cxx . . $ `<file>/lib/3d.h`/ |
| 25 | #include "grdefs.h"cxx . . $ `<file>/lib/grdefs.h`/ |
| 26 | #include "object.h"cxx . . $ `<file>/Descent3/object.h`/ |
| 27 | |
| 28 | // How far we texture out to...after this distance we draw flat shaded polygons |
| 29 | #define DEFAULT_TEXTURE_DISTANCEcxx . . $ `Descent3/terrain.h:29:9`! 9999 |
| 30 | |
| 31 | #define TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! 256 // How many cells across |
| 32 | #define TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`! 256 // How many cells down |
| 33 | #define TERRAIN_SIZEcxx . . $ `Descent3/terrain.h:33:9`! 16.0 // The size of each segment, must be a power of 2 |
| 34 | #define TERRAIN_TEX_WIDTHcxx . . $ `Descent3/terrain.h:34:9`! 32 |
| 35 | #define TERRAIN_TEX_DEPTHcxx . . $ `Descent3/terrain.h:35:9`! 32 |
| 36 | |
| 37 | // LOD STUFF |
| 38 | #define MAX_TERRAIN_LODcxx . . $ `Descent3/terrain.h:38:9`! 4 // How many levels of detail we support |
| 39 | #define SHUTOFF_LOD_DELTAcxx . . $ `Descent3/terrain.h:39:9`! 800000.0f // Forces lod engine not to work for a particular cell |
| 40 | #define SHUTOFF_LOD_INVISIBLEcxx . . $ `Descent3/terrain.h:40:9`! 900000.0f // This LOD is totally invisible |
| 41 | |
| 42 | #define MAX_LOD_SIZEcxx . . $ `Descent3/terrain.h:42:9`! (1 << (MAX_TERRAIN_LODcxx . . $ `Descent3/terrain.h:38:9`! - 1)) |
| 43 | |
| 44 | #define MAX_CELLS_TO_RENDERcxx . . $ `Descent3/terrain.h:44:9`! 32768 // The maximum number of cells we can render in a frame |
| 45 | |
| 46 | #define MAX_TERRAIN_HEIGHTcxx . . $ `Descent3/terrain.h:46:9`! 350.0f // Max height of our terrain |
| 47 | #define TERRAIN_HEIGHT_INCREMENTcxx . . $ `Descent3/terrain.h:47:9`! (MAX_TERRAIN_HEIGHTcxx . . $ `Descent3/terrain.h:46:9`! / 255.0f) // Incremental jumps |
| 48 | #define DEFAULT_VISIBLE_TERRAIN_DISTANCEcxx . . $ `Descent3/terrain.h:48:9`! 80.0 * TERRAIN_SIZE |
| 49 | |
| 50 | // Sky defines |
| 51 | #define MAX_STARScxx . . $ `Descent3/terrain.h:51:9`! 600 // how many stars in our sky |
| 52 | #define MAX_SATELLITEScxx . . $ `Descent3/terrain.h:52:9`! 5 // max satellites in our sky |
| 53 | #define MAX_HORIZON_PIECEScxx . . $ `Descent3/terrain.h:53:9`! 16 // how many segments of the horizon there are around our sphere |
| 54 | |
| 55 | // Sky flags |
| 56 | #define TF_STARScxx . . $ `Descent3/terrain.h:56:9`! 1 // whether or not our terrain is starred |
| 57 | #define TF_SATELLITEScxx . . $ `Descent3/terrain.h:57:9`! 2 // Draw satellites or no? |
| 58 | #define TF_FOGcxx . . $ `Descent3/terrain.h:58:9`! 4 // Draw fog? |
| 59 | #define TF_ROTATE_STARScxx . . $ `Descent3/terrain.h:59:9`! 8 |
| 60 | #define TF_ROTATE_SKYcxx . . $ `Descent3/terrain.h:60:9`! 16 |
| 61 | |
| 62 | // Satellite flags |
| 63 | #define TSF_HALOcxx . . $ `Descent3/terrain.h:63:9`! 1 // Draw halo? |
| 64 | #define TSF_ATMOSPHEREcxx . . $ `Descent3/terrain.h:64:9`! 2 // Draw atmosphere |
| 65 | |
| 66 | // occlusion stuff |
| 67 | #define OCCLUSION_SIZEcxx . . $ `Descent3/terrain.h:67:9`! 16 |
| 68 | |
| 69 | // Mine/terrain joining |
| 70 | #define MAX_LINK_TILEScxx . . $ `Descent3/terrain.h:70:9`! 4 // how many terrain segments can be attached to mines |
| 71 | |
| 72 | // Terrain segment flags |
| 73 | #define TF_DYNAMICcxx . . $ `Descent3/terrain.h:73:9`! 1 |
| 74 | #define TF_SPECIAL_WATERcxx . . $ `Descent3/terrain.h:74:9`! 4 // Water |
| 75 | #define TF_SPECIAL_MINEcxx . . $ `Descent3/terrain.h:75:9`! 8 // This segment has a mine attached to it |
| 76 | #define TF_INVISIBLEcxx . . $ `Descent3/terrain.h:76:9`! 16 // This segment is invisible |
| 77 | #define TFM_REGION_MASKcxx . . $ `Descent3/terrain.h:77:9`! (32 + 64 + 128) |
| 78 | // NOTE: 32 64 and 128 are reserved for AI stuff (terrain region partitioning) |
| 79 | |
| 80 | // Terrain cells are on a fixed grid so they have no x and z positions. If you want the x and z |
| 81 | // positions you must calculate them yourself: gridx*TERRAIN_SIZE and gridz*TERRAIN_SIZE |
| 82 | |
| 83 | struct terrain_segmentcxx . . $ terrain_segment# { |
| 84 | float ycxx . . $ terrain_segment#y.; // Y position of the lower left corner of the terrain cell |
| 85 | float modycxx . . $ terrain_segment#mody.; // The modified y position of this cell - used for LOD |
| 86 | |
| 87 | uint8_tcxx . . $ uint8_t# lcxx . . $ terrain_segment#l., rcxx . . $ terrain_segment#r., gcxx . . $ terrain_segment#g., bcxx . . $ terrain_segment#b.; |
| 88 | |
| 89 | int16_tcxx . . $ int16_t# objectscxx . . $ terrain_segment#objects.; // Index of the first object in this cell |
| 90 | int16_tcxx . . $ int16_t# texseg_indexcxx . . $ terrain_segment#texseg_index.; // index into the tex_segment array |
| 91 | |
| 92 | uint8_tcxx . . $ uint8_t# flagscxx . . $ terrain_segment#flags.; // various flags |
| 93 | uint8_tcxx . . $ uint8_t# lm_quadcxx . . $ terrain_segment#lm_quad.; // which lightmap quad this index belongs to |
| 94 | uint8_tcxx . . $ uint8_t# yposcxx . . $ terrain_segment#ypos.; // this is so we don't have to constantly convert |
| 95 | // floats to ints when traversing the terrain |
| 96 | // it's the integer version of pos.y |
| 97 | uint8_tcxx . . $ uint8_t# padcxx . . $ terrain_segment#pad.; // for alignment |
| 98 | }; |
| 99 | |
| 100 | struct terrain_tex_segmentcxx . . $ terrain_tex_segment# { |
| 101 | uint8_tcxx . . $ uint8_t# rotationcxx . . $ terrain_tex_segment#rotation.; |
| 102 | int16_tcxx . . $ int16_t# tex_indexcxx . . $ terrain_tex_segment#tex_index.; |
| 103 | }; |
| 104 | |
| 105 | // Data for LOD shutoff code |
| 106 | struct lodoffcxx . . $ lodoff# { |
| 107 | int cellnumcxx . . $ lodoff#cellnum.; |
| 108 | float save_deltacxx . . $ lodoff#save_delta.[MAX_TERRAIN_LODcxx . . $ `Descent3/terrain.h:38:9`!]; |
| 109 | }; |
| 110 | |
| 111 | // Data for the sky spherical map |
| 112 | struct terrain_skycxx . . $ terrain_sky# { |
| 113 | int texturedcxx . . $ terrain_sky#textured.; // 1=use textures, 0=use gouraud shaded polygon |
| 114 | |
| 115 | // The two subscripts correspond to the top, middle, and bottom of the horizon piece |
| 116 | vectorcxx . . $ vector# horizon_vectorscxx . . $ terrain_sky#horizon_vectors.[MAX_HORIZON_PIECEScxx . . $ `Descent3/terrain.h:53:9`!][6]; |
| 117 | float horizon_ucxx . . $ terrain_sky#horizon_u.[MAX_HORIZON_PIECEScxx . . $ `Descent3/terrain.h:53:9`!][5]; |
| 118 | float horizon_vcxx . . $ terrain_sky#horizon_v.[MAX_HORIZON_PIECEScxx . . $ `Descent3/terrain.h:53:9`!][5]; |
| 119 | |
| 120 | int16_tcxx . . $ int16_t# dome_texturecxx . . $ terrain_sky#dome_texture.; |
| 121 | |
| 122 | float radiuscxx . . $ terrain_sky#radius.; |
| 123 | float rotate_ratecxx . . $ terrain_sky#rotate_rate.; |
| 124 | |
| 125 | ddgr_colorcxx . . $ ddgr_color# sky_colorcxx . . $ terrain_sky#sky_color.; |
| 126 | ddgr_colorcxx . . $ ddgr_color# horizon_colorcxx . . $ terrain_sky#horizon_color.; |
| 127 | ddgr_colorcxx . . $ ddgr_color# fog_colorcxx . . $ terrain_sky#fog_color.; |
| 128 | |
| 129 | float satellite_rcxx . . $ terrain_sky#satellite_r.[MAX_SATELLITEScxx . . $ `Descent3/terrain.h:52:9`!]; |
| 130 | float satellite_gcxx . . $ terrain_sky#satellite_g.[MAX_SATELLITEScxx . . $ `Descent3/terrain.h:52:9`!]; |
| 131 | float satellite_bcxx . . $ terrain_sky#satellite_b.[MAX_SATELLITEScxx . . $ `Descent3/terrain.h:52:9`!]; |
| 132 | |
| 133 | vectorcxx . . $ vector# star_vectorscxx . . $ terrain_sky#star_vectors.[MAX_STARScxx . . $ `Descent3/terrain.h:51:9`!]; |
| 134 | vectorcxx . . $ vector# satellite_vectorscxx . . $ terrain_sky#satellite_vectors.[MAX_SATELLITEScxx . . $ `Descent3/terrain.h:52:9`!]; |
| 135 | uint8_tcxx . . $ uint8_t# satellite_flagscxx . . $ terrain_sky#satellite_flags.[MAX_SATELLITEScxx . . $ `Descent3/terrain.h:52:9`!]; |
| 136 | float satellite_sizecxx . . $ terrain_sky#satellite_size.[MAX_SATELLITEScxx . . $ `Descent3/terrain.h:52:9`!]; |
| 137 | |
| 138 | uint8_tcxx . . $ uint8_t# num_satellitescxx . . $ terrain_sky#num_satellites.; |
| 139 | uint8_tcxx . . $ uint8_t# num_starscxx . . $ terrain_sky#num_stars.; |
| 140 | |
| 141 | int16_tcxx . . $ int16_t# satellite_texturecxx . . $ terrain_sky#satellite_texture.[MAX_SATELLITEScxx . . $ `Descent3/terrain.h:52:9`!]; |
| 142 | |
| 143 | vectorcxx . . $ vector# lightsourcecxx . . $ terrain_sky#lightsource.; |
| 144 | anglecxx . . $ angle# lightanglecxx . . $ terrain_sky#lightangle.; |
| 145 | |
| 146 | float damage_per_secondcxx . . $ terrain_sky#damage_per_second.; |
| 147 | float fog_scalarcxx . . $ terrain_sky#fog_scalar.; |
| 148 | |
| 149 | int star_colorcxx . . $ terrain_sky#star_color.[MAX_STARScxx . . $ `Descent3/terrain.h:51:9`!]; |
| 150 | int flagscxx . . $ terrain_sky#flags.; |
| 151 | }; |
| 152 | |
| 153 | struct link_tilecxx . . $ link_tile# { |
| 154 | int mine_segcxx . . $ link_tile#mine_seg.; |
| 155 | int mine_sidecxx . . $ link_tile#mine_side.; |
| 156 | int portal_numcxx . . $ link_tile#portal_num.; |
| 157 | int terrain_segcxx . . $ link_tile#terrain_seg.; |
| 158 | |
| 159 | }; |
| 160 | |
| 161 | struct terrain_mine_listcxx . . $ terrain_mine_list# { |
| 162 | int terrain_segcxx . . $ terrain_mine_list#terrain_seg.; |
| 163 | uint8_tcxx . . $ uint8_t# num_segscxx . . $ terrain_mine_list#num_segs.; |
| 164 | int16_tcxx . . $ int16_t# mine_segscxx . . $ terrain_mine_list#mine_segs.[50]; |
| 165 | }; |
| 166 | |
| 167 | struct terrain_render_infocxx . . $ terrain_render_info# { |
| 168 | float zcxx . . $ terrain_render_info#z.; |
| 169 | uint16_tcxx . . $ uint16_t# right_edgecxx . . $ terrain_render_info#right_edge., left_edgecxx . . $ terrain_render_info#left_edge., top_edgecxx . . $ terrain_render_info#top_edge., bottom_edgecxx . . $ terrain_render_info#bottom_edge.; // for fixing tjoint problems |
| 170 | uint8_tcxx . . $ uint8_t# right_countcxx . . $ terrain_render_info#right_count., left_countcxx . . $ terrain_render_info#left_count., top_countcxx . . $ terrain_render_info#top_count., bottom_countcxx . . $ terrain_render_info#bottom_count.; |
| 171 | uint16_tcxx . . $ uint16_t# segmentcxx . . $ terrain_render_info#segment.; // what segment to render |
| 172 | uint8_tcxx . . $ uint8_t# lodcxx . . $ terrain_render_info#lod.; // what level of detail: 0=16x16, 1=8x8, 2=4x4, 3=2x2, 4=just this segment (1x1) |
| 173 | uint8_tcxx . . $ uint8_t# padcxx . . $ terrain_render_info#pad.; |
| 174 | }; |
| 175 | |
| 176 | struct terrain_normalscxx . . $ terrain_normals# { |
| 177 | vectorcxx . . $ vector# normal1cxx . . $ terrain_normals#normal1.; // Upper left triangle |
| 178 | vectorcxx . . $ vector# normal2cxx . . $ terrain_normals#normal2.; // Lower right triangle |
| 179 | }; |
| 180 | |
| 181 | extern uint8_tcxx . . $ uint8_t# Terrain_dynamic_tablecxx . . $ Terrain_dynamic_table.[]; |
| 182 | extern terrain_normalscxx . . $ terrain_normals# *TerrainNormalscxx . . $ TerrainNormals.[MAX_TERRAIN_LODcxx . . $ `Descent3/terrain.h:38:9`!]; |
| 183 | |
| 184 | // Occlusion data for knowing what to draw |
| 185 | extern uint8_tcxx . . $ uint8_t# Terrain_occlusion_mapcxx . . $ Terrain_occlusion_map.[256][32]; |
| 186 | extern int Terrain_occlusion_checksumcxx . . $ Terrain_occlusion_checksum.; |
| 187 | |
| 188 | extern int Check_terrain_portalcxx . . $ Check_terrain_portal.; |
| 189 | extern int Terrain_checksumcxx . . $ Terrain_checksum.; |
| 190 | |
| 191 | // Our lighting maps for the terrain, one for each quadrant (starting at lower left) |
| 192 | extern int TerrainLightmapscxx . . $ TerrainLightmaps.[4]; |
| 193 | |
| 194 | extern int GlobalTransCountcxx . . $ GlobalTransCount., TotalDepthcxx . . $ TotalDepth.; |
| 195 | extern int TerrainEdgeTestcxx . . $ TerrainEdgeTest.[MAX_TERRAIN_LODcxx . . $ `Descent3/terrain.h:38:9`!][16]; |
| 196 | |
| 197 | extern terrain_render_infocxx . . $ terrain_render_info# Terrain_listcxx . . $ Terrain_list.[]; |
| 198 | extern uint16_tcxx . . $ uint16_t# TS_FrameCountcxx . . $ TS_FrameCount.; |
| 199 | |
| 200 | extern float VisibleTerrainZcxx . . $ VisibleTerrainZ.; |
| 201 | extern float Terrain_average_heightcxx . . $ Terrain_average_height.; |
| 202 | |
| 203 | extern float Clip_scale_leftcxx . . $ Clip_scale_left., Clip_scale_rightcxx . . $ Clip_scale_right., Clip_scale_topcxx . . $ Clip_scale_top., Clip_scale_botcxx . . $ Clip_scale_bot.; |
| 204 | extern uint8_tcxx . . $ uint8_t# Terrain_from_minecxx . . $ Terrain_from_mine.; |
| 205 | |
| 206 | extern float Last_terrain_render_timecxx . . $ Last_terrain_render_time.; |
| 207 | |
| 208 | extern terrain_segmentcxx . . $ terrain_segment# Terrain_segcxx . . $ Terrain_seg.[TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`!]; |
| 209 | extern terrain_tex_segmentcxx . . $ terrain_tex_segment# Terrain_tex_segcxx . . $ Terrain_tex_seg.[TERRAIN_TEX_WIDTHcxx . . $ `Descent3/terrain.h:34:9`! * TERRAIN_TEX_DEPTHcxx . . $ `Descent3/terrain.h:35:9`!]; |
| 210 | |
| 211 | // first object to render after cell has been rendered (only used for SW renderer) |
| 212 | extern int16_tcxx . . $ int16_t# Terrain_seg_render_objscxx . . $ Terrain_seg_render_objs.[]; |
| 213 | |
| 214 | #ifdef RELEASE |
| 215 | #define TERRAIN_REGION(x) ((Terrain_seg[0x7FFFFFFF & x].flags & TFM_REGION_MASK) >> 5) |
| 216 | #else // debug(-ish) builds - check if x is valid |
| 217 | static inline int TERRAIN_REGIONcxx . . $ TERRAIN_REGION(7864480464b09eea).(int x) { |
| 218 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(x != -1 && "invalid/unset room number (-1)!"); |
| 219 | // Note: due to the 0x7FFFFFFF mask, terrSegIdx will be >= 0 |
| 220 | int terrSegIdx = 0x7FFFFFFF & x; |
| 221 | // catch other invalid cell/segment numbers than -1 as well |
| 222 | ASSERTcxx . . $ `misc/pserror.h:246:9`!((terrSegIdx < TERRAIN_WIDTHcxx . . $ `Descent3/terrain.h:31:9`! * TERRAIN_DEPTHcxx . . $ `Descent3/terrain.h:32:9`!) && "invalid cellnum!"); |
| 223 | return (Terrain_segcxx . . $ Terrain_seg.[terrSegIdx].flagscxx . . $ terrain_segment#flags. & TFM_REGION_MASKcxx . . $ `Descent3/terrain.h:77:9`!) >> 5; |
| 224 | } |
| 225 | #endif |
| 226 | |
| 227 | extern terrain_skycxx . . $ terrain_sky# Terrain_skycxx . . $ Terrain_sky.; |
| 228 | |
| 229 | #if (defined(EDITOR) || defined(NEWEDITOR)) |
| 230 | extern int Editor_LOD_engine_off; |
| 231 | extern bool Terrain_render_ext_room_objs; |
| 232 | #endif |
| 233 | |
| 234 | extern int Terrain_LOD_engine_offcxx . . $ Terrain_LOD_engine_off.; |
| 235 | |
| 236 | extern float Terrain_texture_distancecxx . . $ Terrain_texture_distance.; // how far we should texture before going to flat shad |
| 237 | |
| 238 | extern uint8_tcxx . . $ uint8_t# TerrainJoinMapcxx . . $ TerrainJoinMap.[]; |
| 239 | extern float *TerrainDeltaBlockscxx . . $ TerrainDeltaBlocks.[]; |
| 240 | extern uint8_tcxx . . $ uint8_t# *Terrain_max_height_intcxx . . $ Terrain_max_height_int.[]; |
| 241 | extern uint8_tcxx . . $ uint8_t# *Terrain_min_height_intcxx . . $ Terrain_min_height_int.[]; |
| 242 | extern uint8_tcxx . . $ uint8_t# Fast_terraincxx . . $ Fast_terrain.; |
| 243 | extern uint8_tcxx . . $ uint8_t# Flat_terraincxx . . $ Flat_terrain.; |
| 244 | extern uint8_tcxx . . $ uint8_t# Show_invisible_terraincxx . . $ Show_invisible_terrain.; |
| 245 | |
| 246 | extern int Camera_directioncxx . . $ Camera_direction., Sort_directioncxx . . $ Sort_direction.; |
| 247 | |
| 248 | #if (defined(_DEBUGcxx . . $ `<built-in>:482:9`!) || defined(EDITOR) || defined(NEWEDITOR)) |
| 249 | extern uint8_tcxx . . $ uint8_t# TerrainSelectedcxx . . $ TerrainSelected.[]; |
| 250 | extern int Num_terrain_selectedcxx . . $ Num_terrain_selected.; |
| 251 | #endif |
| 252 | |
| 253 | extern uint16_tcxx . . $ uint16_t# *Terrain_rotate_listcxx . . $ Terrain_rotate_list.; // which points have been sub/rotated this frame |
| 254 | extern g3Pointcxx . . $ g3Point# *World_point_buffercxx . . $ World_point_buffer.; // Rotated points |
| 255 | |
| 256 | #define TSEARCH_FOUND_TERRAINcxx . . $ `Descent3/terrain.h:256:9`! 0 |
| 257 | #define TSEARCH_FOUND_MINEcxx . . $ `Descent3/terrain.h:257:9`! 1 |
| 258 | #define TSEARCH_FOUND_SATELLITEcxx . . $ `Descent3/terrain.h:258:9`! 2 |
| 259 | #define TSEARCH_FOUND_SKY_DOMEcxx . . $ `Descent3/terrain.h:259:9`! 3 |
| 260 | #define TSEARCH_FOUND_SKY_BANDcxx . . $ `Descent3/terrain.h:260:9`! 4 |
| 261 | #define TSEARCH_FOUND_OBJECTcxx . . $ `Descent3/terrain.h:261:9`! 5 |
| 262 | #ifdef NEWEDITOR |
| 263 | #define TSEARCH_FOUND_NODE 6 |
| 264 | #define TSEARCH_FOUND_BNODE 7 |
| 265 | #endif |
| 266 | |
| 267 | extern int TSearch_oncxx . . $ TSearch_on., TSearch_found_typecxx . . $ TSearch_found_type., TSearch_xcxx . . $ TSearch_x., TSearch_ycxx . . $ TSearch_y., TSearch_segcxx . . $ TSearch_seg., TSearch_facecxx . . $ TSearch_face.; |
| 268 | |
| 269 | extern void InitTerraincxx . . $ InitTerrain(49f6e7a06ebc5aa8).(); |
| 270 | |
| 271 | // Called whenever a new level is initted |
| 272 | extern void ResetTerraincxx . . $ ResetTerrain(d4f767463ce0a6b3).(int force = 0); |
| 273 | |
| 274 | extern int GetVisibleTerraincxx . . $ GetVisibleTerrain(ffb987d81e13bf99).(vectorcxx . . $ vector# *, matrixcxx . . $ matrix# *); |
| 275 | extern void DisplayTerrainListcxx . . $ DisplayTerrainList(918ebd27a9ddbad3).(int, bool from_automap = 0); |
| 276 | extern int CheckToRenderSkycxx . . $ CheckToRenderSky(7864480464b09eea).(int); |
| 277 | |
| 278 | // left,top,right,bot are optional parameters. Omiting them (or setting them to -1) will |
| 279 | // render to the whole screen. Passing valid values will only render tiles visible in the |
| 280 | // specified window (though it won't clip those tiles to the window) |
| 281 | void RenderTerraincxx . . $ RenderTerrain(29744a30b22ab106).(uint8_tcxx . . $ uint8_t# from_mine, int left = -1, int top = -1, int right = -1, int bot = -1); |
| 282 | |
| 283 | void GetPreRotatedPointcxx . . $ GetPreRotatedPoint(64ae893c5b75a9e3).(g3Pointcxx . . $ g3Point# *, int, int, int); |
| 284 | void GenerateTerrainLightcxx . . $ GenerateTerrainLight(49f6e7a06ebc5aa8).(); |
| 285 | |
| 286 | void BuildMinMaxTerraincxx . . $ BuildMinMaxTerrain(49f6e7a06ebc5aa8).(); |
| 287 | void BuildTerrainNormalscxx . . $ BuildTerrainNormals(49f6e7a06ebc5aa8).(); |
| 288 | |
| 289 | int DrawTerrainTrianglescxx . . $ DrawTerrainTriangles(7864480464b09eea).(int n); |
| 290 | int LoadPCXTerraincxx . . $ LoadPCXTerrain(1ef8e6ec083aabb9).(char *); |
| 291 | |
| 292 | // Given a position, returns the terrain segment that that position is in/over |
| 293 | // The return value is a pure cell number, meaning it doesn't have the outside flag set |
| 294 | int GetTerrainCellFromPoscxx . . $ GetTerrainCellFromPos(177d9005acf670a0).(vectorcxx . . $ vector# *pos); |
| 295 | |
| 296 | // Given a position, returns the terrain segment that that position is in/over |
| 297 | // The return value is a valid room number, meaning it has the outside flag set |
| 298 | int GetTerrainRoomFromPoscxx . . $ GetTerrainRoomFromPos(177d9005acf670a0).(vectorcxx . . $ vector# *pos); |
| 299 | |
| 300 | // Given a position, returns the collision terrain segment that that position is in/over |
| 301 | int GetColTerrainSegFromPoscxx . . $ GetColTerrainSegFromPos(177d9005acf670a0).(vectorcxx . . $ vector# *pos); |
| 302 | // Given a terrain cell, returns the collision terrain segment that that position is in/over |
| 303 | int GetColTerrainSegFromTerrainSegcxx . . $ GetColTerrainSegFromTerrainSeg(7864480464b09eea).(int cell_index); |
| 304 | |
| 305 | // Computes the center of the segment in x,z and also sets y touching the ground |
| 306 | void ComputeTerrainSegmentCentercxx . . $ ComputeTerrainSegmentCenter(86b7faebfcd459cf).(vectorcxx . . $ vector# *pos, int segnum); |
| 307 | // Given an position, returns the terrain Y coord at that location |
| 308 | // Also now can return the normal at that ground point |
| 309 | float GetTerrainGroundPointcxx . . $ GetTerrainGroundPoint(a0b9c8659ecc16b8).(vectorcxx . . $ vector# *pos, vectorcxx . . $ vector# *normal = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 310 | |
| 311 | void SetupSkycxx . . $ SetupSky(20c5b41d67e83162).(float radius, int flags, uint8_tcxx . . $ uint8_t# randit = 0); |
| 312 | |
| 313 | // Builds the surface normal for terrain segment n |
| 314 | void BuildNormalForTerrainSegmentcxx . . $ BuildNormalForTerrainSegment(d4f767463ce0a6b3).(int n); |
| 315 | |
| 316 | // Builds the vertex normal for terrain segment n |
| 317 | void BuildLightingNormalForSegmentcxx . . $ BuildLightingNormalForSegment(d4f767463ce0a6b3).(int n); |
| 318 | |
| 319 | // Gets a prerotated point that does not fall exactly on one of our 255 height values |
| 320 | void GetSpecialRotatedPointcxx . . $ GetSpecialRotatedPoint(2f08a9677e0d7483).(g3Pointcxx . . $ g3Point# *dest, int x, int z, float yvalue); |
| 321 | |
| 322 | // Takes our light angle and fills in the appropriate values in the lightsource vector |
| 323 | void GenerateLightSourcecxx . . $ GenerateLightSource(49f6e7a06ebc5aa8).(); |
| 324 | |
| 325 | // Returns the terrain segment index of the farthest point that mine segment "mine_seg" |
| 326 | // touches. Based on Camera_direction |
| 327 | int GetFurthestMineSegmentcxx . . $ GetFurthestMineSegment(7864480464b09eea).(int mine_seg); |
| 328 | |
| 329 | // codes a point for visibility in the window passed to RenderTerrain() |
| 330 | uint8_tcxx . . $ uint8_t# CodeTerrainPointcxx . . $ CodeTerrainPoint(1c2cda054d3314c5).(g3Pointcxx . . $ g3Point# *p); |
| 331 | |
| 332 | // Generates info for the LOD engine...must be called after the geometry changes |
| 333 | void GenerateLODDeltascxx . . $ GenerateLODDeltas(49f6e7a06ebc5aa8).(); |
| 334 | |
| 335 | // Generates lightmaps based on the info given by the .light field of each Terrain_seg |
| 336 | void UpdateTerrainLightmapscxx . . $ UpdateTerrainLightmaps(49f6e7a06ebc5aa8).(); |
| 337 | |
| 338 | // Makes a four sided rectangle pinched into a triangle |
| 339 | void MakePinchBitmapcxx . . $ MakePinchBitmap(3e454b8ccf442868).(int dest_bm, int src_bm); |
| 340 | |
| 341 | // Gets the dynamic light value for this position |
| 342 | float GetTerrainDynamicScalarcxx . . $ GetTerrainDynamicScalar(bdb4036c8ebf1af).(vectorcxx . . $ vector# *pos, int seg); |
| 343 | |
| 344 | // Shuts off LOD for a given cell |
| 345 | void TurnOffLODForCellcxx . . $ TurnOffLODForCell(d4f767463ce0a6b3).(int cellnum); |
| 346 | |
| 347 | // Restores the terrain deltas to their original state |
| 348 | void ClearLODOffscxx . . $ ClearLODOffs(49f6e7a06ebc5aa8).(); |
| 349 | |
| 350 | // Gets the checksum for this terrain |
| 351 | int GetTerrainGeometryChecksumcxx . . $ GetTerrainGeometryChecksum(b126dc7c1de90089).(); |
| 352 | |
| 353 | #endif |