-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,011 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,8 @@ | |
*.exe | ||
*.out | ||
*.app | ||
*.elf | ||
*.sav | ||
*.gba | ||
|
||
.vscode/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#--------------------------------------------------------------------------------------------------------------------- | ||
# TARGET is the name of the output. | ||
# BUILD is the directory where object files & intermediate files will be placed. | ||
# LIBBUTANO is the main directory of butano library (https://github.com/GValiente/butano). | ||
# PYTHON is the path to the python interpreter. | ||
# SOURCES is a list of directories containing source code. | ||
# INCLUDES is a list of directories containing extra header files. | ||
# DATA is a list of directories containing binary data. | ||
# GRAPHICS is a list of directories containing files to be processed by grit. | ||
# AUDIO is a list of directories containing files to be processed by mmutil. | ||
# DMGAUDIO is a list of directories containing files to be processed by mod2gbt and s3m2gbt. | ||
# ROMTITLE is a uppercase ASCII, max 12 characters text string containing the output ROM title. | ||
# ROMCODE is a uppercase ASCII, max 4 characters text string containing the output ROM code. | ||
# USERFLAGS is a list of additional compiler flags: | ||
# Pass -flto to enable link-time optimization. | ||
# Pass -O0 to improve debugging. | ||
# USERASFLAGS is a list of additional assembler flags. | ||
# USERLDFLAGS is a list of additional linker flags: | ||
# Pass -flto=auto -save-temps to enable parallel link-time optimization. | ||
# USERLIBDIRS is a list of additional directories containing libraries. | ||
# Each libraries directory must contains include and lib subdirectories. | ||
# USERLIBS is a list of additional libraries to link with the project. | ||
# USERBUILD is a list of additional directories to remove when cleaning the project. | ||
# EXTTOOL is an optional command executed before processing audio, graphics and code files. | ||
# | ||
# All directories are specified relative to the project directory where the makefile is found. | ||
#--------------------------------------------------------------------------------------------------------------------- | ||
TARGET := $(notdir $(CURDIR)) | ||
BUILD := build | ||
LIBBUTANO := ../../butano | ||
PYTHON := python | ||
SOURCES := src ../../common/src | ||
INCLUDES := include ../../common/include | ||
DATA := | ||
GRAPHICS := graphics ../../common/graphics | ||
AUDIO := audio ../../common/audio | ||
DMGAUDIO := dmg_audio ../../common/dmg_audio | ||
ROMTITLE := ROCK_PAPER_SHOTGUN | ||
ROMCODE := SBTP | ||
USERFLAGS := | ||
USERASFLAGS := | ||
USERLDFLAGS := | ||
USERLIBDIRS := | ||
USERLIBS := | ||
USERBUILD := | ||
EXTTOOL := | ||
|
||
#--------------------------------------------------------------------------------------------------------------------- | ||
# Export absolute butano path: | ||
#--------------------------------------------------------------------------------------------------------------------- | ||
ifndef LIBBUTANOABS | ||
export LIBBUTANOABS := $(realpath $(LIBBUTANO)) | ||
endif | ||
|
||
#--------------------------------------------------------------------------------------------------------------------- | ||
# Include main makefile: | ||
#--------------------------------------------------------------------------------------------------------------------- | ||
include $(LIBBUTANOABS)/butano.mak |
Empty file.
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"type": "sprite", | ||
"height": 16 | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "regular_bg" | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"type": "sprite", | ||
"height": 16 | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"type": "sprite", | ||
"height": 16 | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"type": "sprite", | ||
"height": 16 | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"type": "sprite", | ||
"height": 16 | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"type": "sprite", | ||
"height": 16 | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"type": "sprite", | ||
"height": 16 | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef PATHFINDER_H | ||
#define PATHFINDER_H | ||
|
||
#include "queue.h" | ||
#include "stack.h" | ||
#include "bn_log.h" | ||
|
||
#define ROW 9 | ||
#define COL 9 | ||
|
||
class Pathfinder | ||
{ | ||
public: | ||
Pathfinder(); | ||
void reset(); | ||
bool is_valid(int row, int col); | ||
bool found; | ||
int game[ROW][COL] = {0}; | ||
void search(int row, int col); | ||
void add_obstacle(int row, int col); | ||
bool check_obstacle(int row, int col); | ||
private: | ||
Queue<int> queue_r {}; | ||
Queue<int> queue_c {}; | ||
Queue<int> queue_count {}; | ||
bool visited[ROW*COL] = {false}; | ||
bool obstacles[ROW*COL] = {false}; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#ifndef QUEUE_H | ||
#define QUEUE_H | ||
|
||
template<class T> | ||
class Queue | ||
{ | ||
public: | ||
bool empty(); | ||
bool is_full(); | ||
T front(); | ||
T rear(); | ||
void push(T element); | ||
void pop(); | ||
void clear(); | ||
private: | ||
T _queue[1000]; | ||
int _capacity = 1000; | ||
int _size = 0; | ||
int _front = 0; | ||
int _rear = _capacity - 1; | ||
}; | ||
|
||
template<class T> | ||
void Queue<T>::clear() | ||
{ | ||
_size = _front = 0; | ||
_rear = _capacity - 1; | ||
} | ||
|
||
template<class T> | ||
bool Queue<T>::empty() | ||
{ | ||
return _size == 0; | ||
} | ||
|
||
template<class T> | ||
bool Queue<T>::is_full() | ||
{ | ||
return _capacity == _size; | ||
} | ||
|
||
template<class T> | ||
T Queue<T>::front() | ||
{ | ||
return _queue[_front]; | ||
} | ||
|
||
template<class T> | ||
T Queue<T>::rear() | ||
{ | ||
return _rear; | ||
} | ||
|
||
template<class T> | ||
void Queue<T>::push(T element) | ||
{ | ||
if(!is_full()) | ||
{ | ||
_rear = (_rear + 1) % _capacity; | ||
_queue[_rear] = element; | ||
_size++; | ||
} | ||
} | ||
|
||
template<class T> | ||
void Queue<T>::pop() | ||
{ | ||
if(!empty()) | ||
{ | ||
_front = (_front + 1) % _capacity; | ||
_size--; | ||
} | ||
} | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef SCENE_H | ||
#define SCENE_H | ||
|
||
enum SceneType | ||
{ | ||
MENU, | ||
LVL1 | ||
}; | ||
|
||
class Scene | ||
{ | ||
public: | ||
virtual void init() = 0; | ||
virtual void update() = 0; | ||
virtual ~Scene() = 0; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#ifndef STACK_H | ||
#define STACK_H | ||
|
||
template<class T> | ||
class Stack | ||
{ | ||
public: | ||
void push(T element); | ||
void pop(T& element); | ||
bool empty(); | ||
bool is_full(); | ||
void clear(); | ||
private: | ||
T _stack[1000]; | ||
int _top = -1; | ||
int capacity = 1000; | ||
}; | ||
|
||
template<class T> | ||
void Stack<T>::push(T element) | ||
{ | ||
if(!is_full()) | ||
{ | ||
_top++; | ||
_stack[_top] = element; | ||
} | ||
} | ||
|
||
template<class T> | ||
void Stack<T>::pop(T& element) | ||
{ | ||
if(!empty()) | ||
{ | ||
element = _stack[_top]; | ||
_top--; | ||
} | ||
} | ||
|
||
template<class T> | ||
bool Stack<T>::empty() | ||
{ | ||
return _top == -1; | ||
} | ||
|
||
template<class T> | ||
bool Stack<T>::is_full() | ||
{ | ||
return _top == capacity; | ||
} | ||
|
||
template<class T> | ||
void Stack<T>::clear() | ||
{ | ||
_top = -1; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef TILES_H | ||
#define TILES_H | ||
|
||
#include "bn_sprite_ptr.h" | ||
#include "bn_sprite_items_tiles.h" | ||
|
||
struct Tile | ||
{ | ||
bn::sprite_ptr tile = bn::sprite_items::tiles.create_sprite(0, 0); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef TURN_CONTROLLER_H | ||
#define TURN_CONTROLLER_H | ||
|
||
class TurnController | ||
{ | ||
public: | ||
TurnController(); | ||
TurnController(int player_u, int npc_u, int total_player_u, int total_npc_u); | ||
bool is_player_turn = false; | ||
int turn_timer = 20; | ||
private: | ||
int player_units; | ||
int npc_units; | ||
int total_player_units; | ||
int total_npc_units; | ||
}; | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef UNIT_H | ||
#define UNIT_H | ||
|
||
enum UnitType { Player, NPC}; | ||
|
||
class Unit | ||
{ | ||
public: | ||
Unit(int r, int c, int X, int Y, UnitType unit_type_); | ||
Unit(); | ||
|
||
int row; | ||
int col; | ||
|
||
int x; | ||
int y; | ||
|
||
int movement_counter; | ||
int movement_radius; | ||
bool is_moving; | ||
|
||
UnitType unit_type; | ||
}; | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef UTIL_H | ||
#define UTIL_H | ||
|
||
#include "bn_sprite_ptr.h" | ||
|
||
#include "unit.h" | ||
#include "pathfinder.h" | ||
#include "turn_controller.h" | ||
|
||
namespace Util | ||
{ | ||
void move_unit(Unit& curr_unit, bn::sprite_ptr& curr_sprite, Pathfinder& pf, int& movement_counter); | ||
void vaild_moves(Pathfinder& pf, int row, int col, int count); | ||
void paint_moves_1(Unit& curr_unit,Pathfinder& pf, bn::sprite_ptr& v_tile_1, bn::sprite_ptr& v_tile_2, | ||
bn::sprite_ptr& v_tile_3, bn::sprite_ptr& v_tile_4); | ||
void paint_moves_2(Unit& curr_unit,Pathfinder& pf, bn::sprite_ptr& v_tile_5, bn::sprite_ptr& v_tile_6, | ||
bn::sprite_ptr& v_tile_7, bn::sprite_ptr& v_tile_8); | ||
void paint_moves_3(Unit& curr_unit,Pathfinder& pf, bn::sprite_ptr& v_tile_9, bn::sprite_ptr& v_tile_10, | ||
bn::sprite_ptr& v_tile_11, bn::sprite_ptr& v_tile_12); | ||
void hide_tiles(bn::sprite_ptr& v_tile_1, bn::sprite_ptr& v_tile_2, | ||
bn::sprite_ptr& v_tile_3, bn::sprite_ptr& v_tile_4, bn::sprite_ptr& v_tile_5, bn::sprite_ptr& v_tile_6, | ||
bn::sprite_ptr& v_tile_7, bn::sprite_ptr& v_tile_8, bn::sprite_ptr& v_tile_9, bn::sprite_ptr& v_tile_10, | ||
bn::sprite_ptr& v_tile_11, bn::sprite_ptr& v_tile_12); | ||
}; | ||
|
||
#endif |
Oops, something went wrong.