Skip to content

Commit

Permalink
Merge pull request #22 from TerminalHash/holidays
Browse files Browse the repository at this point in the history
Change textures on holidays
  • Loading branch information
TerminalHash authored Oct 31, 2024
2 parents 5a352da + 64c5409 commit 28215d0
Show file tree
Hide file tree
Showing 101 changed files with 3,470 additions and 45 deletions.
13 changes: 11 additions & 2 deletions Base/Entities/Characters/Archer/ArcherAnim.as
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "PixelOffsets.as"
#include "RunnerTextures.as"
#include "Accolades.as"

#include "HolidayCommon.as";

const f32 config_offset = -6.0f;
const string shiny_layer = "shiny bit";
Expand Down Expand Up @@ -118,7 +118,16 @@ void LoadSprites(CSprite@ this)
anim.AddFrame(1); //normal
anim.AddFrame(9); //water
anim.AddFrame(8); //fire
anim.AddFrame(14); //bomb

if (getRules().get_string(holiday_prop) == "Halloween") {
anim.AddFrame(18); //bomb halloween
} else if (getRules().get_string(holiday_prop) == "Christmas") {
anim.AddFrame(20); //bomb christmas
} else {
anim.AddFrame(14); //bomb
}

//anim.AddFrame(14); //bomb
anim.AddFrame(16); //wooden block
anim.AddFrame(17); //stone block
arrow.SetOffset(Vec2f(-1.0f, 5.0f + config_offset));
Expand Down
12 changes: 11 additions & 1 deletion Base/Entities/Characters/Archer/ArcherHUD.as
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
#include "ActorHUDStartPos.as";
#include "ArcherResupplyHUD.as";
#include "MaterialIndicatorHUD.as";
#include "HolidaySprites.as";
#include "pathway.as";

const string iconsFilename = "Entities/Characters/Archer/ArcherIcons.png";
string icons_file_name;

const int slotsSize = 6;

void onInit(CSprite@ this)
Expand Down Expand Up @@ -94,5 +97,12 @@ void onRender(CSprite@ this)
DrawPersonalMats();

// class weapon icon
GUI::DrawIcon(iconsFilename, arrow_frame, Vec2f(16, 32), tl + Vec2f(8 + (slotsSize - 1) * 40, -16), 1.0f, blob.getTeamNum());
if (isAnyHoliday()) {
icons_file_name = getHolidayVersionFileName("ArcherIcons");
GUI::DrawIcon(icons_file_name, arrow_frame, Vec2f(16, 32), tl + Vec2f(8 + (slotsSize - 1) * 40, -16), 1.0f, blob.getTeamNum());
} else {
GUI::DrawIcon(iconsFilename, arrow_frame, Vec2f(16, 32), tl + Vec2f(8 + (slotsSize - 1) * 40, -16), 1.0f, blob.getTeamNum());
}

//GUI::DrawIcon(iconsFilename, frame, Vec2f(16, 32), tl + Vec2f(8 + (slotsSize - 1) * 40, -16), 1.0f, blob.getTeamNum());
}
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.
11 changes: 10 additions & 1 deletion Base/Entities/Characters/Archer/ArcherLogic.as
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "BombCommon.as";
#include "RedBarrierCommon.as";
#include "StandardControlsCommon.as";
#include "HolidaySprites.as";
#include "BindingsCommon.as"

const int FLETCH_COOLDOWN = 45;
Expand Down Expand Up @@ -1561,15 +1562,23 @@ void Callback_PickArrow(CBitStream@ params)
blob.SendCommand(blob.getCommandID("pick " + matname));
}

string icons_file_name;
string arrow_icons_file_name;

// arrow pick menu
void onCreateInventoryMenu(CBlob@ this, CBlob@ forBlob, CGridMenu @gridmenu)
{
icons_file_name = isAnyHoliday() ? getHolidayVersionFileName("KnightIcons") : "KnightIcons.png";
arrow_icons_file_name = isAnyHoliday() ? getHolidayVersionFileName("ArcherIcons") : "ArcherIcons.png";

AddIconToken("$Arrow$", "Entities/Characters/Archer/ArcherIcons.png", Vec2f(16, 32), 0, this.getTeamNum());
AddIconToken("$WaterArrow$", "Entities/Characters/Archer/ArcherIcons.png", Vec2f(16, 32), 1, this.getTeamNum());
AddIconToken("$FireArrow$", "Entities/Characters/Archer/ArcherIcons.png", Vec2f(16, 32), 2, this.getTeamNum());
AddIconToken("$BombArrow$", "Entities/Characters/Archer/ArcherIcons.png", Vec2f(16, 32), 3, this.getTeamNum());
AddIconToken("$BombArrow$", arrow_icons_file_name, Vec2f(16, 32), 3, this.getTeamNum());
AddIconToken("$BlockArrow$", "Entities/Characters/Archer/ArcherIcons.png", Vec2f(16, 32), 4, this.getTeamNum());
AddIconToken("$StoneBlockArrow$", "Entities/Characters/Archer/ArcherIcons.png", Vec2f(16, 32), 5, this.getTeamNum());
AddIconToken("$Bomb$", icons_file_name, Vec2f(16, 32), 0, this.getTeamNum());
AddIconToken("$WaterBomb$", icons_file_name, Vec2f(16, 32), 2, this.getTeamNum());
AddIconToken("$StickyBomb$", "Entities/Characters/Knight/KnightIcons.png", Vec2f(16, 32), 5, this.getTeamNum());
AddIconToken("$IceBomb$", "Entities/Characters/Knight/KnightIcons.png", Vec2f(16, 32), 6, this.getTeamNum());

Expand Down
7 changes: 7 additions & 0 deletions Base/Entities/Characters/Builder/BuilderLogic.as
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "ParticleSparks.as";
#include "MaterialCommon.as";
#include "StandardControlsCommon.as";
#include "HolidaySprites.as";
#include "BindingsCommon.as";

const f32 hit_damage = 0.5f;
Expand Down Expand Up @@ -289,8 +290,14 @@ void TakeItem(CBlob@ this, const string &in name)
}
}

string icons_file_name;

void onCreateInventoryMenu(CBlob@ this, CBlob@ forBlob, CGridMenu @gridmenu)
{
icons_file_name = isAnyHoliday() ? getHolidayVersionFileName("KnightIcons") : "KnightIcons.png";

AddIconToken("$Bomb$", icons_file_name, Vec2f(16, 32), 0, this.getTeamNum());
AddIconToken("$WaterBomb$", icons_file_name, Vec2f(16, 32), 2, this.getTeamNum());
AddIconToken("$StickyBomb$", "Entities/Characters/Knight/KnightIcons.png", Vec2f(16, 32), 5, this.getTeamNum());
AddIconToken("$IceBomb$", "Entities/Characters/Knight/KnightIcons.png", Vec2f(16, 32), 6, this.getTeamNum());

Expand Down
11 changes: 10 additions & 1 deletion Base/Entities/Characters/Knight/KnightHUD.as
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//knight HUD
#include "/Entities/Common/GUI/ActorHUDStartPos.as";
#include "MaterialIndicatorHUD.as";
#include "HolidaySprites.as";
#include "pathway.as";

const string iconsFilename = "Entities/Characters/Knight/KnightIcons.png";
string icons_file_name;

const int slotsSize = 6;

void onInit(CSprite@ this)
Expand Down Expand Up @@ -102,6 +105,12 @@ void onRender(CSprite@ this)
DrawPersonalMats();

// draw class icon
if (isAnyHoliday()) {
icons_file_name = getHolidayVersionFileName("KnightIcons");
GUI::DrawIcon(icons_file_name, frame, Vec2f(16, 32), tl + Vec2f(8 + (slotsSize - 1) * 40, -16), 1.0f, blob.getTeamNum());
} else {
GUI::DrawIcon(iconsFilename, frame, Vec2f(16, 32), tl + Vec2f(8 + (slotsSize - 1) * 40, -16), 1.0f, blob.getTeamNum());
}

GUI::DrawIcon(iconsFilename, frame, Vec2f(16, 32), tl + Vec2f(8 + (slotsSize - 1) * 40, -16), 1.0f, blob.getTeamNum());
//GUI::DrawIcon(iconsFilename, frame, Vec2f(16, 32), tl + Vec2f(8 + (slotsSize - 1) * 40, -16), 1.0f, blob.getTeamNum());
}
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.
7 changes: 7 additions & 0 deletions Base/Entities/Characters/Knight/KnightLogic.as
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "Help.as";
#include "Requirements.as"
#include "StandardControlsCommon.as";
#include "HolidaySprites.as";

//attacks limited to the one time per-actor before reset.

Expand Down Expand Up @@ -1906,9 +1907,15 @@ void Callback_PickBomb(CBitStream@ params)
blob.SendCommand(blob.getCommandID("pick " + matname));
}

string icons_file_name;

// bomb pick menu
void onCreateInventoryMenu(CBlob@ this, CBlob@ forBlob, CGridMenu @gridmenu)
{
icons_file_name = isAnyHoliday() ? getHolidayVersionFileName("KnightIcons") : "KnightIcons.png";

AddIconToken("$Bomb$", icons_file_name, Vec2f(16, 32), 0, this.getTeamNum());
AddIconToken("$WaterBomb$", icons_file_name, Vec2f(16, 32), 2, this.getTeamNum());
AddIconToken("$StickyBomb$", "Entities/Characters/Knight/KnightIcons.png", Vec2f(16, 32), 5, this.getTeamNum());
AddIconToken("$IceBomb$", "Entities/Characters/Knight/KnightIcons.png", Vec2f(16, 32), 6, this.getTeamNum());

Expand Down
10 changes: 8 additions & 2 deletions Base/Entities/Common/Attacks/PlantHitEffects.as
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@

#include "Hitters.as"
#include "HolidaySprites.as";

string gibs_file_name;

void onInit(CBlob@ this) {
gibs_file_name = isAnyHoliday() ? getHolidayVersionFileName("GenericGibs") : "GenericGibs.png";
}

f32 onHit(CBlob@ this, Vec2f worldPoint, Vec2f velocity, f32 damage, CBlob@ hitterBlob, u8 customData)
{
Expand All @@ -19,7 +25,7 @@ f32 onHit(CBlob@ this, Vec2f worldPoint, Vec2f velocity, f32 damage, CBlob@ hitt

for (int i = 0; i < (damage + 1); ++i)
{
makeGibParticle("GenericGibs",
makeGibParticle(gibs_file_name,
this.getPosition(), getRandomVelocity(-90, (Maths::Min(Maths::Max(0.5f, damage), 2.0f) * 4.0f) , 270),
7, 3 + XORRandom(4), Vec2f(8, 8),
1.0f, 0, "", 0);
Expand Down
11 changes: 10 additions & 1 deletion Base/Entities/Common/Decaying/DecayStuckArrows.as
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
#include "HolidaySprites.as";

string gibs_file_name;

void onInit(CBlob@ this)
{
gibs_file_name = isAnyHoliday() ? getHolidayVersionFileName("GenericGibs") : "GenericGibs.png";
}

Random rand(Time());

void onTick(CBlob@ this)
Expand Down Expand Up @@ -25,7 +34,7 @@ void onTick(CBlob@ this)
Vec2f pos = arrow.getWorldTranslation();
Vec2f vel = this.getVelocity();
makeGibParticle(
"GenericGibs.png", pos, vel,
gibs_file_name, pos, vel,
1, rand.NextRanged(4) + 4,
Vec2f(8, 8), 2.0f, 20, "/thud",
this.getTeamNum()
Expand Down
7 changes: 6 additions & 1 deletion Base/Entities/Common/Fabric/Stone.as
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#include "Hitters.as"
#include "HolidaySprites.as";

string gibs_file_name;

void onInit(CBlob@ this)
{
this.Tag("stone");

gibs_file_name = isAnyHoliday() ? getHolidayVersionFileName("GenericGibs") : "GenericGibs.png";
}

f32 onHit(CBlob@ this, Vec2f worldPoint, Vec2f velocity, f32 damage, CBlob@ hitterBlob, u8 customData)
Expand All @@ -16,7 +21,7 @@ f32 onHit(CBlob@ this, Vec2f worldPoint, Vec2f velocity, f32 damage, CBlob@ hitt

if (getRules().get_string("clusterfuck") != "off")
{
makeGibParticle("GenericGibs", worldPoint, getRandomVelocity((this.getPosition() - worldPoint).getAngle(), 1.0f + damage, 90.0f) + Vec2f(0.0f, -2.0f),
makeGibParticle(gibs_file_name, worldPoint, getRandomVelocity((this.getPosition() - worldPoint).getAngle(), 1.0f + damage, 90.0f) + Vec2f(0.0f, -2.0f),
2, 4 + XORRandom(4), Vec2f(8, 8), 2.0f, 0, "", 0);
}
}
Expand Down
7 changes: 6 additions & 1 deletion Base/Entities/Common/Fabric/Wooden.as
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#include "Hitters.as"
#include "HolidaySprites.as";

string gibs_file_name;

void onInit(CBlob@ this)
{
this.Tag("wooden");

gibs_file_name = isAnyHoliday() ? getHolidayVersionFileName("GenericGibs") : "GenericGibs.png";
}

f32 onHit(CBlob@ this, Vec2f worldPoint, Vec2f velocity, f32 damage, CBlob@ hitterBlob, u8 customData)
Expand All @@ -21,7 +26,7 @@ f32 onHit(CBlob@ this, Vec2f worldPoint, Vec2f velocity, f32 damage, CBlob@ hitt

if (getRules().get_string("clusterfuck") != "off")
{
makeGibParticle("/GenericGibs", worldPoint, getRandomVelocity(angle, 1.0f + damage, 90.0f) + Vec2f(0.0f, -2.0f),
makeGibParticle(gibs_file_name, worldPoint, getRandomVelocity(angle, 1.0f + damage, 90.0f) + Vec2f(0.0f, -2.0f),
1, 4 + XORRandom(4), Vec2f(8, 8), 2.0f, 0, "", 0);
}
}
Expand Down
Binary file added Base/Entities/Effects/Sprites/GenericGibs.png
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.
7 changes: 6 additions & 1 deletion Base/Entities/Industry/CTFShops/Storage/Storage.as
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
// Storage.as

#include "GenericButtonCommon.as"
#include "HolidaySprites.as"

string lantern_file_name;

void onInit(CSprite@ this)
{
lantern_file_name = isAnyHoliday() ? getHolidayVersionFileName("Lantern") : "Lantern.png";

// Building
this.SetZ(-60); //-60 instead of -50 so sprite layers are behind ladders

Expand Down Expand Up @@ -77,7 +82,7 @@ void onInit(CSprite@ this)
}

// Lantern
CSpriteLayer@ lantern = this.addSpriteLayer("lantern", "Lantern.png", 8, 8);
CSpriteLayer@ lantern = this.addSpriteLayer("lantern", lantern_file_name, 8, 8);
if (lantern !is null)
{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "Hitters.as";
#include "BombCommon.as";
#include "ShieldCommon.as";
#include "HolidayCommon.as";

const s32 bomb_fuse = 120;

Expand All @@ -26,6 +27,21 @@ void onInit(CBlob@ this)
this.SetMapEdgeFlags(CBlob::map_collide_left | CBlob::map_collide_right);
}

void onInit(CSprite@ this)
{
CBlob@ blob = this.getBlob();

if (blob !is null && blob.getName() == "waterbomb") {
if (getRules().get_string(holiday_prop) == "Halloween") {
this.SetAnimation("default_halloween");
} else if (getRules().get_string(holiday_prop) == "Christmas") {
this.SetAnimation("default_christmas");
} else {
this.SetAnimation("default");
}
}
}

//start ugly bomb logic :)

void set_delay(CBlob@ this, string field, s32 delay)
Expand All @@ -50,12 +66,26 @@ void onTick(CSprite@ this)

if (timer > 30)
{
this.SetAnimation("default");
if (getRules().get_string(holiday_prop) == "Halloween") {
this.SetAnimation("default_halloween");
} else if (getRules().get_string(holiday_prop) == "Christmas") {
this.SetAnimation("default_christmas");
} else {
this.SetAnimation("default");
}

this.animation.frame = this.animation.getFramesCount() * (1.0f - ((timer - 30) / 220.0f));
}
else
{
this.SetAnimation("shes_gonna_blow");
if (getRules().get_string(holiday_prop) == "Halloween") {
this.SetAnimation("shes_gonna_blow_halloween");
} else if (getRules().get_string(holiday_prop) == "Christmas") {
this.SetAnimation("shes_gonna_blow_christmas");
} else {
this.SetAnimation("shes_gonna_blow");
}

this.animation.frame = this.animation.getFramesCount() * (1.0f - (timer / 30.0f));

if (timer < 15 && timer > 0)
Expand Down
Loading

0 comments on commit 28215d0

Please sign in to comment.