Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
PushBlockGravity.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "entity.h"
3
4f32 N(PushBlockFallCurve)[] = {
5 0.02, 0.02, 0.04, 0.08, 0.11, 0.2, 0.3, 0.31,
6 0.42, 0.46, 0.5, 0.53, 0.56, 0.59, 0.62, 0.65,
7 0.68, 0.71, 0.74, 0.77, 0.8, 0.83, 0.86, 0.89,
8 0.92, 0.95, 0.98, 1.0,
9};
10
11s32 N(push_block_handle_fall)(Entity* block, Evt* source) {
12
13 block->pos.y = source->varTable[0] - (N(PushBlockFallCurve)[source->functionTemp[0]] * BLOCK_GRID_SIZE);
14 if (source->functionTemp[0] == 0) {
15 sfx_play_sound_at_position(SOUND_PUSH_BLOCK_FALL, SOUND_SPACE_DEFAULT, block->pos.x, block->pos.y, block->pos.z);
16 }
17
18 if ((source->functionTemp[0] > 4) && (source->functionTemp[0] & 1)) {
19 fx_smoke_burst(1, block->pos.x, block->pos.y, block->pos.z, 1.0f, 20);
20 }
21
22 source->functionTemp[0]++;
23
24 return source->functionTemp[0] == ARRAY_COUNT(N(PushBlockFallCurve));
25}
s32 N push_block_handle_fall(Entity *block, Evt *source)
#define sfx_play_sound_at_position
#define BLOCK_GRID_SIZE
Definition entity.h:67
@ SOUND_PUSH_BLOCK_FALL
Definition enums.h:873
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
#define ARRAY_COUNT(arr)
Definition macros.h:40