From 8bf2179629440c2305f39dddf90b5ae6740ca209 Mon Sep 17 00:00:00 2001 From: pyroceper Date: Mon, 31 Oct 2022 18:50:20 -0400 Subject: [PATCH] Added src --- .gitignore | 5 + Makefile | 58 ++++++ audio/.gitignore | 0 dmg_audio/.gitignore | 0 graphics/assault_class_.bmp | Bin 0 -> 2166 bytes graphics/assault_class_.json | 4 + graphics/board.bmp | Bin 0 -> 66614 bytes graphics/board.json | 3 + graphics/d_red.bmp | Bin 0 -> 246 bytes graphics/d_red.json | 4 + graphics/dst_cursor.bmp | Bin 0 -> 630 bytes graphics/dst_cursor.json | 4 + graphics/g_arrow.bmp | Bin 0 -> 246 bytes graphics/g_arrow.json | 4 + graphics/selection_cursor.bmp | Bin 0 -> 758 bytes graphics/selection_cursor.json | 4 + graphics/tiles.bmp | Bin 0 -> 1334 bytes graphics/tiles.json | 4 + graphics/wasp.bmp | Bin 0 -> 1142 bytes graphics/wasp.json | 4 + img/pathfinding-0.png | Bin 0 -> 8869 bytes img/pathfinding-1.png | Bin 0 -> 8960 bytes img/pathfinding-2.png | Bin 0 -> 8708 bytes include/.gitignore | 0 include/pathfinder.h | 30 +++ include/queue.h | 76 +++++++ include/scene.h | 18 ++ include/stack.h | 57 ++++++ include/tiles.h | 12 ++ include/turn_controller.h | 19 ++ include/unit.h | 26 +++ include/util.h | 26 +++ src/main.cpp | 362 +++++++++++++++++++++++++++++++++ src/pathfinder.cpp | 83 ++++++++ src/scene.cpp | 6 + src/turn_controller.cpp | 15 ++ src/unit.cpp | 19 ++ src/util.cpp | 168 +++++++++++++++ 38 files changed, 1011 insertions(+) create mode 100644 Makefile create mode 100644 audio/.gitignore create mode 100644 dmg_audio/.gitignore create mode 100644 graphics/assault_class_.bmp create mode 100644 graphics/assault_class_.json create mode 100644 graphics/board.bmp create mode 100644 graphics/board.json create mode 100644 graphics/d_red.bmp create mode 100644 graphics/d_red.json create mode 100644 graphics/dst_cursor.bmp create mode 100644 graphics/dst_cursor.json create mode 100644 graphics/g_arrow.bmp create mode 100644 graphics/g_arrow.json create mode 100644 graphics/selection_cursor.bmp create mode 100644 graphics/selection_cursor.json create mode 100644 graphics/tiles.bmp create mode 100644 graphics/tiles.json create mode 100644 graphics/wasp.bmp create mode 100644 graphics/wasp.json create mode 100644 img/pathfinding-0.png create mode 100644 img/pathfinding-1.png create mode 100644 img/pathfinding-2.png create mode 100644 include/.gitignore create mode 100644 include/pathfinder.h create mode 100644 include/queue.h create mode 100644 include/scene.h create mode 100644 include/stack.h create mode 100644 include/tiles.h create mode 100644 include/turn_controller.h create mode 100644 include/unit.h create mode 100644 include/util.h create mode 100644 src/main.cpp create mode 100644 src/pathfinder.cpp create mode 100644 src/scene.cpp create mode 100644 src/turn_controller.cpp create mode 100644 src/unit.cpp create mode 100644 src/util.cpp diff --git a/.gitignore b/.gitignore index 259148f..7e23f45 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,8 @@ *.exe *.out *.app +*.elf +*.sav +*.gba + +.vscode/* \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..07875b6 --- /dev/null +++ b/Makefile @@ -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 diff --git a/audio/.gitignore b/audio/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/dmg_audio/.gitignore b/dmg_audio/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/graphics/assault_class_.bmp b/graphics/assault_class_.bmp new file mode 100644 index 0000000000000000000000000000000000000000..fbb7b4d90a4bbc62a8cd6f7dad2eb1a815123ae7 GIT binary patch literal 2166 zcmeHIF$%&!5M1FPmL5U^spJq$tLY_3AeE&bNO86XLe|>%_yK$Wb^AA^Ga?%y5t7Z6KEtMs%AC^)n%k=ycpukxj@sN7FQ=^MdHGoXIp)NFXE- z5(o)|1U^ham1TiX0iGyEp`n_jNq`Ys%?vcUHaKG<6W3-7wEEh&db7iRWb?U49_NBs zWRJr8>WzL|V7-Z7bnRbs#W>_hRon_um1eImzG2|u`$=E=Kl0tHf6sk~{}6rPce!5x D#R^G} literal 0 HcmV?d00001 diff --git a/graphics/assault_class_.json b/graphics/assault_class_.json new file mode 100644 index 0000000..d831df0 --- /dev/null +++ b/graphics/assault_class_.json @@ -0,0 +1,4 @@ +{ + "type": "sprite", + "height": 16 +} diff --git a/graphics/board.bmp b/graphics/board.bmp new file mode 100644 index 0000000000000000000000000000000000000000..a44711db08a09afc04ae482bf0fcaf234e88a32e GIT binary patch literal 66614 zcmeI5&u$&bb;d6hin2(Dlt@X|a5QrR1A_$F#BhRH43Hp5y!8VlyI_F8S!6%U#4E3} z$qNKt1bG3!KweAvzVDnwkCszH_Sj&+W_mcfb7h^km2I?dfj! zXG}1Q|0la2F^6FFP4eSz_qR7UyMO=TYWE+%x!V2fPtSH&S3m52_dh@Ee(~MA-TT+C zcfbALx4ZAZ-|v3?H-EbO=U;rc`^~@nBX;p|_sc)I+a;<#%*!Dkv`IsTZxMhfp$13wpR4vEy`f<;HS1(__e#C&)A83j6#fy;P_IB?< z)uzD8P#&8fhx{XieB_7A%emp^`~CHP|Kj%6T%Ox!EPVgw&HMLK;RRcspW7&!<3Bz> z50?daz`XMV{~7{70tD0I>lb^Gzh`*!X0MjU-yZ)Do}a`NfLjG>@#5>R!TnEbyT!$AJ!+4uJ?5&v`WgB7zr zEdpExf&U8OOyW?0m5Y%_KmS*?U!LH0omb%umcUurGIo0IFBa8uWpk3t_LrA?SRVp_ z{{n%Y@FPl6@UJl$>{{UKA&}o9~TV6`3Yn}6eS5fw=YwM zj}+6?B?3B035!|JJeXe5{KUsv0AG0b1ZA7`U zK`q5_gEJQbu#_rBCoOfdJ@}vRU!CnQx%`P=_;vB$oZpx+_L8Vr#^Y8sKF$ICWBbCd zh6Nuv(2Ae#|LT=4h$IST0R>p_W4+`o*pIhAv4n1pAXD1Ltyxz=6`Z*HYgU*5tqi8c zIWGK6f&H10!^O|eP^_RMYNNFhHD?#s7q}!Cv;Omj1D8QK|5t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LaX$P-Hnf&l|#8W;%Bie`Y?gW)VCFkoN`1p@_I(F{;~Fzko4FCWCXNWHXb0FfRlgtJXJ-`7K8{e3qk~dG*|$M1}j9UgX)8s12Y$D57-s}eZvjD literal 0 HcmV?d00001 diff --git a/graphics/g_arrow.json b/graphics/g_arrow.json new file mode 100644 index 0000000..df4ccdd --- /dev/null +++ b/graphics/g_arrow.json @@ -0,0 +1,4 @@ +{ + "type": "sprite", + "height": 16 +} \ No newline at end of file diff --git a/graphics/selection_cursor.bmp b/graphics/selection_cursor.bmp new file mode 100644 index 0000000000000000000000000000000000000000..afafbe3f5f41f70a083b47487d0f503393280c1e GIT binary patch literal 758 zcma)&y$XXs5QHxwTpb%9z(UdsK0pw=fQ{Dv?jxiQRP-=HhhK__#;Hsqfg D=e7hq literal 0 HcmV?d00001 diff --git a/graphics/tiles.json b/graphics/tiles.json new file mode 100644 index 0000000..df4ccdd --- /dev/null +++ b/graphics/tiles.json @@ -0,0 +1,4 @@ +{ + "type": "sprite", + "height": 16 +} \ No newline at end of file diff --git a/graphics/wasp.bmp b/graphics/wasp.bmp new file mode 100644 index 0000000000000000000000000000000000000000..8d96afd7d6bc95ec3a64dcb9f2ae7a6a5c1fe148 GIT binary patch literal 1142 zcmZ?rEn{H-gEAng0mK48+yKOk3{VLu1r!3yfoO*R3=CgCK4xHIVq#FS+{>V)sLh~T z^N7Jo@iADMc!I^n1+3V`#l-={fbqeCKtf4L0mNidHUd!$OvXWA0VdNRVt!eG8rIBZ4U1sS64tOI7_o>& zEEkM49_{a}EW2r<_sP@R>(y#4zZ%WXzB{`U{j&gu=%|8|S+y6%<9*m9iY!XT6#!I= zyxNO;X)}7PqSKT&zCMgi63Y=hc@CpMFe^D^<#80O^?R;ZMM6g_R{k2g+JUM z<3*RlR==3d@Gq#f^%2^CZzDw(Rf}9N=Y`5i>8(;Oq4G<+o-ZHopn3oRhz#~P)Xur< zpD%9aUzYi73INGu65P{pn2l?j1n!<7pW?^+B0InrF+jO@fS<;X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s`3k9;{zM;BQ6IDa^1Zgie!%0MvB zcbkB8%f>4g1OSrvqvCFv-)C_$0#jtwmaqCPV<-A&!QV$m6`ahfy{Lke^Oy@KbbdqI z%qaS4Xp`P{lx^jl*UJpj`ibT&^D87YMc?%Ki`utlpQ5~!HbX;YtaeovaWgc8Mi~MC7k{^+6SbFeFwXBY^0rlAB5Dh* zYc|W0Rlgmm78=kGzxhg#AW~>LVNvJ({CAanv8UGenFqc zMP5z1Oqx`;Q9S)TSm+k2+aZtymsLglLN;^vfT)bK-{Zu~N8@stO{0j$e87|&pfQ+ejU{(?A2EFK_>j`! zm#3@A!sDaw0B0EYP((|JRl5Y-=T>~8`->O|J}f_I$>vLr~Q~C0007DNklq#G`RkJODtE&v3w(=Peb-*TrsGel)Z~EfjgVzrp2aVgHA)gLY3;@?VaKckPAy+-sja5%ow2LqFU~p9AR1*No za@LsPn#!%|z3M5Fq~_?4#ANMsRw;&1*bWD_X?p_ja<30g4Q0#6{I~+ZZ_ClL_7tIEB3qYM--(&($)|j3+Nikr; zQH}k-P&I!@!ZWN@ld=3ZFcJm*0i*xwEtC%~`LR1YJ4#b)4pQFU(={6VVyOMJ|_Htqy$L;C-lD z(9NA|O$>yt5kU^HzX`7+2=Yv%+r&#|u!4cmD>QcT;a7PbMHUqhK_`D>0OH+7A635* ns=ZpG{R_Pg?r#jgOE>&Km~a*39L;it00000NkvXXu0mjfTDytz literal 0 HcmV?d00001 diff --git a/img/pathfinding-1.png b/img/pathfinding-1.png new file mode 100644 index 0000000000000000000000000000000000000000..dfc26ee65ee4727d06c2854f5cfa9c23075233ef GIT binary patch literal 8960 zcmV+bBmdlqP)BLN-s7dSBnTfL zpgN1{U?EgZx%Z#2`uq7J@UHxSv5+}!WwY?owAMfQG6J~1IR4<>&3`8V0RQtdNIEuO zpPpW2DF9qfXW4YBWCKwd7=!aV|MKnKaQ={Q?{bzCkCDoube6Iy`RdWQ=<$BOUc9qc z(IXlcj_>qnGMWCIO^#05T+Rh@e*}|^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Uh43P*=|8U&C9-@gVY7x7V&-KQT9V#DcwDqL5rG-O{!{eZiET4+S4k+AZ$V>Z`# z1=xE`X*RC%!9|)qrku@CQyI;!i#)7{hEOX*0ATi|k)5cblu?pBrW9?9z(Uj-T32j# zD^|Tb5Ir=Yliod)KdO*7NYi4K;xr0H9mHk;AVOQ?SLCab(-$`>a+;iUa6Y4V!#pde zZ6;01`yjkH8$5Ia<^7OIg3Gcbej%HActBLf+3(A;q-pTWvP2cf!^2my$4NdU@$+K_ z0D?>AY(@;ti))9Mqdz5Qe9+Y3}8q~eJWo)E}{)2%|8k%Ii)CbM{y9~!k zkUs%Hp3QNx0FrN`3HQVi_GkR#!?W<_`~Z0LZc`=9;tE0005MNkl#KG5uwm!dt1HTyVcee+C+D~(`hT|kCUjU$NngPHw zV|g+8TK^>G01$>#Xw`o+Iw25eu%o^FCp{K6?~;=qx`OXb z{H^TQ)r^o&hcPCAs~tGurJ9f{U#iB+mooT>FXUu!kY{8G07Wsc-Ec+a#`IqK61bG+ z=y@PWF4HUC;1smd5nC3_x{bU)>}J+kfd|PoD(5vAcP)7}wj-^@Ooevei&wIb$J5Z{ zaeu?Rz6XvUg886s0jSFBt6bp82GbKKF(ynn%EbPSmW!vzzrtEMO{_lyj1Y9rn6u4n zscUm@Z_oY2KJdYD+oc^q%y;hT3NG{&5awA9L5uGtSkB?rvUEir3o1v4I!l)}9WTL; zbV&NWAU^4;t=}3YC}bzw2kBA*a4mR82%by0oetup0TrU8ETUN6+k2Y`CJ^SCyWDDh z;`1;T0%*PQ=AQ@ji0*|zd%~M{;CIL1q1UMW;?rA29eEn$5J0PVV*ujA@TfwR`;|od i4WkYoZw%i{JN!RKg4Gm7kY)t{0000 literal 0 HcmV?d00001 diff --git a/include/.gitignore b/include/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/include/pathfinder.h b/include/pathfinder.h new file mode 100644 index 0000000..ef7ed3d --- /dev/null +++ b/include/pathfinder.h @@ -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 queue_r {}; + Queue queue_c {}; + Queue queue_count {}; + bool visited[ROW*COL] = {false}; + bool obstacles[ROW*COL] = {false}; +}; + +#endif \ No newline at end of file diff --git a/include/queue.h b/include/queue.h new file mode 100644 index 0000000..da47b60 --- /dev/null +++ b/include/queue.h @@ -0,0 +1,76 @@ +#ifndef QUEUE_H +#define QUEUE_H + +template +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 +void Queue::clear() +{ + _size = _front = 0; + _rear = _capacity - 1; +} + +template +bool Queue::empty() +{ + return _size == 0; +} + +template +bool Queue::is_full() +{ + return _capacity == _size; +} + +template +T Queue::front() +{ + return _queue[_front]; +} + +template +T Queue::rear() +{ + return _rear; +} + +template +void Queue::push(T element) +{ + if(!is_full()) + { + _rear = (_rear + 1) % _capacity; + _queue[_rear] = element; + _size++; + } +} + +template +void Queue::pop() +{ + if(!empty()) + { + _front = (_front + 1) % _capacity; + _size--; + } +} + + +#endif \ No newline at end of file diff --git a/include/scene.h b/include/scene.h new file mode 100644 index 0000000..922087b --- /dev/null +++ b/include/scene.h @@ -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 \ No newline at end of file diff --git a/include/stack.h b/include/stack.h new file mode 100644 index 0000000..0f4dae9 --- /dev/null +++ b/include/stack.h @@ -0,0 +1,57 @@ +#ifndef STACK_H +#define STACK_H + +template +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 +void Stack::push(T element) +{ + if(!is_full()) + { + _top++; + _stack[_top] = element; + } +} + +template +void Stack::pop(T& element) +{ + if(!empty()) + { + element = _stack[_top]; + _top--; + } +} + +template +bool Stack::empty() +{ + return _top == -1; +} + +template +bool Stack::is_full() +{ + return _top == capacity; +} + +template +void Stack::clear() +{ + _top = -1; +} + +#endif \ No newline at end of file diff --git a/include/tiles.h b/include/tiles.h new file mode 100644 index 0000000..7038c69 --- /dev/null +++ b/include/tiles.h @@ -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 \ No newline at end of file diff --git a/include/turn_controller.h b/include/turn_controller.h new file mode 100644 index 0000000..e0c643d --- /dev/null +++ b/include/turn_controller.h @@ -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 \ No newline at end of file diff --git a/include/unit.h b/include/unit.h new file mode 100644 index 0000000..9318ecf --- /dev/null +++ b/include/unit.h @@ -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 \ No newline at end of file diff --git a/include/util.h b/include/util.h new file mode 100644 index 0000000..900850e --- /dev/null +++ b/include/util.h @@ -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 \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..84479c3 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,362 @@ +#include "bn_core.h" +#include "bn_math.h" +#include "bn_keypad.h" +#include "bn_display.h" +#include "bn_blending.h" +#include "bn_bg_palettes.h" +#include "bn_regular_bg_ptr.h" +#include "bn_sprites_mosaic.h" +#include "bn_sprite_actions.h" +#include "bn_sprite_builder.h" +#include "bn_sprite_text_generator.h" +#include "bn_sprite_animate_actions.h" +#include "bn_sprite_first_attributes.h" +#include "bn_sprite_third_attributes.h" +#include "bn_sprite_position_hbe_ptr.h" +#include "bn_sprite_first_attributes_hbe_ptr.h" +#include "bn_sprite_third_attributes_hbe_ptr.h" +#include "bn_sprite_affine_second_attributes.h" +#include "bn_sprite_regular_second_attributes.h" +#include "bn_sprite_affine_second_attributes_hbe_ptr.h" +#include "bn_sprite_regular_second_attributes_hbe_ptr.h" +#include "bn_log.h" + +#include "bn_sprite_items_tiles.h" +#include "bn_sprite_items_assault_class_.h" +#include "bn_sprite_items_selection_cursor.h" +#include "bn_sprite_items_dst_cursor.h" +#include "bn_sprite_items_g_arrow.h" +#include "bn_sprite_items_wasp.h" +#include "bn_regular_bg_items_board.h" + +#include "common_info.h" +#include "common_variable_8x16_sprite_font.h" + +#include "scene.h" +#include "util.h" +#include "unit.h" +#include "tiles.h" +#include "queue.h" +#include "pathfinder.h" +#include "turn_controller.h" + + +int main() +{ + bn::core::init(); + + bn::sprite_text_generator text_generator(common::variable_8x16_sprite_font); + text_generator.set_alignment(bn::sprite_text_generator::alignment_type::LEFT); + + bn::vector text_sprites; + + bn::bg_palettes::set_transparent_color(bn::color(16, 16, 16)); + + bn::string_view debug_text[2]; + debug_text[0] = "Player turn"; + text_generator.generate(45, 70, debug_text[0], text_sprites); + + bn::regular_bg_ptr board_bg = bn::regular_bg_items::board.create_bg(0, 0); + + int movement_counter = 0; + const int origin_r = 0; + const int origin_c = 0; + const int origin_pos_x = -104; + const int origin_pos_y = -73; + + int wasp_r = 5; + int wasp_c = 8; + int wasp_pos_x = origin_pos_x + (16 * wasp_c); + int wasp_pos_y = origin_pos_y + (16 * wasp_r); + + bn::sprite_ptr red_tile = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 1); + + bn::sprite_ptr sp_2 = bn::sprite_items::assault_class_.create_sprite(origin_pos_x, origin_pos_y); + + bn::sprite_ptr sp_wasp = bn::sprite_items::wasp.create_sprite(wasp_pos_x, wasp_pos_y); + + bn::sprite_animate_action<8> sp_wasp_animate_action = bn::create_sprite_animate_action_forever( + sp_wasp, 12, bn::sprite_items::wasp.tiles_item(), 0, 1, 2, 3, 4, 5, 6, 7); + + bn::sprite_animate_action<4> sp_2_animate_action = bn::create_sprite_animate_action_forever( + sp_2, 12, bn::sprite_items::assault_class_.tiles_item(), 0, 1, 2, 3); + + Unit player_unit(origin_r, origin_c, origin_pos_x, origin_pos_y, UnitType::Player); + player_unit.movement_counter = 100; //debug + Unit *curr_unit = &player_unit; + + Unit wasp_unit(wasp_r, wasp_c, wasp_pos_x, wasp_pos_y, UnitType::NPC); + wasp_unit.movement_counter = 3; + + bn::sprite_ptr curr_sp = sp_2; + + + bn::sprite_ptr v_tile_1 = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 2); + bn::sprite_ptr v_tile_2 = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 2); + bn::sprite_ptr v_tile_3 = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 2); + bn::sprite_ptr v_tile_4 = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 2); + v_tile_1.set_visible(false); + v_tile_2.set_visible(false); + v_tile_3.set_visible(false); + v_tile_4.set_visible(false); + + bn::sprite_ptr v_tile_5 = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 2); + bn::sprite_ptr v_tile_6 = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 2); + bn::sprite_ptr v_tile_7 = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 2); + bn::sprite_ptr v_tile_8 = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 2); + + v_tile_5.set_visible(false); + v_tile_6.set_visible(false); + v_tile_7.set_visible(false); + v_tile_8.set_visible(false); + + bn::sprite_ptr v_tile_9 = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 2); + bn::sprite_ptr v_tile_10 = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 2); + bn::sprite_ptr v_tile_11 = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 2); + bn::sprite_ptr v_tile_12 = bn::sprite_items::dst_cursor.create_sprite(origin_pos_x, origin_pos_y, 2); + + v_tile_9.set_visible(false); + v_tile_10.set_visible(false); + v_tile_11.set_visible(false); + v_tile_12.set_visible(false); + + int cursor_pos_x = origin_pos_x; + int cursor_pos_y = origin_pos_y; + int cursor_r = 0; + int cursor_c = 0; + bn::sprite_ptr sp_cursor = bn::sprite_items::selection_cursor.create_sprite(cursor_pos_x, cursor_pos_y); + bn::sprite_ptr sp_cursor_blocked = bn::sprite_items::selection_cursor.create_sprite(cursor_pos_x, cursor_pos_y, 2); + sp_cursor_blocked.set_visible(false); + + //UI + int sp_arrow_x = 45; int sp_arrow_y = -20; + bn::sprite_ptr sp_arrow = bn::sprite_items::g_arrow.create_sprite(sp_arrow_x, sp_arrow_y); + sp_arrow.set_visible(false); + bn::sprite_text_generator ui_text_generator(common::variable_8x16_sprite_font); + ui_text_generator.set_alignment(bn::sprite_text_generator::alignment_type::LEFT); + + bn::vector ui_text_1_sp; + bn::vector ui_text_2_sp; + bn::vector ui_text_3_sp; + bn::vector ui_text_4_sp; + bn::string_view ui_text[4]; + + bn::bg_palettes::set_transparent_color(bn::color(16, 16, 16)); + + ui_text[0] = "Move"; + ui_text[1] = "Attack"; + ui_text[2] = "End Turn"; + ui_text[3] = "Back"; + + + Pathfinder pf; + + int dst_r = -1; + int dst_c = -1; + + + red_tile.set_position(origin_pos_x + (dst_r * 16) , origin_pos_y + ((dst_c - 1) * 16)); + + pf.add_obstacle(0, 4); + pf.add_obstacle(1, 1); + pf.add_obstacle(2, 1); + pf.add_obstacle(6, 5); + pf.add_obstacle(8, 5); + pf.add_obstacle(8, 6); + pf.add_obstacle(8, 7); + pf.add_obstacle(8, 8); + + + TurnController tc; + tc.is_player_turn = true; + + bool is_menu = false; + bool prepare_menu = false; + + while(true) + { + bn::core::update(); + //keypad controls + if(!is_menu) + { + if(bn::keypad::pressed(bn::keypad::key_type::LEFT) && pf.is_valid(cursor_r, cursor_c - 1) && !pf.check_obstacle(cursor_r, cursor_c - 1)) + { + cursor_pos_x -= 16; + cursor_c--; + } + else if(bn::keypad::pressed(bn::keypad::key_type::RIGHT) && pf.is_valid(cursor_r, cursor_c + 1) && !pf.check_obstacle(cursor_r, cursor_c + 1)) + { + cursor_pos_x += 16; + cursor_c++; + } + else if(bn::keypad::pressed(bn::keypad::key_type::DOWN) && pf.is_valid(cursor_r + 1, cursor_c) && !pf.check_obstacle(cursor_r + 1, cursor_c)) + { + cursor_pos_y += 16; + cursor_r++; + } + else if(bn::keypad::pressed(bn::keypad::key_type::UP) && pf.is_valid(cursor_r - 1, cursor_c) && !pf.check_obstacle(cursor_r - 1, cursor_c)) + { + cursor_pos_y -= 16; + cursor_r--; + } + } + else + { + if(bn::keypad::pressed(bn::keypad::key_type::DOWN)) + { + sp_arrow_y += 20; + if(sp_arrow_y >= 40) + sp_arrow_y = 40; + } + else if(bn::keypad::pressed(bn::keypad::key_type::UP)) + { + sp_arrow_y -= 20; + if(sp_arrow_y <= -20) + sp_arrow_y = -20; + } + } + + if(bn::keypad::pressed(bn::keypad::key_type::B) && is_menu) + { + sp_arrow.set_visible(false); + is_menu = false; + } + + if(prepare_menu) + { + ui_text_1_sp.clear(); + ui_text_2_sp.clear(); + ui_text_3_sp.clear(); + ui_text_4_sp.clear(); + ui_text_generator.generate(60, -20, ui_text[0], ui_text_1_sp); + ui_text_generator.generate(60, 0, ui_text[1], ui_text_2_sp); + ui_text_generator.generate(60, 20, ui_text[2], ui_text_3_sp); + ui_text_generator.generate(60, 40, ui_text[3], ui_text_4_sp); + prepare_menu = false; + } + + if(!is_menu && !prepare_menu) + { + ui_text_1_sp.clear(); + ui_text_2_sp.clear(); + ui_text_3_sp.clear(); + ui_text_4_sp.clear(); + + Util::hide_tiles(v_tile_1, v_tile_2, v_tile_3, v_tile_4, v_tile_5, v_tile_6, v_tile_7, v_tile_8, v_tile_9, v_tile_10, v_tile_11, v_tile_12); + } + + if(bn::keypad::pressed(bn::keypad::key_type::A) && tc.is_player_turn && !is_menu) + { + //if cursor on unit + //then show available path + //else + if(cursor_r == curr_unit->row && cursor_c == curr_unit->col) + { + + sp_arrow.set_visible(true); + is_menu = true; + prepare_menu = true; + + //get movement radius + BN_LOG("Movement radius"); + Util::vaild_moves(pf, curr_unit->row, curr_unit->col, curr_unit->movement_radius); + Util::paint_moves_1(*curr_unit, pf, v_tile_1, v_tile_2, v_tile_3, v_tile_4); + Util::paint_moves_2(*curr_unit, pf, v_tile_5, v_tile_6, v_tile_7, v_tile_8); + Util::paint_moves_3(*curr_unit, pf, v_tile_9, v_tile_10, v_tile_11, v_tile_12); + pf.reset(); + } + else + { + Util::hide_tiles(v_tile_1, v_tile_2, v_tile_3, v_tile_4, v_tile_5, v_tile_6, v_tile_7, v_tile_8, v_tile_9, v_tile_10, v_tile_11, v_tile_12); + + sp_arrow.set_visible(false); + + dst_r = cursor_r; + dst_c = cursor_c; + BN_LOG(dst_r, " , ", dst_c); + BN_LOG(curr_unit->row, " , ", curr_unit->col); + pf.search(dst_r, dst_c); + for(int i =0;irow != dst_r || curr_unit->col != dst_c)) + { + + Util::move_unit(*curr_unit, curr_sp, pf, movement_counter); + } + else if((curr_unit->row == dst_r) && (curr_unit->col == dst_c)) + { + if(tc.is_player_turn) + { + dst_r = dst_c = -1; + red_tile.set_position(origin_pos_x + (dst_c * 16) , origin_pos_y + (dst_r * 16)); // hide tile + BN_LOG("CPU turn"); + debug_text[0] = "CPU turn"; + text_sprites.clear(); + text_generator.generate(45, 70, debug_text[0], text_sprites); + sp_cursor_blocked.set_visible(true); + sp_cursor.set_visible(false); + pf.reset(); + //after player's turn + //transfer control to CPU + tc.is_player_turn = false; + tc.turn_timer = 100; + dst_r = player_unit.row; + dst_c = player_unit.col; + curr_unit = &wasp_unit; + wasp_unit.movement_counter = 3; + curr_sp = sp_wasp; + BN_LOG(dst_r, " , ", dst_c); + BN_LOG(curr_unit->row, " , ", curr_unit->col); + pf.search(dst_r, dst_c); + } + else + { + BN_LOG("player turn"); + debug_text[0] = "Player turn"; + text_sprites.clear(); + text_generator.generate(45, 70, debug_text[0], text_sprites); + sp_cursor.set_visible(true); + sp_cursor_blocked.set_visible(false); + dst_r = dst_c = -1; + pf.reset(); + tc.is_player_turn = true; + curr_unit = &player_unit; + player_unit.movement_counter = 100; //debug + curr_sp = sp_2; + } + } + + if(curr_unit->movement_counter == 0 || (!tc.is_player_turn && tc.turn_timer <= 0)) + { + BN_LOG("player turn"); + debug_text[0] = "Player turn"; + text_sprites.clear(); + text_generator.generate(45, 70, debug_text[0], text_sprites); + sp_cursor.set_visible(true); + sp_cursor_blocked.set_visible(false); + dst_r = dst_c = -1; + pf.reset(); + tc.is_player_turn = true; + curr_unit = &player_unit; + player_unit.movement_counter = 100; //debug + curr_sp = sp_2; + } + + sp_2_animate_action.update(); + sp_wasp_animate_action.update(); + sp_cursor.set_position(cursor_pos_x, cursor_pos_y); + sp_cursor_blocked.set_position(cursor_pos_x, cursor_pos_y); + sp_arrow.set_position(sp_arrow_x, sp_arrow_y); + } + return 0; +} diff --git a/src/pathfinder.cpp b/src/pathfinder.cpp new file mode 100644 index 0000000..321148f --- /dev/null +++ b/src/pathfinder.cpp @@ -0,0 +1,83 @@ +#include "pathfinder.h" + +Pathfinder::Pathfinder() +{ + reset(); +} + +void Pathfinder::reset() +{ + found = false; + for(int i=0;i= 0 && row < ROW) && (col >= 0 && col < COL)); +} + +void Pathfinder::add_obstacle(int row, int col) +{ + obstacles[ROW* row + col] = true; +} + +bool Pathfinder::check_obstacle(int row, int col) +{ + return obstacles[ROW * row + col]; +} + +void Pathfinder::search(int row, int col) +{ + reset(); + int count = 1; + queue_r.push(row); queue_c.push(col); + queue_count.push(count); + visited[ROW * row + col] = true; + + while(!queue_r.empty()) + { + int rr = queue_r.front(); queue_r.pop(); + int cc = queue_c.front(); queue_c.pop(); + + count = queue_count.front(); queue_count.pop(); + game[rr][cc] = count; + + //SOUTH + if(is_valid(rr+1, cc) && !visited[ROW * (rr+1) + cc] && !obstacles[ROW * (rr+1) + cc]) + { + queue_r.push(rr+1); queue_c.push(cc); queue_count.push(count + 1); + visited[ROW * (rr+1) + cc] = true; + } + //NORTH + if(is_valid(rr-1, cc) && !visited[ROW * (rr-1) + cc] && !obstacles[ROW * (rr-1) + cc]) + { + queue_r.push(rr-1); queue_c.push(cc); queue_count.push(count + 1); + visited[ROW * (rr-1) + cc] = true; + } + //EAST + if(is_valid(rr, cc+1) && !visited[ROW * rr + (cc+1)] && !obstacles[ROW * rr + (cc+1)]) + { + queue_r.push(rr); queue_c.push(cc+1); queue_count.push(count + 1); + visited[ROW * rr + (cc+1)] = true; + } + //WEST + if(is_valid(rr, cc-1) && !visited[ROW * rr + (cc-1)] && !obstacles[ROW * rr + (cc-1)]) + { + queue_r.push(rr); queue_c.push(cc-1); queue_count.push(count + 1); + visited[ROW * rr + (cc-1)] = true; + } + } +} \ No newline at end of file diff --git a/src/scene.cpp b/src/scene.cpp new file mode 100644 index 0000000..df68dfb --- /dev/null +++ b/src/scene.cpp @@ -0,0 +1,6 @@ +#include "scene.h" + +Scene::~Scene() +{ + +} \ No newline at end of file diff --git a/src/turn_controller.cpp b/src/turn_controller.cpp new file mode 100644 index 0000000..22a434d --- /dev/null +++ b/src/turn_controller.cpp @@ -0,0 +1,15 @@ +#include "turn_controller.h" + +TurnController::TurnController() +{ + TurnController(1, 1, 1, 1); +} + +TurnController::TurnController(int player_u, int npc_u, int total_player_u, int total_npc_u) +{ + player_units = player_u; + npc_units = npc_u; + total_player_units = total_player_u; + total_npc_units = total_npc_u; + is_player_turn = true; +} \ No newline at end of file diff --git a/src/unit.cpp b/src/unit.cpp new file mode 100644 index 0000000..b79978b --- /dev/null +++ b/src/unit.cpp @@ -0,0 +1,19 @@ +#include "unit.h" + +Unit::Unit(int r, int c, int X, int Y, UnitType unit_type_) +{ + row = r; + col = c; + x = X; + y = Y; + movement_counter = 0; + movement_radius = 3;//default + is_moving = false; + unit_type = unit_type_; +} + +Unit::Unit() +{ + Unit(0, 0, 0, 0, NPC); +} + diff --git a/src/util.cpp b/src/util.cpp new file mode 100644 index 0000000..62e877f --- /dev/null +++ b/src/util.cpp @@ -0,0 +1,168 @@ +#include "util.h" + +void Util::move_unit(Unit &curr_unit, bn::sprite_ptr& curr_sprite, Pathfinder& pf, int& movement_counter) +{ + if(movement_counter == 30 && curr_unit.movement_counter > 0) + { + // BN_LOG("moving"); + + if(pf.is_valid(curr_unit.row + 1, curr_unit.col) && pf.game[curr_unit.row + 1][curr_unit.col] == pf.game[curr_unit.row][curr_unit.col] - 1) + { + BN_LOG("SOUTH"); + + curr_unit.row = curr_unit.row + 1; + curr_unit.y = curr_unit.y + 16; + curr_sprite.set_y(curr_unit.y); + curr_unit.movement_counter--; + } + else if(pf.is_valid(curr_unit.row, curr_unit.col + 1) && pf.game[curr_unit.row][curr_unit.col + 1] == pf.game[curr_unit.row][curr_unit.col] - 1) + { + BN_LOG("EAST"); + + curr_unit.col = curr_unit.col + 1; + curr_unit.x = curr_unit.x + 16; + curr_sprite.set_x(curr_unit.x); + curr_sprite.set_horizontal_flip(false); + curr_unit.movement_counter--; + } + else if(pf.is_valid(curr_unit.row - 1, curr_unit.col) && pf.game[curr_unit.row - 1][curr_unit.col] == pf.game[curr_unit.row][curr_unit.col] - 1) + { + BN_LOG("NORTH"); + + curr_unit.row = curr_unit.row - 1; + curr_unit.y = curr_unit.y - 16; + curr_sprite.set_y(curr_unit.y); + curr_unit.movement_counter--; + } + else if(pf.is_valid(curr_unit.row, curr_unit.col - 1) && pf.game[curr_unit.row][curr_unit.col - 1] == pf.game[curr_unit.row][curr_unit.col] - 1) + { + BN_LOG("WEST"); + + curr_unit.col = curr_unit.col - 1; + curr_unit.x = curr_unit.x - 16; + curr_sprite.set_x(curr_unit.x); + curr_sprite.set_horizontal_flip(true); + curr_unit.movement_counter--; + } + + movement_counter = 0; + + } + movement_counter++; + // if(!tc.is_player_turn) + // { + // tc.turn_timer--; + // } +} + +void Util::vaild_moves(Pathfinder& pf, int row, int col, int count) +{ + if(!pf.is_valid(row, col) || count == 0 || pf.game[row][col] != -1) + return; + + pf.game[row][col] = count; + + vaild_moves(pf, row - 1, col, count - 1); //SOUTH + vaild_moves(pf, row + 1, col, count - 1); // NORTH + vaild_moves(pf, row, col - 1, count - 1); // WEST + vaild_moves(pf, row, col + 1, count - 1); // EAST +} + +void Util::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) +{ + v_tile_1.set_visible(false); + v_tile_2.set_visible(false); + v_tile_3.set_visible(false); + v_tile_4.set_visible(false); + + v_tile_5.set_visible(false); + v_tile_6.set_visible(false); + v_tile_7.set_visible(false); + v_tile_8.set_visible(false); + + v_tile_9.set_visible(false); + v_tile_10.set_visible(false); + v_tile_11.set_visible(false); + v_tile_12.set_visible(false); +} + +void Util::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) +{ + int origin_pos_x = -104; int origin_pos_y = -73;//temp + if(pf.game[curr_unit.row + 1][curr_unit.col] == 2) + { + v_tile_1.set_position(origin_pos_x + (curr_unit.col * 16) , origin_pos_y + ((curr_unit.row + 1) * 16)); + v_tile_1.set_visible(true); + } + if(pf.game[curr_unit.row - 1][curr_unit.col] == 2) + { + v_tile_2.set_position(origin_pos_x + (curr_unit.col * 16) , origin_pos_y + ((curr_unit.row - 1) * 16)); + v_tile_2.set_visible(true); + } + if(pf.game[curr_unit.row][curr_unit.col + 1] == 2) + { + v_tile_3.set_position(origin_pos_x + ((curr_unit.col + 1) * 16) , origin_pos_y + (curr_unit.row * 16)); + v_tile_3.set_visible(true); + } + if(pf.game[curr_unit.row][curr_unit.col - 1] == 2) + { + v_tile_4.set_position(origin_pos_x + ((curr_unit.col - 1) * 16) , origin_pos_y + (curr_unit.row * 16)); + v_tile_4.set_visible(true); + } +} + +void Util::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) +{ + int origin_pos_x = -104; int origin_pos_y = -73;//temp + if(pf.game[curr_unit.row + 2][curr_unit.col] == 1) + { + v_tile_5.set_position(origin_pos_x + (curr_unit.col * 16) , origin_pos_y + ((curr_unit.row + 2) * 16)); + v_tile_5.set_visible(true); + } + if(pf.game[curr_unit.row - 2][curr_unit.col] == 1) + { + v_tile_6.set_position(origin_pos_x + (curr_unit.col * 16) , origin_pos_y + ((curr_unit.row - 2) * 16)); + v_tile_6.set_visible(true); + } + if(pf.game[curr_unit.row][curr_unit.col + 2] == 1) + { + v_tile_7.set_position(origin_pos_x + ((curr_unit.col + 2) * 16) , origin_pos_y + (curr_unit.row * 16)); + v_tile_7.set_visible(true); + } + if(pf.game[curr_unit.row][curr_unit.col - 2] == 1) + { + v_tile_8.set_position(origin_pos_x + ((curr_unit.col - 2) * 16) , origin_pos_y + (curr_unit.row * 16)); + v_tile_8.set_visible(true); + } +} + +void Util::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) +{ + int origin_pos_x = -104; int origin_pos_y = -73;//temp + if(pf.game[curr_unit.row - 1][curr_unit.col - 1] == 1) + { + v_tile_9.set_position(origin_pos_x + ((curr_unit.col -1) * 16) , origin_pos_y + ((curr_unit.row - 1) * 16)); + v_tile_9.set_visible(true); + } + if(pf.game[curr_unit.row - 1][curr_unit.col + 1] == 1) + { + v_tile_10.set_position(origin_pos_x + ((curr_unit.col + 1) * 16) , origin_pos_y + ((curr_unit.row - 1) * 16)); + v_tile_10.set_visible(true); + } + if(pf.game[curr_unit.row + 1][curr_unit.col - 1] == 1) + { + v_tile_11.set_position(origin_pos_x + ((curr_unit.col - 1) * 16) , origin_pos_y + ((curr_unit.row + 1) * 16)); + v_tile_11.set_visible(true); + } + if(pf.game[curr_unit.row + 1][curr_unit.col + 1] == 1) + { + v_tile_12.set_position(origin_pos_x + ((curr_unit.col + 1) * 16) , origin_pos_y + ((curr_unit.row + 1) * 16)); + v_tile_12.set_visible(true); + } +}