This repository has been archived on 2022-01-13. You can view files and clone it, but cannot push or open issues or pull requests.
jtmm2-old/src/player_modifiers.c

46 lines
1.0 KiB
C

#include "player_modifiers.h"
#include "player.h"
#include "conf.h"
void player_mod_water(Player *player, uint8_t sides) {
if (sides & D_ANY & ~(D_FLOOR)) {
/* precise and slow movement */
player->vars.acceleration *= 4;
player->vars.friction *= 16;
/* low jump and super slow fall */
player->vars.jump_spd /= 4;
player->vars.gravity_scalar /= 8;
/* allow the player to jump midair */
player->grace = 1;
}
}
void player_mod_ice(Player *player, uint8_t sides) {
if (sides & D_FLOOR) {
player->vars.acceleration /= 4;
player->vars.friction /= 4;
}
}
void player_mod_glue(Player *player, uint8_t sides) {
if (sides & D_FLOOR) {
player->vars.acceleration = 1;
player->vars.friction = 1;
}
if (sides & D_CEIL) {
player->spd.y = 0;
player->vars.gravity = 0;
player->vars.friction *= 2;
/* jump to drop of the ceiling */
player->vars.jump_spd = 1;
player->grace = 1;
}
if (sides & (D_LEFT | D_RIGHT)) {
player->spd.y = 0;
player->vars.gravity = 0;
/* wall jump */
player->grace = UPS / 5;
}
}