Mortal Kombat Plus
Documentação gerada automaticamente com Doxygen
Carregando...
Procurando...
Nenhuma entrada encontrado
src
modulos
anima_system.c
Ir para a documentação desse arquivo.
1
#include "anima_system.h"
2
3
#include "game_vars.h"
4
#include "fighters.h"
5
6
typedef
void (*
PlayerStateFunc
)(int, u16);
7
8
const
PlayerStateFunc
PLAYER_STATE_FUNCS
[7] = {
9
playerState_Johnny
,
10
playerState_Kano
,
11
playerState_Raiden
,
12
playerState_LiuKang
,
13
playerState_SubZero
,
14
playerState_Scorpion
,
15
playerState_Sonya
};
16
17
void
playerState
(
int
ind, u16 state)
18
{
19
if
(
player
[ind].sprite)
20
{
21
SPR_releaseSprite(
player
[ind].sprite);
22
player
[ind].sprite = NULL;
23
}
24
25
player
[ind].animFrame = 1;
26
player
[ind].frameTimeAtual = 1;
27
player
[ind].dataAnim[1] = 1;
28
player
[ind].animFrameTotal = 1;
29
player
[ind].state = state;
30
31
if
(
PLAYER_STATE_FUNCS
[
player
[ind].
id
])
32
{
33
PLAYER_STATE_FUNCS
[
player
[ind].id](ind, state);
34
}
35
36
SPR_setHFlip(
player
[ind].sprite, (
player
[ind].direcao == 1) ? FALSE : TRUE);
37
38
SPR_setDepth(
player
[ind].sprite, SPR_MIN_DEPTH);
39
40
SPR_setAnimAndFrame(
player
[ind].sprite, 0,
player
[ind].animFrame - 1);
41
player
[ind].frameTimeTotal =
player
[ind].dataAnim[1];
42
// SPR_setAnim(player[ind].sprite, 0);
43
}
44
45
void
anima
()
46
{
47
gASG_system
= FALSE;
48
49
// jogadores 1 e 2
50
for
(
int
ind = 0; ind < 2; ind++)
51
{
52
player
[ind].frameTimeAtual++;
53
54
if
(
player
[ind].frameTimeAtual >
player
[ind].frameTimeTotal &&
gASG_system
== FALSE)
55
{
56
player
[ind].animFrame++;
57
58
if
(
player
[ind].animFrame >
player
[ind].animFrameTotal)
59
{
60
gASG_system
= TRUE;
61
62
if
(
player
[ind].state == PARADO)
63
{
64
playerState
(ind, PARADO);
65
}
66
}
67
player
[ind].frameTimeAtual = 1;
68
player
[ind].frameTimeTotal =
player
[ind].dataAnim[
player
[ind].animFrame];
69
70
if
(
player
[ind].sprite)
71
{
72
u16 totalReal =
player
[ind].sprite->animation->numFrame;
73
74
if
(
player
[ind].animFrame - 1 < totalReal)
75
{
76
SPR_setAnimAndFrame(
player
[ind].sprite, 0,
player
[ind].animFrame - 1);
77
}
78
}
79
}
80
else
if
(
player
[ind].frameTimeAtual >
player
[ind].frameTimeTotal &&
gASG_system
== TRUE)
81
{
82
if
(
player
[ind].frameTimeAtual > 1)
83
{
84
player
[ind].frameTimeAtual--;
85
}
86
}
87
}
88
}
anima
void anima()
Definição
anima_system.c:45
PLAYER_STATE_FUNCS
const PlayerStateFunc PLAYER_STATE_FUNCS[7]
Definição
anima_system.c:8
playerState
void playerState(int ind, u16 state)
Definição
anima_system.c:17
PlayerStateFunc
void(* PlayerStateFunc)(int, u16)
Definição
anima_system.c:6
player
Player player[2]
Definição
game_vars.c:24
gASG_system
bool gASG_system
Definição
game_vars.c:17
playerState_Johnny
void playerState_Johnny(int numPlayer, u16 State)
Definição
johnny.c:6
playerState_Kano
void playerState_Kano(int numPlayer, u16 State)
Definição
kano.c:6
playerState_LiuKang
void playerState_LiuKang(int numPlayer, u16 State)
Definição
liukang.c:6
playerState_Raiden
void playerState_Raiden(int numPlayer, u16 State)
Definição
raiden.c:6
playerState_Scorpion
void playerState_Scorpion(int numPlayer, u16 State)
Definição
scorpion.c:6
playerState_Sonya
void playerState_Sonya(int numPlayer, u16 State)
Definição
sonya.c:6
playerState_SubZero
void playerState_SubZero(int numPlayer, u16 State)
Definição
subzero.c:6
Gerado por
1.11.0