Skip to content

Commit

Permalink
Make the platinum key more usable and fix skull totem targeting non-m…
Browse files Browse the repository at this point in the history
…onsters
  • Loading branch information
MarioSMB committed Oct 19, 2024
1 parent 2913011 commit 7cfb5a2
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 6 deletions.
13 changes: 12 additions & 1 deletion mod/quake/common/triggers/func/button.qc
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ void button_touch(entity this, entity toucher)
else if(this.worldtype == WORLDTYPE_MEDIEVAL || this.worldtype == WORLDTYPE_HUB)
centerprint(toucher, "You need the gold key");
}
else if(this.items == IT_KEY3)
{
if(this.worldtype == WORLDTYPE_BASE)
centerprint(toucher, "You need the platinum keycard");
else if(this.worldtype == WORLDTYPE_METAL)
centerprint(toucher, "You need the platinum runekey");
else if(this.worldtype == WORLDTYPE_MEDIEVAL || this.worldtype == WORLDTYPE_HUB)
centerprint(toucher, "You need the platinum key");
}
return;
}
else
Expand Down Expand Up @@ -248,8 +257,10 @@ spawnfunc(func_button)

if(this.spawnflags & DOOR_SILVER_KEY)
this.items = IT_KEY1;
if(this.spawnflags & DOOR_GOLD_KEY)
else if(this.spawnflags & DOOR_GOLD_KEY)
this.items = IT_KEY2;
else if(this.spawnflags & DOOR_PLAT_KEY)
this.items = IT_KEY3;

if(this.spawnflags & 128)
this.use = func_button_init;
Expand Down
22 changes: 21 additions & 1 deletion mod/quake/common/triggers/func/door.qc
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,24 @@ void door_touch(entity this, entity toucher)
_sound(this, CH_TRIGGER_SINGLE, this.noise3, 1, ATTN_NORM);
}
}
else if(this.owner.items == IT_KEY3)
{
if(this.worldtype == WORLDTYPE_BASE)
{
centerprint(toucher, "You need the platinum keycard");
_sound(this, CH_TRIGGER_SINGLE, this.noise3, 1, ATTN_NORM);
}
else if(this.worldtype == WORLDTYPE_METAL)
{
centerprint(toucher, "You need the platinum runekey");
_sound(this, CH_TRIGGER_SINGLE, this.noise3, 1, ATTN_NORM);
}
else if(this.worldtype == WORLDTYPE_MEDIEVAL || this.worldtype == WORLDTYPE_HUB)
{
centerprint(toucher, "You need the platinum key");
_sound(this, CH_TRIGGER_SINGLE, this.noise3, 1, ATTN_NORM);
}
}
return;
}

Expand Down Expand Up @@ -723,8 +741,10 @@ spawnfunc(func_door)

if(this.spawnflags & DOOR_SILVER_KEY)
this.items = IT_KEY1;
if(this.spawnflags & DOOR_GOLD_KEY)
else if(this.spawnflags & DOOR_GOLD_KEY)
this.items = IT_KEY2;
else if(this.spawnflags & DOOR_PLAT_KEY)
this.items = IT_KEY3;

if(!this.speed)
this.speed = 100;
Expand Down
1 change: 1 addition & 0 deletions mod/quake/common/triggers/func/door.qh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const int DOOR_GOLD_KEY = BIT(3);
const int DOOR_SILVER_KEY = BIT(4);
const int DOOR_TOGGLE = BIT(5);
const int DOOR_CRUSHER = BIT(6); // mg flag
const int DOOR_PLAT_KEY = 16384; // alkaline

.float speed2; // Yoder add, July 10 2020, used by func_doors' "door_go_down"

Expand Down
12 changes: 12 additions & 0 deletions mod/quake/common/triggers/trigger/usekey.qc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifdef SVQC

const int USE_GOLD_KEY = BIT(0);
const int USE_PLAT_KEY = 16384; // alkaline

void keytrigger_use(entity this, entity actor, entity trigger)
{
Expand Down Expand Up @@ -36,6 +37,15 @@ void keytrigger_use(entity this, entity actor, entity trigger)
else if(world.worldtype == WORLDTYPE_MEDIEVAL)
centerprint(actor, "You need the gold key");
}
else if(this.items == IT_KEY3)
{
if(world.worldtype == WORLDTYPE_BASE)
centerprint(actor, "You need the platinum keycard");
else if(world.worldtype == WORLDTYPE_METAL)
centerprint(actor, "You need the platinum runekey");
else if(world.worldtype == WORLDTYPE_MEDIEVAL)
centerprint(actor, "You need the platinum key");
}
}
_sound(this, CH_INFO, this.noise3, 1, ATTN_NORM);
return;
Expand Down Expand Up @@ -98,6 +108,8 @@ spawnfunc(trigger_usekey)

if(this.spawnflags & USE_GOLD_KEY)
this.items = IT_KEY2;
else if(this.spawnflags & USE_PLAT_KEY)
this.items = IT_KEY3;
else
this.items = IT_KEY1;

Expand Down
2 changes: 1 addition & 1 deletion mod/quake/common/weapons/weapon/spellbook.qc
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ void seek_and_fire1(entity this)
entity targ = NULL;
while(head)
{
if(head != this && head != this.realowner && head.takedamage && Damage_ValidTarget(head, this.realowner))
if(head != this && head != this.realowner && head.takedamage && (IS_MONSTER(head) || IS_PLAYER(head)) && Damage_ValidTarget(head, this.realowner))
{
float newdist = vlen2(head.origin - this.origin);
if((!olddist || newdist <= olddist) && visible(this, head))
Expand Down
2 changes: 1 addition & 1 deletion mod/quake/server/client.qc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void SetChangeParms(entity this)
}

// remove items
this.items &= ~(IT_KEY1 | IT_KEY2);
this.items &= ~(IT_KEY1 | IT_KEY2 | IT_KEY3);
this.items &= ~IT_TANK;
this.items &= ~IT_SUPERHEALTH; // rogue
this.gravity = 1.0;
Expand Down
3 changes: 3 additions & 0 deletions mod/quake/server/combat.qc
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ bool Damage_ValidTarget(entity targ, entity attacker)
// decoys are never valid targets
if(targ.monsterdef && (targ.monsterdef.spawnflags & MONSTER_TYPE_DECOY))
return false;
// in the event of our owner being lost, just treat the target as braindead
if(targ.charmed && !targ.charmer)
return false;

// first verify the target
if(IS_MONSTER(targ) && targ.charmed)
Expand Down
2 changes: 1 addition & 1 deletion mod/quake/server/items.qc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void ItemSpawn(entity this, entity actor, entity trigger)
void PlaceItem(entity this)
{
this.mdl = this.model; // so it can be restored on respawn
if(!(this.items & IT_KEY1) && !(this.items & IT_KEY2))
if(!(this.items & IT_KEY1) && !(this.items & IT_KEY2) && !(this.items & IT_KEY3))
this.flags = FL_ITEM; // make extra wide
this.solid = SOLID_TRIGGER;
if(this.classname != "item_sigil" && ((this.spawnflags & DROPTOFLOOR_DISABLE) || (this.spawnflags & ITEM_SUSPENDED)))
Expand Down
2 changes: 1 addition & 1 deletion mod/quake/server/monsters/monsters.qc
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ bool Monster_Appear_Check(entity this, Monster monster_id)
Monster monster_randomize(entity this, Monster mon)
{
this.nightmare_checked = true;
if((mon.spawnflags & MONSTER_TYPE_DECOY) || world.model == "maps/eod7.bsp" || world.model == "maps/zigisp1.bsp" || world.model == "maps/markiesm1.bsp" || world.model == "maps/r2m1.bsp")
if((mon.spawnflags & MONSTER_TYPE_DECOY) || world.model == "maps/eod7.bsp" || world.model == "maps/zigisp1.bsp" || world.model == "maps/markiesm1.bsp" || world.model == "maps/r2m1.bsp" || world.model == "maps/hip2m4.bsp")
return mon; // map is broken currently with random mobs TODO

if(substring(world.model, 0, 9) == "maps/ffj_")
Expand Down

0 comments on commit 7cfb5a2

Please sign in to comment.