Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Gh0stBlade/KAIN2
Browse files Browse the repository at this point in the history
  • Loading branch information
Gh0stBlade committed Nov 14, 2023
2 parents 06cd0c0 + 97ac818 commit 1f36602
Show file tree
Hide file tree
Showing 4 changed files with 491 additions and 767 deletions.
22 changes: 20 additions & 2 deletions KAIN2/Game/DEBUG.C
Original file line number Diff line number Diff line change
Expand Up @@ -1932,9 +1932,27 @@ void DEBUG_FillUpHealth(long* var)
RAZIEL_DebugManaFillUp();
}

void DEBUG_FogLoad(void)
void DEBUG_FogLoad() // Matching - 97.88%
{
UNIMPLEMENTED();
int temp, temp2, temp3, temp4, temp5; // not in SYMDUMP
struct _StreamUnit* currentUnit;

currentUnit = FindStreamUnitFromLevel(gameTrackerX.level);
temp = currentUnit->TargetFogFar;
debugFogFar = temp;
debugOrgFogFar = temp;
temp2 = currentUnit->TargetFogNear;
debugFogNear = temp2;
debugOrgFogNear = temp2;
temp3 = (currentUnit->FogColor >> 16) & 0xFF;
debugFogRed = temp3;
debugOrgFogRed = temp3;
temp4 = (currentUnit->FogColor >> 8) & 0xFF;
debugFogGrn = temp4;
debugOrgFogGrn = temp4;
temp5 = (currentUnit->FogColor >> 0) & 0xFF;
debugFogBlu = temp5;
debugOrgFogBlu = temp5;
}


Expand Down
110 changes: 74 additions & 36 deletions KAIN2/Game/RAZIEL/ATTACK.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include "Game/CORE.H"
#include "ATTACK.H"
#include <Game/STATE.H>
#include "RAZIEL.H"
#include "CONTROL.H"
#include "STEERING.H"


// autogenerated function stub:
Expand Down Expand Up @@ -152,42 +156,76 @@ void StateHandlerAttack2(struct __CharacterState *In, int CurrentSection, int Da
}


// autogenerated function stub:
// void /*$ra*/ StateHandlerCannedReaction(struct __CharacterState *In /*$s1*/, int CurrentSection /*$s2*/, int Data /*$s4*/)
void StateHandlerCannedReaction(struct __CharacterState *In, int CurrentSection, int Data)
{ // line 651, offset 0x8009cf38
/* begin block 1 */
// Start line: 652
// Start offset: 0x8009CF38
// Variables:
struct __Event *Ptr; // $v0

/* begin block 1.1 */
// Start line: 694
// Start offset: 0x8009D0F8
// Variables:
struct _Instance *Inst; // $v0
/* end block 1.1 */
// End offset: 0x8009D114
// End Line: 697

/* begin block 1.2 */
// Start line: 707
// Start offset: 0x8009D11C
// Variables:
//struct _Instance *Inst; // $s0
/* end block 1.2 */
// End offset: 0x8009D18C
// End Line: 724
/* end block 1 */
// End offset: 0x8009D1A8
// End Line: 767

/* begin block 2 */
// Start line: 1341
/* end block 2 */
// End Line: 1342
UNIMPLEMENTED();
void StateHandlerCannedReaction(struct __CharacterState* In, int CurrentSection, int Data) // Matching - 99.05%
{
struct __Event* Ptr;
struct _Instance* Inst;
struct _Instance* temp; // had to use a different name than in SYMDUMP for this one

while (Ptr = PeekMessageQueue(&In->SectionList[CurrentSection].Event))
{
if (Ptr != NULL)
{
switch (Ptr->ID)
{
case 0x100001:
if (CurrentSection == 0)
{
Raziel.alarmTable = 4500;
Raziel.Mode = 0x10000;
ControlFlag = 0x1041009;
PhysicsMode = 3;
SteerSwitchMode(In->CharacterInstance, 0);
In->CharacterInstance->anim.section[0].swAlarmTable = &Raziel.alarmTable;
}
break;
case 0x100004:
if (CurrentSection == 1)
{
G2EmulationSwitchAnimationSync(In, 2, 1, 4);
}
break;
case 0x100014:
case 0x08000000:
StateSwitchStateData(In, CurrentSection, &StateHandlerIdle, SetControlInitIdleData(0, 0, 3));
Raziel.Mode = 1;
break;
case 0x8000003:
if (CurrentSection == 0)
{
temp = razGetHeldItem();
if (Raziel.Senses.EngagedMask & 0x200)
{
INSTANCE_Post(Raziel.Senses.EngagedList[9].instance, 0x100000A, SetMonsterImpaleData(temp, &In->CharacterInstance->rotation, &In->CharacterInstance->position, 520));
}
}
break;
case 0x8000004:
Inst = razGetHeldItem();
INSTANCE_Post(Inst, 0x800008, 2);
razReaverOn();
if (Raziel.Senses.EngagedMask & 0x200)
{
INSTANCE_Post(Raziel.Senses.EngagedList[9].instance, 0x100000A, SetMonsterImpaleData(Inst, &In->CharacterInstance->rotation, &In->CharacterInstance->position, 520));
}
break;
case 0x80000000:
break;
case 0x80000008:
break;
case 0x1000001:
break;
case 0x1000000:
break;
case 0x80000020:
break;
default:
DefaultStateHandler(In, CurrentSection, Data);
break;
}
DeMessageQueue(&In->SectionList[CurrentSection].Event);
}
}
}


Expand Down
127 changes: 78 additions & 49 deletions KAIN2/Game/RAZIEL/PUPPET.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "CONTROL.H"
#include "ALGOCTRL.H"
#include "STEERING.H"
#include <Game/G2/ANMG2ILF.H>


// autogenerated function stub:
Expand Down Expand Up @@ -140,58 +141,86 @@ void StateHandlerMoveToPosition(struct __CharacterState *In, int CurrentSection,
UNIMPLEMENTED();
}

void DefaultPuppetStateHandler(struct __CharacterState* In, int CurrentSection, int Data) // Matching - 98.99%
{
struct __Event* Ptr;
struct evPositionData* data;
long _x1;
long _y1;
long _z1;
struct _Vector* _v0;

// autogenerated function stub:
// void /*$ra*/ DefaultPuppetStateHandler(struct __CharacterState *In /*$s1*/, int CurrentSection /*$s0*/, int Data /*$s2*/)
void DefaultPuppetStateHandler(struct __CharacterState *In, int CurrentSection, int Data)
{ // line 174, offset 0x8009afc8
/* begin block 1 */
// Start line: 175
// Start offset: 0x8009AFC8
// Variables:
struct __Event *Ptr; // $a1

/* begin block 1.1 */
// Start line: 194
// Start offset: 0x8009B190
// Variables:
struct evPositionData *data; // $v0
/* end block 1.1 */
// End offset: 0x8009B190
// End Line: 194

/* begin block 1.2 */
// Start line: 201
// Start offset: 0x8009B1A4
// Variables:
//struct evPositionData *data; // $v1

/* begin block 1.2.1 */
// Start line: 203
// Start offset: 0x8009B1A4
// Variables:
long _x1; // $a0
long _y1; // $a2
long _z1; // $a1
struct _Vector *_v0; // $v0
/* end block 1.2.1 */
// End offset: 0x8009B1A4
// End Line: 203
/* end block 1.2 */
// End offset: 0x8009B1E4
// End Line: 208
/* end block 1 */
// End offset: 0x8009B264
// End Line: 240

/* begin block 2 */
// Start line: 383
/* end block 2 */
// End Line: 384
UNIMPLEMENTED();
Ptr = PeekMessageQueue(&In->SectionList[CurrentSection].Event);
if (Ptr != NULL)
{
switch (Ptr->ID)
{
case 0x100004:
razResetMotion(gameTrackerX.playerInstance);
break;
case 0x4000A:
STREAM_SetInstancePosition(gameTrackerX.playerInstance, (struct evPositionData*)Ptr->Data);
break;
case 0x4000B:
if (CurrentSection == 0)
{
data = (struct evPositionData*)Ptr->Data;
gameTrackerX.playerInstance->rotation.z = data->z;
}
break;
case 0x4000F:
_v0 = &Raziel.Senses.lookAtPoint;
_x1 = ((struct evPositionData*)Ptr->Data)->x;
_y1 = ((struct evPositionData*)Ptr->Data)->y;
_z1 = ((struct evPositionData*)Ptr->Data)->z;
_v0->x = _x1;
_v0->y = _y1;
_v0->z = _z1;
Raziel.Senses.Flags |= 16;
ControlFlag |= 0x20000;
break;
case 0x40020:
if (CurrentSection == 0)
{
G2Anim_SetSpeedAdjustment(&gameTrackerX.playerInstance->anim, Ptr->Data);
}
break;
case 0x800027:
if (Data != 0)
{
ControlFlag |= 8;
break;
}
ControlFlag &= 0xFFFFFFF7;
break;
case 0x10002002:
razMaterialShift();
break;
case 0x10002001:
razSpectralShift();
break;
case 0x8000000:
break;
case 0x1000001:
break;
case 0x80000020:
break;
case 0x80000008:
break;
case 0x80000010:
break;
case 0x80000000:
break;
case 0x100009:
break;
case 0x4010200:
break;
default:
DefaultStateHandler(In, CurrentSection, Data);
}
}
}


// autogenerated function stub:
// void /*$ra*/ StateHandlerWarpGate(struct __CharacterState *In /*$s0*/, int CurrentSection /*$s1*/, int Data /*$s4*/)
void StateHandlerWarpGate(struct __CharacterState *In, int CurrentSection, int Data)
Expand Down
Loading

0 comments on commit 1f36602

Please sign in to comment.