From 1f492784df1cd8efa82a0c852b72011e971ca548 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 14 May 2008 17:49:11 +0000 Subject: [PATCH] - Fixed dynamic light crash with respawning players. Update to ZDoom r971: - Changed: For actors not being spawned on the floor P_FindFloorCeiling should be used to prevent them from dropping through 3DMIDTEX textures. - Fixed: AMageStaffFX2::IsOkayToAttack overwrote the projectile's angle variable. - Changed the types of object hash indices in FArchive from size_t to DWORD. This seems to fix crashes on GCC 64-bit builds when saving games. Not sure if it was a GCC bug or my bug, since it worked fine with VC++, but since the code that calculates the index only returns a DWORD, storing it as a size_t was rather pointless. - Added the C99 printf size specifiers 't' (ptrdiff_t) and 'z' (size_t) to FString::Format() so that I can fix all the problem printf strings that a 64-bit GCC compile finds. - Added Skulltag's PUFFGETSOWNER flag. - Fixed: Parsing sector special bit masks must be done backwards so that later definitions take precedence. - Added base translation tables for UDMF compatibility maps which only should handle the native line and sector types of each game. - Turned the inactive SILENT_INSTANT_FLOORS define into a compatibility option so that it can be (un)set in a map definition and the menu. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@105 b0f79afe-0144-0410-b225-9a4edf0717df --- docs/rh-log.txt | 88 +++++++++++- src/actor.h | 1 + src/d_main.cpp | 1 + src/dobjgc.cpp | 4 +- src/doomdata.h | 8 +- src/doomdef.h | 1 + src/f_finale.cpp | 2 +- src/farchive.cpp | 4 +- src/farchive.h | 4 +- src/fragglescript/t_script.cpp | 1 + src/g_hexen/a_magestaff.cpp | 2 +- src/g_level.cpp | 2 + src/g_shared/a_skies.cpp | 2 +- src/g_shared/a_weapons.cpp | 2 +- src/gl/gl_dynlight.cpp | 10 ++ src/gl/gl_models.cpp | 2 +- src/m_alloc.cpp | 8 +- src/m_options.cpp | 1 + src/nodebuild.cpp | 4 +- src/p_floor.cpp | 11 +- src/p_local.h | 2 +- src/p_map.cpp | 22 +-- src/p_maputl.cpp | 2 +- src/p_mobj.cpp | 5 +- src/p_setup.cpp | 3 - src/p_setup.h | 7 + src/p_udmf.cpp | 195 +++++++++++++++------------ src/p_user.cpp | 8 +- src/p_xlat.cpp | 2 +- src/r_bsp.cpp | 2 +- src/r_segs.cpp | 4 +- src/r_things.cpp | 8 +- src/sound/fmodsound.cpp | 4 +- src/stats.h | 6 +- src/svnrevision.h | 4 +- src/thingdef/thingdef_properties.cpp | 2 + src/timidity/common.cpp | 4 +- src/timidity/mix.cpp | 2 +- src/xlat/parse_xlat.cpp | 8 +- src/xlat/xlat_parser.y | 14 ++ src/zstrformat.cpp | 26 +++- src/zstring.h | 4 +- wadsrc/xlat/doom_base.txt | 17 +++ wadsrc/xlat/heretic_base.txt | 8 ++ wadsrc/xlat/strife_base.txt | 14 ++ 45 files changed, 373 insertions(+), 158 deletions(-) create mode 100644 wadsrc/xlat/doom_base.txt create mode 100644 wadsrc/xlat/heretic_base.txt create mode 100644 wadsrc/xlat/strife_base.txt diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 7e6dd5b6..aea3dc05 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,85 @@ +May 13, 2008 (Changes by Graf Zahl) +- Changed: For actors not being spawned on the floor P_FindFloorCeiling should + be used to prevent them from dropping through 3DMIDTEX textures. +- Fixed: AMageStaffFX2::IsOkayToAttack overwrote the projectile's angle variable. + +May 13, 2008 +- Changed the types of object hash indices in FArchive from size_t to DWORD. + This seems to fix crashes on GCC 64-bit builds when saving games. Not sure + if it was a GCC bug or my bug, since it worked fine with VC++, but since the + code that calculates the index only returns a DWORD, storing it as a size_t + was rather pointless. +- Added the C99 printf size specifiers 't' (ptrdiff_t) and 'z' (size_t) to + FString::Format() so that I can fix all the problem printf strings that a + 64-bit GCC compile finds. + +May 12, 2008 (Changes by Graf Zahl) +- Added Skulltag's PUFFGETSOWNER flag. +- Fixed: Parsing sector special bit masks must be done backwards so that later + definitions take precedence. +- Added base translation tables for UDMF compatibility maps which only should + handle the native line and sector types of each game. +- Turned the inactive SILENT_INSTANT_FLOORS define into a compatibility option + so that it can be (un)set in a map definition and the menu. +- Fixed: SPAC_AnyCross didn't work. +- Fixed: Pushable doors must also check for SPAC_MPush. +- Fixed: P_LoadThings2 did not adjust the byte order for the thingid field. + +May 11, 2008 (Changes by Graf Zahl) +- Changed: HIRESTEX 'define' textures now replace existing textures + of type MiscPatch with the same name. +- Added UDMF line trigger types MonsterUse and MonsterPush. +- Separated skill and class filter bits from FMapThing::flags so that + UDMF can define up to 16 of each. Also separated easy/baby and + hard/nightmare and changed default MAPINFO definitions. + +May 10, 2008 +- Fixed: FWadCollection::MergeLumps() did not initialize the flags for any + marker lumps it inserted. +- Fixed: Need write barriers when modifying SequenceListHead. + +May 9, 2008 +- Added a new cvar: midi_timiditylike. This re-enables TiMidity handling of + GUS patch flags, envelopes, and volume levels, while trying to be closer + to TiMidity++ than original TiMidity. +- Renamed timidity_config and timidity_voices to midi_config and midi_voices + respectively. + +May 9, 2008 (Changes by Graf Zahl) +- Changed: Crosshair drawing uses the current player class's default health instead + of 100 to calculate the color for the crosshair. +- Added SECF_NOFALLINGDAMAGE flag plus Sector_ChangeFlags to set it. Also separated + all user settable flags from MoreFlags into their own Flags variable. + +May 8, 2008 +- Reduced volume, expression, and panning controllers back to 7 bits. +- Added very basic Soundfont support to the internal TiMidity. Things missing: + filter, LFOs, modulation envelope, chorus, reverb, and modulators. May or + may not be compatible with TiMidity++'s soundfont extensions. + +May 8, 2008 (Changes by Graf Zahl) +- Changed all thing coordinates that were stored as shorts into fixed_t. +- Separated mapthing2_t into mapthinghexen_t and the internal FMapThing so + that it is easier to add new features in the UDMF map format. +- Added some initial code to read UDMF maps. + +May 6, 2008 +- Added support for quoted strings to the TiMidity config parser. + +May 2, 2008 (Changes by Graf Zahl) +- Split off the slope creation code from p_Setup.cpp into its own file. +- Separated the linedef activation types into a bit mask that allows combination + of all types on the same linedef. Also added a 'first side only' flag. This + is not usable from Hexen or Doom format maps though but in preparation of + the UDMF format discussed here: + http://www.doomworld.com/vb/source-ports/43145-udmf-v0-99-specification-draft-aka-textmap/ +- Changed linedef's alpha property from a byte to fixed point after seeing that + 255 wasn't handled to be fully opaque. +- fixed a GCC warning in fmodsound.cpp + +April 30, 2008 (Changes by Graf Zahl) +- Fixed: Warped textures didn't work anymore because the default speed was 0. + April 30, 2008 - Fixed: I had instrument vibrato setting the tremolo_sweep_increment value in the instrument loader, effectively disabling vibrato. @@ -205,7 +287,7 @@ April 15, 2008 (Changes by Graf Zahl) check being done manually. April 14, 2008 (Changes by Graf Zahl) -- Added rotation 90° angles only) and mirroring to the Multipatch texture +- Added rotation 90� angles only) and mirroring to the Multipatch texture composition code. - Fixed: The game crashed when a level was ended while a player was morphed by a powerup. @@ -5409,7 +5491,7 @@ April 22, 2006 (Changes by Graf Zahl) - Fixed the issues with .96x's railgun code and added it to the current version. - Fixed: Setting of the friendly Minotaur's angle was inconsistent and - could cause it to move backwards in a féw situation. + could cause it to move backwards in a f�w situation. - Fixed: The minotaur did checks for type by checking for the MF_FRIENDLY flag, not by checking for the actor class. That made it impossible to spawn friendly 'normal' minotaurs. @@ -16375,7 +16457,7 @@ September 12, 1998 September 4, 1998 - Added weapnext and weapprev commands courtesy of - Papst Johannes Jörg IV. [which were later completely + Papst Johannes J�rg IV. [which were later completely rewritten by me] - Add support for suspending and resuming scripts (easy when you know you can only have one copy running at a time). diff --git a/src/actor.h b/src/actor.h index e359d705..4932f05d 100644 --- a/src/actor.h +++ b/src/actor.h @@ -301,6 +301,7 @@ enum MF5_NOINFIGHTING = 0x00100000, // This actor doesn't switch target when it's hurt MF5_NOINTERACTION = 0x00200000, // Thing is completely excluded from any gameplay related checks MF5_NOTIMEFREEZE = 0x00400000, // Actor is not affected by time freezer + MF5_PUFFGETSOWNER = 0x00800000, // [BB] Sets the owner of the puff to the player who fired it // --- mobj.renderflags --- diff --git a/src/d_main.cpp b/src/d_main.cpp index 20592b63..f6ed3955 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -452,6 +452,7 @@ CVAR (Flag, compat_trace, compatflags, COMPATF_TRACE); CVAR (Flag, compat_dropoff, compatflags, COMPATF_DROPOFF); CVAR (Flag, compat_boomscroll, compatflags, COMPATF_BOOMSCROLL); CVAR (Flag, compat_invisibility,compatflags, COMPATF_INVISIBILITY); +CVAR (Flag, compat_silentinstantfloors,compatflags, COMPATF_SILENT_INSTANT_FLOORS); //========================================================================== // diff --git a/src/dobjgc.cpp b/src/dobjgc.cpp index 25bbb1e4..f2877636 100644 --- a/src/dobjgc.cpp +++ b/src/dobjgc.cpp @@ -644,7 +644,7 @@ ADD_STAT(gc) " Sweep ", "Finalize " }; FString out; - out.Format("[%s] Alloc:%6uK Thresh:%6uK Est:%6uK Steps: %d", + out.Format("[%s] Alloc:%6zuK Thresh:%6zuK Est:%6zuK Steps: %d", StateStrings[GC::State], (GC::AllocBytes + 1023) >> 10, (GC::Threshold + 1023) >> 10, @@ -652,7 +652,7 @@ ADD_STAT(gc) GC::StepCount); if (GC::State != GC::GCS_Pause) { - out.AppendFormat(" %uK", (GC::Dept + 1023) >> 10); + out.AppendFormat(" %zuK", (GC::Dept + 1023) >> 10); } return out; } diff --git a/src/doomdata.h b/src/doomdata.h index fc77b5ed..33b3395c 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -88,7 +88,7 @@ typedef struct } mapsidedef_t; // A LineDef, as used for editing, and as input to the BSP builder. -typedef struct +struct maplinedef_t { WORD v1; WORD v2; @@ -97,10 +97,10 @@ typedef struct short tag; WORD sidenum[2]; // sidenum[1] will be -1 if one sided -} maplinedef_t; +} ; // [RH] Hexen-compatible LineDef. -typedef struct +struct maplinedef2_t { WORD v1; WORD v2; @@ -108,7 +108,7 @@ typedef struct BYTE special; BYTE args[5]; WORD sidenum[2]; -} maplinedef2_t; +} ; // diff --git a/src/doomdef.h b/src/doomdef.h index b78d2960..760de632 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -282,6 +282,7 @@ enum COMPATF_DROPOFF = 1 << 14, // Monsters cannot move when hanging over a dropoff COMPATF_BOOMSCROLL = 1 << 15, // Scrolling sectors are additive like in Boom COMPATF_INVISIBILITY = 1 << 16, // Monsters can see semi-invisible players + COMPATF_SILENT_INSTANT_FLOORS = 1<<17, // Instantly moving floors are not silent }; // phares 3/20/98: diff --git a/src/f_finale.cpp b/src/f_finale.cpp index c91e9418..d70125fa 100644 --- a/src/f_finale.cpp +++ b/src/f_finale.cpp @@ -961,7 +961,7 @@ void F_BunnyScroll (void) laststage = stage; } - sprintf (name, "END%i", stage); + sprintf (name, "END%d", (int)stage); screen->DrawTexture (TexMan(name), (320-13*8)/2, (200-8*8)/2, DTA_320x200, true, TAG_DONE); } } diff --git a/src/farchive.cpp b/src/farchive.cpp index 629f703f..cbf2cd35 100644 --- a/src/farchive.cpp +++ b/src/farchive.cpp @@ -1459,12 +1459,12 @@ DWORD FArchive::HashObject (const DObject *obj) const DWORD FArchive::FindObjectIndex (const DObject *obj) const { - size_t index = m_ObjectHash[HashObject (obj)]; + DWORD index = m_ObjectHash[HashObject (obj)]; while (index != TypeMap::NO_INDEX && m_ObjectMap[index].object != obj) { index = m_ObjectMap[index].hashNext; } - return (DWORD)index; + return index; } void FArchive::UserWriteClass (const PClass *type) diff --git a/src/farchive.h b/src/farchive.h index 6d751d9e..fdb60d41 100644 --- a/src/farchive.h +++ b/src/farchive.h @@ -237,9 +237,9 @@ protected: struct ObjectMap { const DObject *object; - size_t hashNext; + DWORD hashNext; } *m_ObjectMap; - size_t m_ObjectHash[EObjectHashSize]; + DWORD m_ObjectHash[EObjectHashSize]; struct NameMap { diff --git a/src/fragglescript/t_script.cpp b/src/fragglescript/t_script.cpp index 83d3a04b..9e2ee140 100644 --- a/src/fragglescript/t_script.cpp +++ b/src/fragglescript/t_script.cpp @@ -636,6 +636,7 @@ static bool RunScript(int snum, AActor * t_trigger) if(!script) return false; DRunningScript *runscr = new DRunningScript(script, 0); + runscr->trigger = t_trigger; // hook into chain at start th->AddRunningScript(runscr); return true; diff --git a/src/g_hexen/a_magestaff.cpp b/src/g_hexen/a_magestaff.cpp index eb0dede3..ac8a253b 100644 --- a/src/g_hexen/a_magestaff.cpp +++ b/src/g_hexen/a_magestaff.cpp @@ -321,7 +321,7 @@ bool AMageStaffFX2::IsOkayToAttack (AActor *link) else if (P_CheckSight (this, link)) { AActor *master = target; - angle = R_PointToAngle2 (master->x, master->y, + angle_t angle = R_PointToAngle2 (master->x, master->y, link->x, link->y) - master->angle; angle >>= 24; if (angle>226 || angle<30) diff --git a/src/g_level.cpp b/src/g_level.cpp index 4544c678..5dccff45 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -296,6 +296,7 @@ static const char *MapInfoMapLevel[] = "compat_dropoff", "compat_boomscroll", "compat_invisibility", + "compat_silent_instant_floors", "bordertexture", "f1", // [RC] F1 help "noinfighting", @@ -446,6 +447,7 @@ MapHandlers[] = { MITYPE_COMPATFLAG, COMPATF_DROPOFF}, { MITYPE_COMPATFLAG, COMPATF_BOOMSCROLL}, { MITYPE_COMPATFLAG, COMPATF_INVISIBILITY}, + { MITYPE_COMPATFLAG, COMPATF_SILENT_INSTANT_FLOORS}, { MITYPE_LUMPNAME, lioffset(bordertexture), 0 }, { MITYPE_LUMPNAME, lioffset(f1), 0, }, { MITYPE_SCFLAGS, LEVEL_NOINFIGHTING, ~LEVEL_TOTALINFIGHTING }, diff --git a/src/g_shared/a_skies.cpp b/src/g_shared/a_skies.cpp index 4ec3a8ad..f682f355 100644 --- a/src/g_shared/a_skies.cpp +++ b/src/g_shared/a_skies.cpp @@ -128,7 +128,7 @@ void ASkyPicker::PostBeginPlay () if (box == NULL && args[0] != 0) { - Printf ("Can't find SkyViewpoint %d for sector %d\n", + Printf ("Can't find SkyViewpoint %d for sector %td\n", args[0], Sector - sectors); } else diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index f6e37b6a..560dacd4 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -851,7 +851,7 @@ CCMD (addslot) if (!LocalWeapons.Slots[slot].AddWeapon (argv[2])) { - Printf ("Could not add %s to slot %d\n", argv[2], slot); + Printf ("Could not add %s to slot %zu\n", argv[2], slot); } } diff --git a/src/gl/gl_dynlight.cpp b/src/gl/gl_dynlight.cpp index aa2a6868..3d1038f3 100644 --- a/src/gl/gl_dynlight.cpp +++ b/src/gl/gl_dynlight.cpp @@ -1034,6 +1034,16 @@ void gl_SetActorLights(AActor *actor) count++; } } + // [BB] Under some circumstances dynamiclights contains NULL pointers, for + // example after a player respawns in multiplayer. Since the following code + // will crash in this case, I remove the NULL pointers from the array here. + // Of course, this is just an ugly hack and should be fixed properly! + // (assuming the real cause is found...) + for( int i = actor->dynamiclights.Size()-1; i >= 0; i-- ) + { + if ( actor->dynamiclights[i] == NULL ) + actor->dynamiclights.Delete(i); + } for(;countdynamiclights.Size();count++) { actor->dynamiclights[count]->flags2|=MF2_DORMANT; diff --git a/src/gl/gl_models.cpp b/src/gl/gl_models.cpp index 3f25dae4..ea9c8aa5 100644 --- a/src/gl/gl_models.cpp +++ b/src/gl/gl_models.cpp @@ -698,7 +698,7 @@ void gl_RenderHUDModel(pspdef_t *psp, fixed_t ofsx, fixed_t ofsy, int cm) bool gl_IsHUDModelForPlayerAvailable (player_t * player) { - if ( (player == NULL) || (player->ReadyWeapon == NULL) ) + if ( (player == NULL) || (player->ReadyWeapon == NULL) || (player->psprites[0].state == NULL) ) return false; FState* state = player->psprites[0].state; diff --git a/src/m_alloc.cpp b/src/m_alloc.cpp index 4d9e0fbf..23d0edc6 100644 --- a/src/m_alloc.cpp +++ b/src/m_alloc.cpp @@ -50,7 +50,7 @@ void *M_Malloc(size_t size) void *block = malloc(size); if (block == NULL) - I_FatalError("Could not malloc %u bytes", size); + I_FatalError("Could not malloc %zu bytes", size); GC::AllocBytes += _msize(block); return block; @@ -65,7 +65,7 @@ void *M_Realloc(void *memblock, size_t size) void *block = realloc(memblock, size); if (block == NULL) { - I_FatalError("Could not realloc %u bytes", size); + I_FatalError("Could not realloc %zu bytes", size); } GC::AllocBytes += _msize(block); return block; @@ -80,7 +80,7 @@ void *M_Malloc_Dbg(size_t size, const char *file, int lineno) void *block = _malloc_dbg(size, _NORMAL_BLOCK, file, lineno); if (block == NULL) - I_FatalError("Could not malloc %u bytes", size); + I_FatalError("Could not malloc %zu bytes", size); GC::AllocBytes += _msize(block); return block; @@ -95,7 +95,7 @@ void *M_Realloc_Dbg(void *memblock, size_t size, const char *file, int lineno) void *block = _realloc_dbg(memblock, size, _NORMAL_BLOCK, file, lineno); if (block == NULL) { - I_FatalError("Could not realloc %u bytes", size); + I_FatalError("Could not realloc %zu bytes", size); } GC::AllocBytes += _msize(block); return block; diff --git a/src/m_options.cpp b/src/m_options.cpp index 513e957f..2ee61599 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -1127,6 +1127,7 @@ static menuitem_t CompatibilityItems[] = { { bitflag, "Monsters get stuck over dropoffs", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_DROPOFF} }, { bitflag, "Monsters see invisible players", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_INVISIBILITY} }, { bitflag, "Boom scrollers are additive", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_BOOMSCROLL} }, + { bitflag, "Inst. moving floors are not silent", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_SILENT_INSTANT_FLOORS} }, { discrete, "Interpolate monster movement", {&nomonsterinterpolation}, {2.0}, {0.0}, {0.0}, {NoYes} }, }; diff --git a/src/nodebuild.cpp b/src/nodebuild.cpp index d8f53425..37b45981 100644 --- a/src/nodebuild.cpp +++ b/src/nodebuild.cpp @@ -751,7 +751,7 @@ void FNodeBuilder::SplitSegs (DWORD set, node_t &node, DWORD splitseg, DWORD &ou if (seg->loopnum) { - Printf (" Split seg %u (%d,%d)-(%d,%d) of sector %d in loop %d\n", + Printf (" Split seg %u (%d,%d)-(%d,%d) of sector %td in loop %d\n", set, Vertices[seg->v1].x>>16, Vertices[seg->v1].y>>16, Vertices[seg->v2].x>>16, Vertices[seg->v2].y>>16, @@ -991,7 +991,7 @@ void FNodeBuilder::PrintSet (int l, DWORD set) Printf ("set %d:\n", l); for (; set != DWORD_MAX; set = Segs[set].next) { - Printf ("\t%u(%d):%d(%d,%d)-%d(%d,%d) ", set, Segs[set].frontsector-sectors, + Printf ("\t%u(%td):%d(%d,%d)-%d(%d,%d) ", set, Segs[set].frontsector-sectors, Segs[set].v1, Vertices[Segs[set].v1].x>>16, Vertices[Segs[set].v1].y>>16, Segs[set].v2, diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 72a9c790..232d2d27 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -533,8 +533,6 @@ manual_floor: } // Do not interpolate instant movement floors. - // Note for ZDoomGL: Check to make sure that you update the sector - // after the floor moves, because it hasn't actually moved yet. bool silent = false; if ((floor->m_Direction>0 && floor->m_FloorDestDist>sec->floorplane.d) || // moving up but going down @@ -542,18 +540,15 @@ manual_floor: (floor->m_Speed >= abs(sec->floorplane.d - floor->m_FloorDestDist))) // moving in one step { stopinterpolation (INTERP_SectorFloor, sec); + // [Graf Zahl] // Don't make sounds for instant movement hacks but make an exception for // switches that activate their own back side. - // I'll leave the decision about this to somebody else. In many maps - // it helps but there are some where this omits sounds that should be there. - #ifdef SILENT_INSTANT_FLOORS - if (floortype != DFloor::floorRaiseInstant && floortype != DFloor::floorLowerInstant) + if (!(i_compatflags & COMPATF_SILENT_INSTANT_FLOORS)) { - if (!line || GET_SPAC(line->flags) != SPAC_USE || line->backsector!=sec) + if (!line || !(line->activation & (SPAC_Use|SPAC_Push)) || line->backsector!=sec) silent = true; } - #endif } if (!silent) floor->StartFloorSound (); diff --git a/src/p_local.h b/src/p_local.h index 844f6510..1d40e891 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -373,7 +373,7 @@ bool P_CheckSight (const AActor* t1, const AActor* t2, int flags=0); void P_ResetSightCounters (bool full); void P_UseLines (player_t* player); bool P_UsePuzzleItem (AActor *actor, int itemType); -void P_FindFloorCeiling (AActor *actor); +void P_FindFloorCeiling (AActor *actor, bool onlymidtex = false); bool P_ChangeSector (sector_t* sector, int crunch, int amt, int floorOrCeil, bool isreset); diff --git a/src/p_map.cpp b/src/p_map.cpp index 8962778b..09bad205 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -164,7 +164,7 @@ static bool PIT_FindFloorCeiling (line_t *ld, const FBoundingBox &box, FCheckPos // //========================================================================== -void P_FindFloorCeiling (AActor *actor) +void P_FindFloorCeiling (AActor *actor, bool onlymidtex) { sector_t *sec; FCheckPosition tmf; @@ -195,13 +195,16 @@ void P_FindFloorCeiling (AActor *actor) if (tmf.touchmidtex) tmf.dropoffz = tmf.floorz; - actor->floorz = tmf.floorz; - actor->dropoffz = tmf.dropoffz; - actor->ceilingz = tmf.ceilingz; - actor->floorpic = tmf.floorpic; - actor->floorsector = tmf.floorsector; - actor->ceilingpic = tmf.ceilingpic; - actor->ceilingsector = tmf.ceilingsector; + if (!onlymidtex || (tmf.touchmidtex && (tmf.floorz < actor->z))) + { + actor->floorz = tmf.floorz; + actor->dropoffz = tmf.dropoffz; + actor->ceilingz = tmf.ceilingz; + actor->floorpic = tmf.floorpic; + actor->floorsector = tmf.floorsector; + actor->ceilingpic = tmf.ceilingpic; + actor->ceilingsector = tmf.ceilingsector; + } } // @@ -3035,6 +3038,9 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, puff->Destroy(); puff = NULL; } + // [BB] If the puff came from a player, set the target of the puff to this player. + if ( puff && (puff->flags5 & MF5_PUFFGETSOWNER) && t1 && t1->player ) + puff->target = t1; return puff; } diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index ef585b1a..243171f3 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -529,7 +529,7 @@ sector_t *AActor::LinkToWorldForMapThing () if (distance < radius) { - DPrintf ("%s at (%d,%d) lies on %s line %d, distance = %f\n", + DPrintf ("%s at (%d,%d) lies on %s line %td, distance = %f\n", this->GetClass()->TypeName.GetChars(), x>>FRACBITS, y>>FRACBITS, ldef->dx == 0? "vertical" : ldef->dy == 0? "horizontal" : "diagonal", ldef-lines, FIXED2FLOAT(distance)); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 19b38a95..2401ea51 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -503,7 +503,7 @@ int AActor::GetTics(FState * newstate) bool AActor::SetState (FState *newstate) { if (debugfile && player && (player->cheats & CF_PREDICTING)) - fprintf (debugfile, "for pl %d: SetState while predicting!\n", player-players); + fprintf (debugfile, "for pl %td: SetState while predicting!\n", player-players); do { if (newstate == NULL) @@ -3350,6 +3350,9 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t actor->floorpic = actor->floorsector->floorpic; actor->ceilingsector = actor->Sector; actor->ceilingpic = actor->ceilingsector->ceilingpic; + // Check if there's something solid to stand on between the current position and the + // current sector's floor. + P_FindFloorCeiling(actor, true); } else if (!(actor->flags5 & MF5_NOINTERACTION)) { diff --git a/src/p_setup.cpp b/src/p_setup.cpp index bdeed490..228c53cf 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -71,10 +71,7 @@ void P_SetSlopes (); extern AActor *P_SpawnMapThing (FMapThing *mthing, int position); extern bool P_LoadBuildMap (BYTE *mapdata, size_t len, FMapThing **things, int *numthings); -extern void P_LoadTranslator(const char *lump); -extern void P_TranslateLineDef (line_t *ld, maplinedef_t *mld); extern void P_TranslateTeleportThings (void); -extern int P_TranslateSectorSpecial (int); void P_ParseTextMap(MapData *map); void P_SpawnTextThings(int position); diff --git a/src/p_setup.h b/src/p_setup.h index 4e22a7cc..d1b71ed6 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -99,4 +99,11 @@ void P_FreeExtraLevelData(); // Called by startup code. void P_Init (void); +struct line_t; +struct maplinedef_t; + +void P_LoadTranslator(const char *lumpname); +void P_TranslateLineDef (line_t *ld, maplinedef_t *mld); +int P_TranslateSectorSpecial (int); + #endif diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index d4a322be..2273d1e7 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -41,8 +41,6 @@ #include "templates.h" #include "i_system.h" -extern void P_TranslateLineDef (line_t *ld, maplinedef_t *mld); -extern int P_TranslateSectorSpecial (int); void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapsidedef_t *msd, int special, int tag, short *alpha); void P_AdjustLine (line_t *ld); void P_FinishLoadingLineDef(line_t *ld, int alpha); @@ -193,16 +191,25 @@ struct UDMFParser } if (isTranslated) { - // NOTE: Handling of this is undefined in the UDMF spec yet! - maplinedef_t mld; - line_t ld; + if (isExtended) + { + // NOTE: Handling of this is undefined in the UDMF spec + // so it is only done for namespace ZDoomTranslated + maplinedef_t mld; + line_t ld; - mld.flags = 0; - mld.special = th->special; - mld.tag = th->args[0]; - P_TranslateLineDef(&ld, &mld); - th->special = ld.special; - memcpy(th->args, ld.args, sizeof (ld.args)); + mld.flags = 0; + mld.special = th->special; + mld.tag = th->args[0]; + P_TranslateLineDef(&ld, &mld); + th->special = ld.special; + memcpy(th->args, ld.args, sizeof (ld.args)); + } + else // NULL the special + { + th->special = 0; + memset(th->args, 0, sizeof (th->args)); + } } } @@ -226,6 +233,8 @@ struct UDMFParser sc.MustGetString(); FString value = sc.String; sc.MustGetStringName(";"); + + // This switch contains all keys of the UDMF base spec switch(key) { case NAME_V1: @@ -273,55 +282,65 @@ struct UDMFParser Flag(ld->flags, ML_MAPPED, value); break; case NAME_Monsteractivate: Flag(ld->flags, ML_MONSTERSCANACTIVATE, value); break; - case NAME_Blockplayers: - if (isExtended) Flag(ld->flags, ML_BLOCK_PLAYERS, value); break; - case NAME_Blockeverything: - if (isExtended) Flag(ld->flags, ML_BLOCKEVERYTHING, value); break; - case NAME_Zoneboundary: - if (isExtended) Flag(ld->flags, ML_ZONEBOUNDARY, value); break; case NAME_Jumpover: - if (isExtended || namespc == NAME_Strife) Flag(ld->flags, ML_RAILING, value); break; + Flag(ld->flags, ML_RAILING, value); break; case NAME_Blockfloating: - if (isExtended || namespc == NAME_Strife) Flag(ld->flags, ML_BLOCK_FLOATERS, value); break; - case NAME_Clipmidtex: - if (isExtended) Flag(ld->flags, ML_CLIP_MIDTEX, value); break; - case NAME_Wrapmidtex: - if (isExtended) Flag(ld->flags, ML_WRAP_MIDTEX, value); break; - case NAME_Midtex3d: - if (isExtended) Flag(ld->flags, ML_3DMIDTEX, value); break; - case NAME_Checkswitchrange: - if (isExtended) Flag(ld->flags, ML_CHECKSWITCHRANGE, value); break; - case NAME_Firstsideonly: - if (isExtended) Flag(ld->flags, ML_FIRSTSIDEONLY, value); break; + Flag(ld->flags, ML_BLOCK_FLOATERS, value); break; case NAME_Transparent: ld->Alpha = !value.CompareNoCase("true")? FRACUNIT*3/4 : FRACUNIT; break; case NAME_Passuse: - passuse = !value.CompareNoCase("true"); - case NAME_Playercross: - if (isExtended) Flag(ld->activation, SPAC_Cross, value); break; - case NAME_Playeruse: - if (isExtended) Flag(ld->activation, SPAC_Use, value); break; - case NAME_Monstercross: - if (isExtended) Flag(ld->activation, SPAC_MCross, value); break; - case NAME_Impact: - if (isExtended) Flag(ld->activation, SPAC_Impact, value); break; - case NAME_Playerpush: - if (isExtended) Flag(ld->activation, SPAC_Push, value); break; - case NAME_Missilecross: - if (isExtended) Flag(ld->activation, SPAC_PCross, value); break; - case NAME_Monsteruse: - if (isExtended) Flag(ld->activation, SPAC_MUse, value); break; - case NAME_Monsterpush: - if (isExtended) Flag(ld->activation, SPAC_MPush, value); break; + passuse = !value.CompareNoCase("true"); break; + default: + break; + } + // This switch contains all keys of the UDMF base spec which only apply to Hexen format specials + if (!isTranslated) switch (key) + { + case NAME_Playercross: + Flag(ld->activation, SPAC_Cross, value); break; + case NAME_Playeruse: + Flag(ld->activation, SPAC_Use, value); break; + case NAME_Monstercross: + Flag(ld->activation, SPAC_MCross, value); break; + case NAME_Impact: + Flag(ld->activation, SPAC_Impact, value); break; + case NAME_Playerpush: + Flag(ld->activation, SPAC_Push, value); break; + case NAME_Missilecross: + Flag(ld->activation, SPAC_PCross, value); break; + case NAME_Monsteruse: + Flag(ld->activation, SPAC_MUse, value); break; + case NAME_Monsterpush: + Flag(ld->activation, SPAC_MPush, value); break; + default: + break; + } + + // This switch contains all keys which are ZDoom specific + if (isExtended) switch(key) + { + case NAME_Blockplayers: + Flag(ld->flags, ML_BLOCK_PLAYERS, value); break; + case NAME_Blockeverything: + Flag(ld->flags, ML_BLOCKEVERYTHING, value); break; + case NAME_Zoneboundary: + Flag(ld->flags, ML_ZONEBOUNDARY, value); break; + case NAME_Clipmidtex: + Flag(ld->flags, ML_CLIP_MIDTEX, value); break; + case NAME_Wrapmidtex: + Flag(ld->flags, ML_WRAP_MIDTEX, value); break; + case NAME_Midtex3d: + Flag(ld->flags, ML_3DMIDTEX, value); break; + case NAME_Checkswitchrange: + Flag(ld->flags, ML_CHECKSWITCHRANGE, value); break; + case NAME_Firstsideonly: + Flag(ld->flags, ML_FIRSTSIDEONLY, value); break; default: break; } } if (isTranslated) - { - } - else { int saved = ld->flags; @@ -523,7 +542,7 @@ struct UDMFParser if (v1i >= numvertexes || v2i >= numvertexes || v1i < 0 || v2i < 0) { - I_Error ("Line %d has invalid vertices: %d and/or %d.\nThe map only contains %d vertices.", i+skipped, v1i, v2i, numvertexes); + I_Error ("Line %d has invalid vertices: %zd and/or %zd.\nThe map only contains %d vertices.", i+skipped, v1i, v2i, numvertexes); } else if (v1i == v2i || (vertexes[v1i].x == vertexes[v2i].x && vertexes[v1i].y == vertexes[v2i].y)) @@ -589,42 +608,50 @@ struct UDMFParser map->Read(ML_TEXTMAP, buffer); sc.OpenMem(Wads.GetLumpFullName(map->lumpnum), buffer, map->Size(ML_TEXTMAP)); sc.SetCMode(true); + if (sc.CheckString("namespace")) + { + sc.MustGetStringName("="); + sc.MustGetString(); + namespc = sc.String; + if (namespc == NAME_ZDoom) + { + isTranslated = false; + isExtended = true; + } + else if (namespc == NAME_Hexen) + { + isTranslated = false; + } + else if (namespc == NAME_ZDoomTranslated) + { + isExtended = true; + } + else if (namespc == NAME_Doom) + { + P_LoadTranslator("xlat/doom_base.txt"); + } + else if (namespc == NAME_Heretic) + { + P_LoadTranslator("xlat/heretic_base.txt"); + } + else if (namespc == NAME_Strife) + { + P_LoadTranslator("xlat/strife_base.txt"); + } + else + { + Printf("Unknown namespace %s\n", sc.String); + } + sc.MustGetStringName(";"); + } + else + { + Printf("Map does not define a namespace.\n"); + } + while (sc.GetString()) { - if (sc.Compare("namespace")) - { - sc.MustGetStringName("="); - sc.MustGetString(); - namespc = sc.String; - if (namespc == NAME_ZDoom) - { - isTranslated = false; - isExtended = true; - } - else if (namespc == NAME_Hexen) - { - isTranslated = false; - } - else if (namespc == NAME_ZDoomTranslated) - { - isExtended = true; - } - else if (namespc == NAME_Doom) - { - } - else if (namespc == NAME_Heretic) - { - } - else if (namespc == NAME_Strife) - { - } - else - { - sc.ScriptError("Unknown namespace %s", sc.String); - } - sc.MustGetStringName(";"); - } - else if (sc.Compare("thing")) + if (sc.Compare("thing")) { FMapThing th; ParseThing(&th); diff --git a/src/p_user.cpp b/src/p_user.cpp index 9e756032..c0779a6b 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -1645,13 +1645,13 @@ void P_MovePlayer (player_t *player) if (debugfile) { - fprintf (debugfile, "move player for pl %d%c: (%d,%d,%d) (%d,%d) %d %d w%d [", player-players, + fprintf (debugfile, "move player for pl %d%c: (%d,%d,%d) (%d,%d) %d %d w%d [", int(player-players), player->cheats&CF_PREDICTING?'p':' ', player->mo->x, player->mo->y, player->mo->z,forwardmove, sidemove, movefactor, friction, player->mo->waterlevel); msecnode_t *n = player->mo->touching_sectorlist; while (n != NULL) { - fprintf (debugfile, "%d ", n->m_sector-sectors); + fprintf (debugfile, "%td ", n->m_sector-sectors); n = n->m_tnext; } fprintf (debugfile, "]\n"); @@ -1924,12 +1924,12 @@ void P_PlayerThink (player_t *player) if (player->mo == NULL) { - I_Error ("No player %d start\n", player - players + 1); + I_Error ("No player %td start\n", player - players + 1); } if (debugfile && !(player->cheats & CF_PREDICTING)) { - fprintf (debugfile, "tic %d for pl %d: (%d, %d, %d, %u) b:%02x p:%d y:%d f:%d s:%d u:%d\n", + fprintf (debugfile, "tic %d for pl %td: (%d, %d, %d, %u) b:%02x p:%d y:%d f:%d s:%d u:%d\n", gametic, player-players, player->mo->x, player->mo->y, player->mo->z, player->mo->angle>>ANGLETOFINESHIFT, player->cmd.ucmd.buttons, player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove, diff --git a/src/p_xlat.cpp b/src/p_xlat.cpp index 440ba7e3..876fc31d 100644 --- a/src/p_xlat.cpp +++ b/src/p_xlat.cpp @@ -337,7 +337,7 @@ int P_TranslateSectorSpecial (int special) { int mask = 0; - for(unsigned i = 0; i < SectorMasks.Size(); i++) + for(int i = SectorMasks.Size()-1; i>=0; i--) { int newmask = special & SectorMasks[i].mask; if (newmask) diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 27248e60..99721019 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -1048,7 +1048,7 @@ void R_Subsector (subsector_t *sub) #ifdef RANGECHECK if (sub - subsectors >= (ptrdiff_t)numsubsectors) - I_Error ("R_Subsector: ss %i with numss = %i", sub - subsectors, numsubsectors); + I_Error ("R_Subsector: ss %ti with numss = %i", sub - subsectors, numsubsectors); #endif frontsector = sub->sector; diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 4c603130..894efc9e 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -1480,7 +1480,7 @@ void R_CheckDrawSegs () firstdrawseg = drawsegs + firstofs; ds_p = drawsegs + MaxDrawSegs; MaxDrawSegs = newdrawsegs; - DPrintf ("MaxDrawSegs increased to %d\n", MaxDrawSegs); + DPrintf ("MaxDrawSegs increased to %zu\n", MaxDrawSegs); } } @@ -1498,7 +1498,7 @@ void R_CheckOpenings (size_t need) maxopenings = maxopenings ? maxopenings*2 : 16384; while (need > maxopenings); openings = (short *)M_Realloc (openings, maxopenings * sizeof(*openings)); - DPrintf ("MaxOpenings increased to %u\n", maxopenings); + DPrintf ("MaxOpenings increased to %zu\n", maxopenings); } } diff --git a/src/r_things.cpp b/src/r_things.cpp index eb8e0e04..6685956e 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -467,7 +467,7 @@ void R_InitSkins (void) strncpy (key, sc.String, sizeof(key)-1); if (!sc.GetString() || sc.String[0] != '=') { - Printf (PRINT_BOLD, "Bad format for skin %d: %s\n", i, key); + Printf (PRINT_BOLD, "Bad format for skin %d: %s\n", (int)i, key); break; } sc.GetString (); @@ -478,7 +478,7 @@ void R_InitSkins (void) { if (stricmp (skins[i].name, skins[j].name) == 0) { - sprintf (skins[i].name, "skin%d", i); + sprintf (skins[i].name, "skin%d", (int)i); Printf (PRINT_BOLD, "Skin %s duplicated as %s\n", skins[j].name, skins[i].name); break; @@ -659,7 +659,7 @@ void R_InitSkins (void) if (!remove) { if (skins[i].name[0] == 0) - sprintf (skins[i].name, "skin%d", i); + sprintf (skins[i].name, "skin%d", (int)i); // Now collect the sprite frames for this skin. If the sprite name was not // specified, use whatever immediately follows the specifier lump. @@ -710,7 +710,7 @@ void R_InitSkins (void) if (spr == 0 && maxframe <= 0) { - Printf (PRINT_BOLD, "Skin %s (#%d) has no frames. Removing.\n", skins[i].name, i); + Printf (PRINT_BOLD, "Skin %s (#%d) has no frames. Removing.\n", skins[i].name, (int)i); remove = true; break; } diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index da134a9f..c57e1293 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -1597,7 +1597,7 @@ void FMODSoundRenderer::LoadSound(sfxinfo_t *sfx) { if (sfx->data == NULL) { - DPrintf("loading sound \"%s\" (%d)\n", sfx->name.GetChars(), sfx - &S_sfx[0]); + DPrintf("Loading sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]); getsfx(sfx); } } @@ -1614,7 +1614,7 @@ void FMODSoundRenderer::UnloadSound(sfxinfo_t *sfx) { ((FMOD::Sound *)sfx->data)->release(); sfx->data = NULL; - DPrintf("Unloaded sound \"%s\" (%d)\n", sfx->name.GetChars(), sfx - &S_sfx[0]); + DPrintf("Unloaded sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]); } } diff --git a/src/stats.h b/src/stats.h index a02e5a12..81066b3c 100644 --- a/src/stats.h +++ b/src/stats.h @@ -58,9 +58,9 @@ inline cycle_t GetClockCycle () #endif } -#elif defined(__GNUG__) && defined(__i386__) +#elif defined(__GNUC__) && (defined(__i386__) || defined(__amd64__)) -typedef QWORD cycle_t; +typedef unsigned long long cycle_t; inline cycle_t GetClockCycle() { @@ -78,7 +78,7 @@ inline cycle_t GetClockCycle() #else -typedef DWORD cycle_t; +typedef QWORD cycle_t; inline cycle_t GetClockCycle () { diff --git a/src/svnrevision.h b/src/svnrevision.h index 3ab1cb30..c6b3c082 100644 --- a/src/svnrevision.h +++ b/src/svnrevision.h @@ -3,5 +3,5 @@ // This file was automatically generated by the // updaterevision tool. Do not edit by hand. -#define ZD_SVN_REVISION_STRING "964" -#define ZD_SVN_REVISION_NUMBER 964 +#define ZD_SVN_REVISION_STRING "970" +#define ZD_SVN_REVISION_NUMBER 970 diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 17f11982..f3c5c2fc 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -240,6 +240,7 @@ static flagdef ActorFlags[]= DEFINE_FLAG(MF5, NOINFIGHTING, AActor, flags5), DEFINE_FLAG(MF5, NOINTERACTION, AActor, flags5), DEFINE_FLAG(MF5, NOTIMEFREEZE, AActor, flags5), + DEFINE_FLAG(MF5, PUFFGETSOWNER, AActor, flags5), // [BB] added PUFFGETSOWNER // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), @@ -255,6 +256,7 @@ static flagdef ActorFlags[]= DEFINE_DEPRECATED_FLAG(LOWGRAVITY), DEFINE_DEPRECATED_FLAG(SHORTMISSILERANGE), DEFINE_DEPRECATED_FLAG(LONGMELEERANGE), + DEFINE_DUMMY_FLAG(NONETID), }; static flagdef InventoryFlags[] = diff --git a/src/timidity/common.cpp b/src/timidity/common.cpp index 8579780e..83e334b5 100644 --- a/src/timidity/common.cpp +++ b/src/timidity/common.cpp @@ -120,7 +120,7 @@ void *safe_malloc(size_t count) void *p; if (count > (1 << 21)) { - I_Error("Timidity: Tried allocating %u bytes. This must be a bug.", count); + I_Error("Timidity: Tried allocating %zu bytes. This must be a bug.", count); } else if ((p = malloc(count))) { @@ -128,7 +128,7 @@ void *safe_malloc(size_t count) } else { - I_Error("Timidity: Couldn't malloc %u bytes.", count); + I_Error("Timidity: Couldn't malloc %zu bytes.", count); } return 0; // Unreachable. } diff --git a/src/timidity/mix.cpp b/src/timidity/mix.cpp index 46fccd97..b4fc0f81 100644 --- a/src/timidity/mix.cpp +++ b/src/timidity/mix.cpp @@ -278,7 +278,7 @@ static bool check_release(double RateMul, double sec) bool SF2Envelope::Update(Voice *v) { double sec; - double newvolume; + double newvolume = 0; switch (stage) { diff --git a/src/xlat/parse_xlat.cpp b/src/xlat/parse_xlat.cpp index ed377b0c..904b1727 100644 --- a/src/xlat/parse_xlat.cpp +++ b/src/xlat/parse_xlat.cpp @@ -111,20 +111,20 @@ struct XlatParseContext : public FParseContext //========================================================================== bool FindToken (char *tok, int *type) { - static const char tokens[][10] = + static const char *tokens[] = { "arg2", "arg3", "arg4", "arg5", "bitmask", "clear", "define", "enum", "flags", "include", "lineid", - "nobitmask", "sector", "tag" + "nobitmask", "sector", "tag", "maxlinespecial" }; static const short types[] = { XLAT_ARG2, XLAT_ARG3, XLAT_ARG4, XLAT_ARG5, XLAT_BITMASK, XLAT_CLEAR, XLAT_DEFINE, XLAT_ENUM, XLAT_FLAGS, XLAT_INCLUDE, XLAT_TAG, - XLAT_NOBITMASK, XLAT_SECTOR, XLAT_TAG, + XLAT_NOBITMASK, XLAT_SECTOR, XLAT_TAG, XLAT_MAXLINESPECIAL }; - int min = 0, max = sizeof(tokens)/sizeof(tokens[0]) - 1; + int min = 0, max = countof(tokens) - 1; while (min <= max) { diff --git a/src/xlat/xlat_parser.y b/src/xlat/xlat_parser.y index 7f47f45d..42098933 100644 --- a/src/xlat/xlat_parser.y +++ b/src/xlat/xlat_parser.y @@ -18,6 +18,7 @@ external_declaration ::= linetype_declaration. external_declaration ::= boom_declaration. external_declaration ::= sector_declaration. external_declaration ::= sector_bitmask. +external_declaration ::= maxlinespecial_def. external_declaration ::= NOP. @@ -452,6 +453,19 @@ list_val(A) ::= exp(B) COLON exp(C). A.value = C; } +//========================================================================== +// +// max line special +// +//========================================================================== + +maxlinespecial_def ::= MAXLINESPECIAL EQUALS exp(mx) SEMICOLON. +{ + // Just kill all specials higher than the max. + // If the translator wants to redefine some later, just let it.s + SimpleLineTranslations.Resize(mx+1); +} + //========================================================================== // // sector types diff --git a/src/zstrformat.cpp b/src/zstrformat.cpp index e783d3cc..567ebbd8 100644 --- a/src/zstrformat.cpp +++ b/src/zstrformat.cpp @@ -218,6 +218,16 @@ namespace StringFormat flags |= F_BIGI; } } + else if (*c == 't') + { + flags |= F_PTRDIFF; + ++c; + } + else if (*c == 'z') + { + flags |= F_SIZE; + ++c; + } base = c+1; @@ -278,7 +288,11 @@ namespace StringFormat } else { - if (size == F_HALFHALF) + if (size == 0) + { + intarg = va_arg (arglist, int); + } + else if (size == F_HALFHALF) { intarg = va_arg (arglist, int); intarg = (signed char)intarg; @@ -302,6 +316,16 @@ namespace StringFormat { int64arg = va_arg (arglist, int64_t); } + else if (size == F_PTRDIFF) + { + if (sizeof(ptrdiff_t) == sizeof(int)) intarg = va_arg (arglist, int); + else { int64arg = va_arg (arglist, int64_t); size = F_LONGLONG; } + } + else if (size == F_SIZE) + { + if (sizeof(size_t) == sizeof(int)) intarg = va_arg (arglist, int); + else { int64arg = va_arg (arglist, int64_t); size = F_LONGLONG; } + } else { intarg = va_arg (arglist, int); diff --git a/src/zstring.h b/src/zstring.h index 749c5172..cfef8c2c 100644 --- a/src/zstring.h +++ b/src/zstring.h @@ -284,7 +284,9 @@ namespace StringFormat F_HALF = 0x2000, // h F_LONG = 0x3000, // l F_LONGLONG = 0x4000, // ll or I64 - F_BIGI = 0x5000 // I + F_BIGI = 0x5000, // I + F_PTRDIFF = 0x6000, // t + F_SIZE = 0x7000, // z }; typedef int (*OutputFunc)(void *data, const char *str, int len); diff --git a/wadsrc/xlat/doom_base.txt b/wadsrc/xlat/doom_base.txt new file mode 100644 index 00000000..e75cd410 --- /dev/null +++ b/wadsrc/xlat/doom_base.txt @@ -0,0 +1,17 @@ +include "xlat/doom.txt" + +maxlinespecial = 272; + + +sector bitmask 0xffe0 clear; + +sector 15 = 0; +sector 17 = 0; +sector 18 = 0; +sector 19 = 0; +sector 20 = 0; +sector 21 = 0; +sector 22 = 0; +sector 23 = 0; +sector 24 = 0; + diff --git a/wadsrc/xlat/heretic_base.txt b/wadsrc/xlat/heretic_base.txt new file mode 100644 index 00000000..76b7840b --- /dev/null +++ b/wadsrc/xlat/heretic_base.txt @@ -0,0 +1,8 @@ +include "xlat/heretic.txt" + +maxlinespecial = 107; + + +sector bitmask 0xffc0 clear; + +sector 17 = 0; diff --git a/wadsrc/xlat/strife_base.txt b/wadsrc/xlat/strife_base.txt new file mode 100644 index 00000000..b01f2fb1 --- /dev/null +++ b/wadsrc/xlat/strife_base.txt @@ -0,0 +1,14 @@ +include "xlat/strife.txt" + +maxlinespecial = 234; + +sector bitmask 0xffe0 clear; + +sector 19 = 0; +sector 20 = 0; +sector 21 = 0; +sector 22 = 0; +sector 23 = 0; +sector 24 = 0; + +