Skip to content

Commit

Permalink
Add Hexen 2 Ambient Pickup Glow Effect
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemon-King committed Aug 19, 2024
1 parent bfb3edb commit de8887d
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 4 deletions.
16 changes: 12 additions & 4 deletions resources/assets/zscript/actors/hxdd/hexen2/pickups/armor.zs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
class HX2Armor : HexenArmor {
override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}
}

// Breastplate (1) -----------------------------------------------------------

class HX2Breastplate : HexenArmor {
class HX2Breastplate : HX2Armor {
Default {
+FLOATBOB
+NOGRAVITY
Expand All @@ -17,7 +25,7 @@ class HX2Breastplate : HexenArmor {

// Bracers (2) --------------------------------------------------------

class HX2Bracers : HexenArmor {
class HX2Bracers : HX2Armor {
Default {
+FLOATBOB
+NOGRAVITY
Expand All @@ -34,7 +42,7 @@ class HX2Bracers : HexenArmor {

// Helmet (3) --------------------------------------------------------

class HX2Helmet : HexenArmor {
class HX2Helmet : HX2Armor {
Default {
+FLOATBOB
+NOGRAVITY
Expand All @@ -51,7 +59,7 @@ class HX2Helmet : HexenArmor {

// Amulet of Protection (4) ----------------------------------------------------

class HX2Amulet : HexenArmor {
class HX2Amulet : HX2Armor {
Default {
+FLOATBOB
+NOGRAVITY
Expand Down
67 changes: 67 additions & 0 deletions resources/assets/zscript/actors/hxdd/hexen2/pickups/artifacts.zs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ class HX2ArtiHealth : ArtiHealth {
0000 A -1;
Loop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}
}

// Needs HX2 Matching Implementation
Expand All @@ -20,6 +26,12 @@ class HX2ArtiSuperHealth : ArtiSuperHealth {
0000 A 350;
Loop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}
}

// Needs HX2 Matching Implementation
Expand All @@ -34,6 +46,12 @@ class HX2ArtiFly : ArtiFly {
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}

override bool Use(bool pickup) {
let result = Super.Use(pickup);
if (result) {
Expand All @@ -59,6 +77,12 @@ class HX2ArtiInvulnerability : ArtiInvulnerability2 {
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}

override bool Use(bool pickup) {
let result = Super.Use(pickup);
if (result) {
Expand All @@ -84,6 +108,12 @@ class HX2ArtiTomeOfPower : ArtiTomeOfPower {
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}

override bool Use(bool pickup) {
let result = Super.Use(pickup);
if (result) {
Expand All @@ -109,6 +139,12 @@ class HX2ArtiSpeedBoots : ArtiSpeedBoots {
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}

override bool Use(bool pickup) {
let result = Super.Use(pickup);
if (result) {
Expand All @@ -133,6 +169,12 @@ class HX2ArtiBlastRadius : ArtiBlastRadius {
0000 A -1;
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}
}

class HX2ArtiBoostMana : ArtiBoostMana {
Expand All @@ -144,6 +186,12 @@ class HX2ArtiBoostMana : ArtiBoostMana {
0000 A -1;
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}
}

// Needs HX2 Matching Implementation
Expand All @@ -157,6 +205,13 @@ class HX2ArtiTorch : ArtiTorch {
0000 A -1;
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}

override bool Use(bool pickup) {
if (CurSector.MoreFlags & Sector.SECMF_UNDERWATERMASK) {
return false;
Expand All @@ -175,6 +230,12 @@ class HX2ArtiInvisibility : ArtiInvisibility {
0000 A -1;
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}
}

class HX2ArtiTeleport : ArtiTeleport {
Expand All @@ -186,4 +247,10 @@ class HX2ArtiTeleport : ArtiTeleport {
0000 A -1;
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}
}
18 changes: 18 additions & 0 deletions resources/assets/zscript/actors/hxdd/hexen2/pickups/mana.zs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ class HX2Mana1 : CustomInventory {
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}

}
class HX2Mana2 : CustomInventory {
Default {
Expand All @@ -31,6 +37,12 @@ class HX2Mana2 : CustomInventory {
TNT1 A 0 A_GiveInventory("Mana2", 15);
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}
}
class HX2Mana3 : Mana3 {
States {
Expand All @@ -42,4 +54,10 @@ class HX2Mana3 : Mana3 {
TNT1 A 0 A_GiveInventory("Mana2", 20);
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}
}
12 changes: 12 additions & 0 deletions resources/assets/zscript/actors/hxdd/hexen2/pickups/pickups.zs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ class HX2CrystalVial : CrystalVial {
TNT1 A 0 A_GiveInventory("CrystalVial", 1);
Stop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}
}

class HX2SuperMap : SuperMap {
Expand All @@ -18,4 +24,10 @@ class HX2SuperMap : SuperMap {
0000 A -1;
Loop;
}

override void Tick() {
Super.Tick();

self.lightlevel = LemonActor.CalcHX2ModelGlowLighting(self);
}
}
1 change: 1 addition & 0 deletions resources/assets/zscript/lib/_lib.zs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "zscript/lib/Gutamatics/include.zsc"
#include "zscript/lib/filejson.zs"
#include "zscript/lib/gameinforeader.zs"
#include "zscript/lib/lemonactor.zs"
#include "zscript/lib/lemonutil.zs"
#include "zscript/lib/particles.zs"
#include "zscript/lib/xclasstranslation.zs"
Expand Down
9 changes: 9 additions & 0 deletions resources/assets/zscript/lib/lemonactor.zs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

class LemonActor {
// ref: https://github.com/videogamepreservation/hexen2/blob/eac5fd50832ce2509226761b3b1a387c468e7a50/H2W/Client/r_alias.c#L958
static int CalcHX2ModelGlowLighting(Actor source) {
int curLightLevel = source.cursector.GetLightLevel();
int ambLightLevel = 60 + 34 + sin(source.pos.x + source.pos.y + (level.MapTime * 3.8)) * 34;
return curLightLevel + ambLightLevel;
}
}

0 comments on commit de8887d

Please sign in to comment.