summaryrefslogtreecommitdiffstats
path: root/src/weapons/WeaponInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/weapons/WeaponInfo.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp
index 284a0c20..b40329c8 100644
--- a/src/weapons/WeaponInfo.cpp
+++ b/src/weapons/WeaponInfo.cpp
@@ -39,11 +39,7 @@ CWeaponInfo::Initialise(void)
ms_apWeaponInfos[i].m_eWeaponFire = WEAPON_FIRE_INSTANT_HIT;
ms_apWeaponInfos[i].m_AnimToPlay = ANIM_PUNCH_R;
ms_apWeaponInfos[i].m_Anim2ToPlay = NUM_ANIMS;
- ms_apWeaponInfos[i].m_bUseGravity = 1;
- ms_apWeaponInfos[i].m_bSlowsDown = 1;
- ms_apWeaponInfos[i].m_bRandSpeed = 1;
- ms_apWeaponInfos[i].m_bExpands = 1;
- ms_apWeaponInfos[i].m_bExplodes = 1;
+ ms_apWeaponInfos[i].m_Flags = WEAPONFLAG_USE_GRAVITY | WEAPONFLAG_SLOWS_DOWN | WEAPONFLAG_RAND_SPEED | WEAPONFLAG_EXPANDS | WEAPONFLAG_EXPLODES;
}
debug("Loading weapon data...\n");
LoadWeaponData();
@@ -80,10 +76,9 @@ CWeaponInfo::LoadWeaponData(void)
line[linelen] = '\0';
// skip white space
- for (lp = 0; line[lp] <= ' '; lp++);
+ for (lp = 0; line[lp] <= ' ' && line[lp] != '\0'; lp++);
- if (lp >= linelen || // FIX: game uses == here, but this is safer if we have empty lines
- line[lp] == '#')
+ if (line[lp] == '\0' || line[lp] == '#')
continue;
spread = 0.0f;
@@ -136,7 +131,7 @@ CWeaponInfo::LoadWeaponData(void)
animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, animToPlay);
animId = static_cast<AnimationId>(animAssoc->animId);
- if (strncmp(anim2ToPlay, "null", 4) != 0) {
+ if (strcmp(anim2ToPlay, "null") != 0) {
animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, anim2ToPlay);
ms_apWeaponInfos[weaponType].m_Anim2ToPlay = (AnimationId) animAssoc->animId;
}
@@ -160,17 +155,7 @@ CWeaponInfo::LoadWeaponData(void)
ms_apWeaponInfos[weaponType].m_fAnimFrameFire = delayBetweenAnimAndFire / 30.0f;
ms_apWeaponInfos[weaponType].m_fAnim2FrameFire = delayBetweenAnim2AndFire / 30.0f;
ms_apWeaponInfos[weaponType].m_nModelId = modelId;
- ms_apWeaponInfos[weaponType].m_bUseGravity = flags & 1;
- ms_apWeaponInfos[weaponType].m_bSlowsDown = (flags >> 1) & 1;
- ms_apWeaponInfos[weaponType].m_bDissipates = (flags >> 2) & 1;
- ms_apWeaponInfos[weaponType].m_bRandSpeed = (flags >> 3) & 1;
- ms_apWeaponInfos[weaponType].m_bExpands = (flags >> 4) & 1;
- ms_apWeaponInfos[weaponType].m_bExplodes = (flags >> 5) & 1;
- ms_apWeaponInfos[weaponType].m_bCanAim = (flags >> 6) & 1;
- ms_apWeaponInfos[weaponType].m_bCanAimWithArm = (flags >> 7) & 1;
- ms_apWeaponInfos[weaponType].m_b1stPerson = (flags >> 8) & 1;
- ms_apWeaponInfos[weaponType].m_bHeavy = (flags >> 9) & 1;
- ms_apWeaponInfos[weaponType].m_bThrow = (flags >> 10) & 1;
+ ms_apWeaponInfos[weaponType].m_Flags = flags;
}
}