From 0e6b536d01aae4fed1ab56c3f67574fb538d94c9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 16 Oct 2023 17:52:03 +0200 Subject: [PATCH] mostly bool fixes. --- source/games/blood/src/aicdud.cpp | 16 ++-- source/games/blood/src/nnextcdud.cpp | 130 +++++++++++++-------------- source/games/blood/src/nnextcdud.h | 88 +++++++++--------- source/games/blood/src/nnexts.cpp | 10 +-- source/games/blood/src/nnextsif.cpp | 4 +- 5 files changed, 126 insertions(+), 122 deletions(-) diff --git a/source/games/blood/src/aicdud.cpp b/source/games/blood/src/aicdud.cpp index f710b6290..8ab34e56b 100644 --- a/source/games/blood/src/aicdud.cpp +++ b/source/games/blood/src/aicdud.cpp @@ -51,7 +51,7 @@ struct TARGET_INFO void resetTarget(DBloodActor* pSpr) { pSpr->xspr.target = nullptr; } void moveStop(DBloodActor* pSpr) { pSpr->vel.XY().Zero(); } -static char THINK_CLOCK(int nSpr, int nClock = 3) { return ((gFrameCount & nClock) == (nSpr & nClock)); } +static bool THINK_CLOCK(int nSpr, int nClock = 3) { return ((gFrameCount & nClock) == (nSpr & nClock)); } static int qsSortTargets(TARGET_INFO* ref1, TARGET_INFO* ref2) { return ref1->nDist > ref2->nDist? 1 : ref1->nDist < ref2->nDist? -1 : 0; } DAngle getTargetAng(DBloodActor* pSpr); @@ -605,10 +605,13 @@ void weaponShot(DBloodActor* pSpr) int dx3, dy3, dz3; int i, j; - int txof; char hxof; - int sang; int hsht; - int tang; char styled; - + int txof; + int sang; + int tang; + bool hxof; + int hsht; + bool styled; + const int dx1 = int(pSpr->spr.Angles.Yaw.Cos() * 16384); const int dy1 = int(pSpr->spr.Angles.Yaw.Sin() * 16384); @@ -1244,7 +1247,8 @@ void enterMorph(DBloodActor* pSpr) void thinkMorph(DBloodActor* pSpr) { - int nTarget; char triggerOn, triggerOff; + int nTarget; + bool triggerOn, triggerOff; CUSTOMDUDE* pDude = cdudeGet(pSpr); if (pDude->SeqPlaying()) diff --git a/source/games/blood/src/nnextcdud.cpp b/source/games/blood/src/nnextcdud.cpp index 8c6aa48b2..e594b3589 100644 --- a/source/games/blood/src/nnextcdud.cpp +++ b/source/games/blood/src/nnextcdud.cpp @@ -43,7 +43,7 @@ BEGIN_BLD_NS #define kParamMax 255 struct SEQCOMPAT { - unsigned char offset[3]; + uint8_t offset[3]; int8_t nAiStateType; }; @@ -394,27 +394,27 @@ VMNativeFunction** const gCdudeCustomCallback[] = &AF(fxPodBloodSpray), // 10 }; -static char CheckProximity(DBloodActor* pSpr1, DBloodActor* pSpr2, int nDist) = delete; // make this error out for refactoring +static bool CheckProximity(DBloodActor* pSpr1, DBloodActor* pSpr2, int nDist) = delete; // make this error out for refactoring -static char CheckProximity(DBloodActor* pSpr1, DBloodActor* pSpr2, double nDist) +static bool CheckProximity(DBloodActor* pSpr1, DBloodActor* pSpr2, double nDist) { return CheckProximityPoint(pSpr1->spr.pos.X, pSpr1->spr.pos.Y, pSpr1->spr.pos.Z, pSpr2->spr.pos.X, pSpr2->spr.pos.Y, pSpr2->spr.pos.Z, nDist); } -static char CanSee(DBloodActor* pSpr1, DBloodActor* pSpr2) +static bool CanSee(DBloodActor* pSpr1, DBloodActor* pSpr2) { return cansee(pSpr1->spr.pos, pSpr1->sector(), pSpr2->spr.pos, pSpr2->sector()); } static void GetExtents(DBloodActor* pSprite, double* top, double* bottom, FTextureID nPic); static int AreaOfSector(sectortype* pSector); -static char isIdKeyword(const char* fullStr, const char* prefix, int* nID = NULL); -static char isNone(const char* str) { return (stricmp(str, gValTypes[kValNone]) == 0); } +static bool isIdKeyword(const char* fullStr, const char* prefix, int* nID = NULL); +static bool isNone(const char* str) { return (stricmp(str, gValTypes[kValNone]) == 0); } static int qsSortWeapons(CUSTOMDUDE_WEAPON* ref1, CUSTOMDUDE_WEAPON* ref2) { return ref1->pickChance - ref2->pickChance; } static bool helperSeqExists(int nSeq); static bool helperSndExists(int nSnd); static int helperGetFirstPic(CUSTOMDUDE* pDude); -static char helperSeqTriggerExists(int nSeq); +static bool helperSeqTriggerExists(int nSeq); static Seq* helperSeqLoad(int nSeq); static Seq* helperSeqLock(int nSeq); @@ -424,9 +424,9 @@ CUSTOMDUDE* CUSTOMDUDE_SETUP::pDude; IniFile* CUSTOMDUDE_SETUP::pIni; DICTNODE* CUSTOMDUDE_SETUP::hIni; -char CUSTOMDUDE_SETUP::key[256]; -char CUSTOMDUDE_SETUP::val[256]; -char CUSTOMDUDE_SETUP::showWarnings; +bool CUSTOMDUDE_SETUP::key[256]; +bool CUSTOMDUDE_SETUP::val[256]; +bool CUSTOMDUDE_SETUP::showWarnings; PARAM* CUSTOMDUDE_SETUP::pGroup; PARAM* CUSTOMDUDE_SETUP::pParam; const char* CUSTOMDUDE_SETUP::pValue; @@ -444,7 +444,7 @@ bool CUSTOMDUDE::IsMediumMatch(int nMedium) if (!nMedium) return true; - char uwater = IsUnderwater(); + bool uwater = IsUnderwater(); return (((nMedium & 0x01) && !uwater) || ((nMedium & 0x02) && uwater)); } @@ -697,7 +697,7 @@ void CUSTOMDUDE::ProcessEffects(void) } } -char CUSTOMDUDE::NewState(AISTATE* pState) +bool CUSTOMDUDE::NewState(AISTATE* pState) { if (!IsMorphing()) { @@ -1057,7 +1057,7 @@ void CUSTOMDUDE::Kill(DBloodActor* pFrom, int nDmgType, int nDmg) if (pOpt->nGameType != kGameTypeSinglePlayer) { - PLAYER* pPlayer; + DBloodPlayer* pPlayer; for (i = connecthead; i >= 0; i = connectpoint2[i]) { pPlayer = &gPlayer[i]; @@ -1195,7 +1195,7 @@ void CUSTOMDUDE::LeechPickup(void) } } -void CUSTOMDUDE::LeechKill(char delSpr) +void CUSTOMDUDE::LeechKill(bool delSpr) { if (pXLeech) { @@ -1288,7 +1288,7 @@ void CUSTOMDUDE::UpdateSlaves() } } -char CUSTOMDUDE::CanMove(XSECTOR* pXSect, char Crusher, char Water, char Uwater, char Depth, int bottom, int floorZ) +bool CUSTOMDUDE::CanMove(XSECTOR* pXSect, bool Crusher, bool Water, bool Uwater, bool Depth, int bottom, int floorZ) { UNREFERENCED_PARAMETER(Depth); @@ -1361,20 +1361,20 @@ const char* CUSTOMDUDE_SETUP::DescriptGetValue(const char* pGroupName, const cha return pRetn; } -char CUSTOMDUDE_SETUP::DescriptGroupExist(const char* pGroupName) +bool CUSTOMDUDE_SETUP::DescriptGroupExist(const char* pGroupName) { return pIni->SectionExists(pGroupName); } -char CUSTOMDUDE_SETUP::DescriptParamExist(const char* pGroupName, const char* pParamName) +bool CUSTOMDUDE_SETUP::DescriptParamExist(const char* pGroupName, const char* pParamName) { return pIni->KeyExists(pGroupName, pParamName); } -char CUSTOMDUDE_SETUP::DescriptLoad(int nID) +bool CUSTOMDUDE_SETUP::DescriptLoad(int nID) { - char tmp[BMAX_PATH]; unsigned char* pRawIni = NULL; + char tmp[BMAX_PATH]; uint8_t* pRawIni = NULL; const char* fname = kCdudeFileNamePrefix; const char* fext = kCdudeFileExt; @@ -1384,10 +1384,10 @@ char CUSTOMDUDE_SETUP::DescriptLoad(int nID) if ((hIni = nnExtResFileSearch(&gSysRes, tmp, fext)) == NULL) // name not found hIni = gSysRes.Lookup(nID, fext); // try by ID - if (hIni && (pRawIni = (unsigned char*)gSysRes.Load(hIni)) != NULL) + if (hIni && (pRawIni = (uint8_t*)gSysRes.Load(hIni)) != NULL) { int nBytes = hIni->size; - unsigned char* pRawNew = (unsigned char*)Bmalloc(nBytes + 1); + uint8_t* pRawNew = (uint8_t*)Bmalloc(nBytes + 1); dassert(pRawNew != NULL); int i, j, c, nLineLen = 0; @@ -1396,7 +1396,7 @@ char CUSTOMDUDE_SETUP::DescriptLoad(int nID) // Sets NULL byte in the end // Skips empty lines - Bmemset(pRawNew, 0, nBytes + 1); + memset(pRawNew, 0, nBytes + 1); for (i = 0, j = 0; i < nBytes; i++) { c = pRawIni[i]; @@ -1422,7 +1422,7 @@ char CUSTOMDUDE_SETUP::DescriptLoad(int nID) } } - pIni = new IniFile((unsigned char*)pRawNew); + pIni = new IniFile((uint8_t*)pRawNew); Bfree(pRawNew); return true; } @@ -1529,7 +1529,7 @@ CUSTOMDUDE* CUSTOMDUDE_SETUP::GetFirstDude(int nID) return NULL; } -char CUSTOMDUDE_SETUP::IsFirst(CUSTOMDUDE* pCmp) +bool CUSTOMDUDE_SETUP::IsFirst(CUSTOMDUDE* pCmp) { return (GetFirstDude(pCmp->pSpr->xspr.data1) == pCmp); } @@ -1574,7 +1574,7 @@ void CUSTOMDUDE_SETUP::RandomizeDudeSettings() } } -char CUSTOMDUDE_SETUP::FindAiState(AISTATE stateArr[][kCdudePostureMax], int arrLen, AISTATE* pNeedle, int* nType, int* nPosture) +bool CUSTOMDUDE_SETUP::FindAiState(AISTATE stateArr[][kCdudePostureMax], int arrLen, AISTATE* pNeedle, int* nType, int* nPosture) { int i, j; for (i = 0; i < arrLen; i++) @@ -1606,7 +1606,7 @@ void CUSTOMDUDE_SETUP::Setup(DBloodActor* pSpr, XSPRITE* pXSpr) if (pDude->pSlaves) delete(pDude->pSlaves); - Bmemset(pDude, 0, sizeof(CUSTOMDUDE)); + memset(pDude, 0, sizeof(CUSTOMDUDE)); pDude->pInfo = getDudeInfo(pSpr->type); pDude->pSpr = pSpr; pDude->pXSpr = pXSpr; pDude->pExtra = &gDudeExtra[pSpr->extra]; @@ -2115,7 +2115,7 @@ int CUSTOMDUDEV2_SETUP::CheckRange(const char* str, int nVal, int nMin, int nMax int CUSTOMDUDEV2_SETUP::CheckValue(const char* str, int nValType, int nDefault) { int t = 0; - char ok = false; + bool ok = false; if (rngok(nValType, kValIdKeywordBase, kValIdKeywordMax)) { @@ -2319,7 +2319,7 @@ void CUSTOMDUDEV2_SETUP::SetupVelocity(void) } } -void CUSTOMDUDEV2_SETUP::SetupAnimation(AISTATE* pState, char asPosture) +void CUSTOMDUDEV2_SETUP::SetupAnimation(AISTATE* pState, bool asPosture) { AnimationFill(pState, 0); // clear seqID first ParseAnimation(pValue, pState, asPosture); @@ -2467,7 +2467,7 @@ void CUSTOMDUDEV2_SETUP::SetupRecoil(void) /* ----------------------------------*/ /* DEFAULT VALUES */ /* ----------------------------------*/ - Bmemset(pRecoil, 0, sizeof(CUSTOMDUDE_RECOIL)); + memset(pRecoil, 0, sizeof(CUSTOMDUDE_RECOIL)); if (!DescriptGroupExist(pGroup->text)) return; @@ -2504,7 +2504,7 @@ void CUSTOMDUDEV2_SETUP::SetupDodge(void) /* ----------------------------------*/ /* DEFAULT VALUES */ /* ----------------------------------*/ - Bmemset(pDodge, 0, sizeof(CUSTOMDUDE_DODGE)); + memset(pDodge, 0, sizeof(CUSTOMDUDE_DODGE)); pDodge->onAimMiss.chance = 0x10000; if (!DescriptGroupExist(pGroup->text)) @@ -2546,7 +2546,7 @@ void CUSTOMDUDEV2_SETUP::SetupKnockout(void) /* ----------------------------------*/ /* DEFAULT VALUES */ /* ----------------------------------*/ - Bmemset(pKnock, 0, sizeof(CUSTOMDUDE_KNOCKOUT)); + memset(pKnock, 0, sizeof(CUSTOMDUDE_KNOCKOUT)); for (i = 0; i < kCdudePostureMax; i++) { pState = &pDude->states[kCdudeStateKnock][i]; @@ -2753,10 +2753,10 @@ int CUSTOMDUDEV2_SETUP::ParseStatesToList(const char* str, IDLIST* pOut) return pOut->Length(); } -char CUSTOMDUDEV2_SETUP::ParseGibSetup(const char* str, CUSTOMDUDE_GIB* pGib) +bool CUSTOMDUDEV2_SETUP::ParseGibSetup(const char* str, CUSTOMDUDE_GIB* pGib) { int i = 0, nPar, data[3]; - Bmemset(data, 0, sizeof(data)); + memset(data, 0, sizeof(data)); pGib->Clear(); if (!isempty(str)) @@ -2919,10 +2919,10 @@ void CUSTOMDUDEV2_SETUP::SetupMovePattern(void) } -char CUSTOMDUDEV2_SETUP::ParseWeaponBasicInfo(const char* str, CUSTOMDUDE_WEAPON* pWeap) +bool CUSTOMDUDEV2_SETUP::ParseWeaponBasicInfo(const char* str, CUSTOMDUDE_WEAPON* pWeap) { int i, nMin, nMax, nID; - char isNum = isufix(str); + bool isNum = isufix(str); WEAPINFO* pInfo; if (isempty(str)) @@ -2973,7 +2973,7 @@ char CUSTOMDUDEV2_SETUP::ParseWeaponBasicInfo(const char* str, CUSTOMDUDE_WEAPON return false; } -char CUSTOMDUDEV2_SETUP::ParseSkill(const char* str) +bool CUSTOMDUDEV2_SETUP::ParseSkill(const char* str) { int range[2] = {1, 5}; int nSkill = gGameOptions.nDifficulty + 1; @@ -2992,11 +2992,11 @@ char CUSTOMDUDEV2_SETUP::ParseSkill(const char* str) return true; } -char CUSTOMDUDEV2_SETUP::ParseDropItem(const char* str, unsigned char out[2]) +bool CUSTOMDUDEV2_SETUP::ParseDropItem(const char* str, uint8_t out[2]) { int nPar, nVal, i = 0; - unsigned char nItem = 0; - unsigned char nPerc = 100; + uint8_t nItem = 0; + uint8_t nPerc = 100; out[0] = out[1] = 0; @@ -3302,7 +3302,7 @@ void CUSTOMDUDEV2_SETUP::SetupWeapons(void) -char CUSTOMDUDEV2_SETUP::ParseVelocity(const char* str, CUSTOMDUDE_VELOCITY* pVelocity) +bool CUSTOMDUDEV2_SETUP::ParseVelocity(const char* str, CUSTOMDUDE_VELOCITY* pVelocity) { int nMod = pDude->pSpr->xspr.busyTime; int i, nPar, nVal; @@ -3359,7 +3359,7 @@ char CUSTOMDUDEV2_SETUP::ParseVelocity(const char* str, CUSTOMDUDE_VELOCITY* pVe return false; } -char CUSTOMDUDEV2_SETUP::ParseAppearance(const char* str, APPEARANCE* pAppear) +bool CUSTOMDUDEV2_SETUP::ParseAppearance(const char* str, APPEARANCE* pAppear) { int i = 0, nPar, range[2]; pAppear->Clear(); @@ -3440,7 +3440,7 @@ char CUSTOMDUDEV2_SETUP::ParseAppearance(const char* str, APPEARANCE* pAppear) return false; } -char CUSTOMDUDEV2_SETUP::ParseSound(const char* str, CUSTOMDUDE_SOUND* pSound) +bool CUSTOMDUDEV2_SETUP::ParseSound(const char* str, CUSTOMDUDE_SOUND* pSound) { int i = 0, j, nMedium = pSound->medium, nVolume = pSound->volume; int t = kCdudeMaxSounds, nVal, nLen; @@ -3515,7 +3515,7 @@ char CUSTOMDUDEV2_SETUP::ParseSound(const char* str, CUSTOMDUDE_SOUND* pSound) return false; } -char CUSTOMDUDEV2_SETUP::ParseAnimation(const char* str, AISTATE* pState, char asPosture) +bool CUSTOMDUDEV2_SETUP::ParseAnimation(const char* str, AISTATE* pState, bool asPosture) { int i, j, nPar, nLen; int nVal; @@ -3564,12 +3564,12 @@ char CUSTOMDUDEV2_SETUP::ParseAnimation(const char* str, AISTATE* pState, char a return false; } -char CUSTOMDUDEV2_SETUP::ParseRange(const char* str, int nValType, int out[2], int nBaseVal) +bool CUSTOMDUDEV2_SETUP::ParseRange(const char* str, int nValType, int out[2], int nBaseVal) { int nLen, nVal; int nMin = out[0]; int nMax = out[1]; - char chkrng = (nMin && nMax); + bool chkrng = (nMin && nMax); char tmp[256]; int i = 0; @@ -3637,10 +3637,10 @@ int CUSTOMDUDEV2_SETUP::CheckArray(const char* str, int nMin, int nMax, int nDef return nDefault; } -char CUSTOMDUDEV2_SETUP::ParseOffsets(const char* str, POINT3D* pOut) +bool CUSTOMDUDEV2_SETUP::ParseOffsets(const char* str, POINT3D* pOut) { int i, nVal, nLen; char tmp[256]; - Bmemset(pOut, 0, sizeof(POINT3D)); + memset(pOut, 0, sizeof(POINT3D)); nLen = CheckArray(str, 3, 0, 0); i = 0; @@ -3660,7 +3660,7 @@ char CUSTOMDUDEV2_SETUP::ParseOffsets(const char* str, POINT3D* pOut) return i; } -char CUSTOMDUDEV2_SETUP::ParseShotSetup(const char* str, CUSTOMDUDE_WEAPON* pWeap) +bool CUSTOMDUDEV2_SETUP::ParseShotSetup(const char* str, CUSTOMDUDE_WEAPON* pWeap) { int i, nPar, nVal; if (isarray(str)) @@ -3706,9 +3706,9 @@ char CUSTOMDUDEV2_SETUP::ParseShotSetup(const char* str, CUSTOMDUDE_WEAPON* pWea return false; } -char CUSTOMDUDEV2_SETUP::ParseWeaponStyle(const char* str, CUSTOMDUDE_WEAPON* pWeap) +bool CUSTOMDUDEV2_SETUP::ParseWeaponStyle(const char* str, CUSTOMDUDE_WEAPON* pWeap) { - Bmemset(&pWeap->style, 0, sizeof(pWeap->style)); + memset(&pWeap->style, 0, sizeof(pWeap->style)); int nPar, i = 0; i = 0; @@ -3730,7 +3730,7 @@ char CUSTOMDUDEV2_SETUP::ParseWeaponStyle(const char* str, CUSTOMDUDE_WEAPON* pW return true; } -char CUSTOMDUDEV2_SETUP::ParseAttackSetup(const char* str, CUSTOMDUDE_WEAPON* pWeap) +bool CUSTOMDUDEV2_SETUP::ParseAttackSetup(const char* str, CUSTOMDUDE_WEAPON* pWeap) { int i = 0, j, nPar, nVal; while ((i = enumStr(i, str, key, val)) != 0) @@ -3770,9 +3770,9 @@ char CUSTOMDUDEV2_SETUP::ParseAttackSetup(const char* str, CUSTOMDUDE_WEAPON* pW } -char CUSTOMDUDEV2_SETUP::ParsePosture(const char* str) +bool CUSTOMDUDEV2_SETUP::ParsePosture(const char* str) { - char nRetn = 0; + bool nRetn = 0; int i, nVal; i = 0; @@ -3790,7 +3790,7 @@ char CUSTOMDUDEV2_SETUP::ParsePosture(const char* str) return nRetn; } -char CUSTOMDUDEV2_SETUP::ParseOnEventDmg(const char* str, int* pOut, int nLen) +bool CUSTOMDUDEV2_SETUP::ParseOnEventDmg(const char* str, int* pOut, int nLen) { int i; if (isarray(str)) @@ -3975,7 +3975,7 @@ void CUSTOMDUDEV1_SETUP::DamageScaleToSurface(int nSurface) void CUSTOMDUDEV1_SETUP::WeaponMeleeSet(CUSTOMDUDE_WEAPON* pWeapon) { - char availStatus = pWeapon->available; + bool availStatus = pWeapon->available; pWeapon->Clear(); pWeapon->type = kCdudeWeaponHitscan; @@ -4005,7 +4005,7 @@ void CUSTOMDUDEV1_SETUP::WeaponConvert(int nWeaponID) { CUSTOMDUDE_WEAPON* pW1 = &pDude->weapons[0]; CUSTOMDUDE_WEAPON* pW2 = &pDude->weapons[1]; - char availStatus = pW1->available; + bool availStatus = pW1->available; pW1->Clear(); if (rngok(nWeaponID, 1, kVectorMax)) pW1->type = kCdudeWeaponHitscan, pW1->clipMask = CLIPMASK1; @@ -4126,7 +4126,7 @@ void CUSTOMDUDEV1_SETUP::SetupBasics(void) if (!pDude->initialized) { // setup mass - Bmemset(pMass, 0, sizeof(SPRITEMASS)); // clear mass cache + memset(pMass, 0, sizeof(SPRITEMASS)); // clear mass cache int nPic = pSpr->picnum; pSpr->picnum = helperGetFirstPic(pDude); // we need a proper pic to get a proper mass @@ -4142,7 +4142,7 @@ void CUSTOMDUDEV1_SETUP::SetupBasics(void) void CUSTOMDUDEV1_SETUP::SetupDamage(void) { CUSTOMDUDE_WEAPON* pWeap = &pDude->weapons[0]; - char isMelee = false; + bool isMelee = false; DamageSetDefault(); DamageScaleToWeapon(pWeap); @@ -4162,10 +4162,10 @@ void CUSTOMDUDEV1_SETUP::SetupDamage(void) if (isMelee) { // no dodge - Bmemset(&pDude->dodge, 0, sizeof(CUSTOMDUDE_DODGE)); + memset(&pDude->dodge, 0, sizeof(CUSTOMDUDE_DODGE)); // no knockout - Bmemset(&pDude->knockout, 0, sizeof(CUSTOMDUDE_KNOCKOUT)); + memset(&pDude->knockout, 0, sizeof(CUSTOMDUDE_KNOCKOUT)); // more dmg and lower chances (isMelee flag analogue) pDude->recoil.dmgReq = 25, pDude->recoil.chance = 0x0400; @@ -4282,7 +4282,7 @@ static int helperGetFirstPic(CUSTOMDUDE* pDude) return nPic; } -static char helperSeqTriggerExists(int nSeq) +static bool helperSeqTriggerExists(int nSeq) { int i; Seq* pSeq = helperSeqLoad(nSeq); @@ -4355,7 +4355,7 @@ static int AreaOfSector(sectortype* pSector) return area; } -static char isIdKeyword(const char* fullStr, const char* prefix, int* nID) +static bool isIdKeyword(const char* fullStr, const char* prefix, int* nID) { if (!fullStr || !prefix) return false; @@ -4389,7 +4389,7 @@ CUSTOMDUDE* cdudeAlloc() if (!gCustomDude) { gCustomDude = (CUSTOMDUDE*)Bmalloc(sizeof(CUSTOMDUDE) * kMaxSprites); - Bmemset(gCustomDude, 0, sizeof(CUSTOMDUDE) * kMaxSprites); + memset(gCustomDude, 0, sizeof(CUSTOMDUDE) * kMaxSprites); } dassert(gCustomDude != NULL); @@ -4458,7 +4458,7 @@ CUSTOMDUDE* cdudeGet(int nIndex) DBloodActor* cdudeSpawn(XSPRITE* pXSource, DBloodActor* pSprite, int nDist) { POINT3D offs; - Bmemset(&offs, 0, sizeof(offs)); + memset(&offs, 0, sizeof(offs)); offs.y = nDist; DBloodActor* pSource = &sprite[pXSource->reference]; @@ -4559,7 +4559,7 @@ void cdudeLeechOperate(DBloodActor* pSpr, XSPRITE* pXSpr) { if (IsPlayerSprite(pTarg)) { - PLAYER* pPlayer = &gPlayer[pTarg->type - kDudePlayer1]; + DBloodPlayer* pPlayer = &gPlayer[pTarg->type - kDudePlayer1]; if (powerupCheck(pPlayer, kPwUpShadowCloak) > 0) return; } diff --git a/source/games/blood/src/nnextcdud.h b/source/games/blood/src/nnextcdud.h index 8b0680f8f..0e37c56b3 100644 --- a/source/games/blood/src/nnextcdud.h +++ b/source/games/blood/src/nnextcdud.h @@ -400,7 +400,7 @@ class ARG_PICK_WEAPON targHealth = CountHealthPerc(target); } - char CountHealthPerc(DBloodActor* actor) + int CountHealthPerc(DBloodActor* actor) { int nHealth = ClipLow(nnExtGetStartHealth(actor), 1); return ClipHigh((kPercFull * actor->xspr.health) / nHealth, 255); @@ -444,7 +444,7 @@ class CUSTOMDUDE_SOUND if (nID != NO_SOUND) { int nClock = PlayClock; - char uwater = spriteIsUnderwater(pSpr, true); + bool uwater = spriteIsUnderwater(pSpr, true); int nRand = Random2(80); if (!medium || ((medium & 0x01) && !uwater) || ((medium & 0x02) && uwater)) @@ -663,8 +663,8 @@ class CUSTOMDUDE_WEAPON unsigned int group; unsigned int dispersion[2]; double _distRange[2]; - unsigned char targHpRange[2]; - unsigned char dudeHpRange[2]; + uint8_t targHpRange[2]; + uint8_t dudeHpRange[2]; CUSTOMDUDE_SOUND sound; struct SHOT { @@ -700,7 +700,7 @@ class CUSTOMDUDE_WEAPON clock += (unsigned int)PlayClock; } - char Check(void) + int Check(void) { if ((unsigned int)PlayClock < clock) return 2; @@ -747,12 +747,12 @@ class CUSTOMDUDE_WEAPON shot._velocity = FLT_MAX; shot.slope = INT32_MAX; } - char HaveAmmmo(void) { return (!ammo.total || ammo.cur); } + bool HaveAmmmo(void) { return (!ammo.total || ammo.cur); } double GetDistance(void) { return max(_distRange[1] - _distRange[0], 0.); } int GetNumshots(void) { return (ammo.total) ? ClipHigh(ammo.cur, numshots) : numshots; } - char IsTimeout(void) { return ((unsigned int)PlayClock < cooldown.clock); } - char HaveSlope(void) { return (shot.slope != INT32_MAX); } - char HaveVelocity(void) { return (shot._velocity != FLT_MAX); } + bool IsTimeout(void) { return ((unsigned int)PlayClock < cooldown.clock); } + bool HaveSlope(void) { return (shot.slope != INT32_MAX); } + bool HaveVelocity(void) { return (shot._velocity != FLT_MAX); } }; @@ -867,7 +867,7 @@ class CUSTOMDUDE_EFFECT pStates.Clear(); } - char CanSpawn(DBloodActor* pSpr) + bool CanSpawn(DBloodActor* pSpr) { int nFrame = 1; int nACount = pAnims.Size(); @@ -1037,7 +1037,7 @@ class CUSTOMDUDE_DODGE unsigned int timer; unsigned int chance; unsigned int dmgReq; - char Allow(int nDamage) + bool Allow(int nDamage) { if (nDamage > (int)dmgReq) { @@ -1062,8 +1062,8 @@ class CUSTOMDUDE_DODGE onDamage; struct { - unsigned int chance : 20; - char Allow(void) { return Chance(chance); } + unsigned int chance; + bool Allow(void) { return Chance(chance); } } onAimMiss; }; @@ -1075,7 +1075,7 @@ class CUSTOMDUDE_RECOIL unsigned int timer; unsigned int chance; unsigned int dmgReq; - char Allow(int nDamage) + bool Allow(int nDamage) { if (nDamage > (int)dmgReq) { @@ -1105,7 +1105,7 @@ class CUSTOMDUDE_KNOCKOUT unsigned int timer; unsigned int chance; unsigned int dmgReq; - char Allow(int nDamage) + bool Allow(int nDamage) { if (nDamage > (int)dmgReq) { @@ -1284,14 +1284,14 @@ class CUSTOMDUDE bool CanMove(sectortype* pXSect, bool Crusher, bool Water, bool Uwater, bool Depth, double bottom, double floorZ); bool FindState(AISTATE* pState, int* nStateType, int* nPosture); void NewState(int nStateType, int nTimeOverride = -1); - char NewState(AISTATE* pState); + bool NewState(AISTATE* pState); void NextState(int nStateType, int nTimeOverride = 0); void NextState(AISTATE* pState, int nTimeOverride = 0); AISTATE* PickDeath(int nDmgType); void SyncState(void); //---------------------------------------------------------------------------------------------------- void LeechPickup(void); - void LeechKill(char delSpr); + void LeechKill(bool delSpr); void UpdateSlaves(void); void DropItems(void); void ClearEffectCallbacks(void); @@ -1307,23 +1307,23 @@ class CUSTOMDUDE_SETUP private: const char* pValue; CUSTOMDUDE* pDude; - PARAM* pGroup; + const PARAM* pGroup; char key[256]; int nWarnings; int hIni; IniFile* pIni; - PARAM* pParam; + const PARAM* pParam; char val[256]; - char showWarnings; + bool showWarnings; /*------------------------------------------------------------*/ - int FindParam(const char* str, PARAM* pDb); - PARAM* FindParam(int nParam, PARAM* pDb); - int ParamLength(PARAM* pDb); + int FindParam(const char* str, const PARAM* pDb); + const PARAM* FindParam(int nParam, const PARAM* pDb); + int ParamLength(const PARAM* pDb); /*-------------------------------------------------*/ - char DescriptLoad(int nID); + bool DescriptLoad(int nID); void DescriptClose(void); - char DescriptGroupExist(const char* pGroupName); - char DescriptParamExist(const char* pGroupName, const char* pParamName); + bool DescriptGroupExist(const char* pGroupName); + bool DescriptParamExist(const char* pGroupName, const char* pParamName); int DescriptCheck(void); const char* DescriptGetValue(const char* pGroupName, const char* pParamName); /*------------------------------------------------------------*/ @@ -1355,9 +1355,9 @@ class CUSTOMDUDE_SETUP /*------------------------------------------------------------*/ CUSTOMDUDE* SameDudeExist(CUSTOMDUDE* pCmp); CUSTOMDUDE* GetFirstDude(int nID); - char IsFirst(CUSTOMDUDE* pCmp); + bool IsFirst(CUSTOMDUDE* pCmp); public: - char FindAiState(AISTATE stateArr[][kCdudePostureMax], int arrLen, AISTATE* pNeedle, int* nType, int* nPosture); + bool FindAiState(AISTATE stateArr[][kCdudePostureMax], int arrLen, AISTATE* pNeedle, int* nType, int* nPosture); static void Setup(DBloodActor* actor); static void Setup(CUSTOMDUDE* pOver = nullptr); @@ -1380,27 +1380,27 @@ class CUSTOMDUDEV1_SETUP : CUSTOMDUDE_SETUP class CUSTOMDUDEV2_SETUP : CUSTOMDUDE_SETUP { private: - char ParseVelocity(const char* str, CUSTOMDUDE_VELOCITY* pVelocity); - char ParseAppearance(const char* str, APPEARANCE* pAppear); - char ParseSound(const char* str, CUSTOMDUDE_SOUND* pSound); - char ParseAnimation(const char* str, AISTATE* pState, char asPosture); - char ParseRange(const char* str, int nValType, int out[2], int nBaseVal = 0); + bool ParseVelocity(const char* str, CUSTOMDUDE_VELOCITY* pVelocity); + bool ParseAppearance(const char* str, APPEARANCE* pAppear); + bool ParseSound(const char* str, CUSTOMDUDE_SOUND* pSound); + bool ParseAnimation(const char* str, AISTATE* pState, bool asPosture); + bool ParseRange(const char* str, int nValType, int out[2], int nBaseVal = 0); int ParseMedium(const char* str); - char ParseOffsets(const char* str, POINT3D* pOut); - char ParseShotSetup(const char* str, CUSTOMDUDE_WEAPON* pWeap); - char ParseAttackSetup(const char* str, CUSTOMDUDE_WEAPON* pWeap); - char ParseWeaponStyle(const char* str, CUSTOMDUDE_WEAPON* pWeap); - char ParseWeaponBasicInfo(const char* str, CUSTOMDUDE_WEAPON* pWeap); - char ParsePosture(const char* str); - char ParseOnEventDmg(const char* str, int* pOut, int nLen); - char ParseDropItem(const char* str, unsigned char out[2]); - char ParseSkill(const char* str); + bool ParseOffsets(const char* str, POINT3D* pOut); + bool ParseShotSetup(const char* str, CUSTOMDUDE_WEAPON* pWeap); + bool ParseAttackSetup(const char* str, CUSTOMDUDE_WEAPON* pWeap); + bool ParseWeaponStyle(const char* str, CUSTOMDUDE_WEAPON* pWeap); + bool ParseWeaponBasicInfo(const char* str, CUSTOMDUDE_WEAPON* pWeap); + bool ParsePosture(const char* str); + bool ParseOnEventDmg(const char* str, int* pOut, int nLen); + bool ParseDropItem(const char* str, unsigned bool out[2]); + bool ParseSkill(const char* str); int ParseKeywords(const char* str, PARAM* pDb); int ParseIDs(const char* str, int nValType, TArray& pOut, int nMax = 0); int ParseIDs(const char* str, int nValType, int* pOut, int nMax); int ParseEffectIDs(const char* str, const char* paramName, unsigned short* pOut, int nLen = 0); int ParseStatesToList(const char* str, TArray& pOut); // todo: determine type. - char ParseGibSetup(const char* str, CUSTOMDUDE_GIB* pOut); + bool ParseGibSetup(const char* str, CUSTOMDUDE_GIB* pOut); /*-------------------------------------------------*/ int CheckArray(const char* str, int nMin = 0, int nMax = 0, int nDefault = 1); int CheckValue(const char* str, int nValType, int nDefault); @@ -1411,7 +1411,7 @@ class CUSTOMDUDEV2_SETUP : CUSTOMDUDE_SETUP /*-------------------------------------------------*/ void SetupGeneral(void); void SetupVelocity(void); - void SetupAnimation(AISTATE* pState, char asPosture); + void SetupAnimation(AISTATE* pState, bool asPosture); void SetupAnimation(void); void SetupSound(CUSTOMDUDE_SOUND* pSound); void SetupMovePattern(void); diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 4774baf39..82e6e2036 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -264,7 +264,7 @@ AISTATE genPatrolStates[] = { // //--------------------------------------------------------------------------- -char idListProcessProxySprite(DBloodActor* actor) +int idListProcessProxySprite(DBloodActor* actor) { int i, okDist; bool causerPart; @@ -325,7 +325,7 @@ char idListProcessProxySprite(DBloodActor* actor) // //--------------------------------------------------------------------------- -char idListProcessSightSprite(DBloodActor* actor) +int idListProcessSightSprite(DBloodActor* actor) { double z[3]; int i, j; @@ -405,7 +405,7 @@ char idListProcessSightSprite(DBloodActor* actor) // //--------------------------------------------------------------------------- -char idListProcessPhysSprite(DBloodActor* actor) +int idListProcessPhysSprite(DBloodActor* actor) { if (actor->spr.flags & kHitagFree) return kListREMOVE; @@ -583,7 +583,7 @@ void followTarget(DBloodActor* actor, DBloodActor* pTarg, DAngle nMaxAng) // //--------------------------------------------------------------------------- -char idListProcessFollowSprite(DBloodActor* actor) +int idListProcessFollowSprite(DBloodActor* actor) { if ((actor->spr.flags & kHitagFree) || actor->ownerActor == nullptr) return kListREMOVE; @@ -1048,7 +1048,7 @@ bool multiTxPointsRx(int rx, DBloodActor* actor) // //--------------------------------------------------------------------------- -int collectObjectsByChannel(int nChannel, bool rx, TArray* pOut, char flags) +int collectObjectsByChannel(int nChannel, bool rx, TArray* pOut, int flags) { bool ok, link = false, unlink = false; int c = 0; diff --git a/source/games/blood/src/nnextsif.cpp b/source/games/blood/src/nnextsif.cpp index c53fb6622..d108dd087 100644 --- a/source/games/blood/src/nnextsif.cpp +++ b/source/games/blood/src/nnextsif.cpp @@ -234,7 +234,7 @@ struct EvalContext final return true; } - bool helperCmpHeight(char ceil) + bool helperCmpHeight(bool ceil) { double nHeigh1, nHeigh2; switch (pSect->type) @@ -1360,7 +1360,7 @@ struct EvalContext final void ReceiveObjects(EVENT* pFrom) { - char srcIsCondition = false; + bool srcIsCondition = false; o = pFrom->target; if (o.type() == EventObject::Actor && pCond != o.actor())