array backwards iteration fixes

This commit is contained in:
Christoph Oelckers 2023-10-15 18:48:52 +02:00
parent 7674b7245b
commit 5f8ab4a828
7 changed files with 45 additions and 9 deletions

View file

@ -0,0 +1,36 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010-2019 EDuke32 developers and contributors
Copyright (C) 2019 Nuke.YKT
Copyright (C) NoOne
*****************************************************************
NoOne: AI code for Custom Dude system.
*****************************************************************
This file is part of NBlood.
NBlood is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#ifdef NOONE_EXTENSIONS
#pragma once
#include "nnextcdud.h"
extern AISTATE gCdudeStateTemplate[kCdudeStateNormalMax][kCdudePostureMax];
extern AISTATE gCdudeStateAttackTemplate[kCdudePostureMax];
extern AISTATE gCdudeStateDyingTemplate[kCdudePostureMax];
void cdudeDoExplosion(CUSTOMDUDE* pDude);
#endif

View file

@ -42,7 +42,7 @@ void InitMirrors(void)
{
portalClear();
for (int i = (int)wall.Size() - 1; i >= 0; i--)
for (int i = wall.SSize() - 1; i >= 0; i--)
{
auto pWalli = &wall[i];
if (pWalli->overtexture == mirrortile)
@ -85,7 +85,7 @@ void InitMirrors(void)
continue;
}
}
for (int i = (int)sector.Size() - 1; i >= 0; i--)
for (int i = sector.SSize() - 1; i >= 0; i--)
{
auto secti = &sector[i];
if (secti->floortexture == mirrortile)

View file

@ -1238,7 +1238,7 @@ class CUSTOMDUDE
char CanSleep(void) { return (!StatusTest(kCdudeStatusAwaked) && GetStateSeq(kCdudeStateSleep, posture) > 0); }
char CanMove(void) { return (GetStateSeq(kCdudeStateSearch, posture) > 0); }
//----------------------------------------------------------------------------------------------------
int GetDamage(int nSource, int nDmgType);
int GetDamage(DBloodActor* nSource, int nDmgType);
char IsPostureMatch(int nPosture);
char IsMediumMatch(int nMedium);
char IsTooTight(void);
@ -1253,7 +1253,7 @@ class CUSTOMDUDE
void ProcessEffects(void);
void Recoil(void);
int Damage(int nFrom, int nDmgType, int nDmg);
void Kill(int nFrom, int nDmgType, int nDmg);
void Kill(DBloodActor* nFrom, int nDmgType, int nDmg);
//----------------------------------------------------------------------------------------------------
char CanMove(sectortype* pXSect, char Crusher, char Water, char Uwater, char Depth, int bottom, int floorZ);
char FindState(AISTATE* pState, int* nStateType, int* nPosture);

View file

@ -1061,7 +1061,7 @@ int collectObjectsByChannel(int nChannel, bool rx, TArray<EventObject>* pOut, ch
case 0x20: unlink = true; break;
}
for(int i = sector.Size() - 1; i >= 0; i--)
for(int i = sector.SSize() - 1; i >= 0; i--)
{
for(auto& wal : sector[i].walls)
{
@ -1598,7 +1598,7 @@ DBloodActor* randomSpawnDude(DBloodActor* sourceactor, DBloodActor* origin, doub
template<class T, class F>
void Process(T& array, F function)
{
for (int i = array.Size(); i >= 0; i--)
for (int i = array.SSize(); i >= 0; i--)
{
if (!array[i]) continue;
if (function(array[i]) == kListREMOVE)

View file

@ -277,7 +277,7 @@ void sfxPlayVectorSound(DBloodActor* pSprite, int vectorId);
// ------------------------------------------------------------------------- //
void debrisBubble(DBloodActor* nSprite);
void debrisMove(DBloodActor* act);
void debrisConcuss(DBloodActor* nOwner, int listIndex, const DVector3& pos, int dmg);
void debrisConcuss(DBloodActor* owneractor, DBloodActor* actor, const DVector3& pos, int dmg);
// ------------------------------------------------------------------------- //
void aiSetGenIdleState(DBloodActor*);

View file

@ -1998,7 +1998,7 @@ void conditionsTrackingProcess()
evn.cmd = kCmdOn;
evn.initiator = nullptr;
for(int i = gTrackingConditionsList.Size() - 1; i >= 0; i--)
for(int i = gTrackingConditionsList.SSize() - 1; i >= 0; i--)
{
auto pTr = &gTrackingConditionsList[i];
auto pSpr = pTr->condi;

View file

@ -2199,7 +2199,7 @@ void trProcessBusy(void)
{
sect.velCeil = sect.velFloor = 0;
}
for (int i = gBusy.Size()-1; i >= 0; i--)
for (int i = gBusy.SSize()-1; i >= 0; i--)
{
int nStatus;
int oldBusy = gBusy[i].busy;