Skip to content

Commit

Permalink
CBattleManager.cpp progress
Browse files Browse the repository at this point in the history
  • Loading branch information
CelestialAmber committed Oct 6, 2024
1 parent be9f780 commit 49134b4
Show file tree
Hide file tree
Showing 16 changed files with 518 additions and 400 deletions.
2 changes: 1 addition & 1 deletion config/jp/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22288,7 +22288,7 @@ func_801BFABC = .text:0x801BFABC; // type:function size:0x28 scope:global align:
func_801BFAE4 = .text:0x801BFAE4; // type:function size:0x4 scope:global align:4
func_801BFAE8 = .text:0x801BFAE8; // type:function size:0x4C scope:global align:4
func_801BFB34 = .text:0x801BFB34; // type:function size:0x104 scope:global align:4
func_801BFC38 = .text:0x801BFC38; // type:function size:0x1B0 scope:global align:4
func_801BFC38__Q22cf10CfSoundManFUlUlUlUlf = .text:0x801BFC38; // type:function size:0x1B0 scope:global align:4
func_801BFDE8 = .text:0x801BFDE8; // type:function size:0x38 scope:global align:4
func_801BFE20 = .text:0x801BFE20; // type:function size:0x38 scope:global align:4
func_801BFE58 = .text:0x801BFE58; // type:function size:0x34 scope:global align:4
Expand Down
90 changes: 90 additions & 0 deletions src/kyoshin/appgame/cf/CBattleManager.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,99 @@
#include "kyoshin/appgame/cf/CBattleManager.hpp"
#include "kyoshin/appgame/UnkClass_805764CC.hpp"
#include "kyoshin/appgame/cf/object/CfObjectPc.hpp"
#include "kyoshin/appgame/cf/object/CfObjectEne.hpp"
#include "kyoshin/appgame/cf/CfSoundMan.hpp"
#include "monolib/MemManager.hpp"
#include "monolib/work/CWorkSystem.hpp"

extern UNKTYPE* func_8009EC9C(u16 r3);
extern void func_8009D7E4(UNKTYPE* r3, u32 r4);

namespace cf{
u32 CBattleManager::lbl_804F8228[] = {
0,
0x1AD,
0x1AA,
0x1B0,
0x1B6,
0x1BA,
0x1B5,
0x1B7,
0x1B8,
0x1B9
};

void func_800D7A04(CfObjectPc* pObjectPc, CfObjectEne* pObjectEne){
CActorParam_UnkStruct1* r3 = pObjectPc->CActorParam_vtableFunc129();
u32 flags = r3->unk74;

if(flags & 0x2){
CfSoundMan::func_801BFC38(0, 0x192, 0, 0, 0.6f);
CfSoundMan::func_801BFC38(0, 0x191, 0, 0, 0.6f);
}else if(flags & 0x2000){
CfSoundMan::func_801BFC38(0, 0x1C5, 0, 0, 0.6f);
}else{
CActorParam_UnkStruct2* r30 = r3->unk50;

if(r30 != nullptr){
if(r30->unk78 & 0x1000000){
if(pObjectEne->CActorParam_vtableFunc19() == 1 ||
pObjectEne->CActorParam_vtableFunc19() == 2){
if(!(r30->unk78 & 0x200)){
CfSoundMan::func_801BFC38(0, 0x1B4, 0, 0, 0.6f);
return;
}
}else if(!(r30->unk78 & 0x200)){
CfSoundMan::func_801BFC38(0, 0x1B5, 0, 0, 0.6f);
return;
}
}else if((r30->unk78 & 0x2000000) && !(r30->unk78 & 0x200)){
CfSoundMan::func_801BFC38(0, 0x1B5, 0, 0, 0.6f);
return;
}

if((s32)r30->unk40 == 1){
if(flags & 0x100){
CfSoundMan::func_801BFC38(0, 0x1AF, 0, 0, 0.6f);
}else{
//likely an inline
if(pObjectEne != nullptr && pObjectEne->unk64 & 0x2){
UNKTYPE* r3_1 = func_8009EC9C(pObjectEne->unk8C_3);
func_8009D7E4((UNKTYPE*)((u32)r3_1 + 0x1C), 1);
}

if(pObjectEne->CActorParam_vtableFunc19() == 1 ||
pObjectEne->CActorParam_vtableFunc19() == 2){
CfSoundMan::func_801BFC38(0, 0x1AE, 0, 0, 0.6f);
}else{
CfSoundMan::func_801BFC38(0, 0x1AD, 0, 0, 0.6f);
}
}
}else if((s32)r30->unk40 == 2){
if(flags & 0x100){
CfSoundMan::func_801BFC38(0, 0x1AC, 0, 0, 0.6f);
}else{
//likely an inline
if(pObjectEne != nullptr && pObjectEne->unk64 & 0x2){
UNKTYPE* r3_1 = func_8009EC9C(pObjectEne->unk8C_3);
func_8009D7E4((UNKTYPE*)((u32)r3_1 + 0x1C), 1);
}

if(pObjectEne->CActorParam_vtableFunc19() == 1 ||
pObjectEne->CActorParam_vtableFunc19() == 2){
CfSoundMan::func_801BFC38(0, 0x1AB, 0, 0, 0.6f);
}else{
CfSoundMan::func_801BFC38(0, 0x1AA, 0, 0, 0.6f);
}
}
}else{
u32 r4 = CBattleManager::lbl_804F8228[r30->unk40];
CfSoundMan::func_801BFC38(0, r4, 0, 0, 0.6f);
}
}
}
}

CBattleManager::CBattleManager() : unk84(0) {
int heapIndex = WorkThreadSystem::getHeapIndex();
mActorList1.initList(64, heapIndex);
Expand Down
12 changes: 7 additions & 5 deletions src/kyoshin/appgame/cf/CBattleManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ namespace cf{
};

struct CBattleManager_Struct1 {
u8 unk0[0x100];
u32 unk0[64];

CBattleManager_Struct1(){
u8* r30 = unk0;
u8* r31 = unk0 + 0x100;
u32* r31 = (u32*)((u32)unk0 + sizeof(unk0));
u32* r30 = unk0;
do{
std::memset(r30, 0, 8);
r30 += 8;
std::memset(r30, 0, sizeof(u32) * 2);
r30 += 2;
} while(r30 < r31);
std::memset(unk0, 0, sizeof(unk0));
}
Expand Down Expand Up @@ -80,6 +80,8 @@ namespace cf{
CSuddenCommu mSuddenCommu; //0x216C
CVision mVision; //0x219C

static u32 lbl_804F8228[];

protected:
static CBattleManager* instance;
};
Expand Down
10 changes: 10 additions & 0 deletions src/kyoshin/appgame/cf/CfSoundMan.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

#include "types.h"

namespace cf {
class CfSoundMan {
public:
static void func_801BFC38(u32 r3, u32 r4, u32 r5, u32 r6, float f1);
};
}
4 changes: 2 additions & 2 deletions src/kyoshin/appgame/cf/object/CAIAction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace cf{
class CAIAction{
public:
virtual void CAIAction_vtableFunc1();
virtual void CAIAction_vtableFunc2();
virtual void CAIAction_vtableFunc1(); //0x8
virtual void CAIAction_vtableFunc2(); //0xC

u8 unk3384[0xB18]; //temporary
};
Expand Down
Loading

0 comments on commit 49134b4

Please sign in to comment.