forked from Nebuleon/ativayeban
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathplayer.h
78 lines (57 loc) · 1.6 KB
/
player.h
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
#pragma once
#include <stdbool.h>
#include <chipmunk/chipmunk.h>
#include <SDL_mixer.h>
#include "animation.h"
typedef struct
{
int Index;
// Whether the player is in the game or not
bool Enabled;
bool Alive;
// Once dead, wait this long before respawning
int RespawnCounter;
int Score;
cpBody *Body;
// Cached positions for drawing only
float x, y;
// The last value returned by GetMovement.
int16_t AccelX;
// Used to detect rolling for rolling sound
bool WasOnSurface;
// Used to detect consecutive fall scoring
bool ScoredInAir;
// Used to animate the player rolling
int Roll;
// Blink until counter runs out
int BlinkCounter;
// Blink when counter reaches zero
int NextBlinkCounter;
// Leave tail particles
int TailCounter;
Tex T;
} Player;
#define MAX_PLAYERS 4
extern Player players[MAX_PLAYERS];
extern int NumPlayers;
#ifndef __GCW0__
extern int NumJoysticks;
#endif
#define PLAYER_SPRITESHEET_WIDTH 35
#define PLAYER_SPRITESHEET_HEIGHT 35
extern Tex PlayerSpritesheets[MAX_PLAYERS];
extern Animation Spark;
extern Animation SparkRed;
extern Animation Tail;
extern Mix_Chunk* SoundPlayerBounce;
extern int SoundPlayerRollChannel;
void PlayerUpdate(Player *player, const Uint32 ms);
void PlayerDraw(const Player *player, const float y);
void PlayerInit(Player *player, const int i, const cpVect pos);
void PlayerReset(Player *player, const int i);
void PlayerScore(Player *player, const bool air);
void PlayerKill(Player *player);
void PlayerRespawn(Player *player, const float x, const float y);
void PlayerRevive(Player *player);
int PlayerAliveCount(void);
int PlayerEnabledCount(void);