Add floor to hospital BG, add entering doors with down arrow, add
patient rooms
This commit is contained in:
parent
90613ed2a8
commit
8f0f75db0f
6 changed files with 35 additions and 16 deletions
Binary file not shown.
14
constants.h
14
constants.h
|
@ -26,6 +26,8 @@ Made by blitzdoughnuts
|
|||
#define ROOM_H_ENT 3
|
||||
#define ROOM_HOSPITAL 4
|
||||
#define ROOM_H_PATIENTS 5
|
||||
#define ROOM_H_HAMIE 6
|
||||
#define ROOM_H_RICHIE 7
|
||||
#define ROOM_BAR 63
|
||||
|
||||
// artifacts
|
||||
|
@ -151,16 +153,16 @@ Made by blitzdoughnuts
|
|||
// unorganized
|
||||
#define SUBPIXELUNIT_ACCURACY 32
|
||||
|
||||
#if GAME_FPS < 30
|
||||
#define ANIM_SPEED 4
|
||||
#else
|
||||
#define ANIM_SPEED 6
|
||||
#endif
|
||||
|
||||
#if GAME_FPS > 30
|
||||
#define ANIM_SPEED 6
|
||||
#define PRE_GRAVITY SUBPIXELUNIT_ACCURACY >> 2
|
||||
#define WALK_SPEED SUBPIXELUNIT_ACCURACY / 8
|
||||
#define WALK_SPEEDLIMIT 3
|
||||
#else
|
||||
#define ANIM_SPEED 3
|
||||
#define PRE_GRAVITY SUBPIXELUNIT_ACCURACY >> 1
|
||||
#define WALK_SPEED SUBPIXELUNIT_ACCURACY / 4
|
||||
#define WALK_SPEEDLIMIT 6
|
||||
#endif
|
||||
|
||||
#define GROUNDLEVEL 200
|
||||
|
|
31
game.h
31
game.h
|
@ -18,6 +18,7 @@ Made by blitzdoughnuts
|
|||
|
||||
// draw calls
|
||||
#define DRAW_PLRUPARROW 1
|
||||
#define DRAW_PLRDNARROW 2
|
||||
|
||||
#define DRAW_CHECK2XSIZE 64
|
||||
#define DRAW_CHECKFULLSC 65
|
||||
|
@ -168,6 +169,9 @@ static inline void LoadInRoom() {
|
|||
interacts[3].vars[0] = 1;
|
||||
interacts[4].vars[0] = 2;
|
||||
interacts[5].vars[0] = 3;
|
||||
addObject(964, GROUNDLEVEL, INTERTYPE_DOOR);
|
||||
interacts[8].vars[0] = ROOM_HOUSE;
|
||||
interacts[8].flags ^= 1 << 3;
|
||||
break;
|
||||
#endif
|
||||
case ROOM_HOUSE: // house
|
||||
|
@ -214,10 +218,13 @@ static inline void LoadInRoom() {
|
|||
case ROOM_HOSPITAL: // hospital main lobby (badge artifact)
|
||||
// if you DON'T have all the artifacts, allow exiting of the room
|
||||
// TO-DO: cutscene of the door slamming
|
||||
addObject(480, GROUNDLEVEL, INTERTYPE_DOOR);
|
||||
interacts[0].vars[0] = ROOM_H_PATIENTS;
|
||||
interacts[0].vars[1] = 1;
|
||||
if (plr.artifacts <= 15) {
|
||||
addObject(-20, GROUNDLEVEL, INTERTYPE_DOOR);
|
||||
interacts[0].vars[0] = ROOM_H_ENT;
|
||||
interacts[0].vars[2] = 1;
|
||||
interacts[1].vars[0] = ROOM_H_ENT;
|
||||
interacts[1].vars[2] = 1;
|
||||
};
|
||||
break;
|
||||
case ROOM_H_PATIENTS:
|
||||
|
@ -279,13 +286,19 @@ void interact_step(WTH_Interactible *REF) {
|
|||
/* flag 1 is the entering door state,
|
||||
flag 2 is if the door is open
|
||||
(flag 2 is only really used if
|
||||
transitioning rooms) */
|
||||
transitioning rooms)
|
||||
flag 3 sets if the door is only
|
||||
enterable by pressing DOWN */
|
||||
if (!(REF->flags & 1 << 1)) {
|
||||
if (!(plr.flags & FLAG_GROUNDED)) return;
|
||||
if (plr.y == REF->y && plr.x >= REF->x - 40 && plr.x < REF->x + 40) {
|
||||
// printf("Player can enter door");
|
||||
signalDraw(DRAW_PLRUPARROW);
|
||||
if ((input_keys & KEY_UP)) {
|
||||
uint8_t doorKey = KEY_UP;
|
||||
if (REF->flags & 1 << 3) {
|
||||
signalDraw(DRAW_PLRDNARROW);
|
||||
doorKey = KEY_DOWN;
|
||||
} else signalDraw(DRAW_PLRUPARROW);
|
||||
if ((input_keys & doorKey)) {
|
||||
signalPlaySFX(4);
|
||||
plr.flags ^= FLAG_CANTMOVE | FLAG_HALTANIM;
|
||||
plr.animindex = WTH_PLR_DOOR_SPR;
|
||||
|
@ -577,8 +590,8 @@ void step() {
|
|||
|
||||
// maybe there's a way to "merge" the walking code in a way that reduces
|
||||
// the redundant animation and flag changes?
|
||||
if (((input_keys & KEY_LEFT) && !(input_keys & KEY_RIGHT)) && plr.hsp > -3) {
|
||||
plr.hsp_sub -= SUBPIXELUNIT_ACCURACY / 8;
|
||||
if (((input_keys & KEY_LEFT) && !(input_keys & KEY_RIGHT)) && plr.hsp > -WALK_SPEEDLIMIT) {
|
||||
plr.hsp_sub -= WALK_SPEED;
|
||||
plr.animindex = WTH_PLR_WALK_SPR;
|
||||
plr.animflimit = WTH_PLR_WALK_LEN;
|
||||
if (plr.flags & FLAG_HALTANIM) plr.flags ^= FLAG_HALTANIM;
|
||||
|
@ -586,8 +599,8 @@ void step() {
|
|||
if (plr.hsp > 0) plr.hsp = 0;
|
||||
if (!(plr.flags & FLAG_FLIPPED)) plr.flags ^= FLAG_FLIPPED;
|
||||
};
|
||||
if (((input_keys & KEY_RIGHT) && !(input_keys & KEY_LEFT)) && plr.hsp < 3) {
|
||||
plr.hsp_sub += SUBPIXELUNIT_ACCURACY / 8;
|
||||
if (((input_keys & KEY_RIGHT) && !(input_keys & KEY_LEFT)) && plr.hsp < WALK_SPEEDLIMIT) {
|
||||
plr.hsp_sub += WALK_SPEED;
|
||||
plr.animindex = WTH_PLR_WALK_SPR;
|
||||
plr.animflimit = WTH_PLR_WALK_LEN;
|
||||
if (plr.flags & FLAG_HALTANIM) plr.flags ^= FLAG_HALTANIM;
|
||||
|
|
|
@ -211,6 +211,9 @@ void signalDraw(uint8_t index) {
|
|||
case DRAW_PLRUPARROW:
|
||||
renderFlags ^= 1;
|
||||
break;
|
||||
case DRAW_PLRDNARROW:
|
||||
renderFlags ^= 2;
|
||||
break;
|
||||
case DRAW_CHECK2XSIZE:
|
||||
if (options[0] & WTHOPTS_2XSIZE)
|
||||
SDL_SetWindowSize(win, WIDTH * 2, HEIGHT * 2);
|
||||
|
@ -335,6 +338,7 @@ void draw() {
|
|||
drawSpriteSheeted(plrsprites[(plr.flags & FLAG_HASCOAT) ? plr.animindex : plr.animindex + WTH_PLR_SPRCOUNT], (plr.x - 75) - cam.x, (plr.y - 100) - cam.y, plr.animframe, 150, 150, (plr.flags & FLAG_FLIPPED) ? 1 : 0);
|
||||
|
||||
if (renderFlags & 1) drawSprite(sprites[WTH_SPR_UPARROW], plr.x - 20 - cam.x, plr.y - 150 - cam.y);
|
||||
if (renderFlags & 2) drawSprite(sprites[WTH_SPR_UPARROW], plr.x - 20 - cam.x, plr.y + 25 - cam.y);
|
||||
|
||||
#ifdef WTH_DEBUG
|
||||
switch (level)
|
||||
|
|
|
@ -30,5 +30,5 @@
|
|||
|
||||
// #define WTH_DEMOS // Enable demo recording on frontends that support it
|
||||
// #define WTH_NOSOUND // Disable audio on frontends that use it
|
||||
// #define WTH_DEBUG // Enable debugging options that show variables and other details
|
||||
#define WTH_DEBUG // Enable debugging options that show variables and other details
|
||||
// #define WTH_NOOPTIONS // Disables the Options menu and relies on the DEFAULT_OPTIONS macro
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 3.8 KiB |
Loading…
Reference in a new issue