vht/vhtzs/events.zsc
Alison Watson 6928c2f898 + add aesthetic fixes for small hud font to make it consistent with the big hud font
+ add option to add a projectile to timon's axe (splits mana use)
+ add option to speed up sapphire wand
+ make pickup flashes bright
+ make sapphire wand's trail look more like the explosion
+ add option to display a detailed quest log on the automap
+ make ettins and centaurs not play a hit sound when missing
+ add an option to set the behaviour of centaurs to make them more vulnerable
+ add an option to make players shatter frozen enemies on touch
+ add an option to change the sapphire wand's damage function
+ make sapphire wand's projectile appear at the proper height
+ add an option to change the frost spell's damage function
+ add an option to make bloodscourge's projectiles foil invulnerability
2022-07-10 07:24:30 -06:00

70 lines
1.9 KiB
Plaintext

class VhtEvents : StaticEventHandler {
bool m_useQuestLog;
string m_questLog;
VhtFnPlayerInv m_fGetQuests;
VhtQuestHolder vhtGetQuests() const {
return m_fGetQuests.vhtRun() ? VhtQuestHolder(m_fGetQuests.m_result) : null;
}
override void playerEntered(PlayerEvent e) {
let p = players[e.playerNumber].mo;
if(p && !p.findInventory("VhtQuestHolder")) {
p.giveInventoryType("VhtQuestHolder");
}
if(!m_fGetQuests) {
m_fGetQuests = new("VhtFnPlayerInvExist").vhtInit("VhtQuestHolder");
}
let qh = vhtGetQuests();
if(!e.isReturn && m_fGetQuests.m_player == e.playerNumber) {
qh.vhtAddQuest("VhtQuest" .. level.levelNum);
}
}
override void playerDisconnected(PlayerEvent e) {
let p = players[e.playerNumber].mo;
if(p) {
let qh_r = VhtQuestHolder(p.findInventory("VhtQuestHolder"));
if(qh_r) {
p.removeInventory(qh_r);
let qh_l = vhtGetQuests();
if(qh_l) {
qh_r.m_quests.move(qh_l.m_quests);
}
}
}
}
override void worldTick() {
m_useQuestLog = vht_player_questlog;
let qh = vhtGetQuests();
if(!qh) {
return;
}
for(int i = 0, j = qh.m_quests.size(); i < j; ++i) {
if(qh.m_quests[i]) {
qh.m_quests[i].vhtTick();
}
}
if(m_useQuestLog) {
m_questLog = "";
for(int i = 0, j = qh.m_quests.size(); i < j; ++i) {
if(qh.m_quests[i]) {
m_questLog.appendFormat(
"\cu- \cn%s\c-\n%s\n\n",
StringTable.localize(
qh.m_quests[i].vhtLevelInfo().levelName,
false
),
qh.m_quests[i].vhtDescribe()
);
}
}
}
}
override void renderUnderlay(RenderEvent e) {
if(automapActive && m_useQuestLog) {
double x = Screen.getWidth() / 320.0;
double y = Screen.getHeight() / 8.0;
Screen.drawText(smallfont, Font.CR_UNTRANSLATED, x+x, y+x, m_questLog, DTA_CLEANNOMOVE_1,true, DTA_ALPHA,0.406, DTA_FILLCOLOR,0);
Screen.drawText(smallfont, Font.CR_UNTRANSLATED, x, y, m_questLog, DTA_CLEANNOMOVE_1,true);
}
}
}