mirror of
https://github.com/id-Software/quake2-rerelease-dll.git
synced 2025-03-14 12:20:45 +00:00
Added CheckItem
This commit is contained in:
parent
fbb6a41014
commit
739bd5fcaf
3 changed files with 48 additions and 0 deletions
|
@ -2382,3 +2382,45 @@ void SetItemNames()
|
|||
cs_index++;
|
||||
}
|
||||
}
|
||||
|
||||
#define ITEM_SWITCH_COUNT 15
|
||||
|
||||
const char* sp_item[ITEM_SWITCH_COUNT][2] = {
|
||||
{"weapon_machinegun", "weapon_MP5"},
|
||||
//{"weapon_supershotgun","weapon_HC"},
|
||||
{"weapon_bfg", "weapon_M4"},
|
||||
{"weapon_shotgun", "weapon_M3"},
|
||||
//{"weapon_grenadelauncher","weapon_M203"},
|
||||
{"weapon_chaingun", "weapon_Sniper"},
|
||||
{"weapon_rocketlauncher", "weapon_HC"},
|
||||
{"weapon_railgun", "weapon_Dual"},
|
||||
{"ammo_bullets", "ammo_clip"},
|
||||
{"ammo_rockets", "ammo_mag"},
|
||||
{"ammo_cells", "ammo_m4"},
|
||||
{"ammo_slugs", "ammo_sniper"},
|
||||
{"ammo_shells", "ammo_m3"},
|
||||
{"ammo_grenades", "weapon_Grenade"},
|
||||
{"ammo_box", "ammo_m3"},
|
||||
{"weapon_cannon", "weapon_HC"},
|
||||
{"weapon_sniper", "weapon_Sniper"}
|
||||
|
||||
};
|
||||
|
||||
void CheckItem(edict_t* ent)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ITEM_SWITCH_COUNT; i++)
|
||||
{
|
||||
//If it's a null entry, bypass it
|
||||
if (!sp_item[i][0])
|
||||
continue;
|
||||
//Do the passed ent and our list match?
|
||||
if (strcmp(ent->classname, sp_item[i][0]) == 0)
|
||||
{
|
||||
//Yep. Replace the Q2 entity with our own.
|
||||
ent->classname = sp_item[i][1];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2166,6 +2166,7 @@ void Compass_Update(edict_t *ent, bool first);
|
|||
|
||||
// ACTION
|
||||
void DeadDropSpec(edict_t * ent);
|
||||
void CheckItem(edict_t* ent);
|
||||
#define ITEM_INDEX(x) ((x)-itemlist)
|
||||
#define INV_AMMO(ent, num) ((ent)->client->pers.inventory[num])
|
||||
#define GET_ITEM(num) (&itemlist[num])
|
||||
|
|
|
@ -443,6 +443,7 @@ char ml_creator[101];
|
|||
//AQ2:TNG END
|
||||
placedata_t locationbase[MAX_LOCATIONS_IN_BASE];
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
ED_CallSpawn
|
||||
|
@ -462,6 +463,9 @@ void ED_CallSpawn(edict_t *ent)
|
|||
return;
|
||||
}
|
||||
|
||||
// zucc - BD's item replacement idea
|
||||
CheckItem(ent);
|
||||
|
||||
// PGM - do this before calling the spawn function so it can be overridden.
|
||||
ent->gravityVector[0] = 0.0;
|
||||
ent->gravityVector[1] = 0.0;
|
||||
|
@ -1569,6 +1573,7 @@ void SP_worldspawn(edict_t *ent)
|
|||
|
||||
PrecacheItem(GetItemByIndex(IT_WEAPON_MK23));
|
||||
|
||||
|
||||
if (g_dm_random_items->integer)
|
||||
for (item_id_t i = static_cast<item_id_t>(IT_NULL + 1); i < IT_TOTAL; i = static_cast<item_id_t>(i + 1))
|
||||
PrecacheItem(GetItemByIndex(i));
|
||||
|
|
Loading…
Reference in a new issue