Flags are no longer hardcoded in mod calls, improved glue.

This commit is contained in:
KikooDX 2021-01-16 11:15:49 +01:00
parent d1047c1bca
commit 42e7c4f9d2
3 changed files with 15 additions and 8 deletions

View File

@ -6,11 +6,17 @@
typedef unsigned char Tile; /* the tile ID */
typedef unsigned char Tile_flags; /* the tile properties (bitmask) */
/* define flags */
#define F_SOLID 0b1
#define F_SPIKY 0b10
#define F_ICE 0b100
#define F_GLUE 0b1000
/* flags enum and defines */
enum {
I_SOLID,
I_SPIKY,
I_ICE,
I_GLUE
};
#define F_SOLID (1 << I_SOLID)
#define F_SPIKY (1 << I_SPIKY)
#define F_ICE (1 << I_ICE)
#define F_GLUE (1 << I_GLUE)
/* define properties */
#define P_AIR (0)

View File

@ -73,9 +73,9 @@ void player_set_vars(Player *player, const Level *level) {
if (flags_ceil & cur_flag)
side_flags[i] |= D_CEIL;
}
/* apply modifiers TODO: Don't harcode this */
player_mod_ice(player, side_flags[2]);
player_mod_glue(player, side_flags[3]);
/* apply modifiers */
player_mod_ice(player, side_flags[I_ICE]);
player_mod_glue(player, side_flags[I_GLUE]);
}
void player_move(Player *player, const Level *level) {

View File

@ -16,6 +16,7 @@ void player_mod_glue(Player *player, uint8_t sides) {
if (sides & (D_LEFT | D_RIGHT | D_CEIL)) {
player->spd.y = 0;
player->vars.gravity = 0;
player->vars.acceleration /= 2;
}
}