Skip to content

Commit

Permalink
Updated swadge hero pressed graphics to add contrast against blue sky…
Browse files Browse the repository at this point in the history
…. Adam should review. The black outline outside should be imperceptible in swadge hero. Flipped direction of wile music data stream effect. Bug fix on 501kg not having y velocity. Atmospheric atomizer wile is done and renamed to Sky Choker in game to fit on screen.
  • Loading branch information
DebrisHauler committed Dec 30, 2024
1 parent 7ea87e1 commit d41262e
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 48 deletions.
Binary file modified assets/swadgeHero/icons/sh_ap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/swadgeHero/icons/sh_bp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/swadgeHero/icons/sh_dp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/swadgeHero/icons/sh_lp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/swadgeHero/icons/sh_rp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/swadgeHero/icons/sh_up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions main/modes/games/bigbug/entityManager_bigbug.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ bb_entity_t* bb_createEntity(bb_entityManager_t* entityManager, bb_animationType
// //also set in bb_onCollisionFuel()
gData->yaw.x = -1; // So he starts off facing left away from the tutorial egg.
gData->activeWile = 255; // 255 means no wile active.
gData->dragShift = 17;

memset(&gData->towedEntities, 0, sizeof(list_t));
int16_t arraySize = sizeof(gData->landingPhrases) / sizeof(gData->landingPhrases[0]);
Expand Down Expand Up @@ -1248,6 +1249,14 @@ bb_entity_t* bb_createEntity(bb_entityManager_t* entityManager, bb_animationType
entity->drawFunction = &bb_drawExplosion;
break;
}
case BB_ATMOSPHERIC_ATOMIZER:
{
bb_setData(entity, heap_caps_calloc(1, sizeof(bb_atmosphericAtomizerData_t), MALLOC_CAP_SPIRAM),
ATMOSPHERIC_ATOMIZER_DATA);
entity->updateFunction = &bb_updateAtmosphericAtomizer;
entity->drawFunction = &bb_drawAtmosphericAtomizer;
break;
}
default: // FLAME_ANIM and others need nothing set
{
break;
Expand Down
154 changes: 108 additions & 46 deletions main/modes/games/bigbug/entity_bigbug.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ void bb_updateGarbotnikFlying(bb_entity_t* self)
drag = 10;
}
// Apply drag based on absolute value to smooth asymmetry
int32_t dragEffect = (drag * self->gameData->elapsedUs) >> 17;
int32_t dragEffect = (drag * self->gameData->elapsedUs) >> gData->dragShift;//typically 17, or 19 with atmospheric atomizer

// Adjust velocity symmetrically for both positive and negative values
if (gData->vel.x > 0)
Expand Down Expand Up @@ -1043,6 +1043,37 @@ void bb_updateGarbotnikFlying(bb_entity_t* self)
}
}
}

// Fuel decrements with time. Right shifting by 10 is fairly close to
// converting microseconds to milliseconds without requiring division.
gData->fuel -= (((self->gameData->elapsedUs >> 10) * self->gameData->GarbotnikStat_fuelConsumptionRate) >> 2);
if (gData->fuel < 0)
{
bb_physicsData_t* physData = heap_caps_calloc(1, sizeof(bb_physicsData_t), MALLOC_CAP_SPIRAM);
physData->vel = gData->vel;
physData->bounceNumerator = 1; // 25% bounce
physData->bounceDenominator = 4;
bb_setData(self, physData, PHYSICS_DATA);
self->updateFunction = bb_updateGarbotnikDying;
self->drawFunction = NULL;
return;
}
else if (gData->fuel < 38000 && self->gameData->bgm.length == 7217)
{
// exploration song length 7217
// hurry up song length 6480
bb_setupMidi();
unloadMidiFile(&self->gameData->bgm);
loadMidiFile("Big Bug Hurry up.mid", &self->gameData->bgm, true);
globalMidiPlayerPlaySong(&self->gameData->bgm, MIDI_BGM);
}
else if (gData->fuel >= 38000 && self->gameData->bgm.length == 6480)
{
bb_setupMidi();
unloadMidiFile(&self->gameData->bgm);
loadMidiFile("BigBugExploration.mid", &self->gameData->bgm, true);
globalMidiPlayerPlaySong(&self->gameData->bgm, MIDI_BGM);
}


bb_hitInfo_t hitInfo = {0};
Expand Down Expand Up @@ -1109,37 +1140,6 @@ void bb_updateGarbotnikFlying(bb_entity_t* self)
gData->vel = mulVec2d(
subVec2d(gData->vel, mulVec2d(hitInfo.normal, (2 * dotVec2d(gData->vel, hitInfo.normal)))), bounceScalar);
}

// Fuel decrements with time. Right shifting by 10 is fairly close to
// converting microseconds to milliseconds without requiring division.
gData->fuel -= (((self->gameData->elapsedUs >> 10) * self->gameData->GarbotnikStat_fuelConsumptionRate) >> 2);
if (gData->fuel < 0)
{
bb_physicsData_t* physData = heap_caps_calloc(1, sizeof(bb_physicsData_t), MALLOC_CAP_SPIRAM);
physData->vel = gData->vel;
physData->bounceNumerator = 1; // 25% bounce
physData->bounceDenominator = 4;
bb_setData(self, physData, PHYSICS_DATA);
self->updateFunction = bb_updateGarbotnikDying;
self->drawFunction = NULL;
return;
}
else if (gData->fuel < 38000 && self->gameData->bgm.length == 7217)
{
// exploration song length 7217
// hurry up song length 6480
bb_setupMidi();
unloadMidiFile(&self->gameData->bgm);
loadMidiFile("Big Bug Hurry up.mid", &self->gameData->bgm, true);
globalMidiPlayerPlaySong(&self->gameData->bgm, MIDI_BGM);
}
else if (gData->fuel >= 38000 && self->gameData->bgm.length == 6480)
{
bb_setupMidi();
unloadMidiFile(&self->gameData->bgm);
loadMidiFile("BigBugExploration.mid", &self->gameData->bgm, true);
globalMidiPlayerPlaySong(&self->gameData->bgm, MIDI_BGM);
}
}

void bb_updateGarbotnikDying(bb_entity_t* self)
Expand Down Expand Up @@ -2351,8 +2351,8 @@ void bb_update501kg(bb_entity_t* self)
bb_501kgData_t* fData = (bb_501kgData_t*)self->data;
if(self->pos.y < fData->targetY)
{
self->pos.x += (fData->vel.x * self->gameData->elapsedUs) >> 14;
self->pos.y += (fData->vel.y * self->gameData->elapsedUs) >> 14;
self->pos.x += (fData->vel.x * self->gameData->elapsedUs) >> 13;
self->pos.y += (fData->vel.y * self->gameData->elapsedUs) >> 13;

bb_hitInfo_t hitInfo = {0};
bb_collisionCheck(&self->gameData->tilemap, self, NULL, &hitInfo);
Expand Down Expand Up @@ -2428,6 +2428,18 @@ void bb_updateExplosion(bb_entity_t* self)
}
}

void bb_updateAtmosphericAtomizer(bb_entity_t* self)
{
bb_atmosphericAtomizerData_t* aData = (bb_atmosphericAtomizerData_t*)self->data;
aData->lifetime += self->gameData->elapsedUs >> 10;
if(aData->lifetime > 30000)
{
bb_garbotnikData_t* gData = (bb_garbotnikData_t*)self->gameData->entityManager.playerEntity->data;
gData->dragShift = 17;//This greatly reduces the drag on the garbotnik
bb_destroyEntity(self, false);
}
}

void bb_drawGarbotnikFlying(bb_entityManager_t* entityManager, rectangle_t* camera, bb_entity_t* self)
{
if (GARBOTNIK_DATA != self->dataType)
Expand Down Expand Up @@ -2540,15 +2552,15 @@ void bb_drawGarbotnikFlying(bb_entityManager_t* entityManager, rectangle_t* came

if(self->gameData->loadout.primaryTimer != 0)
{
drawWsgPalette(&entityManager->sprites[BB_ARROW].frames[0], 70 - ((sequenceLength * 29 - 5)>>1) + i * 29, 17, &self->gameData->damagePalette, false, false, rotation);
drawWsgPalette(&entityManager->sprites[BB_ARROW].frames[0], 70 - ((sequenceLength * 28 - 4)>>1) + i * 28, 17, &self->gameData->damagePalette, false, false, rotation);
}
else if(primaryComparison != -1 && self->gameData->loadout.playerInputSequence[i] == self->gameData->loadout.allWiles[self->gameData->loadout.primaryWileIdx].callSequence[i])
{
drawWsg(&entityManager->sprites[BB_ARROW].frames[1], 70 - ((sequenceLength * 29 - 5)>>1) + i * 29, 17, false, false, rotation);
drawWsg(&entityManager->sprites[BB_ARROW].frames[1], 70 - ((sequenceLength * 28 - 4)>>1) + i * 28, 17, false, false, rotation);
}
else
{
drawWsg(&entityManager->sprites[BB_ARROW].frames[0], 70 - ((sequenceLength * 29 - 5)>>1) + i * 29, 17, false, false, rotation);
drawWsg(&entityManager->sprites[BB_ARROW].frames[0], 70 - ((sequenceLength * 28 - 4)>>1) + i * 28, 17, false, false, rotation);
}
}
}
Expand Down Expand Up @@ -2579,15 +2591,15 @@ void bb_drawGarbotnikFlying(bb_entityManager_t* entityManager, rectangle_t* came

if(self->gameData->loadout.secondaryTimer != 0)
{
drawWsgPalette(&entityManager->sprites[BB_ARROW].frames[0], 210 - ((sequenceLength * 29 - 5)>>1) + i * 29, 17, &self->gameData->damagePalette, false, false, rotation);
drawWsgPalette(&entityManager->sprites[BB_ARROW].frames[0], 210 - ((sequenceLength * 28 - 4)>>1) + i * 28, 17, &self->gameData->damagePalette, false, false, rotation);
}
else if(secondaryComparison != -1 && self->gameData->loadout.playerInputSequence[i] == self->gameData->loadout.allWiles[self->gameData->loadout.secondaryWileIdx].callSequence[i])
{
drawWsg(&entityManager->sprites[BB_ARROW].frames[1], 210 - ((sequenceLength * 29 - 5)>>1) + i * 29, 17, false, false, rotation);
drawWsg(&entityManager->sprites[BB_ARROW].frames[1], 210 - ((sequenceLength * 28 - 4)>>1) + i * 28, 17, false, false, rotation);
}
else
{
drawWsg(&entityManager->sprites[BB_ARROW].frames[0], 210 - ((sequenceLength * 29 - 5)>>1) + i * 29, 17, false, false, rotation);
drawWsg(&entityManager->sprites[BB_ARROW].frames[0], 210 - ((sequenceLength * 28 - 4)>>1) + i * 28, 17, false, false, rotation);
}
}
}
Expand Down Expand Up @@ -3170,12 +3182,12 @@ void bb_drawWile(bb_entityManager_t* entityManager, rectangle_t* camera, bb_enti
if(self->gameData->bgm.data[i + (wData->lifetime>>2)] & 1)
{
drawText(&self->gameData->font, c511, "1", (self->pos.x >> DECIMAL_BITS) - camera->pos.x - 3,
(self->pos.y >> DECIMAL_BITS) - camera->pos.y - 30 - i * 15);
(self->pos.y >> DECIMAL_BITS) - camera->pos.y - 285 + i * 15);
}
else
{
drawText(&self->gameData->font, c511, "0", (self->pos.x >> DECIMAL_BITS) - camera->pos.x - 3,
(self->pos.y >> DECIMAL_BITS) - camera->pos.y - 30 - i * 15);
(self->pos.y >> DECIMAL_BITS) - camera->pos.y - 285 + i * 15);
}
}

Expand All @@ -3199,6 +3211,40 @@ void bb_drawExplosion(bb_entityManager_t* entityManager, rectangle_t* camera, bb
((bb_explosionData_t*)self->data)->radius, bb_randomInt(0,1)?c555:c550);
}

void bb_drawAtmosphericAtomizer(bb_entityManager_t* entityManager, rectangle_t* camera, bb_entity_t* self)
{
//draw solar radiation lines diagonally penetrating the screen from above that offset in time with bb_atmostphericAtomizerData_t->lifetime.
bb_atmosphericAtomizerData_t* aData = (bb_atmosphericAtomizerData_t*)self->data;

uint16_t thing1 = aData->lifetime % 16;
uint16_t thing2 = aData->lifetime % 240;
uint16_t thing3 = (aData->lifetime >> 2) % 2;
for(int i = 0; i < 17; i++)
{
if(bb_randomInt(0,2))
{
drawLineFast(i*16+thing1 - thing3,
thing2 + 240 - i * 12,
i*18+thing1 - thing3,
thing2 - 30 - i * 15, c555);
}
else
{
drawLineFast(i*16+thing1 - thing3,
thing2 + 240 - i * 12,
i*18+thing1 - thing3,
thing2 - 30 - i * 15, c552);
}
}
//draw dots randomly all over the screen
for(int i = 0; i < 30; i++)
{
drawCircleFilled(bb_randomInt(0,280),
bb_randomInt(0,240),
1, c445);
}
}

// void bb_drawRect(bb_entityManager_t* entityManager, rectangle_t* camera, bb_entity_t* self)
// {
// drawRect (((self->pos.x - self->halfWidth) >>DECIMAL_BITS) - camera->pos.x,
Expand Down Expand Up @@ -4419,13 +4465,19 @@ void bb_playCarAlarm(bb_entity_t* self)
void bb_trigger501kg(bb_entity_t* self)
{
bb_loadSprite("501kg",1, 1, &self->gameData->entityManager.sprites[BB_501KG]);

bb_entity_t* missile = bb_createEntity(&self->gameData->entityManager, NO_ANIMATION, true, BB_501KG, 1,
self->gameData->camera.camera.pos.x, self->gameData->camera.camera.pos.y, true, true);
self->pos.x >> DECIMAL_BITS,
self->pos.y >> DECIMAL_BITS, true, true);
bb_501kgData_t* kgData = ((bb_501kgData_t*)missile->data);

missile->pos = (vec_t){self->pos.x + ((bb_randomInt(0,1)*2)-1) * bb_randomInt(0,((6144 - self->pos.y)>>1)), -6144};
kgData->vel = subVec2d(self->pos, missile->pos);
fastNormVec(&kgData->vel.x, &kgData->vel.y);
kgData->vel = (vec_t){bb_randomInt(-60,60), 60};

while(missile->pos.y > -2173)
{
missile->pos.x -= (self->gameData->elapsedUs >> 12) * kgData->vel.x;
missile->pos.y -= (self->gameData->elapsedUs >> 12) * kgData->vel.y;
}

vecFl_t floatVel = {(float)kgData->vel.x, (float)kgData->vel.y};

Expand All @@ -4450,6 +4502,16 @@ void bb_triggerFaultyWile(bb_entity_t* self)
eData->radius = 40;
}

void bb_triggerAtmosphericAtomizerWile(bb_entity_t* self)
{
bb_createEntity(&self->gameData->entityManager, NO_ANIMATION, true, BB_ATMOSPHERIC_ATOMIZER, 1, self->pos.x >> DECIMAL_BITS, self->pos.y >> DECIMAL_BITS, false, false);
if(self->gameData->entityManager.playerEntity != NULL && self->gameData->entityManager.playerEntity->dataType == GARBOTNIK_DATA)
{
bb_garbotnikData_t* gData = (bb_garbotnikData_t*)self->gameData->entityManager.playerEntity->data;
gData->dragShift = 20;//This greatly reduces the drag on the garbotnik
}
}

void bb_crumbleDirt(bb_gameData_t* gameData, uint8_t gameFramesPerAnimationFrame, uint8_t tile_i, uint8_t tile_j,
bool zeroHealth)
{
Expand Down
11 changes: 11 additions & 0 deletions main/modes/games/bigbug/entity_bigbug.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ typedef enum
WILE_DATA,
BB_501KG_DATA,
EXPLOSION_DATA,
ATMOSPHERIC_ATOMIZER_DATA,
} bb_data_type_t;


Expand Down Expand Up @@ -82,6 +83,8 @@ typedef struct
int16_t harpoonCooldown; // decrements over time. Fires if < 0 and resets to GameData's GarbotnikStat_fireTime.

uint8_t activeWile;

uint8_t dragShift; //typically 17 or 19 with the atmospheric atomizer.
} bb_garbotnikData_t;

typedef struct
Expand Down Expand Up @@ -280,6 +283,11 @@ typedef struct
uint16_t radius;
} bb_explosionData_t;

typedef struct
{
uint16_t lifetime;
} bb_atmosphericAtomizerData_t;

typedef struct
{
vec_t pos;
Expand Down Expand Up @@ -386,6 +394,8 @@ void bb_updateDiveSummary(bb_entity_t* self);
void bb_updateWile(bb_entity_t* self);
void bb_update501kg(bb_entity_t* self);
void bb_updateExplosion(bb_entity_t* self);
void bb_updateAtmosphericAtomizer(bb_entity_t* self);


void bb_drawGarbotnikFlying(bb_entityManager_t* entityManager, rectangle_t* camera, bb_entity_t* self);
void bb_drawHarpoon(bb_entityManager_t* entityManager, rectangle_t* camera, bb_entity_t* self);
Expand Down Expand Up @@ -414,6 +424,7 @@ void bb_drawFoodCart(bb_entityManager_t* entityManager, rectangle_t* camera, bb_
void bb_drawWile(bb_entityManager_t* entityManager, rectangle_t* camera, bb_entity_t* self);
void bb_draw501kg(bb_entityManager_t* entityManager, rectangle_t* camera, bb_entity_t* self);
void bb_drawExplosion(bb_entityManager_t* entityManager, rectangle_t* camera, bb_entity_t* self);
void bb_drawAtmosphericAtomizer(bb_entityManager_t* entityManager, rectangle_t* camera, bb_entity_t* self);

// void bb_drawRect(bb_entityManager_t* entityManager, rectangle_t* camera, bb_entity_t* self);

Expand Down
5 changes: 3 additions & 2 deletions main/modes/games/bigbug/gameData_bigbug.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,16 @@ void bb_initializeGameData(bb_gameData_t* gameData)
gameData->loadout.allWiles[4].cost = bb_randomInt(1, 3);
gameData->loadout.allWiles[4].wileFunction = bb_trigger501kg;

strcpy(gameData->loadout.allWiles[5].name, "Atmospheric Atomizer");
strcpy(gameData->loadout.allWiles[5].description, "The first prototype for the Death Dumpster's own onboard time machine, but it eviscerates the atmosphere within a few square miles for 30 seconds.");
strcpy(gameData->loadout.allWiles[5].name, "Sky Choker");
strcpy(gameData->loadout.allWiles[5].description, "Eliminates drag on Garbotnik. It was a failed time machine prototype, but it eviscerates the atmosphere withing a few square miles.");
gameData->loadout.allWiles[5].callSequence[0] = BB_DOWN;
gameData->loadout.allWiles[5].callSequence[1] = BB_LEFT;
gameData->loadout.allWiles[5].callSequence[2] = BB_DOWN;
gameData->loadout.allWiles[5].callSequence[3] = BB_RIGHT;
gameData->loadout.allWiles[5].callSequence[4] = BB_DOWN;
gameData->loadout.allWiles[5].cooldown = 30;
gameData->loadout.allWiles[5].cost = bb_randomInt(1, 3);
gameData->loadout.allWiles[5].wileFunction = bb_triggerAtmosphericAtomizerWile;

strcpy(gameData->loadout.allWiles[6].name, "Ammo Supply");
strcpy(gameData->loadout.allWiles[6].description, "Drops a crate to top off your ammo to the max.");
Expand Down
2 changes: 2 additions & 0 deletions main/modes/games/bigbug/typedef_bigbug.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ typedef enum
BB_SPIT, // projectile from the bug. Reuses fuel sprite with a palette swap.
BB_DIVE_SUMMARY, // A notepad that shows your dive stats.
BB_EXPLOSION, // A particle effect that deletes dirt, kills bugs, hurts and pushes garbotnik.
BB_ATMOSPHERIC_ATOMIZER, // A particle effect that increases garbotnik's dragShift.

} bb_spriteDef_t;

Expand All @@ -101,5 +102,6 @@ typedef enum

void bb_trigger501kg(bb_entity_t* self);
void bb_triggerFaultyWile(bb_entity_t* self);
void bb_triggerAtmosphericAtomizerWile(bb_entity_t* self);

#endif

0 comments on commit d41262e

Please sign in to comment.