From 4c1cbcedfa86b6c99e6fde91909f6a008ca7e91b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 6 Apr 2009 17:27:59 +0000 Subject: [PATCH] - fixed: Map wads with less than 4 lumps caused an endless loop in the gl nodes checking code. This condition is true for all UDMF maps with only a TEXTMAP lump. Update to ZDoom r1523: - Fixed: The UDMF textmap readbuffer was never freed. - Fixed: GetPlayerInput() died if you tried to get the input of the activator and the activator was the world. - fixed: Any player class inheriting directly from PlayerPawn was left with empty weapon slots due to the recent rewrite of the weapon slot assignment code. To handle such classes each game now defines a default weapon slot setting in its gameinfo. This will be used when a player class without any weapon slot settings is used. - added 'damage' to the actor variables exported to DECORATE's expression evaluator. - fixed: solid corpses could block ripper missile that originally killed them. - Fixed: Doom's status bar was lacking its default face. - Fixed: Custom skin face graphics were not added to the texture manager. - Fixed: UseHealthItems() gave you health equal to the number of items in the stack of health items, rather than the item's proper amount. - Fixed: SBARINFO's "usessecondaryammo" considered a weapon to not use secondaryammo if ammo2's type was the same as ammo1's, but only if you didn't use the "not" keyword with it. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@321 b0f79afe-0144-0410-b225-9a4edf0717df --- docs/rh-log.txt | 30 ++++++++++++++++++++- src/g_shared/a_pickups.cpp | 17 +++++++----- src/g_shared/a_pickups.h | 1 + src/g_shared/a_weapons.cpp | 40 ++++++++++++++++++++++++++++ src/g_shared/sbarinfo_display.cpp | 2 +- src/gi.cpp | 21 ++++++++++++++- src/gi.h | 1 + src/gl/gl_nodes.cpp | 2 +- src/p_acs.cpp | 4 +++ src/p_interaction.cpp | 4 +-- src/p_map.cpp | 5 ++++ src/p_udmf.cpp | 2 +- src/svnrevision.h | 4 +-- src/thingdef/thingdef_expression.cpp | 1 + src/v_collection.cpp | 8 ++++++ wadsrc/static/actors/actor.txt | 1 + wadsrc/static/mapinfo/chex.txt | 7 +++++ wadsrc/static/mapinfo/doomcommon.txt | 7 +++++ wadsrc/static/mapinfo/heretic.txt | 7 +++++ wadsrc/static/mapinfo/hexen.txt | 4 +++ wadsrc/static/mapinfo/strife.txt | 8 ++++++ wadsrc/static/sbarinfo/doom.txt | 2 +- 22 files changed, 161 insertions(+), 17 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 9f444321..3f12a453 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,32 @@ -March 29, 2009 (Changes by Graf Zahl) +April 6, 2009 (Changes by Graf Zahl) +- Fixed: The UDMF textmap readbuffer was never freed. + +April 4, 2009 +- Fixed: GetPlayerInput() died if you tried to get the input of the activator + and the activator was the world. + +April 4, 2009 (Changes by Graf Zahl) +- fixed: Any player class inheriting directly from PlayerPawn was left with + empty weapon slots due to the recent rewrite of the weapon slot assignment + code. To handle such classes each game now defines a default weapon slot + setting in its gameinfo. This will be used when a player class without any + weapon slot settings is used. +- added 'damage' to the actor variables exported to DECORATE's expression + evaluator. +- fixed: solid corpses could block ripper missile that originally killed them. + +April 2, 2009 +- Fixed: Doom's status bar was lacking its default face. +- Fixed: Custom skin face graphics were not added to the texture manager. +- Fixed: UseHealthItems() gave you health equal to the number of items in + the stack of health items, rather than the item's proper amount. + +April 1, 2008 +- Fixed: SBARINFO's "usessecondaryammo" considered a weapon to not use + secondaryammo if ammo2's type was the same as ammo1's, but only if you + didn't use the "not" keyword with it. + +March 29, 2009 (Changes by Graf Zahl) - Fixed: Altering a link type with Sector_SetLink did not work. - Fixed: player.crouchsprite had no proper means of unsetting the crouch sprite which is needed by the ChexPlayer. diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 34a4a716..2984a069 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -328,34 +328,37 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition) _y = self->SpawnPoint[1]; sec = P_PointInSector (_x, _y); - self->SetOrigin (_x, _y, sec->floorplane.ZatPoint (_x, _y)); - P_CheckPosition (self, _x, _y); + fixed_t floorz = sec->floorplane.ZatPoint (_x, _y); + fixed_t ceilingz = sec->ceilingplane.ZatPoint (_x, _y); + + self->SetOrigin (_x, _y, floorz); if (self->flags & MF_SPAWNCEILING) { - self->z = self->ceilingz - self->height - self->SpawnPoint[2]; + self->z = ceilingz - self->height - self->SpawnPoint[2]; } else if (self->flags2 & MF2_SPAWNFLOAT) { - fixed_t space = self->ceilingz - self->height - self->floorz; + fixed_t space = ceilingz - self->height - floorz; if (space > 48*FRACUNIT) { space -= 40*FRACUNIT; - self->z = ((space * pr_restore())>>8) + self->floorz + 40*FRACUNIT; + self->z = ((space * pr_restore())>>8) + floorz + 40*FRACUNIT; } else { - self->z = self->floorz; + self->z = floorz; } } else { - self->z = self->SpawnPoint[2] + self->floorz; + self->z = self->SpawnPoint[2] + floorz; if (self->flags2 & MF2_FLOATBOB) { self->z += FloatBobOffsets[(self->FloatBobPhase + level.maptime) & 63]; } } + P_CheckPosition (self, _x, _y); } int AInventory::StaticLastMessageTic; diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index 023002dd..58709d97 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -73,6 +73,7 @@ struct FWeaponSlots bool LocateWeapon (const PClass *type, int *const slot, int *const index); ESlotDef AddDefaultWeapon (int slot, const PClass *type); void AddExtraWeapons(); + void SetFromGameInfo(); void SetFromPlayer(const PClass *type); void StandardSetup(const PClass *type); void LocalSetup(const PClass *type); diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index 11829f85..8beec168 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -1115,6 +1115,44 @@ void FWeaponSlots::AddExtraWeapons() } } +//=========================================================================== +// +// FWeaponSlots :: SetFromGameInfo +// +// If neither the player class nor any defined weapon contain a +// slot assignment, use the game's defaults +// +//=========================================================================== + +void FWeaponSlots::SetFromGameInfo() +{ + unsigned int i; + + // Only if all slots are empty + for (i = 0; i < NUM_WEAPON_SLOTS; ++i) + { + if (Slots[i].Size() > 0) return; + } + + // Append extra weapons to the slots. + for (i = 0; i < NUM_WEAPON_SLOTS; ++i) + { + for (unsigned j = 0; j < gameinfo.DefaultWeaponSlots[i].Size(); i++) + { + const PClass *cls = PClass::FindClass(gameinfo.DefaultWeaponSlots[i][j]); + if (cls == NULL) + { + Printf("Unknown weapon class '%s' found in default weapon slot assignments\n", + gameinfo.DefaultWeaponSlots[i][j].GetChars()); + } + else + { + Slots[i].AddWeapon(cls); + } + } + } +} + //=========================================================================== // // FWeaponSlots :: StandardSetup @@ -1122,6 +1160,7 @@ void FWeaponSlots::AddExtraWeapons() // Setup weapons in this order: // 1. Use slots from player class. // 2. Add extra weapons that specify their own slots. +// 3. If all slots are empty, use the settings from the gameinfo (compatibility fallback) // //=========================================================================== @@ -1129,6 +1168,7 @@ void FWeaponSlots::StandardSetup(const PClass *type) { SetFromPlayer(type); AddExtraWeapons(); + SetFromGameInfo(); } //=========================================================================== diff --git a/src/g_shared/sbarinfo_display.cpp b/src/g_shared/sbarinfo_display.cpp index 702e3868..aac681b8 100644 --- a/src/g_shared/sbarinfo_display.cpp +++ b/src/g_shared/sbarinfo_display.cpp @@ -1288,7 +1288,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a break; case SBARINFO_USESSECONDARYAMMO: if((CPlayer->ReadyWeapon != NULL && CPlayer->ReadyWeapon->AmmoType2 != NULL && CPlayer->ReadyWeapon->AmmoType2 != CPlayer->ReadyWeapon->AmmoType1 && !(cmd.flags & SBARINFOEVENT_NOT)) || - ((CPlayer->ReadyWeapon == NULL || CPlayer->ReadyWeapon->AmmoType2 == NULL) && cmd.flags & SBARINFOEVENT_NOT)) + ((CPlayer->ReadyWeapon == NULL || CPlayer->ReadyWeapon->AmmoType2 == NULL || CPlayer->ReadyWeapon->AmmoType2 == CPlayer->ReadyWeapon->AmmoType1) && cmd.flags & SBARINFOEVENT_NOT)) { doCommands(cmd.subBlock, xOffset, yOffset, alpha); } diff --git a/src/gi.cpp b/src/gi.cpp index 18c0554e..514b09e7 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -175,7 +175,26 @@ void FMapInfoParser::ParseGameInfo() FString nextKey = sc.String; sc.MustGetToken('='); - if(nextKey.CompareNoCase("border") == 0) + if (nextKey.CompareNoCase("weaponslot") == 0) + { + sc.MustGetToken(TK_IntConst); + if (sc.Number < 0 || sc.Number >= 10) + { + sc.ScriptError("Weapon slot index must be in range [0..9].\n"); + } + int i = sc.Number; + gameinfo.DefaultWeaponSlots[i].Clear(); + sc.MustGetToken(','); + do + { + sc.MustGetString(); + FName val = sc.String; + gameinfo.DefaultWeaponSlots[i].Push(val); + + } + while (sc.CheckToken(',')); + } + else if(nextKey.CompareNoCase("border") == 0) { if(sc.CheckToken(TK_Identifier)) { diff --git a/src/gi.h b/src/gi.h index 0e3ad50a..09908e5a 100644 --- a/src/gi.h +++ b/src/gi.h @@ -72,6 +72,7 @@ struct gameinfo_t TArray creditPages; TArray finalePages; TArray infoPages; + TArray DefaultWeaponSlots[10]; FString titleMusic; float titleTime; diff --git a/src/gl/gl_nodes.cpp b/src/gl/gl_nodes.cpp index ffd79c36..89fac7c4 100644 --- a/src/gl/gl_nodes.cpp +++ b/src/gl/gl_nodes.cpp @@ -781,7 +781,7 @@ static int FindGLNodesInFile(FileReader * f, const char * label) f->Seek(0, SEEK_SET); (*f) >> id >> numentries >> dirofs; - if (id == IWAD_ID || id == PWAD_ID) + if ((id == IWAD_ID || id == PWAD_ID) && numentries > 4) { f->Seek(dirofs, SEEK_SET); for(DWORD i=0;iplayer; } else if (playernum >= MAXPLAYERS || !playeringame[playernum]) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index bd3f47a8..68dbda5c 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -744,11 +744,11 @@ static int UseHealthItems(TArray &Items, int &saveHealth) if (Items[i]->health > maxhealth) { index = i; - maxhealth = Items[i]->Amount; + maxhealth = Items[i]->health; } } - // Now apply the health items, using the same logic as Heretic anf Hexen. + // Now apply the health items, using the same logic as Heretic and Hexen. int count = (saveHealth + maxhealth-1) / maxhealth; for(int i = 0; i < count; i++) { diff --git a/src/p_map.cpp b/src/p_map.cpp index 09a8336a..bed89962 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -834,6 +834,11 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm) { return true; } + // Check for rippers passing through corpses + if ((thing->flags & MF_CORPSE) && (tm.thing->flags2 & MF2_RIP) && !(thing->flags & MF_SHOOTABLE)) + { + return true; + } int clipheight; diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 1e540339..7a82e656 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1107,6 +1107,7 @@ struct UDMFParser map->Read(ML_TEXTMAP, buffer); sc.OpenMem(Wads.GetLumpFullName(map->lumpnum), buffer, map->Size(ML_TEXTMAP)); + delete [] buffer; sc.SetCMode(true); if (sc.CheckString("namespace")) { @@ -1232,7 +1233,6 @@ struct UDMFParser // Create the real linedefs and decompress the sidedefs ProcessLineDefs(); - } }; diff --git a/src/svnrevision.h b/src/svnrevision.h index 5aea93e1..945dd61c 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 "1514" -#define ZD_SVN_REVISION_NUMBER 1514 +#define ZD_SVN_REVISION_STRING "1523" +#define ZD_SVN_REVISION_NUMBER 1523 diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 116b5854..e1e8a60e 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -72,6 +72,7 @@ DEFINE_MEMBER_VARIABLE(z, AActor) DEFINE_MEMBER_VARIABLE(momx, AActor) DEFINE_MEMBER_VARIABLE(momy, AActor) DEFINE_MEMBER_VARIABLE(momz, AActor) +DEFINE_MEMBER_VARIABLE(Damage, AActor) //========================================================================== // diff --git a/src/v_collection.cpp b/src/v_collection.cpp index b8ee25d8..f1aa2b63 100644 --- a/src/v_collection.cpp +++ b/src/v_collection.cpp @@ -63,6 +63,14 @@ void FImageCollection::Add (const char **patchNames, int numPatches, int namespc for (int i = 0; i < numPatches; ++i) { FTextureID picnum = TexMan.CheckForTexture(patchNames[i], namespc); + if (!picnum.isValid()) + { + int lumpnum = Wads.CheckNumForName(patchNames[i], namespc); + if (lumpnum >= 0) + { + picnum = TexMan.CreateTexture(lumpnum, namespc); + } + } ImageMap[OldCount + i] = picnum; } } diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 4fcae343..7dfac00d 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -33,6 +33,7 @@ ACTOR Actor native //: Thinker native int tid; native int TIDtoHate; native int waterlevel; + native int damage; native fixed_t x; native fixed_t y; native fixed_t z; diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index 7c00dd8b..dec8990c 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -25,6 +25,13 @@ gameinfo backpacktype = "ZorchPack" statusbar = "sbarinfo/doom.txt" intermissionmusic = "$MUSIC_INTER" + weaponslot = 1, "Bootspoon", "SuperBootspork" + weaponslot = 2, "MiniZorcher" + weaponslot = 3, "LargeZorcher", "SuperLargeZorcher" + weaponslot = 4, "RapidZorcher" + weaponslot = 5, "ZorchPropulsor" + weaponslot = 6, "PhasingZorcher" + weaponslot = 7, "LAZDevice" } skill baby diff --git a/wadsrc/static/mapinfo/doomcommon.txt b/wadsrc/static/mapinfo/doomcommon.txt index 84fc4c1e..1de00818 100644 --- a/wadsrc/static/mapinfo/doomcommon.txt +++ b/wadsrc/static/mapinfo/doomcommon.txt @@ -25,6 +25,13 @@ gameinfo backpacktype = "Backpack" statusbar = "sbarinfo/doom.txt" intermissionmusic = "$MUSIC_DM2INT" + weaponslot = 1, "Fist", "Chainsaw" + weaponslot = 2, "Pistol" + weaponslot = 3, "Shotgun", "SuperShotgun" + weaponslot = 4, "Chaingun" + weaponslot = 5, "RocketLauncher" + weaponslot = 6, "PlasmaRifle" + weaponslot = 7, "BFG9000" } skill baby diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index a56c90fc..733498aa 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -25,6 +25,13 @@ gameinfo backpacktype = "BagOfHolding" statusbar = "" intermissionmusic = "mus_intr" + weaponslot = 1, "Staff", "Gauntlets" + weaponslot = 2, "GoldWand" + weaponslot = 3, "Crossbow" + weaponslot = 4, "Blaster" + weaponslot = 5, "SkullRod" + weaponslot = 6, "PhoenixRod" + weaponslot = 7, "Mace" } skill baby diff --git a/wadsrc/static/mapinfo/hexen.txt b/wadsrc/static/mapinfo/hexen.txt index 7cf50f89..be391e99 100644 --- a/wadsrc/static/mapinfo/hexen.txt +++ b/wadsrc/static/mapinfo/hexen.txt @@ -28,6 +28,10 @@ gameinfo backpacktype = "BagOfHolding" // Hexen doesn't have a backpack so use Heretic's. statusbar = "" intermissionmusic = "hub" + weaponslot = 1, "FWeapFist", "CWeapMace", "MWeapWand" + weaponslot = 2, "FWeapAxe", "CWeapStaff", "MWeapFrost" + weaponslot = 3, "FWeapHammer", "CWeapFlame", "MWeapLightning" + weaponslot = 4, "FWeapQuietus", "CWeapWraithverge", "MWeapBloodscourge" } skill baby diff --git a/wadsrc/static/mapinfo/strife.txt b/wadsrc/static/mapinfo/strife.txt index 03341496..b94b0284 100644 --- a/wadsrc/static/mapinfo/strife.txt +++ b/wadsrc/static/mapinfo/strife.txt @@ -25,6 +25,14 @@ gameinfo backpacktype = "AmmoSatchel" statusbar = "" intermissionmusic = "d_slide" + weaponslot = 1, "PunchDagger" + weaponslot = 2, "StrifeCrossbow2", "StrifeCrossbow" + weaponslot = 3, "AssaultGun" + weaponslot = 4, "MiniMissileLauncher" + weaponslot = 5, "StrifeGrenadeLauncher2", "StrifeGrenadeLauncher" + weaponslot = 6, "FlameThrower" + weaponslot = 7, "Mauler2", "Mauler" + weaponslot = 8, "Sigil" } skill baby diff --git a/wadsrc/static/sbarinfo/doom.txt b/wadsrc/static/sbarinfo/doom.txt index 2d5ff536..bd53f7a0 100644 --- a/wadsrc/static/sbarinfo/doom.txt +++ b/wadsrc/static/sbarinfo/doom.txt @@ -110,7 +110,7 @@ statusbar normal // Standard Doom Status bar } drawselectedinventory alternateonempty, INDEXFONT, 143, 168 { - drawmugshot 5, 143, 168; + drawmugshot "STF", 5, 143, 168; } }