Dawn progress
This commit is contained in:
12
src/dawn/rpg/battle/CMakeLists.txt
Normal file
12
src/dawn/rpg/battle/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
# Copyright (c) 2024 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Subdirs
|
||||
|
||||
# Sources
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
battle.c
|
||||
)
|
37
src/dawn/rpg/battle/battle.c
Normal file
37
src/dawn/rpg/battle/battle.c
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2024 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "assert/assert.h"
|
||||
#include "battle.h"
|
||||
#include "util/memory.h"
|
||||
#include "game/game.h"
|
||||
#include "ui/textbox.h"
|
||||
|
||||
battle_t BATTLE;
|
||||
|
||||
void battleInit() {
|
||||
memorySet(&BATTLE, 0, sizeof(battle_t));
|
||||
}
|
||||
|
||||
void battleStart() {
|
||||
GAME.state = GAME_STATE_BATTLE;
|
||||
BATTLE.state = BATTLE_STATE_INITIAL;
|
||||
|
||||
textboxSetText(NULL, "battle.start");
|
||||
}
|
||||
|
||||
void battleUpdate() {
|
||||
switch(BATTLE.state) {
|
||||
case BATTLE_STATE_INITIAL:
|
||||
if(textboxIsOpen()) return;
|
||||
break;
|
||||
|
||||
default:
|
||||
assertUnreachable("Unknown battle state.");
|
||||
break;
|
||||
}
|
||||
}
|
40
src/dawn/rpg/battle/battle.h
Normal file
40
src/dawn/rpg/battle/battle.h
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2024 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "dawn.h"
|
||||
|
||||
typedef enum {
|
||||
BATTLE_STATE_INITIAL
|
||||
} battlestate_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
} battlefighter_t;
|
||||
|
||||
typedef struct {
|
||||
battlestate_t state;
|
||||
} battle_t;
|
||||
|
||||
extern battle_t BATTLE;
|
||||
|
||||
/**
|
||||
* Initializes the battle system.
|
||||
*/
|
||||
void battleInit();
|
||||
|
||||
/**
|
||||
* Starts a battle.
|
||||
*/
|
||||
void battleStart(
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* Updates the battle system.
|
||||
*/
|
||||
void battleUpdate();
|
Reference in New Issue
Block a user