Skip to content

Commit

Permalink
feat: 1.1.5 - base for foeTurnOption (#19)
Browse files Browse the repository at this point in the history
- Adds `foeTurnOption` and `foeTurnOption_OP` for later use.
- Bumps `koliseo` to `0.1.20`.
- Bumps `amboso` to `1.6.4`.
- Adds `stamina` to `Fighter`, `Enemy` and `Boss` for later use.
- Uses bigger sizes for `kls_new()`, 2x for `default_kls` and 4x for
`temporary_kls`.
- Changes calls to `kls_free()` to be made when the game is won.
- Prettier `Makefile` output.
  • Loading branch information
jgabaut authored Sep 7, 2023
1 parent 26fafa0 commit e19eacf
Show file tree
Hide file tree
Showing 19 changed files with 467 additions and 75 deletions.
22 changes: 14 additions & 8 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,46 @@ LDADD = $(HELAPORDO_LDFLAGS) -lncurses -lmenu -lpanel -lm

if DEBUG_BUILD
AM_LDFLAGS = -ggdb -O0
KLS_LDFLAGS = -ggdb -O0
HELAPORDO_CFLAGS += -DHELAPORDO_DEBUG_LOG -DHELAPORDO_DEBUG_ACCESS
else
# Linker flag to strip symbols
AM_LDFLAGS = -s -O2
KLS_LDFLAGS = -O2
endif

# Compiler flags
AM_CFLAGS = $(HELAPORDO_CFLAGS) -Werror -Wpedantic -Wall -DKOLISEO_HAS_CURSES

./src/anvil__helapordo.c:
@echo -en "Generating C anvil__helapordo for $(VERSION): "
-./anvil -G ./src $(VERSION)
@echo -e "\033[1;34m[Makefile]\e[0m Using \033[1;33mamboso\e[0m to generate [\033[1;34m./src/anvil__helapordo.c\e[0m and \033[1;34m./src/anvil__helapordo.h\e[0m] for [ \033[1;36m$(VERSION)\e[0m ]:"
-./anvil -qG ./src $(VERSION)
@echo -e "\033[1;33mDone.\e[0m"

./koliseo/src/koliseo.o:
@echo -en "Building Koliseo with curses: "
gcc -c ./koliseo/src/koliseo.c -DKOLISEO_HAS_CURSES -o ./koliseo/src/koliseo.o
@echo -e " \033[1;35mAM_CFLAGS\e[0m: [ \"\033[1;34m$(AM_CFLAGS)\e[0m\" ]"
@echo -e " \033[1;35mKLS_LDFLAGS\e[0m: [ \"\033[1;34m$(KLS_LDFLAGS)\e[0m\" ]"
@echo -en "\033[1;34m[Makefile]\e[0m Building [\033[1;35m./koliseo/src/koliseo.o\e[0m] with curses: "
gcc -c ./koliseo/src/koliseo.c $(AM_CFLAGS) -o ./koliseo/src/koliseo.o $(KLS_LDFLAGS)
@echo -e "\033[1;33mDone.\e[0m"

./src/palette.c:
@echo -en "\033[1;34m[Makefile]\e[0m Using python to generate C palette files from \033[1;35m[$(PALETTE_PATH)]:\e[0m "
@echo -en "\033[1;34m[Makefile]\e[0m Using \033[1;33mpython\e[0m to generate C [\033[1;34m./src/palette.c\e[0m and \033[1;34m./src/palette.h\e[0m] files from \033[1;35m[$(PALETTE_PATH)]:\e[0m "
python ./sprites4curses/scripts/palette.py C-impl $(PALETTE_PATH) .. > ./src/palette.c
python ./sprites4curses/scripts/palette.py C-header $(PALETTE_PATH) .. > ./src/palette.h
@echo -e "\033[1;33mDone.\e[0m"

# Build rule for object files
%.o: %.c
@echo -en "[ $< ] ->\033[1;34m [ $@ ]:\e[0m "
@echo -en " [ $< ] -> [ \033[1;34m$@\e[0m ]: "
$(CC) -c $(CFLAGS) $(AM_CFLAGS) $< -o $@
@echo -e "\033[1;33mDone.\e[0m"

# Build rule for the final binary
$(TARGET): $(helapordo_SOURCES:.c=.o)
@echo -en "\033[1;34mBuilding [\033[1;35m $@ \033[1;34m]:\e[0m "
@echo -e " \033[1;35mAM_CFLAGS\e[0m: [ \"\033[1;34m$(AM_CFLAGS)\e[0m\" ]"
@echo -e " \033[1;35mAM_LDFLAGS\e[0m: [ \"\033[1;34m$(AM_LDFLAGS)\e[0m\" ]"
@echo -en "\033[1;34m[Makefile] Building [\033[1;35m $@ \033[1;34m]:\e[0m "
$(CC) $(CFLAGS) $(AM_CFLAGS) $(helapordo_SOURCES:.c=.o) -o $@ $(LDADD) $(AM_LDFLAGS)
@echo -e "\033[1;33mDone.\e[0m"

Expand Down Expand Up @@ -171,7 +177,7 @@ cleanob:
@echo -e "\033[1;33mDone.\e[0m"

# Default target (builds everything)
all: ./src/anvil__helapordo.c ./koliseo/src/koliseo.o ./src/palette.c $(TARGET)
all: ./src/anvil__helapordo.c ./src/palette.c ./koliseo/src/koliseo.o $(TARGET)

# Target to clean and rebuild
rebuild: clean all
Expand Down
2 changes: 1 addition & 1 deletion amboso
1 change: 1 addition & 0 deletions bin/stego.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ kazoj# tests folder name
1.1.2# Define HLP_Region_Type, bump Koliseo to 0.1.17 - Deprecated
1.1.3# Fix enum conversion warn, bump Koliseo to 0.1.18
1.1.4# Add Gamestate, variadic log_tag()
1.1.5# Add foeTurnOption
5 changes: 5 additions & 0 deletions bin/v1.1.5/.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.5/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.4], [[email protected]])
AC_INIT([helapordo], [1.1.5], [[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.4"
VERSION="1.1.5"
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.4"
PROJECT_NUMBER = "1.1.5"

# 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 installer
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if [[ $# -ne 6 ]] ; then {
}
fi

INSTALLER_VERSION="0.1.0"
INSTALLER_VERSION="0.1.1"
VERSION="$2"
TARGET_INSTALL_DIR="$3"
SOURCE_INSTALL_DIR="$4"
Expand Down
11 changes: 10 additions & 1 deletion kazoj/bone/const.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ void fail(char* msg, int ex, int val) {

int main(void) {
int check = -1;
if ( ! (( check = strcmp(VERSION, "1.1.4") ) == 0)) {
if ( ! (( check = strcmp(VERSION, "1.1.5") ) == 0)) {
fail("VERSION",0,check);
};
if ( ! (HLP_MAX_INDEX == 27) ) {
fail("HLP_MAX_INDEX",27,HLP_MAX_INDEX);
}
if ( ! (MAX_SAVESLOTS == 3) ) {
fail("MAX_SAVESLOTS",3,MAX_SAVESLOTS);
}
if ( ! (FOETURNOP_MAX == 3) ) {
fail("FOETURNOP_MAX",3,FOETURNOP_MAX);
};
if ( ! (TURNOP_MAX == 15) ) {
fail("TURNOP_MAX",15,TURNOP_MAX);
};
Expand Down
2 changes: 1 addition & 1 deletion koliseo
2 changes: 1 addition & 1 deletion src/floors.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ void move_update(Gamestate* gamestate, Floor* floor, int* current_x, int* curren
}
break;
default: {
log_tag("debug_log.txt","[FLOOR]","move_update(): Player char (%c)was not accounted for. Target (x=%i,y=%i) class (%s).",c,target_x,target_y,stringFromRoom(floor->roomclass_layout[target_x][target_y]));
log_tag("debug_log.txt","[FLOOR]","move_update(): Player char ( %c ) was not accounted for. Target (x=%i,y=%i) class (%s).",c,target_x,target_y,stringFromRoom(floor->roomclass_layout[target_x][target_y]));
picked = 0;
continue;
}
Expand Down
66 changes: 49 additions & 17 deletions src/game_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,31 @@ turnOption_OP turnOP_from_turnOption(turnOption t) {
return res;
}

foeTurnOption_OP foeTurnOP_from_foeTurnOption(foeTurnOption ft) {
foeTurnOption_OP res = FOE_OP_INVALID;

switch(ft) {
case FOE_INVALID: {
res = FOE_OP_INVALID;
}
break;
case FOE_FIGHT: {
res = FOE_OP_FIGHT;
}
break;
case FOE_SPECIAL: {
res = FOE_OP_SPECIAL;
}
break;
default: {
//FIXME:
//Signal error right here?
return FOE_OP_INVALID;
}
}
return res;
}

OP_res OP_res_from_fightResult(fightResult fr) {
OP_res res = INVALID_OP;

Expand Down Expand Up @@ -186,6 +211,13 @@ char* turnopstrings[TURNOP_MAX+1] = {
"Load Home Room",
};

char* foeturnopstrings[FOETURNOP_MAX+1] = {
"!INVALID!",
"Idle",
"Fight",
"Special",
};

char* fightresultstrings[FIGHT_RES_TOT+1] = {
"!Invalid fight result!",
"Kill done",
Expand Down Expand Up @@ -244,10 +276,10 @@ char* classesstrings[CLASSESMAX+1] = {

BaseStats basestats[CLASSESMAX+1] = {

{Knight,32,12,22,7,1,0,1,0,32,5},
{Archer,24,15,14,11,1,0,1,0,24,5},
{Mage,17,19,10,8,1,0,1,0,17,5},
{Assassin,20,16,12,10,1,0,1,0,20,5}
{Knight,32,12,22,7,1,0,1,0,32,5,5},
{Archer,24,15,14,11,1,0,1,0,24,5,5},
{Mage,17,19,10,8,1,0,1,0,17,5,5},
{Assassin,20,16,12,10,1,0,1,0,20,5,5}

};

Expand All @@ -264,14 +296,14 @@ char* classenemystrings[ENEMYCLASSESMAX+1] = {

EnemyBaseStats baseenemystats[ENEMYCLASSESMAX+1] = {

{Mummy,22,11,7,5,1,1,22,0,5},
{Ghost,35,5,16,6,1,2,35,0,5},
{Zombie,20,6,7,5,1,1,20,0,5},
{Goblin,32,10,8,11,1,2,32,0,5},
{Imp,24,12,7,10,1,3,24,0,5},
{Troll,42,4,17,4,2,3,42,0,5},
{Boar,30,9,12,8,2,4,30,0,5},
{Werewolf,20,14,5,7,1,3,20,0,5}
{Mummy,22,11,7,5,1,1,22,0,5,5},
{Ghost,35,5,16,6,1,2,35,0,5,5},
{Zombie,20,6,7,5,1,1,20,0,5,5},
{Goblin,32,10,8,11,1,2,32,0,5,5},
{Imp,24,12,7,10,1,3,24,0,5,5},
{Troll,42,4,17,4,2,3,42,0,5,5},
{Boar,30,9,12,8,2,4,30,0,5,5},
{Werewolf,20,14,5,7,1,3,20,0,5,5}
};

char* classbossstrings[BOSSCLASSESMAX+1] = {
Expand All @@ -284,11 +316,11 @@ char* classbossstrings[BOSSCLASSESMAX+1] = {

BossBaseStats basebossstats[BOSSCLASSESMAX+1] = {

{Blue_Troll,90,11,26,5,1,18,90,0,8},
{Headless_Ninja,65,19,16,9,1,18,65,0,8},
{Crawling_Dude,76,13,32,7,1,18,76,0,8},
{Sr_Warthog,58,17,21,10,1,18,58,0,8},
{Doppelganger,15,10,10,10,1,18,15,0,8}
{Blue_Troll,90,11,26,5,1,18,90,0,8,5},
{Headless_Ninja,65,19,16,9,1,18,65,0,8,5},
{Crawling_Dude,76,13,32,7,1,18,76,0,8,5},
{Sr_Warthog,58,17,21,10,1,18,58,0,8,5},
{Doppelganger,15,10,10,10,1,18,15,0,8,5}
};

char* specialsnamestrings[CLASSESMAX+1][SPECIALSMAX+1] = {
Expand Down
61 changes: 57 additions & 4 deletions src/game_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ extern int GS_AUTOSAVE_ON;
/**
* Current patch release.
*/
#define HELAPORDO_PATCH_VERSION 4
#define HELAPORDO_PATCH_VERSION 5

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

/**
* Default savepath.
Expand Down Expand Up @@ -373,6 +373,7 @@ typedef struct BaseStats {
int currentlevelxp; /**< Total xp value for current level*/
int totalhp; /**< Total hp value*/
int totalenergy; /**< Total energy value*/
int totalstamina; /**< Total stamina value*/
} BaseStats;

/**
Expand Down Expand Up @@ -431,6 +432,7 @@ typedef struct EnemyBaseStats {
int totalhp; /**< Total hp value*/
int beast; /**< Flag used for "beast" enemies*/
int totalenergy;/**< Total energy value*/
int totalstamina;/**< Total stamina value*/
} EnemyBaseStats;

/**
Expand Down Expand Up @@ -486,6 +488,7 @@ typedef struct BossBaseStats {
int totalhp; /**< Total hp value*/
int beast; /**< Flag used for "beast" enemies*/
int totalenergy;/**< Total energy value*/
int totalstamina;/**< Total stamina value*/
} BossBaseStats;

/**
Expand Down Expand Up @@ -773,6 +776,8 @@ typedef struct Fighter {

int energy; /**< Current energy value*/
int totalenergy; /**< Full energy value*/
int stamina; /**< Current stamina value*/
int totalstamina; /**< Full stamina value*/
Specialslot* specials[SPECIALSMAX+1]; /**< Array with all the Specialslot*/

struct Turncounter* counters[COUNTERSMAX+1]; /**< Array with all the Turncounter pointers*/
Expand Down Expand Up @@ -834,6 +839,9 @@ typedef struct Enemy {
int energy; /**< Current energy value*/
int totalenergy; /**< Full energy value*/

int stamina; /**< Current stamina value*/
int totalstamina; /**< Full stamina value*/

fighterStatus status; /**< Defines active fighterStatus*/
int beast; /**< Flag defining the instance as "beast" if set*/

Expand Down Expand Up @@ -870,6 +878,9 @@ typedef struct Boss {
int energy; /**< Current energy value*/
int totalenergy; /**< Full energy value*/

int stamina; /**< Current stamina value*/
int totalstamina; /**< Full stamina value*/

fighterStatus status; /**< Defines active fighterStatus*/
int beast; /**< Flag defining the instance as "beast" if set*/

Expand Down Expand Up @@ -1630,6 +1641,48 @@ turnOption_OP turnOP_from_turnOption(turnOption t);
*/
extern char* turnopstrings[TURNOP_MAX+1];

/**
* The different kinds of foeTurnOption.
*/
typedef enum foeTurnOption {
FOE_INVALID=0,
FOE_IDLE=1,
FOE_FIGHT=2,
FOE_SPECIAL=3,
} foeTurnOption;

/**
* The different kinds of foeTurnOption_OP.
* @see stringFromFoeTurnOP()
*/
typedef enum foeTurnOption_OP {
FOE_OP_INVALID=0,
FOE_OP_IDLE=1,
FOE_OP_FIGHT=2,
FOE_OP_SPECIAL=3,
} foeTurnOption_OP;

/**
* Returns a foeTurnOption_OP from a foeTurnOption.
* @param ft The foeTurnOption to convert.
* @return The corresponding foeTurnOption_OP
*/
foeTurnOption_OP foeTurnOP_from_foeTurnOption(foeTurnOption ft);

/**
* Maximum value for foeTurnOption_OP.
* At runtime, not all of them are valid options.
* @see foeTurnOption_OP
* @see stringFromFoeTurnOP()
*/
#define FOETURNOP_MAX 3
/**
* Array with the name strings for foeTurnOption.
* @see foeTurnOption
* @see stringFromFoeTurnOption()
*/
extern char* foeturnopstrings[FOETURNOP_MAX+1];

/**
* Filename for OPS log.
* @see turnOP()
Expand All @@ -1647,8 +1700,8 @@ typedef enum OP_res {
NO_OP=2,
OP_CANNOT_OPEN_SAVEFILE=3,
OP_RES_KILL_DONE=4, /**< Value of fight status indicating the enemy died.*/
OP_RES_DMG_DEALT=5, /**< Value of fight status indicating the enemy was damaded.*/
OP_RES_DMG_TAKEN=6, /**< Value of fight status indicating the fighter was damaded.*/
OP_RES_DMG_DEALT=5, /**< Value of fight status indicating the enemy was damaged.*/
OP_RES_DMG_TAKEN=6, /**< Value of fight status indicating the fighter was damaged.*/
OP_RES_DEATH=7, /**< Value of fight status indicating the fighter died.*/
OP_RES_NO_DMG=8, /**< Value of fight status indicating no damage occurred. Used to reset the fight status to neutral after the end of a combat. */
OP_RES_LOADED_ENEMYROOM=9, /**< Value of OP_res indicating success in loading a enemyroom*/
Expand Down
Loading

0 comments on commit e19eacf

Please sign in to comment.