lara: rename ammo properties

This renames Lara's ammo properties in TR1 to match TR2.
This commit is contained in:
lahm86 2025-04-08 19:44:50 +01:00
parent e7c193a106
commit ca56a3c68e
11 changed files with 63 additions and 58 deletions

View file

@ -59,10 +59,10 @@ typedef struct {
XYZ_16 torso_rot;
LARA_ARM left_arm;
LARA_ARM right_arm;
AMMO_INFO pistols;
AMMO_INFO magnums;
AMMO_INFO uzis;
AMMO_INFO shotgun;
AMMO_INFO pistol_ammo;
AMMO_INFO magnum_ammo;
AMMO_INFO uzi_ammo;
AMMO_INFO shotgun_ammo;
LOT_INFO lot;
struct {
int32_t item_num;

View file

@ -137,7 +137,7 @@ void Gun_Control(void)
switch (g_Lara.gun_type) {
case LGT_PISTOLS:
if (g_Lara.pistols.ammo && g_Input.action) {
if (g_Lara.pistol_ammo.ammo && g_Input.action) {
Lara_SwapSingleMesh(LM_HEAD, O_UZI_ANIM);
}
if (g_Camera.type != CAM_CINEMATIC && g_Camera.type != CAM_LOOK) {
@ -147,7 +147,7 @@ void Gun_Control(void)
break;
case LGT_MAGNUMS:
if (g_Lara.magnums.ammo && g_Input.action) {
if (g_Lara.magnum_ammo.ammo && g_Input.action) {
Lara_SwapSingleMesh(LM_HEAD, O_UZI_ANIM);
}
if (g_Camera.type != CAM_CINEMATIC && g_Camera.type != CAM_LOOK) {
@ -157,7 +157,7 @@ void Gun_Control(void)
break;
case LGT_UZIS:
if (g_Lara.uzis.ammo && g_Input.action) {
if (g_Lara.uzi_ammo.ammo && g_Input.action) {
Lara_SwapSingleMesh(LM_HEAD, O_UZI_ANIM);
}
if (g_Camera.type != CAM_CINEMATIC && g_Camera.type != CAM_LOOK) {
@ -167,7 +167,7 @@ void Gun_Control(void)
break;
case LGT_SHOTGUN:
if (g_Lara.shotgun.ammo && g_Input.action) {
if (g_Lara.shotgun_ammo.ammo && g_Input.action) {
Lara_SwapSingleMesh(LM_HEAD, O_UZI_ANIM);
}
if (g_Camera.type != CAM_CINEMATIC && g_Camera.type != CAM_LOOK) {

View file

@ -394,28 +394,28 @@ int32_t Gun_FireWeapon(
AMMO_INFO *ammo;
switch (weapon_type) {
case LGT_MAGNUMS:
ammo = &g_Lara.magnums;
ammo = &g_Lara.magnum_ammo;
if (Game_IsBonusFlagSet(GBF_NGPLUS)) {
ammo->ammo = 1000;
}
break;
case LGT_UZIS:
ammo = &g_Lara.uzis;
ammo = &g_Lara.uzi_ammo;
if (Game_IsBonusFlagSet(GBF_NGPLUS)) {
ammo->ammo = 1000;
}
break;
case LGT_SHOTGUN:
ammo = &g_Lara.shotgun;
ammo = &g_Lara.shotgun_ammo;
if (Game_IsBonusFlagSet(GBF_NGPLUS)) {
ammo->ammo = 1000;
}
break;
default:
ammo = &g_Lara.pistols;
ammo = &g_Lara.pistol_ammo;
ammo->ammo = 1000;
break;
}

View file

@ -54,9 +54,9 @@ bool Inv_AddItem(const GAME_OBJECT_ID obj_id)
case O_SHOTGUN_OPTION:
for (int32_t i = Inv_RequestItem(O_SG_AMMO_ITEM); i > 0; i--) {
Inv_RemoveItem(O_SG_AMMO_ITEM);
Inv_AddAmmo(&g_Lara.shotgun, SHOTGUN_AMMO_QTY);
Inv_AddAmmo(&g_Lara.shotgun_ammo, SHOTGUN_AMMO_QTY);
}
Inv_AddAmmo(&g_Lara.shotgun, SHOTGUN_AMMO_QTY);
Inv_AddAmmo(&g_Lara.shotgun_ammo, SHOTGUN_AMMO_QTY);
Inv_InsertItem(&g_InvRing_Item_Shotgun);
Item_GlobalReplace(O_SHOTGUN_ITEM, O_SG_AMMO_ITEM);
return false;
@ -65,9 +65,9 @@ bool Inv_AddItem(const GAME_OBJECT_ID obj_id)
case O_MAGNUM_OPTION:
for (int32_t i = Inv_RequestItem(O_MAG_AMMO_ITEM); i > 0; i--) {
Inv_RemoveItem(O_MAG_AMMO_ITEM);
Inv_AddAmmo(&g_Lara.magnums, MAGNUM_AMMO_QTY);
Inv_AddAmmo(&g_Lara.magnum_ammo, MAGNUM_AMMO_QTY);
}
Inv_AddAmmo(&g_Lara.magnums, MAGNUM_AMMO_QTY);
Inv_AddAmmo(&g_Lara.magnum_ammo, MAGNUM_AMMO_QTY);
Inv_InsertItem(&g_InvRing_Item_Magnum);
Item_GlobalReplace(O_MAGNUM_ITEM, O_MAG_AMMO_ITEM);
return false;
@ -76,9 +76,9 @@ bool Inv_AddItem(const GAME_OBJECT_ID obj_id)
case O_UZI_OPTION:
for (int32_t i = Inv_RequestItem(O_UZI_AMMO_ITEM); i > 0; i--) {
Inv_RemoveItem(O_UZI_AMMO_ITEM);
Inv_AddAmmo(&g_Lara.uzis, UZI_AMMO_QTY);
Inv_AddAmmo(&g_Lara.uzi_ammo, UZI_AMMO_QTY);
}
Inv_AddAmmo(&g_Lara.uzis, UZI_AMMO_QTY);
Inv_AddAmmo(&g_Lara.uzi_ammo, UZI_AMMO_QTY);
Inv_InsertItem(&g_InvRing_Item_Uzi);
Item_GlobalReplace(O_UZI_ITEM, O_UZI_AMMO_ITEM);
return false;
@ -86,7 +86,7 @@ bool Inv_AddItem(const GAME_OBJECT_ID obj_id)
case O_SG_AMMO_ITEM:
case O_SG_AMMO_OPTION:
if (Inv_RequestItem(O_SHOTGUN_ITEM)) {
Inv_AddAmmo(&g_Lara.shotgun, SHOTGUN_AMMO_QTY);
Inv_AddAmmo(&g_Lara.shotgun_ammo, SHOTGUN_AMMO_QTY);
} else {
Inv_InsertItem(&g_InvRing_Item_ShotgunAmmo);
}
@ -95,7 +95,7 @@ bool Inv_AddItem(const GAME_OBJECT_ID obj_id)
case O_MAG_AMMO_ITEM:
case O_MAG_AMMO_OPTION:
if (Inv_RequestItem(O_MAGNUM_ITEM)) {
Inv_AddAmmo(&g_Lara.magnums, MAGNUM_AMMO_QTY);
Inv_AddAmmo(&g_Lara.magnum_ammo, MAGNUM_AMMO_QTY);
} else {
Inv_InsertItem(&g_InvRing_Item_MagnumAmmo);
}
@ -104,7 +104,7 @@ bool Inv_AddItem(const GAME_OBJECT_ID obj_id)
case O_UZI_AMMO_ITEM:
case O_UZI_AMMO_OPTION:
if (Inv_RequestItem(O_UZI_ITEM)) {
Inv_AddAmmo(&g_Lara.uzis, UZI_AMMO_QTY);
Inv_AddAmmo(&g_Lara.uzi_ammo, UZI_AMMO_QTY);
} else {
Inv_InsertItem(&g_InvRing_Item_UziAmmo);
}

View file

@ -122,15 +122,16 @@ static void M_RingNotActive(const INVENTORY_ITEM *const inv_item)
switch (inv_item->object_id) {
case O_SHOTGUN_OPTION:
M_ShowAmmoQuantity("%5d A", g_Lara.shotgun.ammo / SHOTGUN_AMMO_CLIP);
M_ShowAmmoQuantity(
"%5d A", g_Lara.shotgun_ammo.ammo / SHOTGUN_AMMO_CLIP);
break;
case O_MAGNUM_OPTION:
M_ShowAmmoQuantity("%5d B", g_Lara.magnums.ammo);
M_ShowAmmoQuantity("%5d B", g_Lara.magnum_ammo.ammo);
break;
case O_UZI_OPTION:
M_ShowAmmoQuantity("%5d C", g_Lara.uzis.ammo);
M_ShowAmmoQuantity("%5d C", g_Lara.uzi_ammo.ammo);
break;
case O_SG_AMMO_OPTION:

View file

@ -107,9 +107,9 @@ void Lara_Cheat_Control(void)
Inv_AddItem(O_SHOTGUN_ITEM);
Inv_AddItem(O_MAGNUM_ITEM);
Inv_AddItem(O_UZI_ITEM);
g_Lara.shotgun.ammo = 500;
g_Lara.magnums.ammo = 500;
g_Lara.uzis.ammo = 5000;
g_Lara.shotgun_ammo.ammo = 500;
g_Lara.magnum_ammo.ammo = 500;
g_Lara.uzi_ammo.ammo = 5000;
Sound_Effect(SFX_LARA_HOLSTER, nullptr, SPM_ALWAYS);
} else if (as == LS_SWAN_DIVE) {
Item_Explode(g_Lara.item_num, -1, 1);
@ -241,9 +241,9 @@ bool Lara_Cheat_GiveAllGuns(void)
Inv_AddItem(O_MAGNUM_ITEM);
Inv_AddItem(O_UZI_ITEM);
Inv_AddItem(O_SHOTGUN_ITEM);
g_Lara.shotgun.ammo = Game_IsBonusFlagSet(GBF_NGPLUS) ? 10001 : 300;
g_Lara.magnums.ammo = Game_IsBonusFlagSet(GBF_NGPLUS) ? 10001 : 1000;
g_Lara.uzis.ammo = Game_IsBonusFlagSet(GBF_NGPLUS) ? 10001 : 2000;
g_Lara.shotgun_ammo.ammo = Game_IsBonusFlagSet(GBF_NGPLUS) ? 10001 : 300;
g_Lara.magnum_ammo.ammo = Game_IsBonusFlagSet(GBF_NGPLUS) ? 10001 : 1000;
g_Lara.uzi_ammo.ammo = Game_IsBonusFlagSet(GBF_NGPLUS) ? 10001 : 2000;
Sound_Effect(SFX_LARA_RELOAD, nullptr, SPM_ALWAYS);
Console_Log(GS(OSD_GIVE_ITEM_ALL_GUNS));
@ -261,17 +261,17 @@ bool Lara_Cheat_GiveAllItems(void)
if (!Inv_RequestItem(O_SHOTGUN_ITEM)) {
Inv_AddItem(O_SHOTGUN_ITEM);
}
g_Lara.shotgun.ammo = Game_IsBonusFlagSet(GBF_NGPLUS) ? 10001 : 300;
g_Lara.shotgun_ammo.ammo = Game_IsBonusFlagSet(GBF_NGPLUS) ? 10001 : 300;
if (!Inv_RequestItem(O_MAGNUM_ITEM)) {
Inv_AddItem(O_MAGNUM_ITEM);
}
g_Lara.magnums.ammo = Game_IsBonusFlagSet(GBF_NGPLUS) ? 10001 : 1000;
g_Lara.magnum_ammo.ammo = Game_IsBonusFlagSet(GBF_NGPLUS) ? 10001 : 1000;
if (!Inv_RequestItem(O_UZI_ITEM)) {
Inv_AddItem(O_UZI_ITEM);
}
g_Lara.uzis.ammo = Game_IsBonusFlagSet(GBF_NGPLUS) ? 10001 : 2000;
g_Lara.uzi_ammo.ammo = Game_IsBonusFlagSet(GBF_NGPLUS) ? 10001 : 2000;
for (int i = 0; i < 10; i++) {
if (Inv_RequestItem(O_MEDI_ITEM) < 240) {

View file

@ -541,7 +541,7 @@ void Lara_InitialiseInventory(const GF_LEVEL *const level)
RESUME_INFO *const resume = Savegame_GetCurrentInfo(level);
g_Lara.pistols.ammo = 1000;
g_Lara.pistol_ammo.ammo = 1000;
if (resume != nullptr) {
if (g_GameInfo.remove_guns) {
@ -576,38 +576,38 @@ void Lara_InitialiseInventory(const GF_LEVEL *const level)
if (resume->flags.has_magnums) {
Inv_AddItem(O_MAGNUM_ITEM);
g_Lara.magnums.ammo = resume->magnum_ammo;
g_Lara.magnum_ammo.ammo = resume->magnum_ammo;
Item_GlobalReplace(O_MAGNUM_ITEM, O_MAG_AMMO_ITEM);
} else {
int32_t ammo = resume->magnum_ammo / MAGNUM_AMMO_QTY;
for (int i = 0; i < ammo; i++) {
Inv_AddItem(O_MAG_AMMO_ITEM);
}
g_Lara.magnums.ammo = 0;
g_Lara.magnum_ammo.ammo = 0;
}
if (resume->flags.has_uzis) {
Inv_AddItem(O_UZI_ITEM);
g_Lara.uzis.ammo = resume->uzi_ammo;
g_Lara.uzi_ammo.ammo = resume->uzi_ammo;
Item_GlobalReplace(O_UZI_ITEM, O_UZI_AMMO_ITEM);
} else {
int32_t ammo = resume->uzi_ammo / UZI_AMMO_QTY;
for (int i = 0; i < ammo; i++) {
Inv_AddItem(O_UZI_AMMO_ITEM);
}
g_Lara.uzis.ammo = 0;
g_Lara.uzi_ammo.ammo = 0;
}
if (resume->flags.has_shotgun) {
Inv_AddItem(O_SHOTGUN_ITEM);
g_Lara.shotgun.ammo = resume->shotgun_ammo;
g_Lara.shotgun_ammo.ammo = resume->shotgun_ammo;
Item_GlobalReplace(O_SHOTGUN_ITEM, O_SG_AMMO_ITEM);
} else {
int32_t ammo = resume->shotgun_ammo / SHOTGUN_AMMO_QTY;
for (int i = 0; i < ammo; i++) {
Inv_AddItem(O_SG_AMMO_ITEM);
}
g_Lara.shotgun.ammo = 0;
g_Lara.shotgun_ammo.ammo = 0;
}
for (int i = 0; i < resume->num_scions; i++) {

View file

@ -630,13 +630,14 @@ static void M_DrawAmmoInfo(void)
case LGT_PISTOLS:
return;
case LGT_SHOTGUN:
sprintf(ammo_string, "%6d A", g_Lara.shotgun.ammo / SHOTGUN_AMMO_CLIP);
sprintf(
ammo_string, "%6d A", g_Lara.shotgun_ammo.ammo / SHOTGUN_AMMO_CLIP);
break;
case LGT_UZIS:
sprintf(ammo_string, "%6d C", g_Lara.uzis.ammo);
sprintf(ammo_string, "%6d C", g_Lara.uzi_ammo.ammo);
break;
case LGT_MAGNUMS:
sprintf(ammo_string, "%6d B", g_Lara.magnums.ammo);
sprintf(ammo_string, "%6d B", g_Lara.magnum_ammo.ammo);
break;
default:
return;

View file

@ -420,7 +420,7 @@ void Savegame_PersistGameToCurrentInfo(const GF_LEVEL *const level)
}
if (Inv_RequestItem(O_MAGNUM_ITEM)) {
current->magnum_ammo = g_Lara.magnums.ammo;
current->magnum_ammo = g_Lara.magnum_ammo.ammo;
current->flags.has_magnums = 1;
} else {
current->magnum_ammo =
@ -429,7 +429,7 @@ void Savegame_PersistGameToCurrentInfo(const GF_LEVEL *const level)
}
if (Inv_RequestItem(O_UZI_ITEM)) {
current->uzi_ammo = g_Lara.uzis.ammo;
current->uzi_ammo = g_Lara.uzi_ammo.ammo;
current->flags.has_uzis = 1;
} else {
current->uzi_ammo = Inv_RequestItem(O_UZI_AMMO_ITEM) * UZI_AMMO_QTY;
@ -437,7 +437,7 @@ void Savegame_PersistGameToCurrentInfo(const GF_LEVEL *const level)
}
if (Inv_RequestItem(O_SHOTGUN_ITEM)) {
current->shotgun_ammo = g_Lara.shotgun.ammo;
current->shotgun_ammo = g_Lara.shotgun_ammo.ammo;
current->flags.has_shotgun = 1;
} else {
current->shotgun_ammo =

View file

@ -872,21 +872,21 @@ static bool M_LoadLara(
}
if (!M_LoadAmmo(
JSON_ObjectGetObject(lara_obj, "pistols"), &lara->pistols)) {
JSON_ObjectGetObject(lara_obj, "pistols"), &lara->pistol_ammo)) {
return false;
}
if (!M_LoadAmmo(
JSON_ObjectGetObject(lara_obj, "magnums"), &lara->magnums)) {
JSON_ObjectGetObject(lara_obj, "magnums"), &lara->magnum_ammo)) {
return false;
}
if (!M_LoadAmmo(JSON_ObjectGetObject(lara_obj, "uzis"), &lara->uzis)) {
if (!M_LoadAmmo(JSON_ObjectGetObject(lara_obj, "uzis"), &lara->uzi_ammo)) {
return false;
}
if (!M_LoadAmmo(
JSON_ObjectGetObject(lara_obj, "shotgun"), &lara->shotgun)) {
JSON_ObjectGetObject(lara_obj, "shotgun"), &lara->shotgun_ammo)) {
return false;
}
@ -1300,10 +1300,13 @@ static JSON_OBJECT *M_DumpLara(LARA_INFO *lara)
JSON_ObjectAppendObject(lara_obj, "left_arm", M_DumpArm(&lara->left_arm));
JSON_ObjectAppendObject(lara_obj, "right_arm", M_DumpArm(&lara->right_arm));
JSON_ObjectAppendObject(lara_obj, "pistols", M_DumpAmmo(&lara->pistols));
JSON_ObjectAppendObject(lara_obj, "magnums", M_DumpAmmo(&lara->magnums));
JSON_ObjectAppendObject(lara_obj, "uzis", M_DumpAmmo(&lara->uzis));
JSON_ObjectAppendObject(lara_obj, "shotgun", M_DumpAmmo(&lara->shotgun));
JSON_ObjectAppendObject(
lara_obj, "pistols", M_DumpAmmo(&lara->pistol_ammo));
JSON_ObjectAppendObject(
lara_obj, "magnums", M_DumpAmmo(&lara->magnum_ammo));
JSON_ObjectAppendObject(lara_obj, "uzis", M_DumpAmmo(&lara->uzi_ammo));
JSON_ObjectAppendObject(
lara_obj, "shotgun", M_DumpAmmo(&lara->shotgun_ammo));
JSON_ObjectAppendObject(lara_obj, "lot", M_DumpLOT(&lara->lot));
JSON_ObjectAppendInt(

View file

@ -275,10 +275,10 @@ static void M_ReadLara(LARA_INFO *const lara)
M_ReadArm(&lara->left_arm);
M_ReadArm(&lara->right_arm);
M_ReadAmmoInfo(&lara->pistols);
M_ReadAmmoInfo(&lara->magnums);
M_ReadAmmoInfo(&lara->uzis);
M_ReadAmmoInfo(&lara->shotgun);
M_ReadAmmoInfo(&lara->pistol_ammo);
M_ReadAmmoInfo(&lara->magnum_ammo);
M_ReadAmmoInfo(&lara->uzi_ammo);
M_ReadAmmoInfo(&lara->shotgun_ammo);
M_ReadLOT(&lara->lot);
}