Dawn progress

This commit is contained in:
2024-11-07 18:28:54 -06:00
parent 6a0ffd4a45
commit 53dc496f2f
17 changed files with 191 additions and 19 deletions

View 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
)

View 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;
}
}

View 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();