Skip to content

Commit c925fce

Browse files
authored
Actor::mType field (zeldaret#7)
* `Actor::mType` field * Fix struct sizes * Update symbols
1 parent 758f36f commit c925fce

File tree

10 files changed

+118
-86
lines changed

10 files changed

+118
-86
lines changed

config/eur/arm9/overlays/ov000/symbols.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,7 +2315,7 @@ _ZN5ActorC2Ev kind:function(arm,size=0xe8) addr:0x02098388
23152315
_ZN5ActorD1Ev kind:function(arm,size=0x4) addr:0x02098470
23162316
_ZN5ActorD0Ev kind:function(arm,size=0x14) addr:0x02098474
23172317
_ZN5ActorD2Ev kind:function(arm,size=0x4) addr:0x02098488
2318-
_ZN5Actor19func_ov000_0209848cEP27UnkStruct_ov000_020b539c_30 kind:function(arm,size=0x1c) addr:0x0209848c
2318+
_ZN5Actor19func_ov000_0209848cEP9ActorType kind:function(arm,size=0x1c) addr:0x0209848c
23192319
_ZN5Actor8vfunc_18Ev kind:function(arm,size=0x8) addr:0x020984a8
23202320
_ZN5Actor8vfunc_1cEv kind:function(arm,size=0x4) addr:0x020984b0
23212321
_ZN5Actor8vfunc_20Ev kind:function(arm,size=0x4) addr:0x020984b4
@@ -3033,7 +3033,7 @@ _ZN23ActorUnk_ov000_020a8bb08vfunc_54Ei kind:function(arm,size=0x4) addr:0x020a8
30333033
_ZN23ActorUnk_ov000_020a8bb08vfunc_1cEv kind:function(arm,size=0xc) addr:0x020a8da4
30343034
_ZN23ActorUnk_ov000_020a8bb019func_ov000_020a8db0Ev kind:function(arm,size=0x20) addr:0x020a8db0
30353035
_ZN23ActorUnk_ov000_020a8bb019func_ov000_020a8dd0Ev kind:function(arm,size=0x20) addr:0x020a8dd0
3036-
_ZN23ActorUnk_ov000_020a8bb019func_ov000_020a8df0Eii kind:function(arm,size=0x94) addr:0x020a8df0
3036+
_ZN23ActorUnk_ov000_020a8bb019func_ov000_020a8df0E8ActorRefi kind:function(arm,size=0x94) addr:0x020a8df0
30373037
_ZN23ActorUnk_ov000_020a8bb08vfunc_b4Ev kind:function(arm,size=0x18) addr:0x020a8e84
30383038
_ZN23ActorUnk_ov000_020a8bb019func_ov000_020a8e9cEP5Vec3p kind:function(arm,size=0x24) addr:0x020a8e9c
30393039
_ZN23ActorUnk_ov000_020a8bb08vfunc_b0Ev kind:function(arm,size=0x94) addr:0x020a8ec0

config/jp/arm9/overlays/ov000/symbols.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,7 +2312,7 @@ _ZN5ActorC2Ev kind:function(arm,size=0xe8) addr:0x02099b30
23122312
_ZN5ActorD1Ev kind:function(arm,size=0x4) addr:0x02099c18
23132313
_ZN5ActorD0Ev kind:function(arm,size=0x14) addr:0x02099c1c
23142314
_ZN5ActorD2Ev kind:function(arm,size=0x4) addr:0x02099c30
2315-
_ZN5Actor19func_ov000_0209848cEP27UnkStruct_ov000_020b539c_30 kind:function(arm,size=0x1c) addr:0x02099c34
2315+
_ZN5Actor19func_ov000_0209848cEP9ActorType kind:function(arm,size=0x1c) addr:0x02099c34
23162316
_ZN5Actor8vfunc_18Ev kind:function(arm,size=0x8) addr:0x02099c50
23172317
_ZN5Actor8vfunc_1cEv kind:function(arm,size=0x4) addr:0x02099c58
23182318
_ZN5Actor8vfunc_20Ev kind:function(arm,size=0x4) addr:0x02099c5c
@@ -3032,7 +3032,7 @@ _ZN23ActorUnk_ov000_020a8bb08vfunc_54Ei kind:function(arm,size=0x4) addr:0x020aa
30323032
_ZN23ActorUnk_ov000_020a8bb08vfunc_1cEv kind:function(arm,size=0xc) addr:0x020aa5a4
30333033
_ZN23ActorUnk_ov000_020a8bb019func_ov000_020a8db0Ev kind:function(arm,size=0x20) addr:0x020aa5b0
30343034
_ZN23ActorUnk_ov000_020a8bb019func_ov000_020a8dd0Ev kind:function(arm,size=0x20) addr:0x020aa5d0
3035-
_ZN23ActorUnk_ov000_020a8bb019func_ov000_020a8df0Eii kind:function(arm,size=0x94) addr:0x020aa5f0
3035+
_ZN23ActorUnk_ov000_020a8bb019func_ov000_020a8df0E8ActorRefi kind:function(arm,size=0x94) addr:0x020aa5f0
30363036
_ZN23ActorUnk_ov000_020a8bb08vfunc_b4Ev kind:function(arm,size=0x18) addr:0x020aa684
30373037
_ZN23ActorUnk_ov000_020a8bb019func_ov000_020a8e9cEP5Vec3p kind:function(arm,size=0x24) addr:0x020aa69c
30383038
_ZN23ActorUnk_ov000_020a8bb08vfunc_b0Ev kind:function(arm,size=0x94) addr:0x020aa6c0

include/Actor/Actor.hpp

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#pragma once
22

33
#include "Actor/ActorId.hpp"
4+
#include "Actor/ActorRef.hpp"
45
#include "Actor/ActorType.hpp"
6+
#include "Physics/Cylinder.hpp"
57
#include "System/SysNew.hpp"
68
#include "global.h"
79
#include "nitro/math.h"
@@ -18,23 +20,10 @@ class Actor_5c {
1820
void func_ov000_020975f8();
1921
};
2022

21-
class UnkStruct_ov000_020b539c_30 {
22-
public:
23-
/* 00 */ unk32 mUnk_00;
24-
/* 04 */ unk32 mUnk_04;
25-
/* 08 */ unk8 mUnk_08[0x18 - 0x08];
26-
/* 1c */ unk8 mUnk_18;
27-
/* 1c */ unk8 mUnk_19;
28-
/* 1c */ unk16 mUnk_1a;
29-
/* 1c */ unk16 mUnk_1c;
30-
/* 1e */ u16 mUnk_1e;
31-
/* 20 */
32-
};
33-
3423
class UnkStruct_ov000_020b539c {
3524
public:
3625
/* 00 */ unk8 mUnk_00[0x30];
37-
/* 30 */ UnkStruct_ov000_020b539c_30 *mUnk_30;
26+
/* 30 */ ActorType *mUnk_30;
3827
/* 34 */
3928

4029
void func_02028cdc(Actor_5c *param1, unk32 param2);
@@ -50,7 +39,7 @@ enum ActorFlag_ {
5039
ActorFlag_5,
5140
ActorFlag_6,
5241
ActorFlag_7,
53-
ActorFlag_8,
42+
ActorFlag_Grabbed,
5443
ActorFlag_9,
5544
ActorFlag_Interacting, // set when player interacts with actor
5645
ActorFlag_11,
@@ -85,8 +74,8 @@ class Actor : public SysObject {
8574
/* 28 */ u16 mAngle;
8675
/* 2a */ unk16 mUnk_2a;
8776
/* 2c */ unk32 mUnk_2c; // gravity?
88-
/* 30 */ unk32 *mUnk_30;
89-
/* 34 */ ActorTypeData *mUnk_34;
77+
/* 30 */ Cylinder *mUnk_30;
78+
/* 34 */ Cylinder *mUnk_34;
9079
/* 38 */ unk32 *mUnk_38;
9180
/* 3c */ unk32 mUnk_3c;
9281
/* 40 */ void *mUnk_40; // pointer to `Actor_c4`
@@ -116,8 +105,8 @@ class Actor : public SysObject {
116105
/* 80 */ unk16 mUnk_82;
117106
/* 84 */ unk32 mUnk_84;
118107
/* 88 */ unk32 mUnk_88;
119-
/* 8c */ unk32 mUnk_8c;
120-
/* 90 */ UnkStruct_ov000_020b539c_30 *mUnk_90;
108+
/* 8c */ ActorRef mRef;
109+
/* 90 */ ActorType *mType;
121110
/* 94 */
122111

123112
/* 00 */ virtual void vfunc_00(Vec3p *param1);
@@ -145,7 +134,7 @@ class Actor : public SysObject {
145134
unk32 func_01fff5d0(unk32 param1, unk32 param2);
146135

147136
Actor();
148-
void func_ov000_0209848c(UnkStruct_ov000_020b539c_30 *param1);
137+
void func_ov000_0209848c(ActorType *param1);
149138
void func_ov000_020984b0();
150139
void func_ov000_020984b4();
151140
void func_ov000_020984b8();

include/Actor/ActorRef.hpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#pragma once
2+
3+
#include "types.h"
4+
5+
#define ACTOR_INDEX_MASK 0x3fff
6+
7+
struct ActorRef {
8+
/* 0 */ s16 index;
9+
/* 2 */ s16 id;
10+
/* 4 */
11+
12+
inline void Reset() {
13+
*(u32 *) this = 0;
14+
}
15+
16+
inline bool operator==(const ActorRef &other) const {
17+
return this->index == other.index && this->id == other.id;
18+
}
19+
20+
inline bool operator!=(const ActorRef &other) const {
21+
return !(*this == other);
22+
}
23+
};

include/Actor/ActorType.hpp

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
11
#pragma once
22

33
#include "Actor/ActorId.hpp"
4+
#include "Physics/Cylinder.hpp"
45
#include "System/SysNew.hpp"
56
#include "types.h"
67

7-
struct ActorTypeData {
8-
/* 00 */ unk32 mUnk_00;
9-
/* 04 */ unk32 mUnk_04;
10-
/* 08 */ unk32 mUnk_08;
11-
/* 0c */ unk32 mUnk_0c;
12-
/* 10 */ unk8 mUnk_10[0x16 - 0x10];
13-
/* 16 */ unk16 mUnk_16;
14-
/* 18 */ unk16 mUnk_18;
15-
/* 1a */ unk16 mUnk_1a;
16-
/* 1c */ ActorId mActorId;
17-
/* 20 */ unk32 mUnk_20;
18-
/* 24 */ unk32 mUnk_24;
19-
/* 28 */ unk32 mUnk_28;
20-
/* 2c */ unk32 mUnk_2c;
21-
/* 30 */ unk32 mUnk_30;
22-
/* 34 */ unk8 mUnk_34;
23-
/* 35 */ unk8 mUnk_35;
24-
};
25-
268
class Actor;
279

2810
class ActorType : public SysObject {
2911
public:
3012
/* 00 (vtable) */
31-
/* 04 */ ActorTypeData mData;
13+
/* 04 */ Cylinder mUnk_04;
14+
/* 14 */ unk8 mUnk_14[0x18 - 0x14];
15+
/* 18 */ unk8 mUnk_18;
16+
/* 19 */ unk8 mUnk_19;
17+
/* 1a */ unk16 mUnk_1a;
18+
/* 1c */ unk16 mUnk_1c;
19+
/* 1e */ u16 mUnk_1e;
20+
/* 20 */ ActorId mActorId;
21+
/* 24 */ unk32 mUnk_24;
22+
/* 28 */ unk32 mUnk_28;
23+
/* 2c */ unk32 mUnk_2c;
24+
/* 30 */ unk32 mUnk_30;
25+
/* 34 */ unk32 mUnk_34;
26+
/* 38 */ unk8 mUnk_38;
27+
/* 39 */ unk8 mUnk_39;
3228
/* 3a */
3329

3430
ActorType(ActorId actorId);

include/Actor/ActorUnk_ov000_020a8bb0.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class ActorUnk_ov000_020a8bb0 : public Actor {
7979
/* 0b0 */ u16 mUnk_0b0;
8080
/* 0b4 */ unk32 mUnk_0b4;
8181
/* 0b8 */ unk32 mUnk_0b8;
82-
/* 0bc */ unk32 mUnk_0bc;
82+
/* 0bc */ ActorRef mUnk_0bc;
8383
/* 0c0 */ Vec3p mUnk_0c0;
8484
/* 0cc */ unk16 mUnk_0cc;
8585
/* 0cc */ unk16 mUnk_0ce;
@@ -152,7 +152,7 @@ class ActorUnk_ov000_020a8bb0 : public Actor {
152152
ActorUnk_ov000_020a8bb0(ActorUnk_ov000_020a8bb0_a4_00 *param1, unk32 param2);
153153
unk32 func_ov000_020a8db0();
154154
unk32 func_ov000_020a8dd0();
155-
void func_ov000_020a8df0(unk32 param1, unk32 param2);
155+
void func_ov000_020a8df0(ActorRef param1, unk32 param2);
156156
void func_ov000_020a8e9c(Vec3p *param1);
157157
void func_ov000_020a8ff4();
158158
void func_ov000_020a91b8(Vec3p *param1, unk32 param2);

include/Physics/Cylinder.hpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#pragma once
2+
3+
#include "types.h"
4+
5+
#include "nitro/math.h"
6+
7+
struct Cylinder {
8+
Vec3p pos;
9+
q20 size; // height and radius
10+
11+
inline Cylinder() {}
12+
inline Cylinder(q20 size) {
13+
pos.x = 0;
14+
pos.y = size;
15+
pos.z = 0;
16+
17+
this->size = size;
18+
}
19+
20+
inline void MakeEmpty() {
21+
pos = gVec3p_ZERO;
22+
size = -1;
23+
}
24+
};

src/000_Second/Actor/Actor.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ ARM Actor::Actor() {
1818
this->mFlags = 0;
1919
this->mUnk_84 = 0;
2020
this->mUnk_5c.func_ov000_020975f8();
21-
this->mUnk_8c = 0;
22-
this->mUnk_90 = 0;
21+
this->mRef.Reset();
22+
this->mType = NULL;
2323
data_ov000_020b539c.func_02028cdc(&this->mUnk_5c, 0x30);
2424
this->mPrevPos = this->mPos = this->mUnk_5c.mUnk_00;
2525
this->mAngle = this->mUnk_5c.mUnk_0c;
@@ -33,16 +33,16 @@ ARM Actor::Actor() {
3333
ARM Actor::~Actor() {}
3434

3535
// non-matching (equivalent)
36-
ARM void Actor::func_ov000_0209848c(UnkStruct_ov000_020b539c_30 *param1) {
36+
ARM void Actor::func_ov000_0209848c(ActorType *param1) {
3737
s16 unk_1c;
38-
unk32 *temp_r3;
38+
Cylinder *temp_r3;
3939

4040
unk_1c = param1->mUnk_1c;
4141
temp_r3 = &param1->mUnk_04;
4242

43-
this->mUnk_90 = param1;
44-
this->mUnk_30 = (unk32 *) this->mUnk_34 = temp_r3;
45-
this->mUnk_4e = unk_1c;
43+
this->mType = param1;
44+
this->mUnk_30 = this->mUnk_34 = temp_r3;
45+
this->mUnk_4e = unk_1c;
4646
}
4747

4848
ARM unk32 Actor::vfunc_18(unk32 param1) {
@@ -97,15 +97,15 @@ ARM void Actor::func_ov000_0209853c(void) {
9797
}
9898

9999
ARM bool Actor::vfunc_04() {
100-
return this->mUnk_90->mUnk_1e & 1;
100+
return this->mType->mUnk_1e & 1;
101101
}
102102

103103
ARM unk16 Actor::vfunc_08() {
104-
return this->mUnk_90->mUnk_1a;
104+
return this->mType->mUnk_1a;
105105
}
106106

107107
ARM unk8 Actor::vfunc_0c() {
108-
return this->mUnk_90->mUnk_18;
108+
return this->mType->mUnk_18;
109109
}
110110

111111
// non-matching
@@ -115,11 +115,11 @@ ARM unk32 Actor::vfunc_38(unk32 param1) {
115115

116116
var_r3 = param1 >> 16;
117117

118-
if (GET_FLAG(&this->mFlags, ActorFlag_8)) {
118+
if (GET_FLAG(&this->mFlags, ActorFlag_Grabbed)) {
119119
return 0;
120120
}
121121

122-
SET_FLAG(&this->mFlags, ActorFlag_8);
122+
SET_FLAG(&this->mFlags, ActorFlag_Grabbed);
123123
stack_c = this->mFlags;
124124

125125
switch (stack_c) {
@@ -141,12 +141,12 @@ ARM unk32 Actor::vfunc_38(unk32 param1) {
141141

142142
// non-matching
143143
ARM bool Actor::vfunc_3c(unk32 param2, Vec3p *param3) {
144-
if (!GET_FLAG(&this->mFlags, ActorFlag_8)) {
144+
if (!GET_FLAG(&this->mFlags, ActorFlag_Grabbed)) {
145145
return false;
146146
}
147147

148148
this->mVel = *param3;
149-
UNSET_FLAG(&this->mFlags, ActorFlag_8);
149+
UNSET_FLAG(&this->mFlags, ActorFlag_Grabbed);
150150
return true;
151151
}
152152

src/000_Second/Actor/ActorUnk_ov000_020a8bb0.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,32 @@ ARM ActorUnk_ov000_020a8bb0::ActorUnk_ov000_020a8bb0(ActorUnk_ov000_020a8bb0_a4_
2424
this->mUnk_0a4.mUnk_08 = 0;
2525
this->mUnk_0b4 = -1;
2626
this->mUnk_0b8 = 0;
27-
this->mUnk_0bc = 0;
28-
this->mUnk_0c0.x = 0;
29-
this->mUnk_0c0.y = 0;
30-
this->mUnk_0c0.z = 0;
31-
this->mUnk_0cc = 0;
32-
this->mUnk_0ce = 0;
33-
this->mUnk_0d0 = 0;
34-
this->mUnk_0d4 = 0;
35-
this->mUnk_0d8 = 0;
36-
this->mUnk_0da = 0;
37-
this->mUnk_0dc = 0x2AAB;
38-
this->mUnk_0de = 0xEAAB;
39-
this->mUnk_0e0 = 0x1555;
40-
this->mUnk_0e4 = 0;
41-
this->mUnk_0e8 = 0;
42-
this->mUnk_0ea = 0;
27+
this->mUnk_0bc.Reset();
28+
this->mUnk_0c0.x = 0;
29+
this->mUnk_0c0.y = 0;
30+
this->mUnk_0c0.z = 0;
31+
this->mUnk_0cc = 0;
32+
this->mUnk_0ce = 0;
33+
this->mUnk_0d0 = 0;
34+
this->mUnk_0d4 = 0;
35+
this->mUnk_0d8 = 0;
36+
this->mUnk_0da = 0;
37+
this->mUnk_0dc = 0x2AAB;
38+
this->mUnk_0de = 0xEAAB;
39+
this->mUnk_0e0 = 0x1555;
40+
this->mUnk_0e4 = 0;
41+
this->mUnk_0e8 = 0;
42+
this->mUnk_0ea = 0;
4343
this->mUnk_0ec.func_ov024_020d6668();
44-
uVar2 = this->mUnk_34->mUnk_0c;
44+
uVar2 = this->mUnk_34->size;
4545
this->mUnk_114 = -1;
4646
this->mUnk_118 = 0x1000;
4747
this->mUnk_11c = 0x019A;
4848
this->mUnk_104 = 0;
4949
this->mUnk_108 = uVar2;
5050
this->mUnk_10c = 0;
5151
this->mUnk_110 = uVar2;
52-
this->mUnk_30 = &this->mUnk_104;
52+
this->mUnk_30 = (Cylinder *) &this->mUnk_104;
5353
this->mUnk_4a = 5;
5454
this->mUnk_44 = 0x1F;
5555
this->mUnk_094.mUnk_08 = 3;
@@ -88,14 +88,14 @@ ARM unk32 ActorUnk_ov000_020a8bb0::func_ov000_020a8dd0() {
8888
}
8989

9090
// non-matching
91-
ARM void ActorUnk_ov000_020a8bb0::func_ov000_020a8df0(unk32 param1, unk32 param2) {
91+
ARM void ActorUnk_ov000_020a8bb0::func_ov000_020a8df0(ActorRef param1, unk32 param2) {
9292
if (!((u32) (((param2 + 8) - param2) / 2) < 2)) {
9393
this->mUnk_0b0 |= 2;
9494
} else {
9595
this->mUnk_0b0 &= ~2;
9696
}
9797

98-
if (this->mUnk_8c != param1) {
98+
if (this->mRef != param1) {
9999
this->vfunc_b4();
100100
this->mUnk_0bc = param1;
101101
this->mUnk_0c0.x = 0;
@@ -118,7 +118,7 @@ ARM void ActorUnk_ov000_020a8bb0::func_ov000_020a8e9c(Vec3p *param1) {
118118
this->mUnk_0c0.x = x;
119119
this->mUnk_0c0.y = y;
120120
this->mUnk_0c0.z = x;
121-
this->mUnk_0bc = 0;
121+
this->mUnk_0bc.Reset();
122122
}
123123

124124
ARM void ActorUnk_ov000_020a8bb0::vfunc_b0() {

0 commit comments

Comments
 (0)