Skip to content

Commit faf5c50

Browse files
committed
Add A6Gorgon Cutscene Record from N64 Hardware & Refactor code.
1 parent fd1a1d6 commit faf5c50

File tree

10 files changed

+221
-214
lines changed

10 files changed

+221
-214
lines changed

include/fox_record.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Used to reproduce recordings made from real N64 hardware
3-
* to accurately reproduce Cutscenes at the correct speed.
3+
* to accurately play cutscenes at the correct speed.
44
* These recordings adjust gVisPerFrame during runtime to produce
55
* the same behaviour as the original game.
66
*/
@@ -15,8 +15,19 @@ typedef struct Record {
1515
} Record;
1616

1717
extern Record gCarrierCutsceneRecord[13];
18+
extern Record gWarpzoneCsRecord[19];
19+
extern Record gA6GorgonCsRecord[12];
20+
extern Record gSyRobotCutsceneRecord[3];
21+
extern Record gAndrossRobotKillCutscene2[20];
22+
extern Record gAndrossRobotKillCutscene1[25];
23+
extern Record gMacbethCutsceneRecord[14];
24+
extern Record gGrangaCutsceneRecord[13];
25+
extern Record gMeCrusherCutsceneRecord[3];
26+
extern Record gEndingCsRecord[37];
1827

19-
void UpdateVisPerFrameFromRecording(Record* record, s32 maxFrames);
20-
void UpdateVisPerFrameFromRecording_Ending(Record* record, s32 maxFrames);
28+
extern int gA6GorgonCsFrameCount;
29+
extern int gWarpzoneCsFrameCount;
30+
31+
void UpdateVisPerFrameFromRecording(Record* record, s32 maxFrames, int* frameCounter);
2132

2233
#endif

src/engine/cutscene_record.c

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
#include "global.h"
2+
#include "fox_record.h"
3+
4+
void UpdateVisPerFrameFromRecording(Record* record, s32 maxFrames, int* frameCounter) {
5+
int i;
6+
7+
if (*frameCounter > record[maxFrames - 1].frame) {
8+
return;
9+
}
10+
11+
for (i = 0; i < maxFrames; i++) {
12+
if (*frameCounter == record[i].frame) {
13+
gVIsPerFrame = record[i].vis;
14+
}
15+
}
16+
}
17+
18+
int gWarpzoneCsFrameCount = 0;
19+
int gA6GorgonCsFrameCount = 0;
20+
21+
Record gWarpzoneCsRecord[19] = {
22+
{ 2, 1 }, { 3, 3 }, { 4, 4 }, { 3, 8 }, { 2, 9 }, { 3, 52 }, { 2, 54 }, { 3, 69 }, { 2, 70 }, { 3, 75 },
23+
{ 2, 76 }, { 3, 79 }, { 2, 117 }, { 3, 118 }, { 2, 120 }, { 3, 145 }, { 2, 215 }, { 3, 216 }, { 2, 230 },
24+
};
25+
26+
Record gA6GorgonCsRecord[12] = {
27+
{ 3, 0 }, { 4, 3 }, { 5, 6 }, { 4, 37 }, { 5, 38 }, { 4, 44 },
28+
{ 3, 53 }, { 4, 54 }, { 3, 57 }, { 4, 58 }, { 3, 59 }, { 2, 170 },
29+
};
30+
31+
Record gEndingCsRecord[37] = {
32+
{ 2, 0 }, { 5, 1 }, { 2, 2 }, { 3, 277 }, { 2, 278 }, { 3, 340 }, { 2, 397 }, { 3, 537 },
33+
{ 2, 538 }, { 3, 548 }, { 2, 549 }, { 3, 568 }, { 2, 569 }, { 3, 620 }, { 2, 623 }, { 3, 803 },
34+
{ 2, 806 }, { 3, 814 }, { 2, 823 }, { 3, 1282 }, { 2, 1284 }, { 5, 3703 }, { 2, 3704 }, { 4, 3904 },
35+
{ 2, 3905 }, { 3, 4782 }, { 2, 4783 }, { 3, 4785 }, { 2, 4820 }, { 3, 4986 }, { 2, 6779 }, { 5, 6780 },
36+
{ 2, 6781 }, { 3, 6785 }, { 4, 6786 }, { 3, 6793 }, { 2, 6799 },
37+
};
38+
39+
// MeCrusher destroy cutscene timings recorded from a real N64
40+
Record gMeCrusherCutsceneRecord[3] = {
41+
{ 2, 0 },
42+
{ 3, 200 },
43+
{ 2, 224 },
44+
};
45+
46+
// Carrier destroy cutscene timings recorded from a real N64
47+
Record gCarrierCutsceneRecord[13] = {
48+
{ 2, 0 },
49+
{ 3, 2 },
50+
{ 4, 16 },
51+
{ 3, 50 },
52+
{ 4, 58 },
53+
{ 5, 67 },
54+
{ 4, 68 },
55+
{ 5, 71 },
56+
{ 4, 73 },
57+
{ 5, 74 },
58+
{ 4, 106 },
59+
{ 3, 146 },
60+
{ 2, 194 },
61+
};
62+
63+
// Granga destroy cutscene timings recorded from a real N64
64+
Record gGrangaCutsceneRecord[13] = {
65+
{ 2, 0 },
66+
{ 3, 1 },
67+
{ 2, 5 },
68+
{ 3, 7 },
69+
{ 2, 52 },
70+
{ 3, 78 },
71+
{ 4, 103 },
72+
{ 3, 125 },
73+
{ 2, 153 },
74+
{ 3, 155 },
75+
{ 2, 157 },
76+
{ 3, 158 },
77+
{ 2, 160 },
78+
};
79+
80+
// Train cutscene timings recorded from a real N64
81+
Record gMacbethCutsceneRecord[14] = {
82+
// Train breaking barriers
83+
{ 2, 0 },
84+
{ 3, 2 },
85+
{ 2, 31 },
86+
{ 3, 400 },
87+
{ 2, 418 },
88+
{ 3, 433 },
89+
{ 4, 435 },
90+
{ 3, 444 },
91+
{ 2, 509 },
92+
// { 3, 559 },
93+
// { 2, 581 },
94+
// { 3, 587 },
95+
// Explosions
96+
{ 2, 589 },
97+
{ 3, 714 },
98+
{ 4, 821 },
99+
{ 5, 849 },
100+
{ 2, 942 },
101+
};
102+
103+
// clang-format off
104+
105+
// After defeating Andross
106+
/*
107+
03 00 00 00 02 00 00 08 03 00 00 13 02 00 00 23 03 00 00 9C 02 00 00 A6 03 00 00 C1 04 00 00 C6 03 00 00 C7 04 00 00 C9
108+
03 00 00 CD 04 00 00 CF 03 00 00 D7 04 00 00 EA 03 00 00 EC 04 00 00 ED 03 00 00 EF 04 00 00 F4 03 00 00 F5 04 00 00 F6
109+
03 00 01 10 04 00 01 12 03 00 01 22 04 00 01 24 03 00 01 27 04 00 01 2D 03 00 01 2E 04 00 01 30 03 00 01 31 04 00 01 33
110+
03 00 01 4C 04 00 01 4E 03 00 01 4F
111+
*/
112+
Record gAndrossRobotKillCutscene1[25] = {
113+
{ 3, 0 },
114+
{ 2, 8 },
115+
{ 3, 19 },
116+
{ 2, 35 },
117+
{ 3, 156 },
118+
{ 2, 166 },
119+
{ 3, 193 },
120+
{ 4, 198 },
121+
{ 3, 199 },
122+
{ 4, 201 },
123+
{ 3, 205 },
124+
{ 4, 207 },
125+
{ 3, 215 },
126+
{ 4, 234 },
127+
// { 3, 236 },
128+
{ 4, 237 },
129+
{ 3, 239 },
130+
{ 4, 244 },
131+
// { 3, 245 },
132+
{ 4, 246 },
133+
// { 3, 272 },
134+
{ 4, 274 },
135+
// { 3, 290 },
136+
{ 4, 292 },
137+
// { 3, 295 }, // too much?
138+
{ 4, 301 },
139+
// { 3, 302 },
140+
{ 4, 304 },
141+
// { 3, 305 },
142+
{ 4, 307 },
143+
// { 3, 332 },
144+
{ 4, 334 },
145+
// { 3, 335 },
146+
{ 2, 339 },
147+
};
148+
149+
/*
150+
04 00 00 00 02 00 00 01 05 00 00 02 02 00 00 03 03 00 00 2A 02 00 00 2B 03 00 00 39 02 00 00 3A 03 00 00 3F 02 00 00 45
151+
03 00 00 9E 04 00 00 A1 05 00 00 A3 04 00 00 B6 03 00 00 B9 04 00 00 BD 05 00 00 C1 04 00 00 CD 03 00 00 CF 02 00 00 D3
152+
*/
153+
Record gAndrossRobotKillCutscene2[20] = {
154+
{ 4, 0 },
155+
{ 2, 1 },
156+
{ 5, 2 },
157+
{ 2, 3 },
158+
{ 3, 42 },
159+
{ 2, 43 },
160+
{ 3, 57 },
161+
{ 2, 58 },
162+
{ 3, 63 },
163+
{ 2, 69 },
164+
{ 3, 158 },
165+
{ 4, 161 },
166+
{ 5, 163 },
167+
{ 4, 182 },
168+
{ 3, 185 },
169+
{ 4, 189 },
170+
{ 5, 193 },
171+
{ 4, 205 },
172+
{ 3, 207 },
173+
{ 2, 211 },
174+
};
175+
// clang-format on
176+
177+
// SyRobot destroy cutscene timings recorded from a real N64
178+
Record gSyRobotCutsceneRecord[3] = {
179+
{ 2, 0 },
180+
{ 3, 129 },
181+
{ 2, 230 },
182+
};

src/engine/fox_demo.c

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -22,55 +22,6 @@
2222
#include "fox_co.h"
2323
#include "fox_record.h"
2424

25-
int gWarpzoneCsFrameCount = 0;
26-
27-
Record gWarpzoneCsRecord[] = {
28-
{ 2, 1 }, { 3, 3 }, { 4, 4 }, { 3, 8 }, { 2, 9 }, { 3, 52 }, { 2, 54 }, { 3, 69 }, { 2, 70 }, { 3, 75 },
29-
{ 2, 76 }, { 3, 79 }, { 2, 117 }, { 3, 118 }, { 2, 120 }, { 3, 145 }, { 2, 215 }, { 3, 216 }, { 2, 230 },
30-
};
31-
32-
void UpdateVisPerFrameFromRecording(Record* record, s32 maxFrames) {
33-
int i;
34-
35-
if (gCsFrameCount > record[maxFrames - 1].frame) {
36-
return;
37-
}
38-
39-
for (i = 0; i < maxFrames; i++) {
40-
if (gCsFrameCount == record[i].frame) {
41-
gVIsPerFrame = record[i].vis;
42-
}
43-
}
44-
}
45-
46-
void UpdateVisPerFrameFromRecording_Warpzone(Record* record, s32 maxFrames) {
47-
int i;
48-
49-
if (gWarpzoneCsFrameCount > record[maxFrames - 1].frame) {
50-
return;
51-
}
52-
53-
for (i = 0; i < maxFrames; i++) {
54-
if (gWarpzoneCsFrameCount == record[i].frame) {
55-
gVIsPerFrame = record[i].vis;
56-
}
57-
}
58-
}
59-
60-
void UpdateVisPerFrameFromRecording_Ending(Record* record, s32 maxFrames) {
61-
int i;
62-
63-
if (gGameFrameCount > record[maxFrames - 1].frame) {
64-
return;
65-
}
66-
67-
for (i = 0; i < maxFrames; i++) {
68-
if (gGameFrameCount == record[i].frame) {
69-
gVIsPerFrame = record[i].vis;
70-
}
71-
}
72-
}
73-
7425
void func_demo_80048AC0(TeamId teamId) {
7526
s32 teamShield;
7627

@@ -448,8 +399,9 @@ void Cutscene_EnterWarpZone(Player* player) {
448399
s32 var_v0;
449400
s32 pad[4];
450401

402+
// @Port: Vi recording
451403
gWarpzoneCsFrameCount++;
452-
UpdateVisPerFrameFromRecording_Warpzone(gWarpzoneCsRecord, ARRAY_COUNT(gWarpzoneCsRecord));
404+
UpdateVisPerFrameFromRecording(gWarpzoneCsRecord, ARRAY_COUNT(gWarpzoneCsRecord), &gWarpzoneCsFrameCount);
453405

454406
player->pos.x += player->vel.x;
455407
player->flags_228 = 0;
@@ -982,7 +934,8 @@ void Cutscene_CoComplete2(Player* player) {
982934

983935
Math_SmoothStepToF(&player->camRoll, 0.0f, 0.1f, 5.0f, 0.01f);
984936

985-
UpdateVisPerFrameFromRecording(gCarrierCutsceneRecord, ARRAY_COUNT(gCarrierCutsceneRecord));
937+
// @Port: Vi recording
938+
UpdateVisPerFrameFromRecording(gCarrierCutsceneRecord, ARRAY_COUNT(gCarrierCutsceneRecord), &gCsFrameCount);
986939

987940
switch (player->csState) {
988941
case 10:

src/overlays/ovl_ending/fox_end1.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99
#include "port/mods/PortEnhancements.h"
1010
#include "fox_record.h"
1111

12-
Record gEndingCsRecord[] = {
13-
{ 2, 0 }, { 5, 1 }, { 2, 2 }, { 3, 277 }, { 2, 278 }, { 3, 340 }, { 2, 397 }, { 3, 537 },
14-
{ 2, 538 }, { 3, 548 }, { 2, 549 }, { 3, 568 }, { 2, 569 }, { 3, 620 }, { 2, 623 }, { 3, 803 },
15-
{ 2, 806 }, { 3, 814 }, { 2, 823 }, { 3, 1282 }, { 2, 1284 }, { 5, 3703 }, { 2, 3704 }, { 4, 3904 },
16-
{ 2, 3905 }, { 3, 4782 }, { 2, 4783 }, { 3, 4785 }, { 2, 4820 }, { 3, 4986 }, { 2, 6779 }, { 5, 6780 },
17-
{ 2, 6781 }, { 3, 6785 }, { 4, 6786 }, { 3, 6793 }, { 2, 6799 },
18-
};
19-
2012
void Ending_8018CE20(s32);
2113
void Ending_801926D4(void);
2214
extern u32 D_ending_80192E70;
@@ -1116,7 +1108,8 @@ void Ending_Main(void) {
11161108
Ending_8018B3D8();
11171109
Ending_8018ABE8();
11181110

1119-
UpdateVisPerFrameFromRecording_Ending(gEndingCsRecord, ARRAY_COUNT(gEndingCsRecord));
1111+
// @Port: Vi recording
1112+
UpdateVisPerFrameFromRecording(gEndingCsRecord, ARRAY_COUNT(gEndingCsRecord), &gGameFrameCount);
11201113
}
11211114

11221115
void DrawBorders(void) {

src/overlays/ovl_i1/fox_co.c

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,6 @@
1111
#include "port/hooks/Events.h"
1212
#include "fox_record.h"
1313

14-
// Carrier destroy cutscene timings recorded from a real N64
15-
Record gCarrierCutsceneRecord[] = {
16-
{ 2, 0 },
17-
{ 3, 2 },
18-
{ 4, 16 },
19-
{ 3, 50 },
20-
{ 4, 58 },
21-
{ 5, 67 },
22-
{ 4, 68 },
23-
{ 5, 71 },
24-
{ 4, 73 },
25-
{ 5, 74 },
26-
{ 4, 106 },
27-
{ 3, 146 },
28-
{ 2, 194 },
29-
};
30-
31-
// Granga destroy cutscene timings recorded from a real N64
32-
Record gGrangaCutsceneRecord[] = {
33-
{ 2, 0 },
34-
{ 3, 1 },
35-
{ 2, 5 },
36-
{ 3, 7 },
37-
{ 2, 52 },
38-
{ 3, 78 },
39-
{ 4, 103 },
40-
{ 3, 125 },
41-
{ 2, 153 },
42-
{ 3, 155 },
43-
{ 2, 157 },
44-
{ 3, 158 },
45-
{ 2, 160 },
46-
};
47-
4814
u8 sFightCarrier;
4915
f32 sCoGrangaWork[68];
5016

@@ -3489,7 +3455,8 @@ void Corneria_LevelComplete1(Player* player) {
34893455
f32 temp_fa1;
34903456
f32 temp_deg;
34913457

3492-
UpdateVisPerFrameFromRecording(gGrangaCutsceneRecord, ARRAY_COUNT(gGrangaCutsceneRecord));
3458+
// @Port: Vi recording
3459+
UpdateVisPerFrameFromRecording(gGrangaCutsceneRecord, ARRAY_COUNT(gGrangaCutsceneRecord), &gCsFrameCount);
34933460

34943461
player->arwing.upperRightFlapYrot = player->arwing.upperLeftFlapYrot = player->arwing.bottomRightFlapYrot =
34953462
player->arwing.bottomLeftFlapYrot = 0.0f;

src/overlays/ovl_i2/fox_me.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
#include "assets/ast_meteo.h"
99
#include "fox_record.h"
1010

11-
// MeCrusher destroy cutscene timings recorded from a real N64
12-
Record gMeCrusherCutsceneRecord[] = {
13-
{ 2, 0 },
14-
{ 3, 200 },
15-
{ 2, 224 },
16-
};
17-
1811
Vec3f D_i2_80195430[] = {
1912
{ 122.0, -5.0, -1200.0 }, { 122.0, -103.0, -727.0 }, { 142.0, -323.0, -848.0 }, { 362.0, -59.0, -435.0 },
2013
{ 692.0, -84.0, -308.0 }, { 1000.0, -7.0, -308.0 }, { 164.0, -700.0, -308.0 }, { 263.0, -370.0, -11.0 },
@@ -2434,7 +2427,8 @@ void Meteo_LevelComplete(Player* player) {
24342427
Math_SmoothStepToAngle(&player->aerobaticPitch, 0.0f, 0.1f, 20.0f, 0.0f);
24352428
Math_SmoothStepToF(&player->boostSpeed, 0.0f, 0.1f, 3.0f, 0.0f);
24362429

2437-
UpdateVisPerFrameFromRecording(gMeCrusherCutsceneRecord, ARRAY_COUNT(gMeCrusherCutsceneRecord));
2430+
// @Port: Vi recording
2431+
UpdateVisPerFrameFromRecording(gMeCrusherCutsceneRecord, ARRAY_COUNT(gMeCrusherCutsceneRecord), &gCsFrameCount);
24382432

24392433
switch (player->csState) {
24402434
case 0:

0 commit comments

Comments
 (0)