Skip to content

Commit

Permalink
Adjusted everything in an attempt to make development easier
Browse files Browse the repository at this point in the history
Added lumberjackGame.c and moved everything to it
Added menu to lumberjack so I can menu
  • Loading branch information
MrTroyD committed Sep 5, 2023
1 parent c30664d commit c985675
Show file tree
Hide file tree
Showing 18 changed files with 1,225 additions and 967 deletions.
Binary file removed assets/fonts/radiostars.font.png
Binary file not shown.
Binary file removed assets/lumbers/lumbers_red_18.png
Binary file not shown.
Binary file removed assets/lumbers/lumbers_red_19.png
Binary file not shown.
Binary file removed assets/lumbers/lumbers_red_20.png
Binary file not shown.
Binary file removed assets/lumbers/lumbers_red_21.png
Binary file not shown.
2 changes: 2 additions & 0 deletions emulator/src/extensions/modes/ext_modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "jukebox.h"
#include "mainMenu.h"
#include "pong.h"
#include "lumberjack.h"
#include "touchTest.h"
#include "tunernome.h"

Expand Down Expand Up @@ -58,6 +59,7 @@ static swadgeMode_t* allSwadgeModes[] = {
&jukeboxMode,
&mainMenuMode,
&pongMode,
&lumberjackMode,
&touchTestMode,
&tunernomeMode,
};
Expand Down
5 changes: 5 additions & 0 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ idf_component_register(SRCS "swadge2024.c"
"modes/dance/dance.c"
"modes/dance/portableDance.c"
"modes/demo/demoMode.c"
"modes/lumberjack/lumberjack.c"
"modes/lumberjack/lumberjackGame.c"
"modes/lumberjack/lumberjackEntity.c"
"modes/lumberjack/lumberjackPlayer.c"
"modes/jukebox/jukebox.c"
"modes/mainMenu/mainMenu.c"
"modes/pong/pong.c"
Expand Down Expand Up @@ -65,6 +69,7 @@ idf_component_register(SRCS "swadge2024.c"
"./modes/pong"
"./modes/tunernome"
"./modes/mainMenu"
"./modes/lumberjack"
"./modes/demo"
"./modes/quickSettings")

Expand Down
1,019 changes: 66 additions & 953 deletions main/modes/lumberjack/lumberjack.c

Large diffs are not rendered by default.

33 changes: 32 additions & 1 deletion main/modes/lumberjack/lumberjack.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,33 @@
#include "lumberjackEntity.h"
#include "lumberjackPlayer.h"

const static char* LUM_TAG = "LUM";
extern swadgeMode_t lumberjackMode;

typedef enum{
LUMBERJACK_MENU,
LUMBERJACK_A,
LUMBERJACK_B,
}lumberjackScreen_t;

typedef enum{
LUMBERJACK_NONE,
LUMBERJACK_PANIC,
LUMBERJACK_ATTACK
}lumberjackGameType_t;

typedef struct
{
menu_t* menu;
menuLogbookRenderer_t* menuLogbookRenderer;
font_t ibm;
font_t logbook;

//The pass throughs
p2pInfo p2p;
lumberjackScreen_t screen;

} lumberjack_t;

typedef struct
{
Expand All @@ -24,6 +49,7 @@ typedef struct

typedef struct
{
bool loaded;
font_t ibm;
p2pInfo p2p;
menu_t* menu;
Expand All @@ -46,18 +72,23 @@ typedef struct
lumberjackTile_t tile[400];
uint8_t anim[400];

wsg_t playerSprites[63];
wsg_t enemySprites[21];
wsg_t playerSprites[41];

wsg_t alertSprite;

wsg_t slowload[400];

lumberjackEntity_t* enemy[8];

lumberjackEntity_t* localPlayer;
lumberjackEntity_t* remotePlayer;

lumberjackGameType_t gameType;

} lumberjackVars_t;




#endif
42 changes: 37 additions & 5 deletions main/modes/lumberjack/lumberjackEntity.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ void lumberjackSetupEnemy(lumberjackEntity_t* enemy, int character)
enemy->ready = true;
enemy->showAlert = false;
enemy->spriteOffset = 0;

enemy->cW = 15;
enemy->cH = 15;
lumberjackUpdateEnemy(enemy, character);

}
Expand All @@ -28,6 +29,7 @@ void lumberjackResetEnemy(lumberjackEntity_t* enemy)
enemy->x = 0;
enemy->upgrading = false;

lumberjackUpdateEnemy(enemy, enemy->type);
}

void lumberjackRespawnEnemy(lumberjackEntity_t* enemy, int side)
Expand All @@ -49,7 +51,7 @@ void lumberjackRespawnEnemy(lumberjackEntity_t* enemy, int side)
else
{
enemy->direction = -1; // This needs to be decided ahead of time
enemy->x = 200;
enemy->x = 279;
enemy->vx = 0;// -enemy->maxVX;
enemy->flipped = true;
}
Expand Down Expand Up @@ -77,25 +79,32 @@ void lumberjackUpdateEnemy(lumberjackEntity_t* enemy, int newIndex)
enemy->spriteOffset = 0;
enemy->maxLevel = 2;

enemy->cW = 15;
enemy->cH = 15;

}
else if (newIndex == 1)
{
enemy->width = 15;
enemy->height = 15;
enemy->tileHeight = 1;
enemy->maxVX = 8;
enemy->maxVX = 6;
enemy->spriteOffset = 7;
enemy->maxLevel = 2;
enemy->cW = 15;
enemy->cH = 15;

}
else if (newIndex == 2)
{
enemy->width = 15;
enemy->height = 15;
enemy->tileHeight = 1;
enemy->maxVX = 10;
enemy->maxVX = 8;
enemy->spriteOffset = 14;
enemy->maxLevel = 2;
enemy->cW = 15;
enemy->cH = 15;

}

Expand All @@ -108,8 +117,31 @@ void lumberjackDoEnemyControls(lumberjackEntity_t* enemy)
{
//pick between types I guess
//if enemy->type 1, 2, or 3... continue
//enemy->direction = -1;


}

void lumberjackUpdateEnemyCollision(lumberjackEntity_t* enemy)
{
enemy->cX = enemy->x;
enemy->cY = enemy->y;
}

void lumberjackUpdatePlayerCollision(lumberjackEntity_t* player)
{
player->cX = player->cX + 2;
player->cW = player->width -4;

if (player->state == LUMBERJACK_DUCK)
{
player->cY = player->cY + 8;
player->cH = player->height -16;
}
else
{
player->cY = player->cY + 4;
player->cH = player->height -8;
}
}


Expand Down
15 changes: 13 additions & 2 deletions main/modes/lumberjack/lumberjackEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ typedef struct
int x;
int y;
int spriteOffset;
float vx;
int vx;
float vy;
float maxVX;
int maxVX;
int type;
int maxLevel;
int respawn;

int cX;
int cY;
int8_t cW;
int8_t cH;

bool upgrading;
bool ready; //Ready to be placed because it's not in game
bool showAlert;
Expand All @@ -40,6 +45,8 @@ typedef struct
int direction;
int animationSpeed;
int64_t timerFrameUpdate;
char name[16];

} lumberjackEntity_t;

void lumberjackSetupEnemy(lumberjackEntity_t* enemy, int character);
Expand All @@ -50,4 +57,8 @@ bool checkCollision(lumberjackEntity_t* AA, lumberjackEntity_t* BB);
void lumberjackUpdateEnemy(lumberjackEntity_t* enemy, int newIndex);
void lumberjackDoEnemyControls(lumberjackEntity_t* enemy);


void lumberjackUpdateEnemyCollision(lumberjackEntity_t* enemy);
void lumberjackUpdatePlayerCollision(lumberjackEntity_t* player);

#endif
Loading

0 comments on commit c985675

Please sign in to comment.