Add direction to the door
This commit is contained in:
@ -10,5 +10,16 @@
|
||||
|
||||
void doorInit(door_t *door) {
|
||||
assertNotNull(door, "Door cannot be NULL.");
|
||||
door->bruv = 0;
|
||||
}
|
||||
|
||||
void doorDestinationSet(
|
||||
door_t *door,
|
||||
const int32_t x,
|
||||
const int32_t y,
|
||||
const entitydirection_t direction
|
||||
) {
|
||||
assertNotNull(door, "Door cannot be NULL.");
|
||||
door->x = x;
|
||||
door->y = y;
|
||||
door->direction = direction;
|
||||
}
|
@ -6,10 +6,12 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "dawn.h"
|
||||
#include "entitydirection.h"
|
||||
|
||||
typedef struct {
|
||||
uint8_t bruv;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
entitydirection_t direction;
|
||||
} door_t;
|
||||
|
||||
/**
|
||||
@ -17,4 +19,19 @@ typedef struct {
|
||||
*
|
||||
* @param door Door to initialize.
|
||||
*/
|
||||
void doorInit(door_t *door);
|
||||
void doorInit(door_t *door);
|
||||
|
||||
/**
|
||||
* Sets the destination of a door.
|
||||
*
|
||||
* @param door Door to set the destination of.
|
||||
* @param x X coordinate of the destination.
|
||||
* @param y Y coordinate of the destination.
|
||||
* @param direction Direction the player should face when they arrive.
|
||||
*/
|
||||
void doorDestinationSet(
|
||||
door_t *door,
|
||||
const int32_t x,
|
||||
const int32_t y,
|
||||
const entitydirection_t direction
|
||||
);
|
@ -32,7 +32,8 @@ void entityInteractEntity(
|
||||
return;
|
||||
|
||||
case ENTITY_TYPE_DOOR:
|
||||
textboxSetText("Door", "It's a door.");
|
||||
entityPositionSet(source, target->door.x, target->door.y);
|
||||
source->direction = target->door.direction;
|
||||
return;
|
||||
|
||||
default:
|
||||
|
Reference in New Issue
Block a user