mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-27 22:42:29 +00:00
- 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. SVN r1521 (trunk)
This commit is contained in:
parent
9d47afb304
commit
78fb48302c
10 changed files with 100 additions and 1 deletions
|
@ -1,4 +1,9 @@
|
|||
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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
21
src/gi.cpp
21
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))
|
||||
{
|
||||
|
|
1
src/gi.h
1
src/gi.h
|
@ -72,6 +72,7 @@ struct gameinfo_t
|
|||
TArray<FName> creditPages;
|
||||
TArray<FName> finalePages;
|
||||
TArray<FName> infoPages;
|
||||
TArray<FName> DefaultWeaponSlots[10];
|
||||
|
||||
FString titleMusic;
|
||||
float titleTime;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue