Skip to content

Commit

Permalink
feat: 1.1.2 - use KLS_PUSH_TYPED() (#16)
Browse files Browse the repository at this point in the history
- Bumps `Koliseo` to `0.1.17`.
- Adds `HLP_Region_Type`.
- Switches allocations to `KLS_PUSH_TYPED()`.
- Reworks `K` and `T` queries for debug menu, old ones were renamed to
`k` and `t`.
  • Loading branch information
jgabaut authored Sep 2, 2023
1 parent 4c2c6ec commit 2706297
Show file tree
Hide file tree
Showing 13 changed files with 301 additions and 90 deletions.
1 change: 1 addition & 0 deletions bin/stego.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ kazoj# tests folder name
1.0.11# Add saveslot selection
1.1.0# Animations and lores are compiled
1.1.1# Palette is compiled
1.1.2# Define HLP_Region_Type, bump Koliseo to 0.1.17
5 changes: 5 additions & 0 deletions bin/v1.1.2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#amboso compliant version folder, will ignore everything inside BUT the gitignore, to keep the clean dir
#we also keep specific dependencies...
*
!.gitignore
!static
1 change: 1 addition & 0 deletions bin/v1.1.2/static
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Define the package name and version
AC_INIT([helapordo], [1.1.1], [[email protected]])
AC_INIT([helapordo], [1.1.2], [[email protected]])

# Verify automake version and enable foreign option
AM_INIT_AUTOMAKE([foreign -Wall])
Expand Down Expand Up @@ -32,7 +32,7 @@ fi
# Set a default version number if not specified externally
AC_ARG_VAR([VERSION], [Version number])
if test -z "$VERSION"; then
VERSION="1.1.1"
VERSION="1.1.2"
fi

# Output variables to the config.h header
Expand Down
2 changes: 1 addition & 1 deletion docs/helapordo.doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = "helapordo"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "1.1.1"
PROJECT_NUMBER = "1.1.2"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion kazoj/bone/const.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void fail(char* msg, int ex, int val) {

int main(void) {
int check = -1;
if ( ! (( check = strcmp(VERSION, "1.1.1") ) == 0)) {
if ( ! (( check = strcmp(VERSION, "1.1.2") ) == 0)) {
fail("VERSION",0,check);
};
if ( ! (TURNOP_MAX == 15) ) {
Expand Down
30 changes: 30 additions & 0 deletions src/game_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,36 @@ char* gamemodenamestrings[GAMEMODE_MAX+1] = {
"Rogue"
};

char* hlp_regiontype_strings[HLP_MAX_INDEX+1] = {
"None",
"KLS_Header",
"HLP_Path",
"HLP_Wincon",
"HLP_Room",
"HLP_Floor",
"HLP_turnOP_args",
"HLP_Fighter",
"HLP_Enemy",
"HLP_Boss",
"HLP_FoeParty",
"HLP_Equip",
"HLP_Equipslot",
"HLP_Specialslot",
"HLP_Turncounter",
"HLP_Perk",
"HLP_Consumable",
"HLP_Artifact",
"HLP_Chest",
"HLP_Treasure",
"HLP_Shop",
"HLP_Roadfork",
"HLP_Turncounter_desc",
"HLP_Room_desc",
"HLP_countStats",
"HLP_Saveslot",
"HLP_loadInfo",
};

Saveslot default_saveslots[MAX_SAVESLOTS+1] = {
{"default_1","helapordo-save.txt"},
{"default_2","helapordo-save-2.txt"},
Expand Down
46 changes: 44 additions & 2 deletions src/game_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,48 @@
#include <panel.h>
#include "../koliseo/src/koliseo.h"

/**
* Defines indexes for all types that are allocated with Koliseo.
*/
typedef enum HLP_Region_Type {
HR_Path=KLS_Header+100, //Start counting from last index of Koliseo's own Region_Type values
HR_Wincon,
HR_Room,
HR_Floor,
HR_turnOP_args,
HR_Fighter,
HR_Enemy,
HR_Boss,
HR_FoeParty,
HR_Equip,
HR_Equipslot,
HR_Specialslot,
HR_Turncounter,
HR_Perk,
HR_Consumable,
HR_Artifact,
HR_Chest,
HR_Treasure,
HR_Shop,
HR_Roadfork,
HR_Turncounter_desc,
HR_Room_desc,
HR_countStats,
HR_Saveslot,
HR_loadInfo,
} HLP_Region_Type;

/**
* Defines max index for an HLP_Region_Type value.
*/
#define HLP_MAX_INDEX (HR_loadInfo-100+KLS_Header)

/**
* Array with the name strings for HLP_Region_Type values.
* @see HLP_Region_Type
*/
extern char* hlp_regiontype_strings[HLP_MAX_INDEX+1];

/**
* Global variable for default Koliseo.
*/
Expand Down Expand Up @@ -70,12 +112,12 @@ extern int GS_AUTOSAVE_ON;
/**
* Current patch release.
*/
#define HELAPORDO_PATCH_VERSION 1
#define HELAPORDO_PATCH_VERSION 2

/**
* Current version string identifier, with MAJOR.MINOR.PATCH format.
*/
#define VERSION "1.1.1"
#define VERSION "1.1.2"

/**
* Default savepath.
Expand Down
13 changes: 12 additions & 1 deletion src/game_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ turnOP_args* init_turnOP_args(Fighter* actor, Path* path, Room* room, loadInfo*
sprintf(msg,"Allocated size %lu for new turnOP_args", sizeof(turnOP_args));
log_tag("debug_log.txt","[TURNOP]",msg);
kls_log("DEBUG",msg);
turnOP_args* res = (turnOP_args*) KLS_PUSH_T_NAMED(tkls,turnOP_args,1,"turnOP_args",msg);
turnOP_args* res = (turnOP_args*) KLS_PUSH_T_TYPED(tkls,turnOP_args,1,HR_turnOP_args,"turnOP_args",msg);

res->actor = actor;
res->path = path;
Expand Down Expand Up @@ -807,6 +807,17 @@ char* stringFromFoePartyClass(foePartyClass fp) {
return foepartystrings[fp];
}

/**
* Takes a integer and returns the corresponding HLP_Region_Type string by the inner array position.
* Correct result is only possible by having the enum values in a consistent order with the string array.
* @see HLP_Region_Type
* @param t The HLP type.
* @return String corresponding to the HLP_Region_Type name.
*/
char* stringFrom_HLP_Region_Type(HLP_Region_Type t) {
return hlp_regiontype_strings[t];
}

/**
* Takes a integer and returns the corresponding room name string by the inner array position.
* Correct result is only possible by having the enum values in a consistent order with the string array.
Expand Down
1 change: 1 addition & 0 deletions src/game_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ void log_OP(turnOption_OP op);
turnOP_args* init_turnOP_args(Fighter* actor, Path* path, Room* room, loadInfo* load_info, Enemy* enemy, Boss* boss, FILE* save_file, WINDOW* notify_win, Koliseo_Temp* t_kls);

saveType saveTypeFrom_string(char* s);
char* stringFrom_HLP_Region_Type(HLP_Region_Type t);
char* stringFrom_OP_res(OP_res r);
char* stringFrom_saveType(saveType s);
char* stringFrom_fightResult(fightResult fr);
Expand Down
Loading

0 comments on commit 2706297

Please sign in to comment.