Skip to content

Commit d4b45da

Browse files
mateusfavarinPedroHLCFRDS
authored
rebase (#210)
* comments * boss cutscene comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * comments * progress * progress * boss cutscene struct data * progress * almost got boss cutscenes working, but Roos head is on his feet * progress * progress * roo head fix * progress * 3 new functions * TeleportSelf working * TeleportSelf working * TeleportSelf working * TeleportSelf working * TeleportSelf working * 74% * bugfixes * fix post-roo door spawn * fix post-roo door spawn * plant bugfix * optimization, removes entire loop * bugfixes * remove dead code * move sps lower to collision function * new mode found * rename flags * OnlineCTR fixes * 60fps fixes * progress * gameModeEnd * comments * overlay rewrite * progress * progress * progress * start implementing custom levels into decomp * more custom level progress * more custom level progress * custom level fixes * remove Prim expansion for custom levels, put back later * custom levels progress * custom levels progress * custom levels work in decomp builds * relic fix * remove map hack, decomp build is nullptr safe * rename extra driver models * remove dead code * debug menu functions in 603 * debug menu functions in 603 * start of profiler integration into retail * profiler progress * debug profiler partially implemented, 1132 byte budget left * debug menu start * debug menu start * reset common.h * progress * progress * timer progress * debug progress * profiler working * profiler progress * profiler vsync/drawsync * pc port fixes * progress * more profiler * DebugMenu flag renamed * DebugMenu structs * progress * debug menu encoding progress * debug menu progress * debug menu draws * debug font in debug menus * progress * progress * folder added * debug menu progress * pc port workaround transparency * fixes * debug progress * debug menu loads levels properly * bugfix * debug menu Square for GO-BACK * progress * timers in pc port * Faradise garage rewrite * UI progress * UI_VS progress * UI_VS progress * UI_VS progress * progress * progress * progress * quip progress * quip progress * quip progress * UI_VsReadDriver * progress * test for persistent primitives * USE_PCDRV (untested) * v1 fixes * PCDRV read=0 * PCDRV size fix * progress * PCDRV draws copyright * progress * progress * LOAD queue refactor, removes hacky fixes from OG game * PCDRV enters gameplay * OG bugfix * rename to XnfFile * rename function * variable rename * Remove dead code, no more size pointers in load queue * progress * LOAD refactor * pc fix * pc fix * pc port hacks removed * save 300 bytes * more defrag * progress * ci: move servers to 64; prioritize mingw32 online-server; fix GCC14 (#196) * ci: disable builds for rebuild_PC * flake: add more targets for online-servers; bump * ci: move to x86-64 and aarch64 * ci: flake bump * online-server: build with GCC14 * flake: prefix pc builds * ci: magic-nix-cache was discontinue; prioritize windows builds * ci: restore PC builds, but let them fail * pc port fixes * USE_DEFRAG -> USE_ALTMODS * fixes * OnlineCTR organizing * debug menu progress * debug menu progress * dbg characters work * FakeCrash->FCrash * bugfix * coll notes * coll notes * coll notes * coll notes * coll notes * coll notes * coll notes * coll notes * coll notes * coll notes * coll notes * coll notes * coll notes * coll notes * coll notes * progress * progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * coll progress * notes * notes * COLL refactor * comments * progress * progress * progress * progress * progress * vismem progress * vismem progress * vismem progress * vismem progress * vismem progress * vismem progress * vismem progress * cam progress * cam progress * cam progress BlastedLerp struct * cleanup * cleanup * cleanup * cleanup * cleanup * PushBuffer 2 new funcs (thanks Faradise) * struct rename * optimization * optimization * advgarage bugfix * progress * Remove Hardware CriticalSection, use Software CriticalSection * defrag MAIN, required for byte budget, fixes Software CriticalSection * progress * bugfix * debug menu DEPTH fix * profiler 16x9 * 226 test and profiler print * profiling for 226 * 226 test progress * loading screen optimizations * progress * remove critical sections * bugfix * boss spawn fix * LOAD full defrag * remove outdated benchmark * progress * MEMPACK_Init refactor * clearity * bugfix * progress * optimization * bugfix * RenderStars and Decomp (#208) * Stars * Decomp progress * add semicolon * add another semicolon * pc port fix * fix VRAM load (#209) --------- Co-authored-by: Niko <a> Co-authored-by: Pedro Lara Campos <root@pedrohlc.com> Co-authored-by: Agung Firdaus <agung.frds7@gmail.com>
1 parent e42dbdb commit d4b45da

File tree

284 files changed

+7361
-4453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

284 files changed

+7361
-4453
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build main
33
on:
44
push:
55
branches:
6-
- '**'
6+
- "**"
77

88
permissions:
99
contents: read
@@ -19,28 +19,25 @@ jobs:
1919
fetch-depth: 0
2020
submodules: true
2121
- uses: DeterminateSystems/nix-installer-action@main
22-
- uses: DeterminateSystems/magic-nix-cache-action@main
2322
- name: Create result directory
2423
run: mkdir ${{ runner.temp }}/result
25-
- name: Build Decomp Debug Linux32 GCC
26-
run: nix build -L --no-link --keep-going '.?submodules=1#decomp.debug.native32.gcc'
27-
- name: Build Decomp Debug Linux32 Clang
28-
run: nix build -L --no-link --keep-going '.?submodules=1#decomp.debug.native32.clang'
29-
- name: Build Decomp Debug Mingw32 GCC
30-
run: nix build -L --no-link --keep-going '.?submodules=1#decomp.debug.mingw32.gcc'
31-
- name: Build Decomp Debug Mingw32 Clang
32-
run: nix build -L --no-link --keep-going '.?submodules=1#decomp.debug.mingw32.clang'
33-
- name: Build Retail Release Linux32 GCC
34-
run: nix build -L --no-link --keep-going '.?submodules=1#retail.release.native32.gcc'
35-
- name: Build Server Release Linux32 GCC
36-
run: nix build -L --no-link --keep-going '.?submodules=1#online-server.release.native32.gcc'
37-
- name: Build Server Release ARM32 GCC
38-
run: nix build -L --no-link --keep-going '.?submodules=1#online-server.release.arm32.gcc'
39-
- name: Build Server Release Mingw2 GCC
24+
# -- Windows online-server
25+
- name: Build Server Release Mingw32 GCC
4026
run: nix build -L --keep-going '.?submodules=1#online-server.release.mingw32.gcc' -o ${{ runner.temp }}/result/online-server.release.mingw32.gcc
4127
- name: Upload artifact
4228
uses: actions/upload-artifact@v4
4329
with:
4430
name: online-server-windows
4531
path: |
46-
${{ runner.temp }}/result/online-server.release.mingw32.gcc/bin
32+
${{ runner.temp }}/result/online-server.release.mingw32.gcc/
33+
34+
# -- Linux online-server
35+
- name: Build Server Release Linux GCC
36+
run: nix build -L --no-link --keep-going '.?submodules=1#online-server.release.native.gcc'
37+
- name: Build Server Release Aarch64 GCC
38+
run: nix build -L --no-link --keep-going '.?submodules=1#online-server.release.aarch64.gcc'
39+
# -- PC Port
40+
- name: Build Decomp Debug Mingw32 GCC
41+
run: nix build -L --no-link --keep-going '.?submodules=1#pc-decomp.debug.mingw32.gcc' 2>&1 | grep -A3 'error:'
42+
- name: Build Decomp Debug Linux32 GCC
43+
run: nix build -L --no-link --keep-going '.?submodules=1#pc-decomp.debug.native32.gcc' 2>&1 | grep -A3 'error:'

decompile/General/221/221_Full.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void DECOMP_CC_EndEvent_DrawMenu()
2828
int growVal;
2929
int bitIndex;
3030
int levelID;
31+
int elapsedFrames;
3132

3233
gGT = sdata->gGT;
3334
levelID = gGT->levelID;
@@ -50,9 +51,13 @@ void DECOMP_CC_EndEvent_DrawMenu()
5051
adv = &sdata->advProgress;
5152
boolLose = driver->numCrystals < gGT->numCrystalsInLEV;
5253

53-
// count frames
54-
if(sdata->framesSinceRaceEnded < FPS_DOUBLE(900))
55-
sdata->framesSinceRaceEnded++;
54+
elapsedFrames = sdata->framesSinceRaceEnded;
55+
56+
// count frames if hasn't been 30 seconds
57+
if (elapsedFrames < FPS_DOUBLE(900))
58+
elapsedFrames++;
59+
60+
sdata->framesSinceRaceEnded = elapsedFrames;
5661

5762
// hide hud crystal
5863
sdata->ptrHudCrystal->flags |= 0x80;
@@ -65,7 +70,7 @@ void DECOMP_CC_EndEvent_DrawMenu()
6570
&posXY[0],
6671
0x264, 0x56, // startX, startY,
6772
0xcd, 0x56, // endX, endY
68-
sdata->framesSinceRaceEnded,
73+
elapsedFrames,
6974
FPS_DOUBLE(0x14));
7075

7176
sdata->ptrMenuCrystal->matrix.t[0] = DECOMP_UI_ConvertX_2(posXY[0], 0x200);
@@ -93,7 +98,7 @@ void DECOMP_CC_EndEvent_DrawMenu()
9398
&posXY[0],
9499
-0x63, 0x18, // startX, startY,
95100
0x100, 0x18, // endX, endY
96-
sdata->framesSinceRaceEnded,
101+
elapsedFrames,
97102
FPS_DOUBLE(0x14));
98103

99104
// TIME REMAINING
@@ -160,14 +165,8 @@ void DECOMP_CC_EndEvent_DrawMenu()
160165
tokenInst->matrix.t[0] = DECOMP_UI_ConvertX_2(posXY[0], 0x200);
161166
tokenInst->matrix.t[1] = DECOMP_UI_ConvertY_2(0xA2-0x18, 0x200);
162167

163-
// play unlock sound after exactly 1 second
164-
if(sdata->framesSinceRaceEnded == FPS_DOUBLE(30))
165-
{
166-
OtherFX_Play(0x67, 1);
167-
}
168-
169168
// grow token after first second
170-
if(sdata->framesSinceRaceEnded > FPS_DOUBLE(30))
169+
if(elapsedFrames > FPS_DOUBLE(30))
171170
{
172171
if(tokenInst->scale[0] < 0x2001)
173172
{
@@ -177,6 +176,12 @@ void DECOMP_CC_EndEvent_DrawMenu()
177176
tokenInst->scale[2] = growVal;
178177
}
179178
}
179+
180+
// play unlock sound after exactly 1 second
181+
else if(elapsedFrames == FPS_DOUBLE(30))
182+
{
183+
OtherFX_Play(0x67, 1);
184+
}
180185

181186
// PRESS * TO CONTINUE
182187
DecalFont_DrawLine(

decompile/General/222/222_Full.c

Lines changed: 38 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
static int str_number = 0x20; // " \0"
44
extern struct RectMenu menu222;
55

6+
// 3528
7+
68
void DECOMP_AA_EndEvent_DrawMenu(void)
79
{
810
struct GameTracker *gGT;
@@ -71,20 +73,24 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
7173
// if not in Token mode, these won't be used until later;
7274
lerpStartY = 0;
7375
lerpEndY = 0;
76+
77+
// For trophy race, check 1st place
78+
int boolWin = (driver->driverRank == 0);
7479

75-
// If you're in Adventure Mode
76-
if ((gGT->gameMode1 & ADVENTURE_MODE) != 0)
80+
// If C-T-R token race
81+
if ((gGT->gameMode2 & TOKEN_RACE) != 0)
7782
{
78-
// If you won the race, and you have all 3 letters (C, T, and R)
79-
if ((driver->driverRank == 0) && (driver->PickupLetterHUD.numCollected == 3))
83+
// add requirement of C-T-R letters
84+
boolWin = (boolWin) && (driver->PickupLetterHUD.numCollected == 3);
85+
86+
if (boolWin)
8087
{
8188
// lerp C-T-R letters closer to center by 16 pixels
8289
// default (unlocking and frames < 140) or (already unlocked and frames < 300)
8390
lerpStartX = hudCTR->x;
8491
lerpStartY = hudCTR->y;
8592
lerpEndX = lerpStartX + 0x10;
8693
lerpEndY = lerpStartY + 0x10;
87-
currFrame = elapsedFrames;
8894
lerpFrames = FPS_DOUBLE(8);
8995

9096
// If you have not unlocked this CTR Token
@@ -97,9 +103,9 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
97103
scaleDown = scaleDown >> 10;
98104

99105
// lerp letters off-screen
100-
if (elapsedFrames > FPS_DOUBLE(230))
106+
if (elapsedFrames >= FPS_DOUBLE(230))
101107
{
102-
currFrame = elapsedFrames - FPS_DOUBLE(230);
108+
elapsedFrames -= FPS_DOUBLE(230);
103109

104110
lerpStartX += 0x10;
105111
lerpStartY += 0x50;
@@ -108,9 +114,9 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
108114
}
109115

110116
// lerp letters to center
111-
else if (elapsedFrames > FPS_DOUBLE(140))
117+
else if (elapsedFrames >= FPS_DOUBLE(140))
112118
{
113-
currFrame = elapsedFrames - FPS_DOUBLE(140);
119+
elapsedFrames -= FPS_DOUBLE(140);
114120

115121
lerpStartX += 0x10;
116122
lerpStartY += 0x10;
@@ -145,7 +151,7 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
145151
// but they passed "elapsedFrames-50" instead of "elapsedFrames-230", kills effect.
146152
// txtStartX = 0x100;
147153
// txtEndX = -150;
148-
// currFrame = elapsedFrames - 50;
154+
// elapsedFrames -= 50;
149155

150156
// lerp on-screen: CTR TOKEN AWARDED
151157
txtStartX = 0x264;
@@ -155,7 +161,7 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
155161
&txtPos[0],
156162
txtStartX, 0xA6,
157163
txtEndX, 0xA6,
158-
currFrame, FPS_DOUBLE(8));
164+
elapsedFrames, FPS_DOUBLE(8));
159165

160166
txtColor = (gGT->timer & FPS_DOUBLE(1)) ? 0xFFFF8003 : 0xFFFF8004;
161167

@@ -169,7 +175,7 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
169175
&letterPos[0],
170176
lerpStartX, lerpStartY,
171177
lerpEndX, lerpEndY,
172-
currFrame, FPS_DOUBLE(8));
178+
elapsedFrames, FPS_DOUBLE(8));
173179

174180
hudToken->flags &= ~HIDE_MODEL;
175181
hudToken->matrix.t[0] = hudT->matrix.t[0];
@@ -183,10 +189,9 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
183189
// If you already have this CTR Token unlocked
184190
else
185191
{
186-
// or <= ?
187-
if (elapsedFrames > FPS_DOUBLE(300))
192+
if (elapsedFrames >= FPS_DOUBLE(300))
188193
{
189-
currFrame = elapsedFrames - FPS_DOUBLE(300);
194+
elapsedFrames -= FPS_DOUBLE(300);
190195

191196
lerpStartX = hudCTR->x + 0x10;
192197
lerpStartY = hudCTR->y + 0x10;
@@ -199,7 +204,7 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
199204
&letterPos[0],
200205
lerpStartX, lerpStartY,
201206
lerpEndX, lerpEndY,
202-
currFrame, lerpFrames);
207+
elapsedFrames, lerpFrames);
203208

204209
// variable reuse, frame timers
205210
lerpStartY = 0;
@@ -256,9 +261,11 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
256261
// Draw how much time it took to finish laps and race
257262
DECOMP_AA_EndEvent_DisplayTime(i, lerpEndY);
258263
}
264+
265+
elapsedFrames = sdata->framesSinceRaceEnded;
259266

260267
// If it hasn't been 1 second from race ended
261-
if (elapsedFrames < FPS_DOUBLE(29))
268+
if (elapsedFrames < FPS_DOUBLE(30))
262269
return;
263270

264271
// If there is one player
@@ -399,43 +406,38 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
399406
// If you have not pressed X
400407
if ((sdata->AnyPlayerTap & 0x50) == 0)
401408
return;
402-
403-
// clear gamepad input
409+
410+
// === If Pressed X ===
411+
404412
RECTMENU_ClearInput();
413+
414+
sdata->Loading.OnBegin.AddBitsConfig0 |= ADVENTURE_ARENA;
415+
sdata->Loading.OnBegin.RemBitsConfig0 |= (ADVENTURE_BOSS | TOKEN_RACE);
405416

406-
// if event was not won
407-
if (driver->driverRank > 0)
417+
// If you are in boss mode
418+
if (gGT->gameMode1 < 0)
408419
{
409-
// pass pointer to menu buffer that shows Retry / Exit To Map,
410-
// identical to buffer in 221 dll, except this one in EXE space
411-
RECTMENU_Show(&data.menuRetryExit);
420+
sdata->Loading.OnBegin.AddBitsConfig8 |= SPAWN_AT_BOSS;
421+
}
412422

413-
// record that the menu is now showing
423+
if (!boolWin)
424+
{
425+
RECTMENU_Show(&data.menuRetryExit);
414426
sdata->menuReadyToPass |= 1;
415427
return;
416428
}
417429

418-
// If you won the race
419-
// If you have pressed X to continue...
430+
// === If you won the race ===
420431

421432
sdata->framesSinceRaceEnded = 0;
422433
sdata->numIconsEOR = 1;
423434

424-
// when loading is done, add flag for "In Adventure Arena"
425-
sdata->Loading.OnBegin.AddBitsConfig0 |= ADVENTURE_ARENA;
426-
427435
// Load the levelID for Adventure Hub that you came from
428436
levSpawn = gGT->prevLEV;
429437

430438
// If you are in boss mode
431439
if (gGT->gameMode1 < 0)
432440
{
433-
// when loading is done, add flag for "spawn near boss door"
434-
sdata->Loading.OnBegin.AddBitsConfig8 |= 1;
435-
436-
// when loading is done, remove flag for Boss Mode
437-
sdata->Loading.OnBegin.RemBitsConfig0 |= ADVENTURE_BOSS;
438-
439441
// bitIndex of keys unlocked, and boss beaten
440442
bitIndex = gGT->bossID + 0x5e;
441443

@@ -476,18 +478,6 @@ void DECOMP_AA_EndEvent_DrawMenu(void)
476478
}
477479
}
478480
}
479-
// if you are in token race
480-
else if ((gGT->gameMode2 & 0x8) != 0)
481-
{
482-
// If you have collected 3 letters (C, T, and R)
483-
if (driver->PickupLetterHUD.numCollected == 3)
484-
{
485-
// set bit to tokens
486-
bitIndex = gGT->levelID + 0x4c;
487-
// when loading is done, remove flag for CTR Challenge
488-
sdata->Loading.OnBegin.RemBitsConfig8 |= TOKEN_RACE;
489-
}
490-
}
491481

492482
// if something needs unlocking
493483
if(bitIndex > 0)

0 commit comments

Comments
 (0)