aboutsummaryrefslogtreecommitdiff
path: root/src/et_player.h
blob: a72aa281d8246bd2afd5332c203ffa5ed8ef8215 (plain)
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
/*
   Kitsune's Curse
   Copyright (C) 2020-2023 Juan J. Martinez <jjm@usebox.net>

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
#ifndef _PLAYER_H
#define _PLAYER_H

#include <stdint.h>

#define WALK 0
#define WALK_CYCLE 3
#define CROUCH 4
#define JUMP 5

#define DIR_RIGHT 0
#define DIR_LEFT 1
#define DIR_DOWN 2
#define DIR_UP 3

#ifndef LOCAL
#define LOCAL extern
extern const uint8_t player_frames[];
extern const uint8_t jump_seq[];
#else
const uint8_t player_frames[6] = { 1, 0, 1, 2, 3, 3 };
const uint8_t jump_seq[8] = { 14, 12, 4, 2, 0, 4, 8, 12 };
#endif

#define JUMP_SEQ 8
#define IS_GOING_DOWN(x) ((x) > 5)


#define COOL_DOWN 10
#define RESPAWN_DELAY 16
#define WAS_HIT 24
#define GAMEOVER_DELAY 48

#define MAX_LIFE 5

void player_checkpoint();

void draw_player();
void update_player();

void player_hit(uint8_t h);

uint8_t check_for_player(uint8_t h) __z88dk_fastcall;

#undef LOCAL

#endif // _PLAYER_H