2018-07-05 19:24:47 +00:00
|
|
|
#ifndef _LMDAVE_H
|
|
|
|
#define _LMDAVE_H
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
|
2018-07-06 00:05:32 +00:00
|
|
|
// for dealing with resources in EXE
|
|
|
|
#include "util/util.h"
|
2018-07-05 19:24:47 +00:00
|
|
|
|
2018-07-12 04:14:15 +00:00
|
|
|
// dave player state
|
|
|
|
typedef struct {
|
|
|
|
uint8_t tx, ty; // tile pos
|
|
|
|
uint16_t px, py; // pixel pos
|
2018-07-14 06:17:28 +00:00
|
|
|
uint16_t score;
|
|
|
|
uint8_t lives;
|
2018-07-12 04:50:40 +00:00
|
|
|
// on ground flag
|
|
|
|
uint8_t on_ground;
|
2018-07-12 04:14:15 +00:00
|
|
|
|
|
|
|
// input flags
|
|
|
|
uint8_t try_right;
|
|
|
|
uint8_t try_left;
|
|
|
|
uint8_t try_jump;
|
2018-07-14 06:17:28 +00:00
|
|
|
uint8_t try_fire;
|
|
|
|
uint8_t try_jetpack;
|
|
|
|
uint8_t try_up, try_down; // jetpack/climbing
|
2018-07-12 04:14:15 +00:00
|
|
|
|
|
|
|
uint8_t do_right;
|
|
|
|
uint8_t do_left;
|
|
|
|
uint8_t do_jump;
|
2018-07-14 06:17:28 +00:00
|
|
|
uint8_t do_fire;
|
|
|
|
uint8_t do_jetpack;
|
|
|
|
uint8_t do_up, do_down;
|
|
|
|
|
2018-07-12 09:18:36 +00:00
|
|
|
uint8_t jump_timer;
|
|
|
|
// pickup tile pos
|
|
|
|
uint8_t check_pickup_x;
|
|
|
|
uint8_t check_pickup_y;
|
2018-07-14 06:17:28 +00:00
|
|
|
// door was hit, check if passable
|
|
|
|
uint8_t check_door;
|
|
|
|
// item flags; jetpack is also fuel count
|
|
|
|
uint8_t trophy, gun, jetpack;
|
2018-07-12 04:50:40 +00:00
|
|
|
|
|
|
|
// collision point clear flags; 1 = clear
|
|
|
|
uint8_t col_point[8];
|
2018-07-12 04:14:15 +00:00
|
|
|
} dave_state_t;
|
|
|
|
|
2018-07-05 19:24:47 +00:00
|
|
|
// global game state
|
|
|
|
typedef struct {
|
|
|
|
uint8_t quit;
|
|
|
|
uint8_t current_level;
|
2018-07-08 05:31:03 +00:00
|
|
|
// view and scroll are per tile
|
2018-07-05 19:24:47 +00:00
|
|
|
uint8_t view_x, view_y;
|
2018-07-08 05:31:03 +00:00
|
|
|
int8_t scroll_x;
|
2018-07-05 19:24:47 +00:00
|
|
|
|
2018-07-12 04:14:15 +00:00
|
|
|
// dave player state
|
|
|
|
dave_state_t ds;
|
|
|
|
|
2018-07-17 10:43:58 +00:00
|
|
|
level_t levels[NUM_EXE_LEVELS]; // copied from exe util's GetLevel
|
2018-07-05 19:24:47 +00:00
|
|
|
} game_state_t;
|
|
|
|
|
|
|
|
// game assets
|
|
|
|
typedef struct {
|
2018-07-06 00:05:32 +00:00
|
|
|
// tiles as textures converted from util's tile surfaces
|
|
|
|
SDL_Texture* tile_tx[NUM_EXE_TILES];
|
2018-07-05 19:24:47 +00:00
|
|
|
} game_assets_t;
|
|
|
|
|
2018-07-12 04:14:15 +00:00
|
|
|
// level tile size in pixels
|
2018-07-13 07:24:53 +00:00
|
|
|
const uint8_t TILE_SIZE = 16;
|
|
|
|
// fixed frame delay
|
|
|
|
const uint8_t FRAME_DELAY = 33;
|
2018-07-12 04:14:15 +00:00
|
|
|
|
2018-07-05 19:24:47 +00:00
|
|
|
#endif
|
2018-07-17 10:43:58 +00:00
|
|
|
|