kettek2/wiki/games/newsboy/Newsboy_0x00/engine/LiveMap.h

115 lines
2.4 KiB
C

#ifndef LIVE_MAP_H
#define LIVE_MAP_H
#include "Animation.h"
#include "Map.h"
#include "Entity.h"
#include "Vector.h"
#include "Phys.h"
#include "VoidMan.h"
// ugh
struct Player {
struct Phys phys;
struct Phys l_phys;
float mass;
float inverse_mass;
int x;
int y;
struct Animation animation;
int walk_id; // bad, but this is quickest
int idle_id;
int curr_id;
int height; // buh huh
};
struct LiveMap {
char *name;
char *session;
int location;
int width;
int height;
struct Cell **cells; // cellz
struct Player player;
struct VoidMan *entities;
struct VoidMan *triggers;
struct VoidMan *active_triggers;
struct VoidMan *events;
//struct VoidTableMan *events;
//struct Event **events;
//struct Paths **paths;
};
struct LiveMap *newLiveMap();
int freeLiveMap();
int freeCells(struct Cell **cells, int width, int height);
int loadLiveMap(struct LiveMap *map, const char *file);
struct LiveMap *initLiveMap(struct MapData *map);
struct Cell {
int flags;
int decor_count;
struct Decor *decor;
};
struct Cell *newCell(int flags, int decor_count);
int freeCell(struct Cell *cell);
int delDecor(struct Cell *cell, int pos);
int collideCell(struct Cell *cell, struct Phys *phys);
// decor has no new/free, as Cell is the sole controlla
struct Decor {
int x;
int y;
struct Animation animation;
};
#define E_TYPE_MSG 0
#define E_TYPE_DECORSET 10
#define E_TYPE_DECORDEL 11
#define E_TYPE_CELL 20
#define E_TYPE_SPAWN_METABIT 40
#define E_TYPE_SPAWN_ENTITY 41
#define E_TYPE_LVL 4
#define E_TYPE_GO 5
#define E_TYPE_MUSIC_SET 30
#define E_TYPE_MUSIC_START 31
#define E_TYPE_MUSIC_STOP 32
#define E_TYPE_HINT 50
#define E_TYPE_OBJ 60
#define E_TYPE_END 99
struct Event {
struct Box box;
int type;
int param_count;
int *param_type;
void **params;
};
struct Event *newEvent();
int freeEvent(struct Event *event);
#define T_TYPE_COLLIDE 0
#define T_TYPE_ACTIVATE 1
#define T_ACT_PLAYER 0
#define T_ACT_ENTITY 1
#define T_ACT_METABIT 2
#define T_ACT_PL_PROJ 3
#define T_ACT_PROJ 4
#define T_BEHAVE_NORM 0
#define T_BEHAVE_ALL 1
#define T_BEHAVE_LOOP 2
struct Trigger {
struct Box box;
int type;
int activator;
int behavior;
int iter;
int runs; // amount of iterations run
int time;
int elapsed; // elapsed time
int event_count;
int event_runs; // amount of events run
int *events; // id of event
};
struct Trigger *newTrigger();
int freeTrigger(struct Trigger *trigger);
#endif