| 1 |
// |
| 2 |
// Copyright(C) 2021 by Ryan Krafnick |
| 3 |
// |
| 4 |
// This program is free software; you can redistribute it and/or |
| 5 |
// modify it under the terms of the GNU General Public License |
| 6 |
// as published by the Free Software Foundation; either version 2 |
| 7 |
// of the License, or (at your option) any later version. |
| 8 |
// |
| 9 |
// This program is distributed in the hope that it will be useful, |
| 10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
// GNU General Public License for more details. |
| 13 |
// |
| 14 |
// DESCRIPTION: |
| 15 |
// DSDA Map Format |
| 16 |
// |
| 17 |
|
| 18 |
#include "doomstat.h" |
| 19 |
#include "lprintf.h" |
| 20 |
#include "p_spec.h" |
| 21 |
#include "r_main.h" |
| 22 |
#include "r_state.h" |
| 23 |
#include "w_wad.h" |
| 24 |
|
| 25 |
#include "dsda/args.h" |
| 26 |
|
| 27 |
#include "map_format.h" |
| 28 |
|
| 29 |
map_format_t map_format; |
| 30 |
|
| 31 |
typedef enum { |
| 32 |
door_type_none = -1, |
| 33 |
door_type_red, |
| 34 |
door_type_blue, |
| 35 |
door_type_yellow, |
| 36 |
door_type_unknown = door_type_yellow, |
| 37 |
door_type_multiple |
| 38 |
} door_type_t; |
| 39 |
|
| 40 |
int dsda_DoorType(int index) { |
| 41 |
int special = lines[index].special; |
| 42 |
|
| 43 |
if (map_format.zdoom) { |
| 44 |
int lock; |
| 45 |
|
| 46 |
if (special == 13) |
| 47 |
lock = lines[index].special_args[3]; |
| 48 |
else |
| 49 |
lock = lines[index].locknumber; |
| 50 |
|
| 51 |
switch (lock) { |
| 52 |
case zk_none: |
| 53 |
return door_type_none; |
| 54 |
case zk_red_card: |
| 55 |
case zk_red_skull: |
| 56 |
case zk_red: |
| 57 |
case zk_redx: |
| 58 |
return door_type_red; |
| 59 |
case zk_blue_card: |
| 60 |
case zk_blue_skull: |
| 61 |
case zk_blue: |
| 62 |
case zk_bluex: |
| 63 |
return door_type_blue; |
| 64 |
case zk_yellow_card: |
| 65 |
case zk_yellow_skull: |
| 66 |
case zk_yellow: |
| 67 |
case zk_yellowx: |
| 68 |
return door_type_yellow; |
| 69 |
default: |
| 70 |
return door_type_unknown; |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
if (map_format.hexen) { |
| 75 |
if (special == 13 || special == 83) |
| 76 |
return door_type_unknown; |
| 77 |
|
| 78 |
return door_type_none; |
| 79 |
} |
| 80 |
|
| 81 |
if (heretic && special > 34) |
| 82 |
return door_type_none; |
| 83 |
|
| 84 |
if (GenLockedBase <= special && special < GenDoorBase) { |
| 85 |
special -= GenLockedBase; |
| 86 |
special = (special & LockedKey) >> LockedKeyShift; |
| 87 |
if (!special || special == 7) |
| 88 |
return door_type_multiple; |
| 89 |
else |
| 90 |
return (special - 1) % 3; |
| 91 |
} |
| 92 |
|
| 93 |
switch (special) { |
| 94 |
case 26: |
| 95 |
case 32: |
| 96 |
case 99: |
| 97 |
case 133: |
| 98 |
return door_type_blue; |
| 99 |
case 27: |
| 100 |
case 34: |
| 101 |
case 136: |
| 102 |
case 137: |
| 103 |
return door_type_yellow; |
| 104 |
case 28: |
| 105 |
case 33: |
| 106 |
case 134: |
| 107 |
case 135: |
| 108 |
return door_type_red; |
| 109 |
default: |
| 110 |
return door_type_none; |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
dboolean dsda_IsDeathExitLine(int index) |
| 115 |
{ |
| 116 |
const sector_t *sec = lines[index].frontsector; |
| 117 |
|
| 118 |
if (raven) return false; |
| 119 |
|
| 120 |
if (sec->special < 32) |
| 121 |
{ |
| 122 |
return (sec->special == 11); |
| 123 |
} |
| 124 |
else if (mbf21 && sec->special & DEATH_MASK) |
| 125 |
{ |
| 126 |
const int i = (sec->special & DAMAGE_MASK) >> DAMAGE_SHIFT; |
| 127 |
|
| 128 |
return (i == 2); |
| 129 |
} |
| 130 |
|
| 131 |
return false; |
| 132 |
} |
| 133 |
|
| 134 |
dboolean dsda_IsDeathSecretExitLine(int index) |
| 135 |
{ |
| 136 |
const sector_t *sec = lines[index].frontsector; |
| 137 |
|
| 138 |
if (raven) return false; |
| 139 |
|
| 140 |
if (sec->special < 32) |
| 141 |
{ |
| 142 |
return (sec->special == 11); |
| 143 |
} |
| 144 |
else if (mbf21 && sec->special & DEATH_MASK) |
| 145 |
{ |
| 146 |
const int i = (sec->special & DAMAGE_MASK) >> DAMAGE_SHIFT; |
| 147 |
|
| 148 |
return (i == 3); |
| 149 |
} |
| 150 |
|
| 151 |
return false; |
| 152 |
} |
| 153 |
|
| 154 |
dboolean dsda_IsExitLine(int index) { |
| 155 |
int special = lines[index].special; |
| 156 |
|
| 157 |
if (map_format.hexen) |
| 158 |
return special == 74 || |
| 159 |
special == 75; |
| 160 |
|
| 161 |
return special == 11 || |
| 162 |
special == 52 || |
| 163 |
special == 197; |
| 164 |
} |
| 165 |
|
| 166 |
dboolean dsda_IsSecretExitLine(int index) { |
| 167 |
int special = lines[index].special; |
| 168 |
|
| 169 |
if (map_format.hexen) return false; |
| 170 |
|
| 171 |
return special == 51 || |
| 172 |
special == 124 || |
| 173 |
special == 198; |
| 174 |
} |
| 175 |
|
| 176 |
dboolean dsda_IsTeleportLine(int index) { |
| 177 |
int special = lines[index].special; |
| 178 |
|
| 179 |
if (map_format.hexen) |
| 180 |
return special == 70 || |
| 181 |
special == 71; |
| 182 |
|
| 183 |
if (heretic) |
| 184 |
return special == 39; |
| 185 |
|
| 186 |
return special == 39 || |
| 187 |
special == 97 || |
| 188 |
special == 125 || |
| 189 |
special == 126; |
| 190 |
} |
| 191 |
|
| 192 |
// Migrate some non-hexen data to hexen format |
| 193 |
static void dsda_MigrateMobjInfo(void) { |
| 194 |
int i; |
| 195 |
static dboolean migrated = false; |
| 196 |
|
| 197 |
if (hexen) return; |
| 198 |
|
| 199 |
if (map_format.zdoom && !migrated) |
| 200 |
{ |
| 201 |
migrated = true; |
| 202 |
|
| 203 |
for (i = mobj_types_zero; i < num_mobj_types; ++i) { |
| 204 |
if (mobjinfo[i].flags & MF_COUNTKILL) |
| 205 |
mobjinfo[i].flags2 |= MF2_MCROSS | MF2_PUSHWALL | MF2_CANUSEWALLS; |
| 206 |
|
| 207 |
if (mobjinfo[i].flags & MF_MISSILE) |
| 208 |
mobjinfo[i].flags2 |= MF2_PCROSS | MF2_IMPACT; |
| 209 |
} |
| 210 |
|
| 211 |
if (!raven) { |
| 212 |
mobjinfo[MT_SKULL].flags2 |= MF2_MCROSS | MF2_PUSHWALL | MF2_CANUSEWALLS; |
| 213 |
mobjinfo[MT_PLAYER].flags2 |= MF2_WINDTHRUST | MF2_PUSHWALL | MF2_CANUSEWALLS; |
| 214 |
} |
| 215 |
} |
| 216 |
else if (!map_format.zdoom && migrated) |
| 217 |
{ |
| 218 |
migrated = false; |
| 219 |
|
| 220 |
for (i = mobj_types_zero; i < num_mobj_types; ++i) { |
| 221 |
if (mobjinfo[i].flags & MF_COUNTKILL) |
| 222 |
mobjinfo[i].flags2 &= ~(MF2_MCROSS | MF2_PUSHWALL | MF2_CANUSEWALLS); |
| 223 |
|
| 224 |
if (mobjinfo[i].flags & MF_MISSILE) |
| 225 |
mobjinfo[i].flags2 &= ~(MF2_PCROSS | MF2_IMPACT); |
| 226 |
} |
| 227 |
|
| 228 |
if (!raven) { |
| 229 |
mobjinfo[MT_SKULL].flags2 &= ~(MF2_MCROSS | MF2_PUSHWALL | MF2_CANUSEWALLS); |
| 230 |
mobjinfo[MT_PLAYER].flags2 &= ~(MF2_WINDTHRUST | MF2_PUSHWALL | MF2_CANUSEWALLS); |
| 231 |
} |
| 232 |
} |
| 233 |
} |
| 234 |
|
| 235 |
extern void P_SpawnCompatibleSectorSpecial(sector_t *sector, int i); |
| 236 |
extern void P_SpawnZDoomSectorSpecial(sector_t *sector, int i); |
| 237 |
|
| 238 |
extern void P_PlayerInCompatibleSector(player_t *player, sector_t *sector); |
| 239 |
extern void P_PlayerInZDoomSector(player_t *player, sector_t *sector); |
| 240 |
extern void P_PlayerInHereticSector(player_t * player, sector_t * sector); |
| 241 |
extern void P_PlayerInHexenSector(player_t * player, sector_t * sector); |
| 242 |
|
| 243 |
extern void P_SpawnCompatibleScroller(line_t *l, int i); |
| 244 |
extern void P_SpawnZDoomScroller(line_t *l, int i); |
| 245 |
|
| 246 |
extern void P_SpawnCompatibleFriction(line_t *l); |
| 247 |
extern void P_SpawnZDoomFriction(line_t *l); |
| 248 |
|
| 249 |
extern void P_SpawnCompatiblePusher(line_t *l); |
| 250 |
extern void P_SpawnZDoomPusher(line_t *l); |
| 251 |
|
| 252 |
extern void P_SpawnCompatibleExtra(line_t *l, int i); |
| 253 |
extern void P_SpawnZDoomExtra(line_t *l, int i); |
| 254 |
|
| 255 |
extern void P_CrossCompatibleSpecialLine(line_t *line, int side, mobj_t *thing, dboolean bossaction); |
| 256 |
extern void P_CrossZDoomSpecialLine(line_t *line, int side, mobj_t *thing, dboolean bossaction); |
| 257 |
extern void P_CrossHereticSpecialLine(line_t *line, int side, mobj_t *thing, dboolean bossaction); |
| 258 |
extern void P_CrossHexenSpecialLine(line_t *line, int side, mobj_t *thing, dboolean bossaction); |
| 259 |
|
| 260 |
extern void P_ShootCompatibleSpecialLine(mobj_t *thing, line_t *line); |
| 261 |
extern void P_ShootHexenSpecialLine(mobj_t *thing, line_t *line); |
| 262 |
|
| 263 |
extern dboolean P_TestActivateZDoomLine(line_t *line, mobj_t *mo, int side, line_activation_t activationType); |
| 264 |
extern dboolean P_TestActivateHexenLine(line_t *line, mobj_t *mo, int side, line_activation_t activationType); |
| 265 |
|
| 266 |
extern void P_PostProcessCompatibleLineSpecial(line_t *ld); |
| 267 |
extern void P_PostProcessHereticLineSpecial(line_t *ld); |
| 268 |
extern void P_PostProcessHexenLineSpecial(line_t *ld); |
| 269 |
extern void P_PostProcessZDoomLineSpecial(line_t *ld); |
| 270 |
|
| 271 |
extern void P_PostProcessCompatibleSidedefSpecial(side_t *sd, const mapsidedef_t *msd, sector_t *sec, int i); |
| 272 |
extern void P_PostProcessHereticSidedefSpecial(side_t *sd, const mapsidedef_t *msd, sector_t *sec, int i); |
| 273 |
extern void P_PostProcessHexenSidedefSpecial(side_t *sd, const mapsidedef_t *msd, sector_t *sec, int i); |
| 274 |
extern void P_PostProcessZDoomSidedefSpecial(side_t *sd, const mapsidedef_t *msd, sector_t *sec, int i); |
| 275 |
|
| 276 |
extern void P_AnimateCompatibleSurfaces(void); |
| 277 |
extern void P_AnimateHereticSurfaces(void); |
| 278 |
extern void P_AnimateHexenSurfaces(void); |
| 279 |
extern void P_AnimateZDoomSurfaces(void); |
| 280 |
|
| 281 |
extern void P_CheckCompatibleImpact(mobj_t *); |
| 282 |
extern void P_CheckHereticImpact(mobj_t *); |
| 283 |
extern void P_CheckZDoomImpact(mobj_t *); |
| 284 |
|
| 285 |
extern void P_TranslateHexenLineFlags(unsigned int *, line_activation_t *); |
| 286 |
extern void P_TranslateZDoomLineFlags(unsigned int *, line_activation_t *); |
| 287 |
extern void P_TranslateCompatibleLineFlags(unsigned int *, line_activation_t *); |
| 288 |
|
| 289 |
extern void P_ApplyCompatibleSectorMovementSpecial(mobj_t *, int); |
| 290 |
extern void P_ApplyHereticSectorMovementSpecial(mobj_t *, int); |
| 291 |
|
| 292 |
extern dboolean P_MobjInCompatibleSector(mobj_t *); |
| 293 |
extern dboolean P_MobjInHereticSector(mobj_t *); |
| 294 |
extern dboolean P_MobjInHexenSector(mobj_t *); |
| 295 |
extern dboolean P_MobjInZDoomSector(mobj_t *); |
| 296 |
|
| 297 |
extern void P_CompatiblePlayerThrust(player_t* player, angle_t angle, fixed_t move); |
| 298 |
extern void P_HereticPlayerThrust(player_t* player, angle_t angle, fixed_t move); |
| 299 |
extern void P_HexenPlayerThrust(player_t* player, angle_t angle, fixed_t move); |
| 300 |
|
| 301 |
extern dboolean P_ExecuteZDoomLineSpecial(int special, int * args, line_t * line, int side, mobj_t * mo); |
| 302 |
extern dboolean P_ExecuteHexenLineSpecial(int special, int * args, line_t * line, int side, mobj_t * mo); |
| 303 |
|
| 304 |
extern void T_VerticalCompatibleDoor(vldoor_t *door); |
| 305 |
extern void T_VerticalHexenDoor(vldoor_t *door); |
| 306 |
|
| 307 |
extern void T_MoveCompatibleFloor(floormove_t *); |
| 308 |
extern void T_MoveHexenFloor(floormove_t *); |
| 309 |
|
| 310 |
void T_MoveCompatibleCeiling(ceiling_t * ceiling); |
| 311 |
void T_MoveHexenCeiling(ceiling_t * ceiling); |
| 312 |
|
| 313 |
int EV_CompatibleTeleport(short thing_id, int tag, line_t *line, int side, mobj_t *thing, int flags); |
| 314 |
int EV_HereticTeleport(short thing_id, int tag, line_t * line, int side, mobj_t * thing, int flags); |
| 315 |
|
| 316 |
void T_BuildHexenPillar(pillar_t * pillar); |
| 317 |
void T_BuildZDoomPillar(pillar_t * pillar); |
| 318 |
|
| 319 |
void T_CompatiblePlatRaise(plat_t * plat); |
| 320 |
void T_HexenPlatRaise(plat_t * plat); |
| 321 |
void T_ZDoomPlatRaise(plat_t * plat); |
| 322 |
|
| 323 |
void P_CreateTIDList(void); |
| 324 |
void dsda_BuildMobjThingIDList(void); |
| 325 |
|
| 326 |
void P_InsertMobjIntoTIDList(mobj_t * mobj, short tid); |
| 327 |
void dsda_AddMobjThingID(mobj_t* mo, short thing_id); |
| 328 |
|
| 329 |
void P_RemoveMobjFromTIDList(mobj_t * mobj); |
| 330 |
void dsda_RemoveMobjThingID(mobj_t* mo); |
| 331 |
|
| 332 |
void P_IterateCompatibleSpecHit(mobj_t *thing, fixed_t oldx, fixed_t oldy); |
| 333 |
void P_IterateZDoomSpecHit(mobj_t *thing, fixed_t oldx, fixed_t oldy); |
| 334 |
|
| 335 |
static const map_format_t zdoom_map_format = { |
| 336 |
.zdoom = true, |
| 337 |
.hexen = true, |
| 338 |
.polyobjs = true, |
| 339 |
.acs = false, |
| 340 |
.thing_id = true, |
| 341 |
.sndseq = false, |
| 342 |
.animdefs = false, |
| 343 |
.doublesky = false, |
| 344 |
.map99 = false, |
| 345 |
.generalized_mask = ~0xff, |
| 346 |
.switch_activation = SPAC_USE | SPAC_IMPACT | SPAC_PUSH, |
| 347 |
.init_sector_special = P_SpawnZDoomSectorSpecial, |
| 348 |
.player_in_special_sector = P_PlayerInZDoomSector, |
| 349 |
.mobj_in_special_sector = P_MobjInZDoomSector, |
| 350 |
.spawn_scroller = P_SpawnZDoomScroller, |
| 351 |
.spawn_friction = P_SpawnZDoomFriction, |
| 352 |
.spawn_pusher = P_SpawnZDoomPusher, |
| 353 |
.spawn_extra = P_SpawnZDoomExtra, |
| 354 |
.cross_special_line = P_CrossZDoomSpecialLine, |
| 355 |
.shoot_special_line = P_ShootHexenSpecialLine, |
| 356 |
.test_activate_line = P_TestActivateZDoomLine, |
| 357 |
.execute_line_special = P_ExecuteZDoomLineSpecial, |
| 358 |
.post_process_line_special = P_PostProcessZDoomLineSpecial, |
| 359 |
.post_process_sidedef_special = P_PostProcessZDoomSidedefSpecial, |
| 360 |
.animate_surfaces = P_AnimateZDoomSurfaces, |
| 361 |
.check_impact = P_CheckZDoomImpact, |
| 362 |
.translate_line_flags = P_TranslateZDoomLineFlags, |
| 363 |
.apply_sector_movement_special = P_ApplyHereticSectorMovementSpecial, |
| 364 |
.t_vertical_door = T_VerticalCompatibleDoor, |
| 365 |
.t_move_floor = T_MoveCompatibleFloor, |
| 366 |
.t_move_ceiling = T_MoveCompatibleCeiling, |
| 367 |
.t_build_pillar = T_BuildZDoomPillar, |
| 368 |
.t_plat_raise = T_ZDoomPlatRaise, |
| 369 |
.ev_teleport = EV_CompatibleTeleport, |
| 370 |
.player_thrust = P_CompatiblePlayerThrust, |
| 371 |
.build_mobj_thing_id_list = dsda_BuildMobjThingIDList, |
| 372 |
.add_mobj_thing_id = dsda_AddMobjThingID, |
| 373 |
.remove_mobj_thing_id = dsda_RemoveMobjThingID, |
| 374 |
.iterate_spechit = P_IterateZDoomSpecHit, |
| 375 |
.point_on_side = R_ZDoomPointOnSide, |
| 376 |
.point_on_seg_side = R_ZDoomPointOnSegSide, |
| 377 |
.point_on_line_side = P_ZDoomPointOnLineSide, |
| 378 |
.point_on_divline_side = P_ZDoomPointOnDivlineSide, |
| 379 |
.mapthing_size = sizeof(hexen_mapthing_t), |
| 380 |
.maplinedef_size = sizeof(hexen_maplinedef_t), |
| 381 |
.mt_push = MT_PUSH, |
| 382 |
.mt_pull = MT_PULL, |
| 383 |
.dn_polyanchor = 9300, |
| 384 |
.dn_polyspawn_start = 9301, |
| 385 |
.dn_polyspawn_hurt = 9303, |
| 386 |
.dn_polyspawn_end = 9303, |
| 387 |
.visibility = VF_ZDOOM | VF_DOOM, |
| 388 |
}; |
| 389 |
|
| 390 |
static const map_format_t hexen_map_format = { |
| 391 |
.zdoom = false, |
| 392 |
.hexen = true, |
| 393 |
.polyobjs = true, |
| 394 |
.acs = true, |
| 395 |
.thing_id = true, |
| 396 |
.sndseq = true, |
| 397 |
.animdefs = true, |
| 398 |
.doublesky = true, |
| 399 |
.map99 = true, |
| 400 |
.generalized_mask = 0, // not used |
| 401 |
.switch_activation = SPAC_USE | SPAC_IMPACT, |
| 402 |
.init_sector_special = NULL, // not used |
| 403 |
.player_in_special_sector = P_PlayerInHexenSector, |
| 404 |
.mobj_in_special_sector = P_MobjInHexenSector, |
| 405 |
.spawn_scroller = NULL, // not used |
| 406 |
.spawn_friction = NULL, // not used |
| 407 |
.spawn_pusher = NULL, // not used |
| 408 |
.spawn_extra = NULL, // not used |
| 409 |
.cross_special_line = P_CrossHexenSpecialLine, |
| 410 |
.shoot_special_line = P_ShootHexenSpecialLine, |
| 411 |
.test_activate_line = P_TestActivateHexenLine, |
| 412 |
.execute_line_special = P_ExecuteHexenLineSpecial, |
| 413 |
.post_process_line_special = P_PostProcessHexenLineSpecial, |
| 414 |
.post_process_sidedef_special = P_PostProcessHexenSidedefSpecial, |
| 415 |
.animate_surfaces = P_AnimateHexenSurfaces, |
| 416 |
.check_impact = NULL, // not used |
| 417 |
.translate_line_flags = P_TranslateHexenLineFlags, |
| 418 |
.apply_sector_movement_special = P_ApplyHereticSectorMovementSpecial, |
| 419 |
.t_vertical_door = T_VerticalHexenDoor, |
| 420 |
.t_move_floor = T_MoveHexenFloor, |
| 421 |
.t_move_ceiling = T_MoveHexenCeiling, |
| 422 |
.t_build_pillar = T_BuildHexenPillar, |
| 423 |
.t_plat_raise = T_HexenPlatRaise, |
| 424 |
.ev_teleport = NULL, // not used |
| 425 |
.player_thrust = P_HexenPlayerThrust, |
| 426 |
.build_mobj_thing_id_list = P_CreateTIDList, |
| 427 |
.add_mobj_thing_id = P_InsertMobjIntoTIDList, |
| 428 |
.remove_mobj_thing_id = P_RemoveMobjFromTIDList, |
| 429 |
.iterate_spechit = NULL, // not used |
| 430 |
.point_on_side = R_CompatiblePointOnSide, |
| 431 |
.point_on_seg_side = R_CompatiblePointOnSegSide, |
| 432 |
.point_on_line_side = P_CompatiblePointOnLineSide, |
| 433 |
.point_on_divline_side = P_CompatiblePointOnDivlineSide, |
| 434 |
.mapthing_size = sizeof(hexen_mapthing_t), |
| 435 |
.maplinedef_size = sizeof(hexen_maplinedef_t), |
| 436 |
.mt_push = -1, |
| 437 |
.mt_pull = -1, |
| 438 |
.dn_polyanchor = 3000, |
| 439 |
.dn_polyspawn_start = 3001, |
| 440 |
.dn_polyspawn_hurt = -1, |
| 441 |
.dn_polyspawn_end = 3002, |
| 442 |
.visibility = VF_HEXEN, |
| 443 |
}; |
| 444 |
|
| 445 |
static const map_format_t heretic_map_format = { |
| 446 |
.zdoom = false, |
| 447 |
.hexen = false, |
| 448 |
.polyobjs = false, |
| 449 |
.acs = false, |
| 450 |
.thing_id = false, |
| 451 |
.sndseq = false, |
| 452 |
.animdefs = false, |
| 453 |
.doublesky = false, |
| 454 |
.map99 = false, |
| 455 |
.generalized_mask = 0, |
| 456 |
.switch_activation = 0, // not used |
| 457 |
.init_sector_special = P_SpawnCompatibleSectorSpecial, |
| 458 |
.player_in_special_sector = P_PlayerInHereticSector, |
| 459 |
.mobj_in_special_sector = P_MobjInHereticSector, |
| 460 |
.spawn_scroller = P_SpawnCompatibleScroller, |
| 461 |
.spawn_friction = P_SpawnCompatibleFriction, |
| 462 |
.spawn_pusher = P_SpawnCompatiblePusher, |
| 463 |
.spawn_extra = P_SpawnCompatibleExtra, |
| 464 |
.cross_special_line = P_CrossHereticSpecialLine, |
| 465 |
.shoot_special_line = P_ShootCompatibleSpecialLine, |
| 466 |
.test_activate_line = NULL, // not used |
| 467 |
.execute_line_special = NULL, // not used |
| 468 |
.post_process_line_special = P_PostProcessHereticLineSpecial, |
| 469 |
.post_process_sidedef_special = P_PostProcessHereticSidedefSpecial, |
| 470 |
.animate_surfaces = P_AnimateHereticSurfaces, |
| 471 |
.check_impact = P_CheckHereticImpact, |
| 472 |
.translate_line_flags = P_TranslateCompatibleLineFlags, |
| 473 |
.apply_sector_movement_special = P_ApplyHereticSectorMovementSpecial, |
| 474 |
.t_vertical_door = T_VerticalCompatibleDoor, |
| 475 |
.t_move_floor = T_MoveCompatibleFloor, |
| 476 |
.t_move_ceiling = T_MoveCompatibleCeiling, |
| 477 |
.t_build_pillar = NULL, // not used |
| 478 |
.t_plat_raise = T_CompatiblePlatRaise, |
| 479 |
.ev_teleport = EV_HereticTeleport, |
| 480 |
.player_thrust = P_HereticPlayerThrust, |
| 481 |
.build_mobj_thing_id_list = NULL, // not used |
| 482 |
.add_mobj_thing_id = NULL, // not used |
| 483 |
.remove_mobj_thing_id = NULL, // not used |
| 484 |
.iterate_spechit = P_IterateCompatibleSpecHit, |
| 485 |
.point_on_side = R_CompatiblePointOnSide, |
| 486 |
.point_on_seg_side = R_CompatiblePointOnSegSide, |
| 487 |
.point_on_line_side = P_CompatiblePointOnLineSide, |
| 488 |
.point_on_divline_side = P_CompatiblePointOnDivlineSide, |
| 489 |
.mapthing_size = sizeof(doom_mapthing_t), |
| 490 |
.maplinedef_size = sizeof(doom_maplinedef_t), |
| 491 |
.mt_push = -1, |
| 492 |
.mt_pull = -1, |
| 493 |
.dn_polyanchor = -1, |
| 494 |
.dn_polyspawn_start = -1, |
| 495 |
.dn_polyspawn_hurt = -1, |
| 496 |
.dn_polyspawn_end = -1, |
| 497 |
.visibility = VF_HERETIC, |
| 498 |
}; |
| 499 |
|
| 500 |
static const map_format_t doom_map_format = { |
| 501 |
.zdoom = false, |
| 502 |
.hexen = false, |
| 503 |
.polyobjs = false, |
| 504 |
.acs = false, |
| 505 |
.thing_id = false, |
| 506 |
.sndseq = false, |
| 507 |
.animdefs = false, |
| 508 |
.doublesky = false, |
| 509 |
.map99 = false, |
| 510 |
.generalized_mask = ~31, |
| 511 |
.switch_activation = 0, // not used |
| 512 |
.init_sector_special = P_SpawnCompatibleSectorSpecial, |
| 513 |
.player_in_special_sector = P_PlayerInCompatibleSector, |
| 514 |
.mobj_in_special_sector = P_MobjInCompatibleSector, |
| 515 |
.spawn_scroller = P_SpawnCompatibleScroller, |
| 516 |
.spawn_friction = P_SpawnCompatibleFriction, |
| 517 |
.spawn_pusher = P_SpawnCompatiblePusher, |
| 518 |
.spawn_extra = P_SpawnCompatibleExtra, |
| 519 |
.cross_special_line = P_CrossCompatibleSpecialLine, |
| 520 |
.shoot_special_line = P_ShootCompatibleSpecialLine, |
| 521 |
.test_activate_line = NULL, // not used |
| 522 |
.execute_line_special = NULL, // not used |
| 523 |
.post_process_line_special = P_PostProcessCompatibleLineSpecial, |
| 524 |
.post_process_sidedef_special = P_PostProcessCompatibleSidedefSpecial, |
| 525 |
.animate_surfaces = P_AnimateCompatibleSurfaces, |
| 526 |
.check_impact = P_CheckCompatibleImpact, |
| 527 |
.translate_line_flags = P_TranslateCompatibleLineFlags, |
| 528 |
.apply_sector_movement_special = P_ApplyCompatibleSectorMovementSpecial, |
| 529 |
.t_vertical_door = T_VerticalCompatibleDoor, |
| 530 |
.t_move_floor = T_MoveCompatibleFloor, |
| 531 |
.t_move_ceiling = T_MoveCompatibleCeiling, |
| 532 |
.t_build_pillar = NULL, // not used |
| 533 |
.t_plat_raise = T_CompatiblePlatRaise, |
| 534 |
.ev_teleport = EV_CompatibleTeleport, |
| 535 |
.player_thrust = P_CompatiblePlayerThrust, |
| 536 |
.build_mobj_thing_id_list = NULL, // not used |
| 537 |
.add_mobj_thing_id = NULL, // not used |
| 538 |
.remove_mobj_thing_id = NULL, // not used |
| 539 |
.iterate_spechit = P_IterateCompatibleSpecHit, |
| 540 |
.point_on_side = R_CompatiblePointOnSide, |
| 541 |
.point_on_seg_side = R_CompatiblePointOnSegSide, |
| 542 |
.point_on_line_side = P_CompatiblePointOnLineSide, |
| 543 |
.point_on_divline_side = P_CompatiblePointOnDivlineSide, |
| 544 |
.mapthing_size = sizeof(doom_mapthing_t), |
| 545 |
.maplinedef_size = sizeof(doom_maplinedef_t), |
| 546 |
.mt_push = MT_PUSH, |
| 547 |
.mt_pull = MT_PULL, |
| 548 |
.dn_polyanchor = -1, |
| 549 |
.dn_polyspawn_start = -1, |
| 550 |
.dn_polyspawn_hurt = -1, |
| 551 |
.dn_polyspawn_end = -1, |
| 552 |
.visibility = VF_DOOM, |
| 553 |
}; |
| 554 |
|
| 555 |
static void dsda_ApplyMapPrecision(void) { |
| 556 |
R_PointOnSide = map_format.point_on_side; |
| 557 |
R_PointOnSegSide = map_format.point_on_seg_side; |
| 558 |
P_PointOnLineSide = map_format.point_on_line_side; |
| 559 |
P_PointOnDivlineSide = map_format.point_on_divline_side; |
| 560 |
} |
| 561 |
|
| 562 |
void dsda_ApplyZDoomMapFormat(void) { |
| 563 |
map_format = zdoom_map_format; |
| 564 |
|
| 565 |
if (!mbf21) |
| 566 |
I_Error("You must use complevel 21 when playing doom-in-hexen format maps."); |
| 567 |
|
| 568 |
dsda_ApplyMapPrecision(); |
| 569 |
dsda_MigrateMobjInfo(); |
| 570 |
} |
| 571 |
|
| 572 |
void dsda_ApplyDefaultMapFormat(void) { |
| 573 |
if (hexen) |
| 574 |
map_format = hexen_map_format; |
| 575 |
else if (heretic) |
| 576 |
map_format = heretic_map_format; |
| 577 |
else |
| 578 |
map_format = doom_map_format; |
| 579 |
|
| 580 |
dsda_ApplyMapPrecision(); |
| 581 |
dsda_MigrateMobjInfo(); |
| 582 |
} |