mirror of https://github.com/yaz0r/FITD.git
Cleanup some of the code
This commit is contained in:
parent
c066659f64
commit
2f77a8d791
|
@ -425,7 +425,7 @@ void updateAnimation(void)
|
|||
|
||||
if(currentProcessedActorPtr->dynFlags & 1) // hard collision enabled for actor ?
|
||||
{
|
||||
int numCol = checkForHardCol(&zvLocal, &roomDataTable[currentProcessedActorPtr->room]);
|
||||
int numCol = AsmCheckListCol(&zvLocal, &roomDataTable[currentProcessedActorPtr->room]);
|
||||
|
||||
for(int i=0;i<numCol;i++)
|
||||
{
|
||||
|
@ -473,7 +473,7 @@ void updateAnimation(void)
|
|||
}
|
||||
else // no hard collision -> just update the flag without performing the position update
|
||||
{
|
||||
if(checkForHardCol(&zvLocal, &roomDataTable[currentProcessedActorPtr->room]))
|
||||
if(AsmCheckListCol(&zvLocal, &roomDataTable[currentProcessedActorPtr->room]))
|
||||
{
|
||||
currentProcessedActorPtr->HARD_COL = 1;
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ void updateAnimation(void)
|
|||
localZv2.ZVZ1 += stepZ;
|
||||
localZv2.ZVZ2 += stepZ;
|
||||
|
||||
if(!checkForHardCol(&localZv2, &roomDataTable[currentProcessedActorPtr->room]))
|
||||
if(!AsmCheckListCol(&localZv2, &roomDataTable[currentProcessedActorPtr->room]))
|
||||
{
|
||||
if(checkObjectCollisions(collisionIndex, &localZv2))
|
||||
{
|
||||
|
@ -649,7 +649,7 @@ void updateAnimation(void)
|
|||
|
||||
zvLocal.ZVY2 += 100;
|
||||
|
||||
if(currentProcessedActorPtr->roomY < -10 && !checkForHardCol(&zvLocal,&roomDataTable[currentProcessedActorPtr->room]) && !manageFall(currentProcessedActorIdx,&zvLocal))
|
||||
if(currentProcessedActorPtr->roomY < -10 && !AsmCheckListCol(&zvLocal,&roomDataTable[currentProcessedActorPtr->room]) && !manageFall(currentProcessedActorIdx,&zvLocal))
|
||||
{
|
||||
InitRealValue(0, 2000, 40, ¤tProcessedActorPtr->YHandler);
|
||||
}
|
||||
|
|
|
@ -1,31 +1,41 @@
|
|||
#include "common.h"
|
||||
|
||||
void processAnimAction(void)
|
||||
#define NO_FRAPPE 0
|
||||
#define WAIT_FRAPPE_ANIM 1
|
||||
#define FRAPPE_OK 2
|
||||
#define DONE_FRAPPE 3
|
||||
#define WAIT_TIR_ANIM 4
|
||||
#define DO_TIR 5
|
||||
#define WAIT_ANIM_THROW 6
|
||||
#define WAIT_FRAME_THROW 7
|
||||
#define HIT_OBJECT 8
|
||||
#define THROW_OBJECT 9
|
||||
#define WAIT_FRAPPE_FRAME 10
|
||||
|
||||
void GereFrappe(void)
|
||||
{
|
||||
switch(currentProcessedActorPtr->animActionType)
|
||||
{
|
||||
case 1: // PRE_HIT
|
||||
case WAIT_FRAPPE_ANIM:
|
||||
if(currentProcessedActorPtr->ANIM == currentProcessedActorPtr->animActionANIM)
|
||||
{
|
||||
if(currentProcessedActorPtr->ANIM == currentProcessedActorPtr->animActionANIM)
|
||||
{
|
||||
currentProcessedActorPtr->animActionType = 10;
|
||||
}
|
||||
|
||||
if(currentProcessedActorPtr->ANIM == currentProcessedActorPtr->animActionANIM)
|
||||
{
|
||||
if(currentProcessedActorPtr->FRAME == currentProcessedActorPtr->animActionFRAME)
|
||||
{
|
||||
currentProcessedActorPtr->animActionType = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentProcessedActorPtr->animActionType = 0;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
currentProcessedActorPtr->animActionType = WAIT_FRAPPE_FRAME;
|
||||
}
|
||||
case 2: // HIT
|
||||
[[fallthrough]];
|
||||
case WAIT_FRAPPE_FRAME:
|
||||
if (currentProcessedActorPtr->ANIM != currentProcessedActorPtr->animActionANIM)
|
||||
{
|
||||
currentProcessedActorPtr->animActionType = NO_FRAPPE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentProcessedActorPtr->FRAME == currentProcessedActorPtr->animActionFRAME)
|
||||
{
|
||||
currentProcessedActorPtr->animActionType = FRAPPE_OK;
|
||||
}
|
||||
return;
|
||||
|
||||
case FRAPPE_OK:
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
|
@ -75,7 +85,7 @@ void processAnimAction(void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 4: // PRE_FIRE
|
||||
case 4: // WAIT_TIR_ANIM
|
||||
{
|
||||
if(currentProcessedActorPtr->ANIM != currentProcessedActorPtr->animActionANIM)
|
||||
return;
|
||||
|
@ -87,7 +97,7 @@ void processAnimAction(void)
|
|||
|
||||
break;
|
||||
}
|
||||
case 5: // FIRE
|
||||
case 5: // DO_TIR
|
||||
{
|
||||
int touchedActor;
|
||||
|
||||
|
@ -134,7 +144,7 @@ void processAnimAction(void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 6: // PRE_THROW
|
||||
case 6: // WAIT_ANIM_THROW
|
||||
{
|
||||
if(currentProcessedActorPtr->ANIM == currentProcessedActorPtr->animActionANIM)
|
||||
{
|
||||
|
@ -148,7 +158,7 @@ void processAnimAction(void)
|
|||
|
||||
ZVStruct rangeZv;
|
||||
|
||||
getZvNormal(HQR_Get(listBody, objPtr->body),&rangeZv);
|
||||
GiveZVObjet(HQR_Get(listBody, objPtr->body),&rangeZv);
|
||||
|
||||
rangeZv.ZVX1 += x;
|
||||
rangeZv.ZVX2 += x;
|
||||
|
@ -157,26 +167,22 @@ void processAnimAction(void)
|
|||
rangeZv.ZVZ1 += z;
|
||||
rangeZv.ZVZ2 += z;
|
||||
|
||||
if(checkForHardCol(&rangeZv, &roomDataTable[currentProcessedActorPtr->room]))
|
||||
if(AsmCheckListCol(&rangeZv, &roomDataTable[currentProcessedActorPtr->room]))
|
||||
{
|
||||
currentProcessedActorPtr->animActionType = 0;
|
||||
putAt(objIdx, currentProcessedActorPtr->indexInWorld);
|
||||
PutAtObjet(objIdx, currentProcessedActorPtr->indexInWorld);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(currentProcessedActorPtr->FRAME == currentProcessedActorPtr->animActionFRAME)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
currentProcessedActorPtr->animActionType = 7;
|
||||
|
||||
x = currentProcessedActorPtr->roomX + currentProcessedActorPtr->hotPoint.x + currentProcessedActorPtr->stepX;
|
||||
y = currentProcessedActorPtr->roomY + currentProcessedActorPtr->hotPoint.y + currentProcessedActorPtr->stepY;
|
||||
z = currentProcessedActorPtr->roomZ + currentProcessedActorPtr->hotPoint.z + currentProcessedActorPtr->stepZ;
|
||||
int x = currentProcessedActorPtr->roomX + currentProcessedActorPtr->hotPoint.x + currentProcessedActorPtr->stepX;
|
||||
int y = currentProcessedActorPtr->roomY + currentProcessedActorPtr->hotPoint.y + currentProcessedActorPtr->stepY;
|
||||
int z = currentProcessedActorPtr->roomZ + currentProcessedActorPtr->hotPoint.z + currentProcessedActorPtr->stepZ;
|
||||
|
||||
removeObjFromInventory(objIdx);
|
||||
DeleteInventoryObjet(objIdx);
|
||||
|
||||
objPtr->x = x;
|
||||
objPtr->y = y;
|
||||
|
@ -225,7 +231,7 @@ void processAnimAction(void)
|
|||
actorPtr->roomY = y;
|
||||
actorPtr->roomZ = z;
|
||||
|
||||
getZvNormal(HQR_Get(listBody,actorPtr->bodyNum),&actorPtr->zv);
|
||||
GiveZVObjet(HQR_Get(listBody,actorPtr->bodyNum),&actorPtr->zv);
|
||||
|
||||
actorPtr->zv.ZVX1 += x;
|
||||
actorPtr->zv.ZVX2 += x;
|
||||
|
@ -415,7 +421,7 @@ void processAnimAction(void)
|
|||
}
|
||||
}
|
||||
|
||||
if(checkForHardCol(&rangeZv, &roomDataTable[currentProcessedActorPtr->room]))
|
||||
if(AsmCheckListCol(&rangeZv, &roomDataTable[currentProcessedActorPtr->room]))
|
||||
{
|
||||
currentProcessedActorPtr->hotPoint.x = 0;
|
||||
currentProcessedActorPtr->hotPoint.y = 0;
|
||||
|
@ -434,21 +440,6 @@ void processAnimAction(void)
|
|||
objPtr->y = ytemp;
|
||||
objPtr->z = ztemp;
|
||||
|
||||
break;
|
||||
}
|
||||
case 10: // PRE_HIT_IN_GOOD_ANIM
|
||||
{
|
||||
if(currentProcessedActorPtr->ANIM == currentProcessedActorPtr->animActionANIM)
|
||||
{
|
||||
if(currentProcessedActorPtr->FRAME == currentProcessedActorPtr->animActionFRAME)
|
||||
{
|
||||
currentProcessedActorPtr->animActionType = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentProcessedActorPtr->animActionType = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifdef FITD_DEBUGGER
|
||||
|
|
|
@ -1 +1 @@
|
|||
void processAnimAction(void);
|
||||
void GereFrappe(void);
|
||||
|
|
|
@ -144,7 +144,7 @@ int testZvEndAnim(tObject* actorPtr,char* animPtr, int param)
|
|||
localZv.ZVZ1 += animMoveZ;
|
||||
localZv.ZVZ2 += animMoveZ;
|
||||
|
||||
if(checkForHardCol(&localZv, &roomDataTable[actorPtr->room]))
|
||||
if(AsmCheckListCol(&localZv, &roomDataTable[actorPtr->room]))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ int testZvEndAnim(tObject* actorPtr,char* animPtr, int param)
|
|||
localZv.ZVY1 += 100;
|
||||
localZv.ZVY2 += 100;
|
||||
|
||||
if(checkForHardCol(&localZv, &roomDataTable[actorPtr->room]))
|
||||
if(AsmCheckListCol(&localZv, &roomDataTable[actorPtr->room]))
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ void put(int x, int y, int z, int room, int stage, int alpha, int beta, int gamm
|
|||
objPtr->beta = beta;
|
||||
objPtr->gamma = gamma;
|
||||
|
||||
removeObjFromInventory(idx);
|
||||
DeleteInventoryObjet(idx);
|
||||
|
||||
objPtr->flags2 |= 0x4000;
|
||||
|
||||
|
@ -59,7 +59,7 @@ void put(int x, int y, int z, int room, int stage, int alpha, int beta, int gamm
|
|||
|
||||
void drop(int worldIdx, int worldSource)
|
||||
{
|
||||
putAt(worldIdx, worldSource);
|
||||
PutAtObjet(worldIdx, worldSource);
|
||||
}
|
||||
|
||||
void fire(int fireAnim, int X, int Y, int Z, int hitForce, int nextAnim)
|
||||
|
@ -1541,7 +1541,7 @@ void processLife(int lifeNum, bool callFoundLife)
|
|||
objIdx2 = *(s16*)currentLifePtr;
|
||||
currentLifePtr += 2;
|
||||
|
||||
putAt(objIdx1, objIdx2);
|
||||
PutAtObjet(objIdx1, objIdx2);
|
||||
break;
|
||||
}
|
||||
case LM_FOUND_NAME: // FOUND_NAME
|
||||
|
|
|
@ -1819,7 +1819,7 @@ void getZvRot(char* bodyPtr, ZVStruct* zvPtr, int alpha, int beta, int gamma)
|
|||
int tempY;
|
||||
int tempZ;
|
||||
|
||||
getZvNormal(bodyPtr, zvPtr);
|
||||
GiveZVObjet(bodyPtr, zvPtr);
|
||||
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
|
@ -2566,7 +2566,7 @@ int findObjectInInventory(int objIdx)
|
|||
return(-1);
|
||||
}
|
||||
|
||||
void removeObjFromInventory(int objIdx)
|
||||
void DeleteInventoryObjet(int objIdx)
|
||||
{
|
||||
int inventoryIdx;
|
||||
|
||||
|
@ -2609,7 +2609,7 @@ void deleteObject(int objIdx)
|
|||
objPtr->room = -1;
|
||||
objPtr->stage = -1;
|
||||
|
||||
removeObjFromInventory(objIdx);
|
||||
DeleteInventoryObjet(objIdx);
|
||||
}
|
||||
|
||||
#ifdef FITD_DEBUGGER
|
||||
|
@ -3934,7 +3934,7 @@ void handleCollision(ZVStruct* startZv, ZVStruct* zvPtr2, ZVStruct* zvPtr3)
|
|||
}
|
||||
}
|
||||
|
||||
int checkForHardCol(ZVStruct* zvPtr, roomDataStruct* pRoomData)
|
||||
int AsmCheckListCol(ZVStruct* zvPtr, roomDataStruct* pRoomData)
|
||||
{
|
||||
u16 i;
|
||||
int hardColVar = 0;
|
||||
|
@ -4326,7 +4326,7 @@ int checkLineProjectionWithActors( int actorIdx, int X, int Y, int Z, int beta,
|
|||
break;
|
||||
}
|
||||
|
||||
if(checkForHardCol(&localZv, &roomDataTable[room]) <= 0)
|
||||
if(AsmCheckListCol(&localZv, &roomDataTable[room]) <= 0)
|
||||
{
|
||||
foundFlag = -1;
|
||||
}
|
||||
|
@ -4380,7 +4380,7 @@ int checkLineProjectionWithActors( int actorIdx, int X, int Y, int Z, int beta,
|
|||
return(foundFlag);
|
||||
}
|
||||
|
||||
void putAt(int objIdx, int objIdxToPutAt)
|
||||
void PutAtObjet(int objIdx, int objIdxToPutAt)
|
||||
{
|
||||
tWorldObject* objPtr = &worldObjects[objIdx];
|
||||
tWorldObject* objPtrToPutAt = &worldObjects[objIdxToPutAt];
|
||||
|
@ -4389,7 +4389,7 @@ void putAt(int objIdx, int objIdxToPutAt)
|
|||
{
|
||||
tObject* actorToPutAtPtr = &objectTable[objPtrToPutAt->objIndex];
|
||||
|
||||
removeObjFromInventory(objIdx);
|
||||
DeleteInventoryObjet(objIdx);
|
||||
|
||||
if(objPtr->objIndex == -1)
|
||||
{
|
||||
|
@ -4429,7 +4429,7 @@ void putAt(int objIdx, int objIdxToPutAt)
|
|||
}
|
||||
else
|
||||
{
|
||||
removeObjFromInventory(objIdx);
|
||||
DeleteInventoryObjet(objIdx);
|
||||
|
||||
if(objPtr->objIndex == -1)
|
||||
{
|
||||
|
@ -4482,7 +4482,7 @@ void throwStoppedAt(int x, int z)
|
|||
|
||||
bodyPtr = (u8*)HQR_Get(listBody,currentProcessedActorPtr->bodyNum);
|
||||
|
||||
getZvNormal((char*)bodyPtr,&zvLocal);
|
||||
GiveZVObjet((char*)bodyPtr,&zvLocal);
|
||||
|
||||
x2 = x;
|
||||
y2 = (currentProcessedActorPtr->roomY/2000)*2000;
|
||||
|
@ -4508,7 +4508,7 @@ void throwStoppedAt(int x, int z)
|
|||
zvCopy.ZVZ1 += z2;
|
||||
zvCopy.ZVZ2 += z2;
|
||||
|
||||
if(!checkForHardCol(&zvCopy,&roomDataTable[currentProcessedActorPtr->room]))
|
||||
if(!AsmCheckListCol(&zvCopy,&roomDataTable[currentProcessedActorPtr->room]))
|
||||
{
|
||||
foundPosition = 1;
|
||||
}
|
||||
|
@ -4520,7 +4520,7 @@ void throwStoppedAt(int x, int z)
|
|||
zvCopy.ZVY1 += 100; // is the object reachable ? (100 is Carnby height. If hard col at Y + 100, carnby can't reach that spot)
|
||||
zvCopy.ZVY2 += 100;
|
||||
|
||||
if(!checkForHardCol(&zvCopy,&roomDataTable[currentProcessedActorPtr->room]))
|
||||
if(!AsmCheckListCol(&zvCopy,&roomDataTable[currentProcessedActorPtr->room]))
|
||||
{
|
||||
y2 += 2000;
|
||||
foundPosition = 0;
|
||||
|
@ -4552,7 +4552,7 @@ void throwStoppedAt(int x, int z)
|
|||
currentProcessedActorPtr->speed = 0;
|
||||
currentProcessedActorPtr->gamma = 0;
|
||||
|
||||
getZvNormal((char*)bodyPtr,¤tProcessedActorPtr->zv);
|
||||
GiveZVObjet((char*)bodyPtr,¤tProcessedActorPtr->zv);
|
||||
|
||||
currentProcessedActorPtr->zv.ZVX1 += x2;
|
||||
currentProcessedActorPtr->zv.ZVX2 += x2;
|
||||
|
|
|
@ -16,9 +16,9 @@ void createActorList();
|
|||
void mainDraw(int mode);
|
||||
int checkObjectCollisions(int actorIdx, ZVStruct* zvPtr);
|
||||
int checkLineProjectionWithActors( int actorIdx, int X, int Y, int Z, int beta, int room, int param );
|
||||
void getZvNormal(char* bodyPtr, ZVStruct* zvPtr);
|
||||
int checkForHardCol(ZVStruct* zvPtr, roomDataStruct* pRoomData);
|
||||
void removeObjFromInventory(int objIdx);
|
||||
void GiveZVObjet(char* bodyPtr, ZVStruct* zvPtr);
|
||||
int AsmCheckListCol(ZVStruct* zvPtr, roomDataStruct* pRoomData);
|
||||
void DeleteInventoryObjet(int objIdx);
|
||||
void walkStep(int angle1, int angle2, int angle3);
|
||||
void throwStoppedAt(int x, int z);
|
||||
sceZoneStruct* processActor2Sub(int x, int y, int z, roomDataStruct* pRoomData);
|
||||
|
@ -53,7 +53,7 @@ void foundObject(int objIdx, int param);
|
|||
void hit(int animNumber,int arg_2,int arg_4,int arg_6,int hitForce,int arg_A);
|
||||
int checkZvCollision(ZVStruct* zvPtr1,ZVStruct* zvPtr2);
|
||||
void getZvCube(char* bodyPtr, ZVStruct* zvPtr);
|
||||
void putAt(int objIdx, int objIdxToPutAt);
|
||||
void PutAtObjet(int objIdx, int objIdxToPutAt);
|
||||
void SetClip(int left, int top, int right, int bottom);
|
||||
|
||||
///
|
||||
|
|
|
@ -148,7 +148,7 @@ void mainLoop(int allowSystemMenu, int deltaTime)
|
|||
|
||||
if(currentProcessedActorPtr->animActionType)
|
||||
{
|
||||
processAnimAction();
|
||||
GereFrappe();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ int copyObjectToActor(int body, int typeZv, int hardZvIdx, s16 objectType, int x
|
|||
{
|
||||
if(body!=-1)
|
||||
{
|
||||
getZvNormal(bodyPtr,zvPtr);
|
||||
GiveZVObjet(bodyPtr,zvPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ void getZvCube(char* bodyPtr, ZVStruct* zvPtr)
|
|||
zvPtr->ZVX1 = zvPtr->ZVZ1 = -zvPtr->ZVZ2;
|
||||
}
|
||||
|
||||
void getZvNormal(char* bodyPtr, ZVStruct* zvPtr)
|
||||
void GiveZVObjet(char* bodyPtr, ZVStruct* zvPtr)
|
||||
{
|
||||
s16* ptr;
|
||||
|
||||
|
@ -50,7 +50,7 @@ void getZvMax(char* bodyPtr, ZVStruct* zvPtr)
|
|||
int z1;
|
||||
int z2;
|
||||
|
||||
getZvNormal(bodyPtr,zvPtr);
|
||||
GiveZVObjet(bodyPtr,zvPtr);
|
||||
|
||||
x1 = zvPtr->ZVX1;
|
||||
x2 = zvPtr->ZVX2;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _ZV_H_
|
||||
#define _ZV_H_
|
||||
void getZvCube(char* bodyPtr, ZVStruct* zvPtr);
|
||||
void getZvNormal(char* bodyPtr, ZVStruct* zvPtr);
|
||||
void GiveZVObjet(char* bodyPtr, ZVStruct* zvPtr);
|
||||
void getZvMax(char* bodyPtr, ZVStruct* zvPtr);
|
||||
void makeDefaultZV(ZVStruct* zvPtr);
|
||||
void getZvMax(char* bodyPtr, ZVStruct* zvPtr);
|
||||
|
|
Loading…
Reference in New Issue