Skip to content

Commit

Permalink
:3
Browse files Browse the repository at this point in the history
  • Loading branch information
bitten2up committed Nov 8, 2024
1 parent 356aeb2 commit a7224c6
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 14 deletions.
19 changes: 16 additions & 3 deletions src/bit_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
//----------------------------------------------------------
// bit_game.cpp
/***********************************************************
* main game loop
************************************************************/
// Horible, despratly needs to be cleaned up...

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
// STD, SDL, and tmx
////////////////////////////////////////////////////////////

#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
Expand All @@ -30,9 +42,9 @@
#include <stdbool.h>
#include "discord.h"

//////////////////
// bitten headers
//////////////////
////////////////////////////////////////////////////////////
// ENGINE HEADERS
////////////////////////////////////////////////////////////

extern "C"
{
Expand All @@ -48,6 +60,7 @@ extern "C"
#include "f_save.h"
}

// mainloop
void bit_main()
{
bitgame.preformance.startTime = 0;
Expand Down
11 changes: 8 additions & 3 deletions src/e_collision.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
* this file handles the collision between sprites
************************************************************/
// needs to be compleatly nuked most likely
// november 2024 update: oh my god its fucking working... maybe i dont need to nuke it

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
// STD and SDL
// STD, SDL, and tmx
////////////////////////////////////////////////////////////
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <SDL2/SDL.h>
#include "r_render.h"
#include "tmx.h"
#include <tmx.h>


////////////////////////////////////////////////////////////
Expand All @@ -51,6 +51,7 @@
#include "e_collision.h" // collision handling
#include "p_player.h"
#include "bit_game.h"
#include "r_render.h"
#include "discord.h"

///////
Expand Down Expand Up @@ -113,6 +114,10 @@ int32_t checkCollision(tmx_map* map, int x, int y)

if (chests->content.gids[((y - 3) * map->width) + (x - 3)] > 0)
return chests->content.gids[((y - 3) * map->width) + (x - 3)];
else if (chests->content.gids[((y - 4) * map->width) + (x - 4)] > 0)
return chests->content.gids[((y - 4) * map->width) + (x - 4)];
else
return chests->content.gids[((y - 2) * map->width) + (x - 2)];
}
else
{
Expand Down
20 changes: 18 additions & 2 deletions src/f_save.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,31 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
//----------------------------------------------------------
// f_save.c
/***********************************************************
* this file handles reading and writing save files
************************************************************/
// was written from scratch, could be cleaned up, but im currently happy with it

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
// STD
////////////////////////////////////////////////////////////

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdbool.h>
#include <string.h>
#include "defaultSave.h" // default savefile

#include "sdl_bittendef.h"
////////////////////////////////////////////////////////////
// ENGINE HEADERS
////////////////////////////////////////////////////////////

#include "sdl_bittendef.h" // defines for the engine
#include "defaultSave.h" // default savefile, also horible way we can make a buffer :)
#include "bit_game.h"
#include "f_save.h"

Expand Down
24 changes: 20 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,35 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
//----------------------------------------------------------
// main.cpp
/***********************************************************
* this file setus up everything
************************************************************/

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
// STD, SDL, and tmx
////////////////////////////////////////////////////////////

#include <stdio.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "discord.h"
#include <tmx.h>

//#include <cLDtk.h>
//#include <cLDtk.h> // sorry cLDtk, tmx seems to be working fine for now :)

////////////////////////////////////////////////////////////
// ENGINE HEADERS
////////////////////////////////////////////////////////////

#include "discord.h"
extern "C"
{
#include "bit_game.h"
#include "sdl_bittendef.h"
#include "sdl_bittendef.h" // defines for the engine
#include "bit_game.h" // a c header for some fucking reason
#include "r_render.h"
#include "f_save.h"
}
Expand Down
12 changes: 12 additions & 0 deletions src/p_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@
* SOFTWARE.
*/

//----------------------------------------------------------
// p_player.c
/***********************************************************
* this file handles the movement of the player
************************************************************/

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
// ENGINE HEADERS
////////////////////////////////////////////////////////////

#include "sdl_bittendef.h"
#include "p_player.h"
#include "e_entity.h"
Expand Down
20 changes: 18 additions & 2 deletions src/r_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,32 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
//----------------------------------------------------------
// r_render.c
/***********************************************************
* this file handles all rendering related logic
************************************************************/
// very dumb and we have to work around some of the things it does, but it works

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
// STD, SDL, and tmx
////////////////////////////////////////////////////////////

#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>

#include <tmx.h>
//#include <cLDtk.h>
//#include <cLDtk.h> // sorry cLDtk, tmx seems to be working fine for now :)

#include "sdl_bittendef.h"
////////////////////////////////////////////////////////////
// ENGINE HEADERS
////////////////////////////////////////////////////////////

#include "sdl_bittendef.h" // defines for the engine
#include "r_render.h"
#include "e_entity.h"
#include "bit_game.h"
Expand Down

0 comments on commit a7224c6

Please sign in to comment.