Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/OOZ/OOZSetup.c
338 views
1
// ---------------------------------------------------------------------
2
// RSDK Project: Sonic Mania
3
// Object Description: OOZSetup Object
4
// Object Author: Christian Whitehead/Simon Thomley/Hunter Bridges
5
// Decompiled by: Rubberduckycooly & RMGRich
6
// ---------------------------------------------------------------------
7
8
#include "Game.h"
9
10
ObjectOOZSetup *OOZSetup;
11
12
void OOZSetup_Update(void) {}
13
14
void OOZSetup_LateUpdate(void) {}
15
16
void OOZSetup_StaticUpdate(void)
17
{
18
foreach_all(OOZSetup, setup) { RSDK.AddDrawListRef(Zone->playerDrawGroup[0] + 1, RSDK.GetEntitySlot(setup)); }
19
20
OOZSetup->palTimer += 128;
21
if (OOZSetup->palTimer >= 256) {
22
OOZSetup->palTimer -= 256;
23
24
RSDK.RotatePalette(3, 216, 223, false);
25
RSDK.RotatePalette(4, 216, 223, false);
26
RSDK.RotatePalette(5, 216, 223, false);
27
RSDK.RotatePalette(6, 216, 223, false);
28
}
29
30
RSDK.SetLimitedFade(1, 3, 4, OOZSetup->palTimer, 216, 223);
31
RSDK.SetLimitedFade(2, 5, 6, OOZSetup->palTimer, 216, 223);
32
RSDK.CopyPalette(1, 216, 0, 216, 8);
33
34
if (!(Zone->timer & 3)) {
35
++OOZSetup->background1->deformationOffset;
36
37
OOZSetup->oilAniTimer += 16;
38
OOZSetup->oilAniTimer %= 160;
39
40
RSDK.DrawAniTiles(OOZSetup->aniTiles, 760, 0, OOZSetup->oilAniTimer, 128, 16);
41
RSDK.DrawAniTiles(OOZSetup->aniTiles, 757, 136, OOZSetup->oilAniTimer, 16, 16);
42
RSDK.DrawAniTiles(OOZSetup->aniTiles, 758, 128, OOZSetup->oilAniTimer, 32, 16);
43
}
44
45
if (--OOZSetup->glowLightAniTimer <= 0) {
46
++OOZSetup->glowLightAniFrame;
47
48
OOZSetup->glowLightAniFrame &= 7;
49
OOZSetup->glowLightAniTimer = OOZSetup->glowLightAniDurations[OOZSetup->glowLightAniFrame];
50
51
RSDK.DrawAniTiles(OOZSetup->aniTiles, 756, 16 * OOZSetup->glowLightAniFrame, 160, 16, 16);
52
}
53
54
OOZSetup->swimmingPlayerCount = 0;
55
foreach_active(Player, player)
56
{
57
int32 playerID = RSDK.GetEntitySlot(player);
58
if (player->state != Player_State_Static) {
59
Hitbox *playerHitbox = Player_GetHitbox(player);
60
uint16 tile =
61
RSDK.GetTile(Zone->fgLayer[0], player->position.x >> 20, ((playerHitbox->bottom << 16) + player->position.y - 0x10000) >> 20);
62
if (tile == (uint16)-1)
63
tile = RSDK.GetTile(Zone->fgLayer[1], player->position.x >> 20, ((playerHitbox->bottom << 16) + player->position.y - 0x10000) >> 20);
64
65
int32 tileFlags = RSDK.GetTileFlags(tile, player->collisionPlane);
66
if (tileFlags != OOZ_TFLAGS_NORMAL) {
67
if (player->shield == SHIELD_FIRE && player->superState != SUPERSTATE_SUPER && tileFlags != OOZ_TFLAGS_OILFALL) {
68
int32 tx = (player->position.x & 0xFFF00000) + 0x70000;
69
int32 ty = player->position.y + ((playerHitbox->bottom + 8) << 16);
70
if (tileFlags == OOZ_TFLAGS_OILPOOL) {
71
ty &= 0xFFF00000;
72
ty -= 0xC0000;
73
if (OOZSetup_StartFire(tx, ty, player->angle)) {
74
EntitySol *sol = CREATE_ENTITY(Sol, INT_TO_VOID(true), tx - 0x10000, ty);
75
sol->velocity.x = -0x40000;
76
RSDK.SetSpriteAnimation(Sol->aniFrames, 3, &sol->mainAnimator, true, 0);
77
sol->state = Sol_State_OilFlame;
78
79
sol = CREATE_ENTITY(Sol, INT_TO_VOID(true), tx + 0x10000, ty);
80
sol->velocity.x = 0x40000;
81
RSDK.SetSpriteAnimation(Sol->aniFrames, 3, &sol->mainAnimator, true, 0);
82
sol->state = Sol_State_OilFlame;
83
}
84
}
85
else if (player->onGround) {
86
ty &= 0xFFFF0000;
87
if (OOZSetup_StartFire(tx, ty, player->angle)) {
88
ty -= 0x80000;
89
EntitySol *sol = CREATE_ENTITY(Sol, INT_TO_VOID(true), tx - 0x10000, ty);
90
sol->velocity.x = -0x40000;
91
RSDK.SetSpriteAnimation(Sol->aniFrames, 3, &sol->mainAnimator, true, 0);
92
sol->state = Sol_State_FireballOilFlame;
93
94
sol = CREATE_ENTITY(Sol, INT_TO_VOID(true), tx + 0x10000, ty);
95
sol->velocity.x = 0x40000;
96
RSDK.SetSpriteAnimation(Sol->aniFrames, 3, &sol->mainAnimator, true, 0);
97
sol->state = Sol_State_FireballOilFlame;
98
}
99
}
100
}
101
102
switch (tileFlags) {
103
case OOZ_TFLAGS_NORMAL:
104
default: OOZSetup->activePlayers &= ~(1 << playerID); break;
105
106
case OOZ_TFLAGS_OILPOOL:
107
if (!player->sidekick)
108
OOZSetup->swimmingPlayerCount++;
109
OOZSetup->activePlayers &= ~(1 << playerID);
110
if (player->velocity.y < 0) {
111
player->velocity.y += 0x3800;
112
}
113
else {
114
player->interaction = true;
115
player->tileCollisions = TILECOLLISION_DOWN;
116
player->state = OOZSetup_PlayerState_OilPool;
117
}
118
break;
119
120
case OOZ_TFLAGS_OILSTRIP:
121
if (player->state != Player_State_BubbleBounce
122
#if MANIA_USE_PLUS
123
&& player->state != Player_State_MightyHammerDrop
124
#endif
125
) {
126
OOZSetup->activePlayers &= ~(1 << playerID);
127
if (player->onGround) {
128
player->interaction = true;
129
player->tileCollisions = TILECOLLISION_DOWN;
130
player->state = OOZSetup_PlayerState_OilStrip;
131
}
132
}
133
break;
134
135
case OOZ_TFLAGS_OILSLIDE:
136
if (player->state != Player_State_BubbleBounce
137
#if MANIA_USE_PLUS
138
&& player->state != Player_State_MightyHammerDrop
139
#endif
140
) {
141
OOZSetup->activePlayers &= ~(1 << playerID);
142
if (player->onGround) {
143
player->interaction = true;
144
player->tileCollisions = TILECOLLISION_DOWN;
145
if (!player->angle)
146
player->state = OOZSetup_PlayerState_OilStrip;
147
else
148
player->state = OOZSetup_PlayerState_OilSlide;
149
}
150
}
151
break;
152
153
case OOZ_TFLAGS_OILFALL:
154
if (!player->sidekick)
155
OOZSetup->swimmingPlayerCount++;
156
157
OOZSetup->activePlayers |= 1 << playerID;
158
player->interaction = true;
159
player->tileCollisions = TILECOLLISION_DOWN;
160
if (player->velocity.y < 0)
161
player->velocity.y += 0xC000;
162
else
163
player->state = OOZSetup_PlayerState_OilFall;
164
break;
165
}
166
}
167
else {
168
OOZSetup->activePlayers &= ~(1 << playerID);
169
}
170
}
171
}
172
173
if (OOZSetup->useSmogEffect && SceneInfo->timeEnabled) {
174
if (OOZSetup->smogTimer < 0x10000)
175
OOZSetup->smogTimer++;
176
}
177
else {
178
if (OOZSetup->smogTimer > 0)
179
OOZSetup->smogTimer -= 32;
180
}
181
182
#if MANIA_USE_PLUS
183
foreach_active(Ring, ring)
184
{
185
if (ring->state == Ring_State_Lost) {
186
uint16 tile = RSDK.GetTile(Zone->fgLayer[0], ring->position.x >> 20, (ring->position.y + 0xE0000) >> 20);
187
if (tile == (uint16)-1)
188
tile = RSDK.GetTile(Zone->fgLayer[1], ring->position.x >> 20, (ring->position.y + 0xE0000) >> 20);
189
190
if (RSDK.GetTileFlags(tile, ring->collisionPlane) == OOZ_TFLAGS_OILPOOL) {
191
ring->velocity.x -= ring->velocity.x >> 4;
192
ring->velocity.y = 0x2800;
193
ring->drawGroup = Zone->objectDrawGroup[1];
194
if (ring->alpha > 0x40) {
195
ring->alpha = 0x40;
196
ring->inkEffect = INK_ALPHA;
197
}
198
}
199
}
200
}
201
#endif
202
203
OOZSetup_HandleActiveFlames();
204
205
#if MANIA_USE_PLUS
206
RSDK.ProcessAnimation(&OOZSetup->animator);
207
#endif
208
}
209
210
void OOZSetup_Draw(void)
211
{
212
RSDK_THIS(OOZSetup);
213
214
#if MANIA_USE_PLUS
215
if (SceneInfo->currentDrawGroup != self->drawGroup) {
216
foreach_active(Player, player)
217
{
218
if ((1 << RSDK.GetEntitySlot(player)) & OOZSetup->activePlayers)
219
RSDK.DrawSprite(&OOZSetup->animator, &player->position, false);
220
}
221
}
222
#endif
223
224
if (self->type)
225
RSDK.FillScreen(0xC0C0E8, OOZSetup->smogTimer >> 5, OOZSetup->smogTimer >> 5, OOZSetup->smogTimer >> 4);
226
else
227
OOZSetup_Draw_Flames();
228
}
229
230
void OOZSetup_Create(void *data)
231
{
232
RSDK_THIS(OOZSetup);
233
234
self->active = ACTIVE_ALWAYS;
235
self->visible = true;
236
self->drawFX = FX_ROTATE;
237
self->drawGroup = self->type ? 14 : Zone->objectDrawGroup[0];
238
}
239
240
void OOZSetup_StageLoad(void)
241
{
242
OOZSetup->aniTiles = RSDK.LoadSpriteSheet("OOZ/AniTiles.gif", SCOPE_STAGE);
243
244
OOZSetup->background1 = RSDK.GetTileLayer(0);
245
for (int32 i = 0; i < 0x400; ++i) {
246
OOZSetup->background1->deformationData[i] = OOZSetup->deformData[i & 0x3F];
247
}
248
249
OOZSetup->smogTimer = 0;
250
OOZSetup->useSmogEffect = true;
251
OOZSetup->swimmingPlayerCount = 0;
252
253
Animals->animalTypes[0] = ANIMAL_ROCKY;
254
Animals->animalTypes[1] = ANIMAL_PECKY;
255
256
memset(OOZSetup->flameTimers, 0, sizeof(OOZSetup->flameTimers));
257
memset(OOZSetup->flameTimerPtrs, 0, sizeof(OOZSetup->flameTimerPtrs));
258
OOZSetup->flameCount = 0;
259
260
OOZSetup->solFrames = RSDK.LoadSpriteAnimation("OOZ/Sol.bin", SCOPE_STAGE);
261
RSDK.SetSpriteAnimation(OOZSetup->solFrames, 3, &OOZSetup->flameAnimator, true, 0);
262
263
#if MANIA_USE_PLUS
264
OOZSetup->splashFrames = RSDK.LoadSpriteAnimation("OOZ/Splash.bin", SCOPE_STAGE);
265
RSDK.SetSpriteAnimation(OOZSetup->splashFrames, 0, &OOZSetup->animator, true, 0);
266
#endif
267
268
if (RSDK.CheckSceneFolder("OOZ2")) {
269
foreach_all(OOZ1Outro, cutscene)
270
{
271
OOZSetup->cutscenePtr = (Entity *)cutscene;
272
foreach_break;
273
}
274
275
GenericTrigger->callbacks[OOZ_GENERICTRIGGER_ACHIEVEMENT] = OOZSetup_Trigger_AwardAchievement;
276
277
if (!StarPost->postIDs[0])
278
Zone->cameraBoundsB[0] = 1600;
279
280
if (isMainGameMode() && globals->enableIntro) {
281
if (!CutsceneRules_CheckStageReload()) {
282
SaveGame_LoadPlayerState();
283
globals->suppressAutoMusic = true;
284
globals->suppressTitlecard = true;
285
}
286
}
287
288
#if MANIA_USE_PLUS
289
if (isMainGameMode() && CutsceneRules_IsAct2())
290
Zone->stageFinishCallback = OOZ2Outro_StageFinish_EndAct2;
291
292
if (SceneInfo->filter & FILTER_ENCORE) {
293
RSDK.LoadPalette(0, "EncoreOOZ2.act", 0b0000000011111111);
294
RSDK.LoadPalette(2, "EncoreOOZSmog.act", 0b0000000011111111);
295
296
RSDK.CopyPalette(0, 128, 1, 128, 128);
297
RSDK.CopyPalette(0, 128, 3, 128, 128);
298
RSDK.CopyPalette(0, 128, 4, 128, 128);
299
RSDK.RotatePalette(4, 215, 223, false);
300
301
RSDK.CopyPalette(2, 128, 5, 128, 128);
302
RSDK.CopyPalette(2, 128, 6, 128, 128);
303
RSDK.RotatePalette(6, 215, 223, false);
304
}
305
#endif
306
}
307
#if MANIA_USE_PLUS
308
else if (SceneInfo->filter & FILTER_ENCORE) {
309
RSDK.LoadPalette(0, "EncoreOOZ1.act", 0b0000000011111111);
310
RSDK.CopyPalette(0, 128, 1, 128, 80);
311
RSDK.CopyPalette(0, 128, 3, 128, 80);
312
}
313
#endif
314
315
int32 sfxID = Soundboard_LoadSfx("OOZ/Slide.wav", 12382, OOZSetup_SfxCheck_Slide, StateMachine_None);
316
if (sfxID >= 0)
317
Soundboard->sfxFadeOutDuration[sfxID] = 30;
318
319
sfxID = Soundboard_LoadSfx("OOZ/OilSwim.wav", true, OOZSetup_SfxCheck_OilSwim, StateMachine_None);
320
if (sfxID >= 0)
321
Soundboard->sfxFadeOutDuration[sfxID] = 30;
322
323
sfxID = Soundboard_LoadSfx("Stage/Flame2.wav", true, OOZSetup_SfxCheck_Flame2, StateMachine_None);
324
if (sfxID >= 0)
325
Soundboard->sfxFadeOutDuration[sfxID] = 30;
326
}
327
328
bool32 OOZSetup_SfxCheck_Flame2(void)
329
{
330
int32 count = 0;
331
332
foreach_active(Sol, sol)
333
{
334
if (sol->isFlameFX)
335
count++;
336
}
337
338
for (int32 i = 0; i < OOZSetup->flameCount; ++i) {
339
if (OOZSetup->flameTimerPtrs[i])
340
count++;
341
}
342
343
return count > 0;
344
}
345
346
bool32 OOZSetup_SfxCheck_Slide(void)
347
{
348
int32 count = 0;
349
350
foreach_active(Player, player)
351
{
352
if (!player->sidekick) {
353
if (player->state == OOZSetup_PlayerState_OilSlide || player->state == OOZSetup_PlayerState_OilStrip)
354
++count;
355
}
356
}
357
358
return count > 0;
359
}
360
361
bool32 OOZSetup_SfxCheck_OilSwim(void) { return OOZSetup->swimmingPlayerCount > 0; }
362
363
void OOZSetup_Draw_Flames(void)
364
{
365
RSDK_THIS(OOZSetup);
366
367
for (int32 i = 0; i < OOZSetup->flameCount; ++i) {
368
if (OOZSetup->flameTimerPtrs[i]) {
369
self->rotation = 2 * (OOZSetup->flamePositions[i].x & 0xFF);
370
OOZSetup->flameAnimator.frameID = OOZSetup->flamePositions[i].y & 0xFF;
371
RSDK.DrawSprite(&OOZSetup->flameAnimator, &OOZSetup->flamePositions[i], false);
372
}
373
}
374
}
375
376
void OOZSetup_HandleActiveFlames(void)
377
{
378
RSDK_THIS(OOZSetup);
379
380
for (int32 i = 0; i < OOZSetup->flameCount; ++i) {
381
if (OOZSetup->flameTimerPtrs[i]) {
382
--(*OOZSetup->flameTimerPtrs[i]);
383
384
if (!*OOZSetup->flameTimerPtrs[i]) {
385
OOZSetup->flameTimerPtrs[i] = NULL;
386
EntitySol *sol = CREATE_ENTITY(Sol, INT_TO_VOID(true), OOZSetup->flamePositions[i].x, OOZSetup->flamePositions[i].y);
387
sol->isFlameFX = true;
388
sol->rotation = 2 * (OOZSetup->flamePositions[i].x & 0xFF);
389
RSDK.SetSpriteAnimation(Sol->aniFrames, 2, &sol->mainAnimator, true, 0);
390
sol->state = Sol_State_FlameDissipate;
391
}
392
else {
393
int32 frame = OOZSetup->flamePositions[i].y & 0xFF;
394
int32 frameTimer = (OOZSetup->flamePositions[i].y >> 8) & 0xFF;
395
396
if (++frameTimer >= 3) {
397
frameTimer = 0;
398
if (++frame > 10)
399
frame = 1;
400
}
401
402
// likewise, this too is evil, using the lower 2 bytes to store frame info
403
OOZSetup->flamePositions[i].y = frame | (frameTimer << 8) | (OOZSetup->flamePositions[i].y & 0xFFFF0000);
404
}
405
406
Vector2 storePos = self->position;
407
foreach_active(Player, player)
408
{
409
self->position = OOZSetup->flamePositions[i];
410
if (Player_CheckCollisionTouch(player, self, &Sol->hitboxBadnik)) {
411
self->position = storePos;
412
Player_ElementHurt(player, self, SHIELD_FIRE);
413
}
414
}
415
self->position = storePos;
416
}
417
}
418
}
419
420
bool32 OOZSetup_StartFire(int32 posX, int32 posY, int32 angle)
421
{
422
RSDK_THIS(OOZSetup);
423
424
int32 pos = (posX >> 20) + (posY >> 20 << 10);
425
426
if (pos < 0x20000) {
427
if (!OOZSetup->flameTimers[pos]) {
428
int32 i = 0;
429
for (; i < 399; ++i) {
430
if (!OOZSetup->flameTimerPtrs[i])
431
break;
432
}
433
// if we get to 399 active flames just use that slot over and over
434
435
OOZSetup->flameTimerPtrs[i] = &OOZSetup->flameTimers[pos];
436
OOZSetup->flamePositions[i].x = posX;
437
OOZSetup->flamePositions[i].y = posY;
438
OOZSetup->flamePositions[i].x &= 0xFFFF0000;
439
OOZSetup->flamePositions[i].y &= 0xFFFF0000;
440
// this is so evil, using the bottom byte of the XPos to store the angle
441
OOZSetup->flamePositions[i].x |= angle;
442
443
if (i + 1 > OOZSetup->flameCount)
444
OOZSetup->flameCount = i + 1;
445
446
OOZSetup->flameTimers[pos] = 0xF0;
447
CREATE_ENTITY(Explosion, INT_TO_VOID(EXPLOSION_BOSS), self->position.x, self->position.y - 0x60000)->drawGroup = self->drawGroup;
448
449
return true;
450
}
451
}
452
453
return false;
454
}
455
456
void OOZSetup_Trigger_AwardAchievement(void)
457
{
458
if (!OOZSetup->hasAchievement) {
459
API_UnlockAchievement(&achievementList[ACH_OOZ]);
460
OOZSetup->hasAchievement = true;
461
}
462
}
463
464
void OOZSetup_PlayerState_OilPool(void)
465
{
466
RSDK_THIS(Player);
467
468
int32 top = self->topSpeed;
469
int32 acc = self->acceleration;
470
self->topSpeed = (self->topSpeed >> 1) + (self->topSpeed >> 3);
471
self->acceleration = (self->acceleration >> 1) + (self->acceleration >> 3);
472
473
if (self->groundVel <= 0) {
474
if (self->groundVel < -self->topSpeed) {
475
self->groundVel += 0x3800;
476
}
477
}
478
else if (self->groundVel > self->topSpeed) {
479
self->groundVel -= 0x3800;
480
}
481
482
self->position.y += 0x10000;
483
484
self->up = false;
485
self->down = false;
486
self->onGround = true;
487
488
Player_State_Ground();
489
490
self->topSpeed = top;
491
self->acceleration = acc;
492
}
493
494
void OOZSetup_PlayerState_OilStrip(void)
495
{
496
RSDK_THIS(Player);
497
498
int32 acc = self->acceleration;
499
int32 top = self->topSpeed;
500
int32 skid = self->skidSpeed;
501
int32 dec = self->deceleration;
502
503
Animator animator;
504
memcpy(&animator, &self->animator, sizeof(Animator));
505
506
self->position.y += 0x10000;
507
508
self->skidSpeed = self->skidSpeed >> 3;
509
self->topSpeed = (self->topSpeed >> 1) + (self->topSpeed >> 2);
510
self->acceleration = 0x400;
511
self->deceleration = self->deceleration >> 3;
512
513
self->up = false;
514
self->down = false;
515
self->skidding = 0;
516
self->onGround = true;
517
518
Player_State_Ground();
519
520
#if MANIA_USE_PLUS
521
if ((animator.animationID == ANI_HURT || animator.animationID == ANI_FLUME) && self->groundedStore && self->onGround) {
522
#else
523
if (animator.animationID == ANI_HURT && self->groundedStore && self->onGround) {
524
#endif
525
if (abs(self->groundVel) >= 0x20000) {
526
memcpy(&self->animator, &animator, sizeof(Animator));
527
if (self->animator.timer >= 3)
528
self->animator.timer = 256;
529
530
if (self->angle == 0x40 || self->angle == 0xC0) {
531
self->onGround = false;
532
self->state = Player_State_Air;
533
}
534
}
535
}
536
537
self->acceleration = acc;
538
self->topSpeed = top;
539
self->skidSpeed = skid;
540
self->deceleration = dec;
541
}
542
543
void OOZSetup_PlayerState_OilSlide(void)
544
{
545
RSDK_THIS(Player);
546
547
if (!self->onGround) {
548
self->state = Player_State_Air;
549
Player_HandleAirMovement();
550
}
551
else {
552
Player_Gravity_False();
553
554
if (self->angle) {
555
if (self->angle <= 0x80) {
556
if (self->groundVel < 0x80000)
557
self->groundVel += 0x4000;
558
}
559
else {
560
if (self->groundVel > -0x80000)
561
self->groundVel -= 0x4000;
562
}
563
}
564
565
self->groundVel += RSDK.Sin256(self->angle) << 13 >> 8;
566
self->controlLock = 30;
567
self->direction = self->groundVel < 0;
568
569
#if MANIA_USE_PLUS
570
RSDK.SetSpriteAnimation(self->aniFrames, ANI_FLUME, &self->animator, false, 0);
571
#else
572
RSDK.SetSpriteAnimation(self->aniFrames, ANI_HURT, &self->animator, false, 2);
573
#endif
574
}
575
576
if (self->jumpPress) {
577
Player_Action_Jump(self);
578
579
if (self->angle <= 0x80) {
580
if (self->velocity.x < 0)
581
self->velocity.x += ((self->jumpStrength + (self->jumpStrength >> 1)) * RSDK.Sin256(self->angle)) >> 8;
582
}
583
else {
584
if (self->velocity.x > 0)
585
self->velocity.x += ((self->jumpStrength + (self->jumpStrength >> 1)) * RSDK.Sin256(self->angle)) >> 8;
586
}
587
}
588
}
589
590
void OOZSetup_PlayerState_OilFall(void)
591
{
592
RSDK_THIS(Player);
593
594
int32 top = self->topSpeed;
595
int32 acc = self->acceleration;
596
597
self->topSpeed = (self->topSpeed >> 2) + (self->topSpeed >> 3);
598
self->acceleration = (self->acceleration >> 2) + (self->acceleration >> 3);
599
600
if (self->groundVel <= 0) {
601
if (self->groundVel < -self->topSpeed)
602
self->groundVel += 0x3800;
603
}
604
else {
605
if (self->groundVel > self->topSpeed)
606
self->groundVel -= 0x3800;
607
}
608
609
self->up = false;
610
self->down = false;
611
self->groundedStore = false;
612
self->onGround = false;
613
self->velocity.y = 0x10000;
614
615
if (abs(self->velocity.x) > 0x20000) {
616
if (self->velocity.x <= 0)
617
self->velocity.x += 0xC000;
618
else
619
self->velocity.x -= 0xC000;
620
}
621
622
if (!self->left && !self->right)
623
self->velocity.x -= self->velocity.x >> 4;
624
625
RSDK.SetSpriteAnimation(self->aniFrames, ANI_JUMP, &self->animator, false, 0);
626
627
Player_HandleGroundMovement();
628
629
if (self->camera)
630
self->camera->disableYOffset = false;
631
632
self->jumpAbilityState = 0;
633
self->nextAirState = Player_State_Air;
634
635
if (self->jumpPress) {
636
Player_Action_Jump(self);
637
638
self->jumpAbilityState = 0;
639
self->timer = 0;
640
}
641
642
self->topSpeed = top;
643
self->acceleration = acc;
644
}
645
646
#if GAME_INCLUDE_EDITOR
647
void OOZSetup_EditorDraw(void) {}
648
649
void OOZSetup_EditorLoad(void)
650
{
651
RSDK_ACTIVE_VAR(OOZSetup, type);
652
RSDK_ENUM_VAR("Manage Flames", OOZSETUP_FLAMES);
653
RSDK_ENUM_VAR("Manage Fade", OOZSETUP_FADE);
654
655
RSDK_ACTIVE_VAR(WarpDoor, effect);
656
RSDK_ENUM_VAR("None", WARPDOOR_EFFECT_NONE);
657
RSDK_ENUM_VAR("To Sub", OOZ_WARPDOOR_EFFECT_TO_SUB);
658
RSDK_ENUM_VAR("From Sub", OOZ_WARPDOOR_EFFECT_FROM_SUB);
659
660
RSDK_ACTIVE_VAR(GenericTrigger, triggerID);
661
RSDK_ENUM_VAR("Award Achievement", OOZ_GENERICTRIGGER_ACHIEVEMENT);
662
}
663
#endif
664
665
void OOZSetup_Serialize(void) { RSDK_EDITABLE_VAR(OOZSetup, VAR_UINT8, type); }
666
667