SERVER: Better management of model and sound allocation

This commit is contained in:
cypress 2023-08-25 15:14:24 -04:00
parent 1011f18b98
commit d56a17faf3
8 changed files with 48 additions and 31 deletions

View file

@ -267,8 +267,9 @@ if (self.state == STATE_TOP || self.state == STATE_UP)
} }
} }
if (other.button7) if (other.button7 && !other.semiuse)
{ {
other.semiuse = true;
if (other.points >= self.cost) if (other.points >= self.cost)
{ {
door_fire(); door_fire();
@ -287,15 +288,13 @@ if (self.state == STATE_TOP || self.state == STATE_UP)
} }
addmoney(other, self.cost*-1, 0); addmoney(other, self.cost*-1, 0);
self.solid = SOLID_NOT; self.solid = SOLID_NOT;
//centerprint (other, "");
//useprint (other, 0, 0, 0);
//other.total_bought = other.total_bought + 1;
} }
else else
{ {
if(other.classname == "player" && !other.downed) if(other.classname == "player" && !other.downed)
{ {
centerprint (other, STR_NOTENOUGHPOINTS); centerprint (other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
other.semiuse = 1; other.semiuse = 1;
} }
} }
@ -647,7 +646,12 @@ void() func_door_nzp =
if (self.cost) if (self.cost)
{ {
self.classname = "door_nzp_cost"; self.classname = "door_nzp_cost";
// total_buy = total_buy +1; switch(self.sounds)
{
case 1: precache_sound("sounds/misc/wood_door.wav"); break;
case 2: precache_sound("sounds/misc/debris.wav"); break;
default: break;
}
} }
else else
self.classname = "door_nzp"; self.classname = "door_nzp";

View file

@ -341,8 +341,8 @@ void() button_touch =
centerprint(other,ftos(self.cost)); centerprint(other,ftos(self.cost));
centerprint(other,"]\n"); centerprint(other,"]\n");
if (other.button7) { if (other.button7 && !other.semiuse) {
other.semiuse = true;
if(other.points >= self.cost) { if(other.points >= self.cost) {
self.enemy = other; self.enemy = other;
addmoney(other, 0 - self.cost, FALSE); addmoney(other, 0 - self.cost, FALSE);
@ -351,6 +351,7 @@ void() button_touch =
return; return;
} else { } else {
centerprint(other, STR_NOTENOUGHPOINTS); centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
} }
} }
} }

View file

@ -299,7 +299,7 @@ void() touch_perk =
// sequence = perk ID in client // sequence = perk ID in client
useprint(other, 9, price, self.sequence); useprint(other, 9, price, self.sequence);
if (other.points >= price && other.button7) { if (other.points >= price && other.button7 && !other.semiuse) {
addmoney(other, -price, 0); addmoney(other, -price, 0);
// Pass along the Perk information to the Player to avoid complications later on, then Drink! // Pass along the Perk information to the Player to avoid complications later on, then Drink!
@ -315,9 +315,12 @@ void() touch_perk =
ReviveGoAway(); ReviveGoAway();
} }
} }
} else if (other.button7) { other.semiuse = true;
} else if (other.button7 && !other.semiuse) {
// We tried to use, but we don't have the cash.. // We tried to use, but we don't have the cash..
centerprint(other, STR_NOTENOUGHPOINTS); centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
other.semiuse = true;
} }
} }
} }
@ -427,6 +430,7 @@ void() setup_perk =
void() perk_revive = void() perk_revive =
{ {
precache_sound ("sounds/pu/byebye.wav"); precache_sound ("sounds/pu/byebye.wav");
precache_model ("models/sprites/lightning.spr");
// //
// Set Default Stats for Compatibility // Set Default Stats for Compatibility
@ -1533,6 +1537,7 @@ void() mystery_touch =
} }
else { else {
centerprint (other, STR_NOTENOUGHPOINTS); centerprint (other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
} }
} }
if (self.boxstatus == 2) if (self.boxstatus == 2)
@ -1697,11 +1702,12 @@ void() mystery_box =
Load_Mbox_Data(); Load_Mbox_Data();
precache_model ("models/machines/mystery.mdl"); precache_model ("models/machines/mystery.mdl");
precache_model ("models/machines/mglow$.mdl");
precache_model ("models/props/teddy.mdl");
precache_sound ("sounds/machines/mbox_open.wav"); precache_sound ("sounds/machines/mbox_open.wav");
precache_sound ("sounds/machines/mbox_close.wav"); precache_sound ("sounds/machines/mbox_close.wav");
if (!(self.spawnflags & MBOX_SPAWNFLAG_NOLIGHT))
precache_model ("models/machines/mglow$.mdl");
self.solid = SOLID_TRIGGER; self.solid = SOLID_TRIGGER;
self.classname = "mystery"; self.classname = "mystery";
setorigin(self, self.origin); setorigin(self, self.origin);
@ -1875,6 +1881,7 @@ void touch_pap() {
} }
else if (other.button7 && other.weapon) { else if (other.button7 && other.weapon) {
centerprint (other, STR_NOTENOUGHPOINTS); centerprint (other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
} }
} else if (self.papState == 2) { } else if (self.papState == 2) {
useprint (other, 7, 0, 0); useprint (other, 7, 0, 0);

View file

@ -273,10 +273,12 @@ void() teleport_touch =
useprint(other, 15, self.cost, 0); useprint(other, 15, self.cost, 0);
if (other.button7) { if (other.button7 && !other.semiuse) {
other.semiuse = true;
if (other.points < self.cost) { if (other.points < self.cost) {
centerprint(other, STR_NOTENOUGHPOINTS); centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return; return;
} }

View file

@ -238,12 +238,14 @@ void zapper_touch () {
if (self.state == 0) { if (self.state == 0) {
useprint (other, 11, self.cost, self.weapon); useprint (other, 11, self.cost, self.weapon);
if (!other.button7) { if (!other.button7 || other.semiuse) {
return; return;
} }
other.semiuse = true;
if (other.points < self.cost) { if (other.points < self.cost) {
centerprint(other, STR_NOTENOUGHPOINTS); centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return; return;
} }

View file

@ -180,6 +180,7 @@ void () WallWeapon_TouchTrigger =
// Player doesn't have enough points. Abort. // Player doesn't have enough points. Abort.
if (other.points < wcost) { if (other.points < wcost) {
centerprint(other, STR_NOTENOUGHPOINTS); centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return; return;
} }
@ -225,6 +226,7 @@ void () WallWeapon_TouchTrigger =
// Player doesn't have enough points. Abort. // Player doesn't have enough points. Abort.
if (other.points < wcost) { if (other.points < wcost) {
centerprint(other, STR_NOTENOUGHPOINTS); centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return; return;
} }
@ -290,7 +292,6 @@ void () WallWeapon_TouchTrigger =
{ {
centerprint(other, STR_NOTENOUGHPOINTS); centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1); sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return; return;
} }
else else
@ -320,6 +321,7 @@ void () WallWeapon_TouchTrigger =
{ {
if (other.points < self.cost2) { if (other.points < self.cost2) {
centerprint(other, STR_NOTENOUGHPOINTS); centerprint(other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return; return;
} else { } else {
addmoney(other, -self.cost2, FALSE); addmoney(other, -self.cost2, FALSE);
@ -347,6 +349,7 @@ void () WallWeapon_TouchTrigger =
other.semiuse = 1; other.semiuse = 1;
if (other.points < self.cost) { if (other.points < self.cost) {
centerprint (other, STR_NOTENOUGHPOINTS); centerprint (other, STR_NOTENOUGHPOINTS);
sound(other, 0, "sounds/misc/denybuy.wav", 1, 1);
return; return;
} }

View file

@ -136,16 +136,18 @@ void() precaches =
// sprites // sprites
precache_model ("models/sprites/sprkle.spr"); precache_model ("models/sprites/sprkle.spr");
precache_model ("models/sprites/explosion.spr"); precache_model ("models/sprites/explosion.spr");
precache_model ("models/sprites/lightning.spr");
precache_model ("models/sprites/null.spr"); precache_model ("models/sprites/null.spr");
precache_model ("models/way/current_way.spr");
precache_model ("models/way/current_way_door.spr"); if (waypoint_mode) {
precache_model ("models/way/last_way.spr"); precache_model ("models/way/current_way.spr");
precache_model ("models/way/last_way_door.spr"); precache_model ("models/way/current_way_door.spr");
precache_model ("models/way/normal_way.spr"); precache_model ("models/way/last_way.spr");
precache_model ("models/way/normal_way_door.spr"); precache_model ("models/way/last_way_door.spr");
precache_model ("models/way/way_jump.spr"); precache_model ("models/way/normal_way.spr");
precache_model ("models/way/way_land.spr"); precache_model ("models/way/normal_way_door.spr");
precache_model ("models/way/way_jump.spr");
precache_model ("models/way/way_land.spr");
}
// zombie // zombie
precache_model ("models/ai/zfull.mdl"); precache_model ("models/ai/zfull.mdl");
@ -163,7 +165,6 @@ void() precaches =
// start weapons // start weapons
precache_model ("models/weapons/m1911/v_colt.mdl"); precache_model ("models/weapons/m1911/v_colt.mdl");
precache_model ("models/weapons/m1911/g_colt.mdl");
precache_model ("models/weapons/knife/v_knife.mdl"); precache_model ("models/weapons/knife/v_knife.mdl");
precache_model ("models/weapons/grenade/v_grenade.mdl"); precache_model ("models/weapons/grenade/v_grenade.mdl");
precache_model ("models/weapons/grenade/g_grenade.mdl"); precache_model ("models/weapons/grenade/g_grenade.mdl");
@ -217,10 +218,8 @@ void() precaches =
precache_sound("sounds/rounds/splash.wav"); precache_sound("sounds/rounds/splash.wav");
precache_sound("sounds/music/end.wav"); precache_sound("sounds/music/end.wav");
// misc // purchasing
precache_sound("sounds/misc/buy.wav"); precache_sound("sounds/misc/buy.wav");
precache_sound("sounds/misc/wood_door.wav");
precache_sound("sounds/misc/debris.wav");
precache_sound("sounds/misc/denybuy.wav"); precache_sound("sounds/misc/denybuy.wav");
// power-ups // power-ups

View file

@ -649,10 +649,9 @@ void() PlayerSpawn =
self.perks = G_PERKS; self.perks = G_PERKS;
SetPerk(self, self.perks); SetPerk(self, self.perks);
//self.zoom = 1; // This is to fix an aimin bug for the kar scope
if (rounds < 1 && player_count == 0) { if (rounds < 1 && player_count == 0) {
sound(self, CHAN_AUTO, "sounds/rounds/splash.wav", 1, ATTN_NONE); sound(self, 0, "sounds/rounds/splash.wav", 1, ATTN_NONE);
sound(self, 1, "sounds/rounds/nround.wav", 0.75, ATTN_NONE);
} }
PromptLevelChange(self.nextthink + 3, 1, self); PromptLevelChange(self.nextthink + 3, 1, self);