Skip to content

Commit

Permalink
Next Release Prep
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemon-King committed Oct 16, 2023
1 parent 6238a68 commit 5c8526d
Show file tree
Hide file tree
Showing 12 changed files with 324 additions and 302 deletions.
5 changes: 2 additions & 3 deletions resources/assets/zscript.zs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version "4.10"
version "4.11"

#include "zscript/_hxdd.zs"
//#include "zscript_generated/_zscript_generated.zs"
#include "zscript/_hxdd.zs"
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,11 @@ class AWeapGrenades_Grenade: Hexen2Projectile {
if ((self.pos.z - self.floorz) <= 0.0 && frandom(0.0, 1.0) > 0.5) {
Actor ex = Spawn("AWeapGrenades_Grenade_ExplodeFloor");
ex.SetOrigin((self.pos.x, self.pos.y, self.floorz + 64.0), false);
A_PlaySound("hexen2/weapons/explode", CHAN_WEAPON, 1.0);
A_StartSound("hexen2/weapons/explode", CHAN_WEAPON, 1.0);
} else {
Actor ex = Spawn("AWeapGrenades_Grenade_Explode");
ex.SetOrigin(self.pos, false);
A_PlaySound("hexen2/weapons/explode", CHAN_WEAPON, 0.5);
A_StartSound("hexen2/weapons/explode", CHAN_WEAPON, 0.5);
}

if (tracer) {
Expand Down Expand Up @@ -396,18 +396,18 @@ class AWeapGrenades_SuperGrenade: Hexen2Projectile {
ex = Spawn("AWeapGrenades_Grenade_SM_Explode");
}
ex.SetOrigin(self.pos, false);
A_PlaySound("hexen2/weapons/explode", CHAN_WEAPON, 0.5);
A_StartSound("hexen2/weapons/explode", CHAN_WEAPON, 0.5);
}
} else {
self.ex_damage = 70;
if ((self.pos.z - self.floorz) == 0.0 && frandom(0.0, 1.0) > 0.25) {
Actor ex = Spawn("AWeapGrenades_Grenade_ExplodeFloor");
ex.SetOrigin((self.pos.x, self.pos.y, self.floorz + 64.0), false);
A_PlaySound("hexen2/weapons/explode", CHAN_WEAPON, 1.0);
A_StartSound("hexen2/weapons/explode", CHAN_WEAPON, 1.0);
} else {
Actor ex = Spawn("AWeapGrenades_Grenade_Explode");
ex.SetOrigin(self.pos, false);
A_PlaySound("hexen2/weapons/explode", CHAN_WEAPON, 0.5);
A_StartSound("hexen2/weapons/explode", CHAN_WEAPON, 0.5);
}
}
self.A_Explode(self.ex_damage, self.ex_damage * 0.75, 0, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class PWeapPurifier: PaladinWeapon {
}
}
weapon.AddRecoil(recoil);
A_PlaySound(sfx, CHAN_WEAPON, 0.5);
A_StartSound(sfx, CHAN_WEAPON, 0.5);
SetCooldown(weapon, refire, 2);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class SWeapAcidRune: SuccubusWeapon {
refire = 0.7;
sfx = "hexen2/succubus/acidpfir";
}
A_PlaySound(sfx, CHAN_WEAPON);
A_StartSound(sfx, CHAN_WEAPON);
SetCooldown(weapon, refire, 2);
}

Expand Down Expand Up @@ -621,9 +621,9 @@ class SWeapAcidRune_AcidDrop: Hexen2Projectile {

if (tracer) {
tracer.DamageMobj(self, self, damage, "Normal");
A_PlaySound("hexen2/succubus/acidhit", CHAN_WEAPON);
A_StartSound("hexen2/succubus/acidhit", CHAN_WEAPON);
} else {
A_PlaySound("hexen2/succubus/dropfizz", CHAN_WEAPON);
A_StartSound("hexen2/succubus/dropfizz", CHAN_WEAPON);
}

if (pg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class SWeapFireStorm: SuccubusWeapon {
SWeapFireStorm_FlameStream(proj).isPowered = true;
}
weapon.AddRecoil(recoil);
A_PlaySound(sfx, CHAN_WEAPON, 0.5);
A_StartSound(sfx, CHAN_WEAPON, 0.5);
SetCooldown(weapon, refire, 2);
}

Expand Down Expand Up @@ -452,7 +452,7 @@ class SWeapFireStorm_Burner: Actor {
self.nextDamage--;
if (self.nextDamage <= 0) {
self.burnTarget.DamageMobj(self, self.target, random[swfs_burndmg](2,3), 'Fire');
self.A_PlaySound("hexen2/raven/fire1", CHAN_WEAPON, 1);
self.A_StartSound("hexen2/raven/fire1", CHAN_WEAPON, 1);

self.nextDamage = frandom(0.0, 0.5) * 35.0;
}
Expand Down Expand Up @@ -557,7 +557,7 @@ class SWeapFireStorm_Boom: Actor {

self.attackCount--;
if (self.attackCount <= 0.0) {
self.A_PlaySound("hexen2/succubus/flamend", CHAN_WEAPON, 0.5);
self.A_StartSound("hexen2/succubus/flamend", CHAN_WEAPON, 0.5);
self.Destroy();
}
}
Expand Down
216 changes: 86 additions & 130 deletions resources/assets/zscript/actors/hxdd/shared/inventory/progression.zs
Original file line number Diff line number Diff line change
Expand Up @@ -118,47 +118,6 @@ class PlayerSheetJSON {
Array<String> stats_lookup;
String xp_bonus_stat;

String GetString(HXDD_JsonObject jo, String key) {
HXDD_JsonElement type_elem = jo.get(key);
if (!type_elem) {
return "";
}
HXDD_JsonString type_str = HXDD_JsonString(type_elem);
return type_str.s;
}
int GetInt(HXDD_JsonObject jo, String key) {
HXDD_JsonElement type_elem = jo.get(key);
if (!type_elem) {
return -1;
}
HXDD_JsonInt type_int = HXDD_JsonInt(type_elem);
return type_int.i;
}
double GetDouble(HXDD_JsonObject jo, String key) {
HXDD_JsonElement type_elem = jo.get(key);
if (!type_elem) {
return -1;
}
HXDD_JsonDouble type_double = HXDD_JsonDouble(type_elem);
return type_double.d;
}
HXDD_JsonArray GetArray(HXDD_JsonObject jo, String key) {
HXDD_JsonElement type_elem = jo.get(key);
if (!type_elem) {
return null;
}
HXDD_JsonArray type_arr = HXDD_JsonArray(type_elem);
return type_arr;
}
bool GetBool(HXDD_JsonObject jo, String key) {
HXDD_JsonElement type_elem = jo.get(key);
if (!type_elem) {
return false;
}
HXDD_JsonBool type_bool = HXDD_JsonBool(type_elem);
return type_bool.b;
}

int GetEnumFromArmorType(String type) {
if (type == "ac" || type == "armor" || type == "armorclass" || type == "hexen" || type == "hx") {
return PSAT_ARMOR_AC;
Expand Down Expand Up @@ -205,110 +164,107 @@ class PlayerSheetJSON {
self.hitpointTable.Copy(defaultHPTable);
self.manaTable.Copy(defaultMPTable);

int lumpIndex = Wads.CheckNumForFullName(String.format("playersheets/%s.playersheet", file));
console.printf("PlayerSheetJSON: Load %d", lumpIndex);
if (lumpIndex != -1) {
String lumpData = Wads.ReadLump(lumpIndex);
let json = HXDD_JSON.parse(lumpData, false);
if (json is "HXDD_JsonElement") {
HXDD_JsonObject jsonObject = HXDD_JsonObject(json);
if (jsonObject) {
console.printf("PlayerSheetJSON: Loaded %s!", file);

String valPlayerClass = GetString(jsonObject, "class");
String valArmorType = GetString(jsonObject, "armor_type");
String valProgressionType = GetString(jsonObject, "progression_type");
int valMaxLevel = GetInt(jsonObject, "max_level");
String valAlignment = GetString(jsonObject, "alignment");
bool valUseMaxHealthScaler = GetBool(jsonObject, "use_max_health_scaler");
let valSkillModifier = GetArray(jsonObject, "skill_modifier");
double valXPModifier = GetDouble(jsonObject, "xp_modifier");
bool valHalveXPBeforeLevel4 = GetBool(jsonObject, "halve_xp_before_level_4");

let valExperienceTable = GetArray(jsonObject, "experience");
let valHPTable = GetArray(jsonObject, "health");
let valManaTable = GetArray(jsonObject, "mana");

// Dynamic User Defined Stats
HXDD_JsonObject objStats = HXDD_JsonObject(jsonObject.get("stats"));
if (objStats) {
Array<String> keys;
objStats.GetKeysInto(keys);

self.stats.Resize(keys.Size());
self.stats_lookup.Resize(keys.Size());
for (let i = 0; i < keys.Size(); i++) {
String key = keys[i];
HXDD_JsonArray stat = GetArray(objStats, key);
if (stat) {
if (stat.arr.size() >= 2) {
PlayerSheetStat nStat = new ("PlayerSheetStat");
nStat.name = key.MakeLower();
nStat.table.Resize(stat.arr.Size());
for (let i = 0; i < stat.arr.Size(); i++) {
nStat.table[i] = HXDD_JsonInt(stat.arr[i]).i;
}
//nStat.value = 0;
nStat.Roll();

self.stats[i] = nStat;
self.stats_lookup[i] = nStat.name;
} else {
console.printf("PlayerSheetJSON: Stat %s array must be 2 or higher. [start_low, start_high] or [start_low, start_high, level_low, level_high, level_max, stat_cap]", key);
FileJSON fJSON = new ("FileJSON");
let success = fJSON.Open(String.format("playersheets/%s.playersheet", file));
console.printf("PlayerSheetJSON: Load %d", fJSON.index);
if (success) {
HXDD_JsonObject jsonObject = HXDD_JsonObject(fJSON.json);
if (jsonObject) {
console.printf("PlayerSheetJSON: Loaded %s!", file);

String valPlayerClass = FileJSON.GetString(jsonObject, "class");
String valArmorType = FileJSON.GetString(jsonObject, "armor_type");
String valProgressionType = FileJSON.GetString(jsonObject, "progression_type");
int valMaxLevel = FileJSON.GetInt(jsonObject, "max_level");
String valAlignment = FileJSON.GetString(jsonObject, "alignment");
bool valUseMaxHealthScaler = FileJSON.GetBool(jsonObject, "use_max_health_scaler");
let valSkillModifier = FileJSON.GetArray(jsonObject, "skill_modifier");
double valXPModifier = FileJSON.GetDouble(jsonObject, "xp_modifier");
bool valHalveXPBeforeLevel4 = FileJSON.GetBool(jsonObject, "halve_xp_before_level_4");

let valExperienceTable = FileJSON.GetArray(jsonObject, "experience");
let valHPTable = FileJSON.GetArray(jsonObject, "health");
let valManaTable = FileJSON.GetArray(jsonObject, "mana");

// Dynamic User Defined Stats
HXDD_JsonObject objStats = HXDD_JsonObject(jsonObject.get("stats"));
if (objStats) {
Array<String> keys;
objStats.GetKeysInto(keys);

self.stats.Resize(keys.Size());
self.stats_lookup.Resize(keys.Size());
for (let i = 0; i < keys.Size(); i++) {
String key = keys[i];
HXDD_JsonArray stat = FileJSON.GetArray(objStats, key);
if (stat) {
if (stat.arr.size() >= 2) {
PlayerSheetStat nStat = new ("PlayerSheetStat");
nStat.name = key.MakeLower();
nStat.table.Resize(stat.arr.Size());
for (let i = 0; i < stat.arr.Size(); i++) {
nStat.table[i] = HXDD_JsonInt(stat.arr[i]).i;
}
//nStat.value = 0;
nStat.Roll();

self.stats[i] = nStat;
self.stats_lookup[i] = nStat.name;
} else {
console.printf("PlayerSheetJSON: Failed to read stat %s at %d.", key, i);
console.printf("PlayerSheetJSON: Stat %s array must be 2 or higher. [start_low, start_high] or [start_low, start_high, level_low, level_high, level_max, stat_cap]", key);
}
} else {
console.printf("PlayerSheetJSON: Failed to read stat %s at %d.", key, i);
}
}
String valXPStat = GetString(jsonObject, "xp_bonus_stat");
if (self.stats_lookup.Find(valXPStat) != self.stats.Size()) {
self.xp_bonus_stat = valXPStat;
}
}
String valXPStat = FileJSON.GetString(jsonObject, "xp_bonus_stat");
if (self.stats_lookup.Find(valXPStat) != self.stats.Size()) {
self.xp_bonus_stat = valXPStat;
}

let valUsesEventHandler = GetBool(jsonObject, "event_handler");
let valUsesEventHandler = FileJSON.GetBool(jsonObject, "event_handler");

// TODO: Setup Item Class Table Here for MultiClassItem Refactor
// TODO: Setup Item Class Table Here for MultiClassItem Refactor

self.PlayerClass = valPlayerClass.MakeLower();
self.Alignment = valAlignment.MakeLower();
self.ArmorType = GetEnumFromArmorType(valArmorType.MakeLower());
self.ProgressionType = GetEnumFromProgressionType(valProgressionType.MakeLower());
self.PlayerClass = valPlayerClass.MakeLower();
self.Alignment = valAlignment.MakeLower();
self.ArmorType = GetEnumFromArmorType(valArmorType.MakeLower());
self.ProgressionType = GetEnumFromProgressionType(valProgressionType.MakeLower());

self.UseMaxHealthScaler = valUseMaxHealthScaler;
self.HalveXPBeforeLevel4 = valHalveXPBeforeLevel4;
self.maxlevel = valMaxLevel;
self.experienceModifier = valXPModifier;
self.UseMaxHealthScaler = valUseMaxHealthScaler;
self.HalveXPBeforeLevel4 = valHalveXPBeforeLevel4;
self.maxlevel = valMaxLevel;
self.experienceModifier = valXPModifier;

self.UsesEventHandler = valUsesEventHandler;
self.UsesEventHandler = valUsesEventHandler;

if (valSkillModifier) {
if (defaultSkillMod.Size() < valSkillModifier.arr.Size()) {
self.skillmodifier.Resize(valSkillModifier.arr.Size());
}
for (let i = 0; i < valSkillModifier.arr.Size(); i++) {
if (valSkillModifier.arr[i]) {
self.skillmodifier[i] = HXDD_JsonDouble(valSkillModifier.arr[i]).d;
}
}
if (valSkillModifier) {
if (defaultSkillMod.Size() < valSkillModifier.arr.Size()) {
self.skillmodifier.Resize(valSkillModifier.arr.Size());
}
self.experienceTable.Resize(valExperienceTable.arr.Size());
for (let i = 0; i < valExperienceTable.arr.Size(); i++) {
self.experienceTable[i] = HXDD_JsonInt(valExperienceTable.arr[i]).i;
for (let i = 0; i < valSkillModifier.arr.Size(); i++) {
if (valSkillModifier.arr[i]) {
self.skillmodifier[i] = HXDD_JsonDouble(valSkillModifier.arr[i]).d;
}
}
}
self.experienceTable.Resize(valExperienceTable.arr.Size());
for (let i = 0; i < valExperienceTable.arr.Size(); i++) {
self.experienceTable[i] = HXDD_JsonInt(valExperienceTable.arr[i]).i;
}

if (valHPTable && valManaTable) {
self.hitpointTable.Resize(clamp(5, valHPTable.arr.Size(), 6));
for (let i = 0; i < valHPTable.arr.Size(); i++) {
if (valHPTable.arr[i]) {
self.hitpointTable[i] = HXDD_JsonInt(valHPTable.arr[i]).i;
}
if (valHPTable && valManaTable) {
self.hitpointTable.Resize(clamp(5, valHPTable.arr.Size(), 6));
for (let i = 0; i < valHPTable.arr.Size(); i++) {
if (valHPTable.arr[i]) {
self.hitpointTable[i] = HXDD_JsonInt(valHPTable.arr[i]).i;
}
self.manaTable.Resize(clamp(5, valManaTable.arr.Size(), 6));
for (let i = 0; i < valManaTable.arr.Size(); i++) {
if (valManaTable.arr[i]) {
self.manaTable[i] = HXDD_JsonInt(valManaTable.arr[i]).i;
}
}
self.manaTable.Resize(clamp(5, valManaTable.arr.Size(), 6));
for (let i = 0; i < valManaTable.arr.Size(); i++) {
if (valManaTable.arr[i]) {
self.manaTable[i] = HXDD_JsonInt(valManaTable.arr[i]).i;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions resources/assets/zscript/lib/_lib.zs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
#include "zscript/lib/ZForms/Include.ZSC"
#include "zscript/lib/Gutamatics/include.zsc"
#include "zscript/lib/particles.zs"
#include "zscript/lib/filejson.zs"
#include "zscript/lib/lemonutil.zs"
#include "zscript/lib/xgametranslation.zs"
Loading

0 comments on commit 5c8526d

Please sign in to comment.