-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathObjectCommon.cpp
More file actions
102 lines (77 loc) · 2.16 KB
/
Copy pathObjectCommon.cpp
File metadata and controls
102 lines (77 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "stdafx.h"
#include "objects.h"
NJS_TEXNAME SA2_OBJ_TEXNAMES[43];
NJS_TEXLIST SA2_OBJ_TEXLIST = { arrayptrandlength(SA2_OBJ_TEXNAMES) };
PVMEntry SA2_OBJ_PVM = { "common-obj", &SA2_OBJ_TEXLIST };
PVMEntry FroggyTex = { "big_kaeru", &big_kaeru_TEXLIST };
void CheckAndLoadTriggerObject() {
if (!CharObj2Ptrs[0])
return;
if (CurrentLevel == LevelIDs_SandHill)
LoadObject((LoadObj)2, 2, LoadRemoveCart);
HotShelterSecretSwitch();
}
void Load_ObjectsCommon()
{
if (CurrentMission == Mission2_100Rings || CurrentStageVersion == KnucklesVersion && CurrentCharacter != Characters_Knuckles)
LoadObject((LoadObj)2, 1, MissionResultCheck);
}
//Create an object so Gamma can hit some specific bosses.
CollisionData col = { 0, 0, 0x77, 0, 0x800400, { 6.0, 6.0, 6.0}, 0, 0 };
void TargetableEntity(ObjectMaster* obj)
{
EntityData1* data = obj->Data1;
if (data->Action == 0) {
AllocateObjectData2(obj, obj->Data1);
//if the scale is specified, temporary set the collision scale to it.
if (data->Scale.x) {
Collision_Init(obj, &col, 1, 2u);
}
else {
Collision_Init(obj, &col, 1, 2u);
}
data->Action = 1;
}
else {
ObjectMaster* boss = (ObjectMaster*)obj->Data1->LoopData;
if (CurrentLevel == LevelIDs_Zero && boss->Data1->Action == 9)
return;
if (!boss || !boss->Data1) {
CheckThingButThenDeleteObject(obj);
return;
}
for (uint8_t i = 0; i < PMax; i++)
{
if (playertwp[i] && EntityData1Ptrs[i]->CharID == Characters_Gamma)
break;
if (i >= PMax)
{
return;
}
}
data->Position = boss->Data1->Position;
data->Position.y += 10;
if (OhNoImDead(obj->Data1, (ObjectData2*)obj->Data2))
{
CheckThingButThenDeleteObject(obj);
//if it is set, don't reload the target object
if (data->CharID == 1)
return;
ObjectMaster* target = LoadObject((LoadObj)(LoadObj_Data1 | LoadObj_Data2), 2, TargetableEntity);
target->Data1->LoopData = (Loop*)boss;
}
else
{
AddToCollisionList(data);
}
}
}
void Objects_Common_Init()
{
LoadMysticMelody_Models();
Set_BackRing();
Set_ZeroChase();
init_CartStuff();
help.RegisterCommonObjectPVM(SA2_OBJ_PVM);
help.RegisterCommonObjectPVM(FroggyTex);
}