From bdb67729dde0a0ac1944241ec1c7af629cf375f5 Mon Sep 17 00:00:00 2001 From: Alison Watson Date: Fri, 20 Sep 2019 23:24:56 -0400 Subject: [PATCH] refactoring --- fixsrcnames.fish | 197 +++++++++++++++++++ source/ai.qc | 120 ++++++------ source/boss.qc | 62 +++--- source/buttons.qc | 10 +- source/client.qc | 477 ++++++++++++++++++++++++++------------------- source/combat.qc | 70 +++---- source/common.qc | 6 +- source/defs.qc | 212 ++++++++++---------- source/demon.qc | 70 +++---- source/dog.qc | 52 ++--- source/doors.qc | 66 +++---- source/enforcer.qc | 54 ++--- source/fight.qc | 226 ++------------------- source/fish.qc | 8 +- source/hknight.qc | 34 ++-- source/items.qc | 324 +++++++++++++++--------------- source/knight.qc | 12 +- source/misc.qc | 122 ++++++------ source/monsters.qc | 30 +-- source/ogre.qc | 138 +++++++++---- source/oldone.qc | 92 +++++---- source/plats.qc | 50 ++--- source/player.qc | 108 +++++----- source/shalrath.qc | 52 ++--- source/shambler.qc | 133 +++++++++---- source/soldier.qc | 82 +++++++- source/subs.qc | 72 +++---- source/tarbaby.qc | 38 ++-- source/triggers.qc | 82 ++++---- source/weapons.qc | 356 +++++++++++++++++---------------- source/wizard.qc | 78 ++++---- source/world.qc | 46 ++--- source/zombie.qc | 42 ++-- todo | 2 +- 34 files changed, 1902 insertions(+), 1621 deletions(-) create mode 100644 fixsrcnames.fish diff --git a/fixsrcnames.fish b/fixsrcnames.fish new file mode 100644 index 0000000..05408af --- /dev/null +++ b/fixsrcnames.fish @@ -0,0 +1,197 @@ +#!/usr/bin/env fish + +set reps \ + WriteByte write_byte \ + WriteChar write_char \ + WriteShort write_short \ + WriteLong write_long \ + WriteCoord write_coord \ + WriteAngle write_angle \ + WriteString write_string \ + WriteEntity write_entity \ + makevectors make_vectors \ + setorigin set_origin \ + setmodel set_model \ + setsize set_size \ + objerror error_obj \ + vlen vec_len \ + vectoyaw vec_yaw \ + traceline trace_line \ + checkclient check_client \ + stuffcmd cmd_client \ + localcmd cmd_server \ + findradius find_radius \ + sprint print_cl \ + bprint print_all \ + dprint print_dbg \ + coredump core_dump \ + traceon trace_on \ + traceoff trace_off \ + eprint print_ent \ + walkmove walk_move \ + droptofloor drop_to_floor \ + lightstyle light_style \ + checkbottom check_bottom \ + pointcontents point_contents \ + nextent next_ent \ + ChangeYaw change_yaw \ + vectoangles vec_to_angles \ + movetogoal move_to_goal \ + makestatic make_static \ + centerprint print_center \ + ambientsound ambient_sound \ + setspawnparms set_spawn_parms \ + infoadd info_add \ + infoget info_get \ + SUB_AttackFinished sub_attack_finished \ + SUB_CalcMove sub_calc_move \ + SUB_CalcMoveEnt sub_calc_move_ent \ + SUB_CalcMoveDone sub_calc_move_done \ + SUB_CalcAngleMove sub_calc_angle_move \ + SUB_CalcAngleMoveDone sub_calc_angle_move_done \ + SUB_CheckRefire sub_check_refire \ + SUB_Null sub_null \ + SUB_PainNull sub_pain_null \ + SUB_UseTargets sub_use_targets \ + SUB_Remove sub_remove \ + T_Heal ent_heal \ + CanHeal can_heal \ + CanDamage can_damage \ + T_Damage ent_damage \ + T_RadiusDamage ent_radius_damage \ + T_MissileTouch ent_missile_touch \ + Key1Name key_1_name \ + Key2Name key_2_name \ + Demon_Melee demon_melee \ + Demon_JumpTouch demon_jump_touch \ + DemonCheckAttack demon_check_attack \ + DogCheckAttack dog_check_attack \ + ShalHome shalrath_home \ + ShalMissile shalrath_missile \ + ShalMissileTouch shalrath_missile_touch \ + ClientObituary client_obituary \ + DeathBubbles death_bubbles \ + ChooseTurn choose_turn \ + LaunchLaser launch_laser \ + SpawnBlood spawn_blood \ + BecomeExplosion become_explosion \ + SameTeam is_same_team \ + DecodeLevelParms decode_level_parms \ + CopyToBodyQue copy_to_body_queue \ + InitBodyQue init_body_queue \ + SuperDamageSound super_damage_sound \ + W_ChangeWeapon wep_change_weapon \ + W_CycleWeaponReverse wep_cycle_weapon_reverse \ + W_CycleWeapon wep_cycle_weapon \ + W_FireAxe wep_fire_axe \ + W_FireShotgun wep_fire_shotgun \ + W_FireSuperShotgun wep_fire_super_shotgun \ + W_FireRocket wep_fire_rocket \ + W_FireLightning wep_fire_lightning \ + W_FireGrenade wep_fire_grenade \ + W_FireSpikes wep_fire_nail \ + W_FireSuperSpikes wep_fire_super_nail \ + W_BestWeapon wep_best_weapon \ + W_SetCurrentAmmo wep_set_current_ammo \ + W_WeaponFrame wep_weapon_frame \ + WizardCheckAttack wiz_check_attack \ + PlayerDie player_die \ + ImpulseCommands impulse_commands \ + anglemod angle_mod \ + HuntTarget hunt_target \ + SightSound sight_sound \ + FoundTarget found_target \ + FindTarget find_target \ + FacingIdeal facing_ideal \ + CheckAnyAttack check_any_attack \ + FindIntermission find_intermission \ + GotoNextMap go_to_next_map \ + ExitIntermission intermission_exit \ + IntermissionThink intermission_think \ + CheckSpawnPoint check_spawn_point \ + SelectSpawnPoint select_spawn_point \ + NextLevel next_level \ + CheckRules check_rules \ + PlayerDeathThink player_death_think \ + PlayerJump player_jump \ + WaterMove water_move \ + CheckWaterJump check_water_jump \ + CheckPowerups check_powerups \ + BothPlayers are_both_players \ + Killed killed \ + T_BeamDamage beam_damage \ + Demon_MeleeAttack demon_melee_attack \ + CheckDemonMelee demon_check_melee \ + CheckDemonJump demon_check_jump \ + Dog_JumpTouch dog_jump_touch \ + CheckDogMelee dog_check_melee \ + CheckDogJump dog_check_jump \ + EntitiesTouching entities_touching \ + LinkDoors link_doors \ + Laser_Touch laser_touch \ + CheckAttack check_attack \ + SoldierCheckAttack army_check_attack \ + ShamCheckAttack sham_check_attack \ + OgreCheckAttack ogre_check_attack \ + CheckForCharge check_for_charge \ + CheckContinueCharge check_continue_charge \ + SUB_regen sub_regen \ + PlaceItem place_item \ + StartItem start_item \ + RankForWeapon wep_rank_for_weapon \ + Deathmatch_Weapon wep_deathmatch_weapon \ + BackpackTouch backpack_touch \ + DropBackpack drop_backpack \ + FireAmbient fire_ambient \ + OgreGrenadeExplode ogre_grenade_explode \ + OgreGrenadeTouch ogre_grenade_touch \ + OgreFireGrenade ogre_fire_grenade \ + PainSound player_pain_sound \ + DeathBubblesSpawn player_death_bubbles_spawn \ + DeathSound player_death_sound \ + PlayerDead player_dead \ + VelocityForDamage player_velocity_for_damage \ + ThrowGib throw_gib \ + ThrowHead throw_head \ + GibPlayer player_gib \ + ShamClaw sham_claw \ + CastLightning sham_cast_lightning \ + SetMovedir set_move_dir \ + InitTrigger init_trigger \ + DelayThink delay_think \ + Tar_JumpTouch tbaby_jump_touch \ + W_Precache wep_precache \ + SpawnMeatSpray spawn_meat_spray \ + SpawnChunk spawn_chunk \ + ClearMultiDamage multi_damage_clear \ + ApplyMultiDamage multi_damage_apply \ + AddMultiDamage multi_damage_add \ + TraceAttack trace_attack \ + FireBullets fire_bullets \ + LightningDamage lightning_damage \ + GrenadeExplode grenade_explode \ + GrenadeTouch grenade_touch \ + W_Attack wep_attack \ + LaunchMissile launch_missile \ + WizardAttackFinished wiz_attack_finished \ + Wiz_FastFire wiz_fast_fire \ + Wiz_StartFast wiz_start_fast \ + Wiz_idlesound wiz_idle_sound \ + Wiz_Pain wiz_pain \ + Wiz_Missile wiz_missile \ + ZombieGrenadeTouch zombie_grenade_touch \ + ZombieFireGrenade zombie_fire_grenade \ + +set srcs (find source -type f) + +for i in (seq 2 2 (count $reps)) + set i2 (math -s0 $i - 1) + set from $reps[$i2] + set to $reps[$i] + echo $i2.$from = $i.$to + for f in $srcs + sed -i -e "s/\b$from\b/$to/g" "$f" + end +end + +## EOF diff --git a/source/ai.qc b/source/ai.qc index fccbb5f..0548105 100644 --- a/source/ai.qc +++ b/source/ai.qc @@ -9,7 +9,7 @@ float(entity enemy) enemy_is_gone = { // as the sight target the next frame so that monsters near that one // will wake up even if they wouldn't have noticed the player // -float(float v) anglemod = { +float(float v) angle_mod = { while(v >= 360) { v = v - 360; } @@ -40,12 +40,12 @@ The number of seconds to spend standing or bowing for path_stand or path_bow void() movetarget_f = { if(!self.targetname) { - objerror("monster_movetarget: no targetname"); + error_obj("monster_movetarget: no targetname"); } self.solid = SOLID_TRIGGER; self.touch = t_movetarget; - setsize(self, '-8 -8 -8', '8 8 8'); + set_size(self, '-8 -8 -8', '8 8 8'); }; @@ -83,9 +83,9 @@ void() t_movetarget = { sound(self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE); // play chainsaw drag sound } - //dprint("t_movetarget\n"); + //print_dbg("t_movetarget\n"); self.goalentity = self.movetarget = find(world, targetname, other.target); - self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin); + self.ideal_yaw = vec_yaw(self.goalentity.origin - self.origin); if(!self.movetarget) { self.pausetime = time + 999999; self.th_stand(); @@ -96,15 +96,15 @@ void() t_movetarget = { //============================================================================ -void() HuntTarget = { +void() hunt_target = { self.goalentity = self.enemy; self.think = self.th_run; - self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin); + self.ideal_yaw = vec_yaw(self.enemy.origin - self.origin); self.nextthink = time + 0.1; - SUB_AttackFinished(1); // wait a while before first attack + sub_attack_finished(1); // wait a while before first attack }; -void() SightSound = { +void() sight_sound = { string snd; switch(self.classname) { @@ -132,7 +132,7 @@ void() SightSound = { sound(self, CHAN_VOICE, snd, 1, ATTN_NORM); }; -void() FoundTarget = { +void() found_target = { if(self.enemy.classname == "player") { // let other monsters see this monster for a while sight_entity = self; @@ -141,13 +141,13 @@ void() FoundTarget = { self.show_hostile = time + 1; // wake up other monsters - SightSound(); - HuntTarget(); + sight_sound(); + hunt_target(); }; /* =========== -FindTarget +find_target Self is currently not attacking anything, so try to find a target @@ -162,7 +162,7 @@ checked each frame. This means multi player games will have slightly slower noticing monsters. ============ */ -float() FindTarget = { +float() find_target = { entity client; float r; @@ -178,7 +178,7 @@ float() FindTarget = { return FALSE; } } else { - client = checkclient(); + client = check_client(); if(!client) { return FALSE; // current check entity isn't in PVS } @@ -221,7 +221,7 @@ float() FindTarget = { } } - FoundTarget(); + found_target(); return TRUE; }; @@ -229,11 +229,11 @@ float() FindTarget = { //============================================================================= void(float dist) ai_forward = { - walkmove(self.angles_y, dist); + walk_move(self.angles_y, dist); }; void(float dist) ai_back = { - walkmove((self.angles_y + 180), dist); + walk_move((self.angles_y + 180), dist); }; /* @@ -248,10 +248,10 @@ void(float dist) ai_pain = { /* float away; - away = anglemod(vectoyaw(self.origin - self.enemy.origin) + away = angle_mod(vec_yaw(self.origin - self.enemy.origin) + 180*(random()- 0.5) ); - walkmove(away, dist); + walk_move(away, dist); */ }; @@ -263,7 +263,7 @@ stagger back a bit ============= */ void(float dist) ai_painforward = { - walkmove(self.ideal_yaw, dist); + walk_move(self.ideal_yaw, dist); }; /* @@ -279,11 +279,11 @@ void(float dist) ai_walk = { movedist = dist; // check for noticing a player - if(FindTarget()) { + if(find_target()) { return; } - movetogoal(dist); + move_to_goal(dist); }; /* @@ -294,7 +294,7 @@ The monster is staying in one place for a while, with slight angle turns ============= */ void() ai_stand = { - if(FindTarget()) { + if(find_target()) { return; } @@ -315,21 +315,21 @@ don't move, but turn towards ideal_yaw ============= */ void() ai_turn = { - if(FindTarget()) { + if(find_target()) { return; } - ChangeYaw(); + change_yaw(); }; //============================================================================= /* ============= -ChooseTurn +choose_turn ============= */ -void(vector dest3) ChooseTurn = { +void(vector dest3) choose_turn = { vector dir, newdir; dir = self.origin - dest3; @@ -347,19 +347,19 @@ void(vector dest3) ChooseTurn = { } dir_z = 0; - self.ideal_yaw = vectoyaw(dir); + self.ideal_yaw = vec_yaw(dir); }; /* ============ -FacingIdeal +facing_ideal ============ */ -float() FacingIdeal = { +float() facing_ideal = { float delta; - delta = anglemod(self.angles_y - self.ideal_yaw); + delta = angle_mod(self.angles_y - self.ideal_yaw); if(delta > 45 && delta < 315) { return FALSE; } @@ -368,29 +368,19 @@ float() FacingIdeal = { //============================================================================= -float() CheckAnyAttack = { +float() check_any_attack = { if(!enemy_vis) { return 0; } - if(self.classname == "monster_army") { - return SoldierCheckAttack(); + switch(self.classname) { + case "monster_army": return army_check_attack(); + case "monster_ogre": return ogre_check_attack(); + case "monster_shambler": return sham_check_attack(); + case "monster_demon1": return demon_check_attack(); + case "monster_dog": return dog_check_attack(); + case "monster_wizard": return wiz_check_attack(); } - if(self.classname == "monster_ogre") { - return OgreCheckAttack(); - } - if(self.classname == "monster_shambler") { - return ShamCheckAttack(); - } - if(self.classname == "monster_demon1") { - return DemonCheckAttack(); - } - if(self.classname == "monster_dog") { - return DogCheckAttack(); - } - if(self.classname == "monster_wizard") { - return WizardCheckAttack(); - } - return CheckAttack(); + return check_attack(); }; /* @@ -402,9 +392,9 @@ Turn and close until within an angle to launch a melee attack */ void() ai_run_melee = { self.ideal_yaw = enemy_yaw; - ChangeYaw(); + change_yaw(); - if(FacingIdeal()) { + if(facing_ideal()) { self.th_melee(); self.attack_state = AS_STRAIGHT; } @@ -419,8 +409,8 @@ Turn in place until within an angle to launch a missile attack */ void() ai_run_missile = { self.ideal_yaw = enemy_yaw; - ChangeYaw(); - if(FacingIdeal()) { + change_yaw(); + if(facing_ideal()) { self.th_missile(); self.attack_state = AS_STRAIGHT; } @@ -437,20 +427,20 @@ void() ai_run_slide = { float ofs; self.ideal_yaw = enemy_yaw; - ChangeYaw(); + change_yaw(); if(self.lefty) { ofs = 90; } else { ofs = -90; } - if(walkmove(self.ideal_yaw + ofs, movedist)) { + if(walk_move(self.ideal_yaw + ofs, movedist)) { return; } self.lefty = 1 - self.lefty; - walkmove(self.ideal_yaw - ofs, movedist); + walk_move(self.ideal_yaw - ofs, movedist); }; /* @@ -471,7 +461,7 @@ void(float dist) ai_run = { self.enemy = world; if(!enemy_is_gone(self.oldenemy)) { self.enemy = self.oldenemy; - HuntTarget(); + hunt_target(); } else { if(self.movetarget) { self.th_walk(); @@ -492,27 +482,27 @@ void(float dist) ai_run = { // look for other coop players if(coop && self.search_time < time) { - if(FindTarget()) { + if(find_target()) { return; } } enemy_infront = infront(self.enemy); enemy_range = range(self.enemy); - enemy_yaw = vectoyaw(self.enemy.origin - self.origin); + enemy_yaw = vec_yaw(self.enemy.origin - self.origin); if(self.attack_state == AS_MISSILE) { - //dprint("ai_run_missile\n"); + //print_dbg("ai_run_missile\n"); ai_run_missile(); return; } if(self.attack_state == AS_MELEE) { - //dprint("ai_run_melee\n"); + //print_dbg("ai_run_melee\n"); ai_run_melee(); return; } - if(CheckAnyAttack()) { + if(check_any_attack()) { return; // beginning an attack } @@ -522,6 +512,6 @@ void(float dist) ai_run = { } // head straight in - movetogoal(dist); // done in C code... + move_to_goal(dist); // done in C code... }; diff --git a/source/boss.qc b/source/boss.qc index 71f634e..cf4260b 100644 --- a/source/boss.qc +++ b/source/boss.qc @@ -165,17 +165,17 @@ void() boss_death7 = [$death7, boss_death8] {}; void() boss_death8 = [$death8, boss_death9] {}; void() boss_death9 = [$death9, boss_death10] { sound(self, CHAN_BODY, "boss1/out1.wav", 1, ATTN_NORM); - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_LAVASPLASH); - WriteCoord(MSG_BROADCAST, self.origin_x); - WriteCoord(MSG_BROADCAST, self.origin_y); - WriteCoord(MSG_BROADCAST, self.origin_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_LAVASPLASH); + write_coord(MSG_BROADCAST, self.origin_x); + write_coord(MSG_BROADCAST, self.origin_y); + write_coord(MSG_BROADCAST, self.origin_z); }; void() boss_death10 = [$death9, boss_death10] { killed_monsters = killed_monsters + 1; - WriteByte(MSG_ALL, SVC_KILLEDMONSTER); // FIXME: reliable broadcast - SUB_UseTargets(); + write_byte(MSG_ALL, SVC_KILLEDMONSTER); // FIXME: reliable broadcast + sub_use_targets(); remove(self); }; @@ -184,14 +184,14 @@ void(vector p) boss_missile = { vector org, vec, d; float t; - offang = vectoangles(self.enemy.origin - self.origin); - makevectors(offang); + offang = vec_to_angles(self.enemy.origin - self.origin); + make_vectors(offang); org = self.origin + p_x * v_forward + p_y * v_right + p_z*'0 0 1'; // lead the player on hard mode if(skill > 1) { - t = vlen(self.enemy.origin - org) / 300; + t = vec_len(self.enemy.origin - org) / 300; vec = self.enemy.velocity; vec_z = 0; d = self.enemy.origin + t * vec; @@ -202,11 +202,11 @@ void(vector p) boss_missile = { vec = normalize(d - org); launch_spike(org, vec); - setmodel(newmis, "progs/lavaball.mdl"); + set_model(newmis, "progs/lavaball.mdl"); newmis.avelocity = '200 100 300'; - setsize(newmis, VEC_ORIGIN, VEC_ORIGIN); + set_size(newmis, VEC_ORIGIN, VEC_ORIGIN); newmis.velocity = vec * 300; - newmis.touch = T_MissileTouch; // rocket explosion + newmis.touch = ent_missile_touch; // rocket explosion sound(self, CHAN_WEAPON, "boss1/throw.wav", 1, ATTN_NORM); // check for dead enemy @@ -220,8 +220,8 @@ void() boss_awake = { self.movetype = MOVETYPE_STEP; self.takedamage = DAMAGE_NO; - setmodel(self, "progs/boss.mdl"); - setsize(self, '-128 -128 -24', '128 128 256'); + set_model(self, "progs/boss.mdl"); + set_size(self, '-128 -128 -24', '128 128 256'); if(skill == 0) { self.health = 1; @@ -231,11 +231,11 @@ void() boss_awake = { self.enemy = activator; - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_LAVASPLASH); - WriteCoord(MSG_BROADCAST, self.origin_x); - WriteCoord(MSG_BROADCAST, self.origin_y); - WriteCoord(MSG_BROADCAST, self.origin_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_LAVASPLASH); + write_coord(MSG_BROADCAST, self.origin_x); + write_coord(MSG_BROADCAST, self.origin_y); + write_coord(MSG_BROADCAST, self.origin_z); self.yaw_speed = 20; boss_rise1(); @@ -290,15 +290,15 @@ void() lightning_fire = { self.nextthink = time + 0.1; self.think = lightning_fire; - WriteByte(MSG_ALL, SVC_TEMPENTITY); - WriteByte(MSG_ALL, TE_LIGHTNING3); - WriteEntity(MSG_ALL, world); - WriteCoord(MSG_ALL, p1_x); - WriteCoord(MSG_ALL, p1_y); - WriteCoord(MSG_ALL, p1_z); - WriteCoord(MSG_ALL, p2_x); - WriteCoord(MSG_ALL, p2_y); - WriteCoord(MSG_ALL, p2_z); + write_byte(MSG_ALL, SVC_TEMPENTITY); + write_byte(MSG_ALL, TE_LIGHTNING3); + write_entity(MSG_ALL, world); + write_coord(MSG_ALL, p1_x); + write_coord(MSG_ALL, p1_y); + write_coord(MSG_ALL, p1_z); + write_coord(MSG_ALL, p2_x); + write_coord(MSG_ALL, p2_y); + write_coord(MSG_ALL, p2_z); }; void() lightning_use = { @@ -309,14 +309,14 @@ void() lightning_use = { le1 = find(world, target, "lightning"); le2 = find(le1, target, "lightning"); if(!le1 || !le2) { - dprint("missing lightning targets\n"); + print_dbg("missing lightning targets\n"); return; } if((le1.state != STATE_TOP && le1.state != STATE_BOTTOM) || (le2.state != STATE_TOP && le2.state != STATE_BOTTOM) || (le1.state != le2.state)) { - // dprint("not aligned\n"); + // print_dbg("not aligned\n"); return; } diff --git a/source/buttons.qc b/source/buttons.qc index 8154754..2d048db 100644 --- a/source/buttons.qc +++ b/source/buttons.qc @@ -5,7 +5,7 @@ void() button_wait = { self.nextthink = self.ltime + self.wait; self.think = button_return; activator = self.enemy; - SUB_UseTargets(); + sub_use_targets(); self.frame = 1; // use alternate textures }; @@ -15,7 +15,7 @@ void() button_done = { void() button_return = { self.state = STATE_DOWN; - SUB_CalcMove(self.pos1, self.speed, button_done); + sub_calc_move(self.pos1, self.speed, button_done); self.frame = 0; // use normal textures if(self.health) { self.takedamage = DAMAGE_YES; // can be shot again @@ -34,7 +34,7 @@ void() button_fire = { sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM); self.state = STATE_UP; - SUB_CalcMove(self.pos2, self.speed, button_wait); + sub_calc_move(self.pos2, self.speed, button_wait); }; void() button_use = { @@ -92,11 +92,11 @@ void() func_button = { self.noise = "buttons/switch04.wav"; } - SetMovedir(); + set_move_dir(); self.movetype = MOVETYPE_PUSH; self.solid = SOLID_BSP; - setmodel(self, self.model); + set_model(self, self.model); self.blocked = button_blocked; self.use = button_use; diff --git a/source/client.qc b/source/client.qc index 4a31d1e..db4b18c 100644 --- a/source/client.qc +++ b/source/client.qc @@ -82,7 +82,7 @@ void() SetNewParms = { parm9 = 0; }; -void() DecodeLevelParms = { +void() decode_level_parms = { float ofs, ofs2, pro; if(serverflags) { @@ -118,12 +118,12 @@ void() DecodeLevelParms = { /* ============ -FindIntermission +find_intermission Returns the entity to view from ============ */ -entity() FindIntermission = { +entity() find_intermission = { entity spot; float cyc; @@ -152,21 +152,107 @@ entity() FindIntermission = { return spot; } - objerror("FindIntermission: no spot"); + error_obj("find_intermission: no spot"); }; -void() GotoNextMap = { +void() go_to_next_map = { if(cvar("samelevel")) { // if samelevel is set, stay on same level - changelevel(mapname); + change_level(mapname); } else { - changelevel(nextmap); + change_level(nextmap); } }; -void() ExitIntermission = { +void() intermission_exit = { + const string FINALE_E1_UNREGISTERED = + "As the corpse of the monstrous entity\n" + "Chthon sinks back into the lava whence\n" + "it rose, you grip the Rune of Earth\n" + "Magic tightly. Now that you have\n" + "conquered the Dimension of the Doomed,\n" + "realm of Earth Magic, you are ready to\n" + "complete your task in the other three\n" + "haunted lands of Quake. Or are you? If\n" + "you don't register Quake, you'll never\n" + "know what awaits you in the Realm of\n" + "Black Magic, the Netherworld, and the\n" + "Elder World!"; + + const string FINALE_E1 = + "As the corpse of the monstrous entity\n" + "Chthon sinks back into the lava whence\n" + "it rose, you grip the Rune of Earth\n" + "Magic tightly. Now that you have\n" + "conquered the Dimension of the Doomed,\n" + "realm of Earth Magic, you are ready to\n" + "complete your task. A Rune of magic\n" + "power lies at the end of each haunted\n" + "land of Quake. Go forth, seek the\n" + "totality of the four Runes!"; + + const string FINALE_E2 = + "The Rune of Black Magic throbs evilly in\n" + "your hand and whispers dark thoughts\n" + "into your brain. You learn the inmost\n" + "lore of the Hell-Mother; Shub-Niggurath!\n" + "You now know that she is behind all the\n" + "terrible plotting which has led to so\n" + "much death and horror. But she is not\n" + "inviolate! Armed with this Rune, you\n" + "realize that once all four Runes are\n" + "combined, the gate to Shub-Niggurath's\n" + "Pit will open, and you can face the\n" + "Witch-Goddess herself in her frightful\n" + "otherworld cathedral."; + + const string FINALE_E3 = + "The charred viscera of diabolic horrors\n" + "bubble viscously as you seize the Rune\n" + "of Hell Magic. Its heat scorches your\n" + "hand, and its terrible secrets blight\n" + "your mind. Gathering the shreds of your\n" + "courage, you shake the devil's shackles\n" + "from your soul, and become ever more\n" + "hard and determined to destroy the\n" + "hideous creatures whose mere existence\n" + "threatens the souls and psyches of all\n" + "the population of Earth."; + + const string FINALE_E4 = + "Despite the awful might of the Elder\n" + "World, you have achieved the Rune of\n" + "Elder Magic, capstone of all types of\n" + "arcane wisdom. Beyond good and evil,\n" + "beyond life and death, the Rune\n" + "pulsates, heavy with import. Patient and\n" + "potent, the Elder Being Shub-Niggurath\n" + "weaves her dire plans to clear off all\n" + "life from the Earth, and bring her own\n" + "foul offspring to our world! For all the\n" + "dwellers in these nightmare dimensions\n" + "are her descendants! Once all Runes of\n" + "magic power are united, the energy\n" + "behind them will blast open the Gateway\n" + "to Shub-Niggurath, and you can travel\n" + "there to foil the Hell-Mother's plots\n" + "in person."; + + const string FINALE_RUNES = + "Now, you have all four Runes. You sense\n" + "tremendous invisible forces moving to\n" + "unseal ancient barriers. Shub-Niggurath\n" + "had hoped to use the Runes Herself to\n" + "clear off the Earth, but now instead,\n" + "you will use them to enter her home and\n" + "confront her as an avatar of avenging\n" + "Earth-life. If you defeat her, you will\n" + "be remembered forever as the savior of\n" + "the planet. If she conquers, it will be\n" + "as if you had never been born."; + // skip any text in deathmatch if(deathmatch) { - GotoNextMap(); + go_to_next_map(); return; } @@ -178,66 +264,66 @@ void() ExitIntermission = { // if(intermission_running == 2) { if(world.model == "maps/e1m7.bsp") { - WriteByte(MSG_ALL, SVC_CDTRACK); - WriteByte(MSG_ALL, 2); - WriteByte(MSG_ALL, 3); + write_byte(MSG_ALL, SVC_CDTRACK); + write_byte(MSG_ALL, 2); + write_byte(MSG_ALL, 3); if(!cvar("registered")) { - WriteByte(MSG_ALL, SVC_FINALE); - WriteString(MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!"); + write_byte(MSG_ALL, SVC_FINALE); + write_string(MSG_ALL, FINALE_E1_UNREGISTERED); } else { - WriteByte(MSG_ALL, SVC_FINALE); - WriteString(MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!"); + write_byte(MSG_ALL, SVC_FINALE); + write_string(MSG_ALL, FINALE_E1); } return; } else if(world.model == "maps/e2m6.bsp") { - WriteByte(MSG_ALL, SVC_CDTRACK); - WriteByte(MSG_ALL, 2); - WriteByte(MSG_ALL, 3); - WriteByte(MSG_ALL, SVC_FINALE); - WriteString(MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral."); + write_byte(MSG_ALL, SVC_CDTRACK); + write_byte(MSG_ALL, 2); + write_byte(MSG_ALL, 3); + write_byte(MSG_ALL, SVC_FINALE); + write_string(MSG_ALL, FINALE_E2); return; } else if(world.model == "maps/e3m6.bsp") { - WriteByte(MSG_ALL, SVC_CDTRACK); - WriteByte(MSG_ALL, 2); - WriteByte(MSG_ALL, 3); - WriteByte(MSG_ALL, SVC_FINALE); - WriteString(MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth."); + write_byte(MSG_ALL, SVC_CDTRACK); + write_byte(MSG_ALL, 2); + write_byte(MSG_ALL, 3); + write_byte(MSG_ALL, SVC_FINALE); + write_string(MSG_ALL, FINALE_E3); return; } else if(world.model == "maps/e4m7.bsp") { - WriteByte(MSG_ALL, SVC_CDTRACK); - WriteByte(MSG_ALL, 2); - WriteByte(MSG_ALL, 3); - WriteByte(MSG_ALL, SVC_FINALE); - WriteString(MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person."); + write_byte(MSG_ALL, SVC_CDTRACK); + write_byte(MSG_ALL, 2); + write_byte(MSG_ALL, 3); + write_byte(MSG_ALL, SVC_FINALE); + write_string(MSG_ALL, FINALE_E4); return; } - GotoNextMap(); + go_to_next_map(); } if(intermission_running == 3) { if(!cvar("registered")) { // shareware episode has been completed, go to sell screen - WriteByte(MSG_ALL, SVC_SELLSCREEN); + write_byte(MSG_ALL, SVC_SELLSCREEN); return; } if((serverflags & 15) == 15) { - WriteByte(MSG_ALL, SVC_FINALE); - WriteString(MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born."); + write_byte(MSG_ALL, SVC_FINALE); + write_string(MSG_ALL, FINALE_RUNES); return; } } - GotoNextMap(); + go_to_next_map(); }; /* ============ -IntermissionThink +intermission_think When the player presses attack or jump, change to the next level ============ */ -void() IntermissionThink = { +void() intermission_think = { if(time < intermission_exittime) { return; } @@ -246,7 +332,7 @@ void() IntermissionThink = { return; } - ExitIntermission(); + intermission_exit(); }; void() execute_changelevel = { @@ -261,11 +347,11 @@ void() execute_changelevel = { intermission_exittime = time + 2; } - WriteByte(MSG_ALL, SVC_CDTRACK); - WriteByte(MSG_ALL, 3); - WriteByte(MSG_ALL, 3); + write_byte(MSG_ALL, SVC_CDTRACK); + write_byte(MSG_ALL, 3); + write_byte(MSG_ALL, 3); - pos = FindIntermission(); + pos = find_intermission(); other = find(world, classname, "player"); while(other != world) { @@ -278,11 +364,11 @@ void() execute_changelevel = { other.movetype = MOVETYPE_NONE; other.modelindex = 0; other.spectating = SPECTATING_INTERMISSION; - setorigin(other, pos.origin); + set_origin(other, pos.origin); other = find(other, classname, "player"); } - WriteByte(MSG_ALL, SVC_INTERMISSION); + write_byte(MSG_ALL, SVC_INTERMISSION); }; void() changelevel_touch = { @@ -293,25 +379,24 @@ void() changelevel_touch = { } if(cvar("noexit") == 1 || (cvar("noexit") == 2 && mapname != "start")) { - T_Damage(other, self, self, 50000); + ent_damage(other, self, self, 50000); return; } if(coop || deathmatch) { - bprint(other.netname, " exited the level\n"); + print_all(other.netname, " exited the level\n"); } nextmap = self.map; - SUB_UseTargets(); + sub_use_targets(); - if(self.spawnflags & 1 && deathmatch == 0) { - // NO_INTERMISSION - GotoNextMap(); + if(self.spawnflags & CHANGELEVEL_NO_INTERMISSION && deathmatch == 0) { + go_to_next_map(); return; } - self.touch = SUB_Null; + self.touch = sub_null; // we can't move people right now, because touch functions are called // in the middle of C movement code, so set a think time to do it @@ -324,10 +409,10 @@ When the player touches this, they get sent to the map listed in the "map" varia */ void() trigger_changelevel = { if(!self.map) { - objerror("changelevel trigger doesn't have map"); + error_obj("changelevel trigger doesn't have map"); } - InitTrigger(); + init_trigger(); self.touch = changelevel_touch; }; @@ -361,7 +446,7 @@ void() become_spectator = { self.view_ofs = VEC_ORIGIN; self.frame = 0; self.modelindex = modelindex_eyes; - W_SetCurrentAmmo(); + wep_set_current_ammo(); pl = find(world, classname, "player"); while(pl != world) { @@ -377,15 +462,15 @@ void() become_spectator = { void() respawn = { if(coop) { // make a copy of the dead body for appearances sake - CopyToBodyQue(self); + copy_to_body_queue(self); // get the spawn parms as they were at level start - setspawnparms(self); + set_spawn_parms(self); // respawn player_respawned = TRUE; PutClientInServer(); } else if(deathmatch) { // make a copy of the dead body for appearances sake - CopyToBodyQue(self); + copy_to_body_queue(self); // set default spawn parms SetNewParms(); // respawn @@ -393,22 +478,22 @@ void() respawn = { PutClientInServer(); } else { // restart the map - localcmd("restart\n"); + cmd_server("restart\n"); } }; -float(vector v) CheckSpawnPoint = { +float(vector v) check_spawn_point = { return FALSE; }; /* ============ -SelectSpawnPoint +select_spawn_point Returns the entity to spawn at ============ */ -entity() SelectSpawnPoint = { +entity() select_spawn_point = { entity spot; entity thing; float pcount; @@ -437,7 +522,7 @@ entity() SelectSpawnPoint = { return lastspawn; } pcount = 0; - thing = findradius(spot.origin, 32); + thing = find_radius(spot.origin, 32); while(thing) { if(thing.classname == "player") { pcount = pcount + 1; @@ -462,7 +547,7 @@ entity() SelectSpawnPoint = { spot = find(world, classname, "info_player_start"); if(!spot) { - error("SelectSpawnPoint: no info_player_start on level"); + error("select_spawn_point: no info_player_start on level"); } return spot; @@ -485,25 +570,25 @@ void() PutClientInServer = { if(sf_lives) { if(respawned) { self.lives--; - bprint(self.netname, " has "); + print_all(self.netname, " has "); if(self.lives == 0) { - bprint("run out of lives...\n"); + print_all("run out of lives...\n"); become_spectator(); return; } else if(self.lives == 1) { - bprint("one life left!\n"); + print_all("one life left!\n"); } else { - bprint(ftos(self.lives), " lives left\n"); + print_all(ftos(self.lives), " lives left\n"); } } else if(self.lives == 0) { self.lives = sf_lives; - dprint("lives reset to ", ftos(sf_lives), "\n"); + print_dbg("lives reset to ", ftos(sf_lives), "\n"); } } else { self.lives = 1; } - spot = SelectSpawnPoint(); + spot = select_spawn_point(); self.classname = "player"; self.health = 100; @@ -523,13 +608,13 @@ void() PutClientInServer = { self.invincible_time = 0; self.spectating = SPECTATING_NOT; - DecodeLevelParms(); + decode_level_parms(); - W_SetCurrentAmmo(); + wep_set_current_ammo(); self.attack_finished = time; self.th_pain = player_pain; - self.th_die = PlayerDie; + self.th_die = player_die; self.deadflag = DEAD_NO; @@ -541,20 +626,20 @@ void() PutClientInServer = { self.fixangle = TRUE; // turn this way immediately // oh, this is a hack! - setmodel(self, "progs/eyes.mdl"); + set_model(self, "progs/eyes.mdl"); modelindex_eyes = self.modelindex; - setmodel(self, "progs/player.mdl"); + set_model(self, "progs/player.mdl"); modelindex_player = self.modelindex; - setsize(self, '-16 -16 -24', '16 16 32'); + set_size(self, '-16 -16 -24', '16 16 32'); self.view_ofs = '0 0 22'; player_stand1(); if(deathmatch || coop) { - makevectors(self.angles); + make_vectors(self.angles); spawn_tfog(self.origin + v_forward * 20); } @@ -611,7 +696,7 @@ RULES go to the next level for deathmatch only called if a time or frag limit has expired */ -void() NextLevel = { +void() next_level = { entity o; if(mapname == "start") { @@ -654,12 +739,12 @@ void() NextLevel = { /* ============ -CheckRules +check_rules Exit deathmatch games upon conditions ============ */ -void() CheckRules = { +void() check_rules = { float timelimit, fraglimit; if(gameover) { // someone else quit the game already @@ -671,7 +756,7 @@ void() CheckRules = { if((timelimit && time >= timelimit) || (fraglimit && self.frags >= fraglimit)) { - NextLevel(); + next_level(); return; } }; @@ -682,7 +767,7 @@ void() reset_death_vel = { float forward; if(self.flags & FL_ONGROUND) { - forward = vlen(self.velocity); + forward = vec_len(self.velocity); forward = forward - 20; if(forward <= 0) { self.velocity = VEC_ORIGIN; @@ -692,7 +777,7 @@ void() reset_death_vel = { } }; -void() PlayerDeathThink = { +void() player_death_think = { reset_death_vel(); // wait for all buttons released @@ -715,7 +800,7 @@ void() PlayerDeathThink = { respawn(); }; -void() PlayerJump = { +void() player_jump = { vector start, end; if(self.flags & FL_WATERJUMP) { @@ -757,11 +842,11 @@ void() PlayerJump = { /* =========== -WaterMove +water_move ============ */ -void() WaterMove = { +void() water_move = { string water_snd; if(self.movetype == MOVETYPE_NOCLIP || self.health < 0) { return; @@ -782,7 +867,7 @@ void() WaterMove = { if(self.dmg > 15) { self.dmg = 10; } - T_Damage(self, world, world, self.dmg); + ent_damage(self, world, world, self.dmg); self.pain_finished = time + 1; } } @@ -804,13 +889,13 @@ void() WaterMove = { } else { self.dmgtime = time + 0.2; } - T_Damage(self, world, world, 10 * self.waterlevel); + ent_damage(self, world, world, 10 * self.waterlevel); } break; case CONTENT_SLIME: if(self.dmgtime < time && self.radsuit_finished < time) { self.dmgtime = time + 1; - T_Damage(self, world, world, 4 * self.waterlevel); + ent_damage(self, world, world, 4 * self.waterlevel); } break; } @@ -832,23 +917,23 @@ void() WaterMove = { } }; -void() CheckWaterJump = { +void() check_water_jump = { vector start, end; // check for a jump-out-of-water - makevectors(self.angles); + make_vectors(self.angles); start = self.origin; start_z = start_z + 8; v_forward_z = 0; normalize(v_forward); end = start + v_forward * 24; - traceline(start, end, TRUE, self); + trace_line(start, end, TRUE, self); if(trace_fraction < 1) { // solid at waist start_z = start_z + self.maxs_z - 8; end = start + v_forward * 24; self.movedir = trace_plane_normal * -50; - traceline(start, end, TRUE, self); + trace_line(start, end, TRUE, self); if(trace_fraction == 1) { // open at eye level self.flags = self.flags | FL_WATERJUMP; @@ -870,21 +955,21 @@ Called every frame before physics are run void() PlayerPreThink = { // otherwise a button could be missed between the think tics if(intermission_running) { - IntermissionThink(); + intermission_think(); return; } else if(self.spectating) { return; } - CheckRules(); - WaterMove(); + check_rules(); + water_move(); if(self.waterlevel == 2) { - CheckWaterJump(); + check_water_jump(); } if(self.deadflag >= DEAD_DEAD) { - PlayerDeathThink(); + player_death_think(); return; } @@ -893,7 +978,7 @@ void() PlayerPreThink = { } if(self.button2) { - PlayerJump(); + player_jump(); } else { self.flags = self.flags | FL_JUMPRELEASED; } @@ -904,19 +989,19 @@ void() PlayerPreThink = { } if(time > self.attack_finished && self.currentammo == 0 && self.weapon != IT_AXE) { - self.weapon = W_BestWeapon(); - W_SetCurrentAmmo(); + self.weapon = wep_best_weapon(); + wep_set_current_ammo(); } }; /* ================ -CheckPowerups +check_powerups Check for turning off powerups ================ */ -void() CheckPowerups = { +void() check_powerups = { if(self.health <= 0 || self.spectating) { return; } @@ -930,14 +1015,14 @@ void() CheckPowerups = { } if(self.invisible_finished < time + 3) { if(self.invisible_time == 1) { - sprint(self, "Ring of Shadows magic is fading\n"); - stuffcmd(self, "bf\n"); + print_cl(self, "Ring of Shadows magic is fading\n"); + cmd_client(self, "bf\n"); sound(self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM); self.invisible_time = time + 1; } if(self.invisible_time < time) { self.invisible_time = time + 1; - stuffcmd(self, "bf\n"); + cmd_client(self, "bf\n"); } } if(self.invisible_finished < time) { @@ -958,14 +1043,14 @@ void() CheckPowerups = { // sound and screen flash when items starts to run out if(self.invincible_finished < time + 3) { if(self.invincible_time == 1) { - sprint(self, "Protection is almost burned out\n"); - stuffcmd(self, "bf\n"); + print_cl(self, "Protection is almost burned out\n"); + cmd_client(self, "bf\n"); sound(self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM); self.invincible_time = time + 1; } if(self.invincible_time < time) { self.invincible_time = time + 1; - stuffcmd(self, "bf\n"); + cmd_client(self, "bf\n"); } } if(self.invincible_finished < time) { @@ -986,14 +1071,14 @@ void() CheckPowerups = { // sound and screen flash when items starts to run out if(self.super_damage_finished < time + 3) { if(self.super_time == 1) { - sprint(self, "Quad Damage is wearing off\n"); - stuffcmd(self, "bf\n"); + print_cl(self, "Quad Damage is wearing off\n"); + cmd_client(self, "bf\n"); sound(self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM); self.super_time = time + 1; } if(self.super_time < time) { self.super_time = time + 1; - stuffcmd(self, "bf\n"); + cmd_client(self, "bf\n"); } } if(self.super_damage_finished < time) { @@ -1015,14 +1100,14 @@ void() CheckPowerups = { // sound and screen flash when items starts to run out if(self.radsuit_finished < time + 3) { if(self.rad_time == 1) { - sprint(self, "Air supply in Biosuit expiring\n"); - stuffcmd(self, "bf\n"); + print_cl(self, "Air supply in Biosuit expiring\n"); + cmd_client(self, "bf\n"); sound(self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM); self.rad_time = time + 1; } if(self.rad_time < time) { self.rad_time = time + 1; - stuffcmd(self, "bf\n"); + cmd_client(self, "bf\n"); } } if(self.radsuit_finished < time) { @@ -1043,7 +1128,7 @@ Called every frame after physics are run */ void() PlayerPostThink = { if(time >= self.attack_finished) { - ImpulseCommands(); + impulse_commands(); } if(self.spectating || self.deadflag) { @@ -1052,7 +1137,7 @@ void() PlayerPostThink = { // do weapon stuff if(time >= self.attack_finished) { - W_WeaponFrame(); + wep_weapon_frame(); } // check to see if player landed and play landing sound @@ -1060,7 +1145,7 @@ void() PlayerPostThink = { if(self.watertype == CONTENT_WATER) { sound(self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM); } else if(self.jump_flag < -650) { - T_Damage(self, world, world, 5); + ent_damage(self, world, world, 5); sound(self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM); self.deathtype = "falling"; } else { @@ -1073,7 +1158,7 @@ void() PlayerPostThink = { self.jump_flag = self.velocity_z; } - CheckPowerups(); + check_powerups(); }; /* @@ -1084,11 +1169,11 @@ called when a player connects to a server ============ */ void() ClientConnect = { - bprint(self.netname, " entered the game\n"); + print_all(self.netname, " entered the game\n"); // a client connecting during an intermission can cause problems if(intermission_running) { - ExitIntermission(); + intermission_exit(); } }; @@ -1107,7 +1192,7 @@ void() ClientDisconnect = { } // let everyone else know - bprint(self.netname, " left the game with ", ftos(self.frags), " frags\n"); + print_all(self.netname, " left the game with ", ftos(self.frags), " frags\n"); if(!self.spectating) { sound(self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE); @@ -1137,7 +1222,7 @@ void() cheat = { self.weapon = IT_ROCKET_LAUNCHER; - W_SetCurrentAmmo(); + wep_set_current_ammo(); }; void() cheat_quad = { @@ -1154,7 +1239,7 @@ void(float pro) change_pronoun = { pro = minmax(pro, PRO_NONE, PRO_MAX - 1); self.pronoun = pro; - sprint(self, "pronoun set to ", + print_cl(self, "pronoun set to ", pronoun_subject(pro), "/", pronoun_possessive(pro), "\n"); }; @@ -1162,23 +1247,23 @@ void(float pro) change_pronoun = { void() spectate = { switch(self.spectating) { case SPECTATING_NOT: - bprint(self.netname, " has become a spectator\n"); + print_all(self.netname, " has become a spectator\n"); become_spectator(); break; case SPECTATING_SPECTATING: - bprint(self.netname, " has returned from spectating\n"); - setspawnparms(self); + print_all(self.netname, " has returned from spectating\n"); + set_spawn_parms(self); PutClientInServer(); break; case SPECTATING_DEAD: - centerprint(self, + print_center(self, "You have no life force left\n" "and cannot return to\n" "the mortal world yet"); break; case SPECTATING_INTERMISSION: case SPECTATING_FINALE: - centerprint(self, + print_center(self, "You are incorporeal as you wait\n" "for the next cycle\n" "and cannot return to\n" @@ -1187,17 +1272,17 @@ void() spectate = { } }; -void() ImpulseCommands = { +void() impulse_commands = { if(self.impulse >= 1 && self.impulse <= 8) { - W_ChangeWeapon(self.impulse); + wep_change_weapon(self.impulse); } else if(self.impulse >= 20 && self.impulse < 40) { change_pronoun(self.impulse - 20); } else { switch(self.impulse) { case 9: cheat(); break; - case 10: W_CycleWeapon(); break; + case 10: wep_cycle_weapon(); break; case 11: cheat_quad(); break; - case 12: W_CycleWeaponReverse(); break; + case 12: wep_cycle_weapon_reverse(); break; case 13: spectate(); break; } } @@ -1207,13 +1292,13 @@ void() ImpulseCommands = { float(entity targ, entity attacker) obit_teledeath = { attacker.owner.frags = attacker.owner.frags + 1; - bprint(" was telefragged by ", attacker.owner.netname, "\n"); + print_all(" was telefragged by ", attacker.owner.netname, "\n"); return TRUE; }; float(entity targ, entity attacker) obit_teledeath2 = { targ.frags--; - bprint("'s telefrag was deflected by satanic power\n"); + print_all("'s telefrag was deflected by satanic power\n"); return TRUE; }; @@ -1221,15 +1306,15 @@ float(entity targ, entity attacker) obit_suicide = { targ.frags--; if(targ.weapon == IT_LIGHTNING && targ.waterlevel > 1) { - bprint(" discharges into the water\n"); + print_all(" discharges into the water\n"); } else if(targ.weapon == IT_GRENADE_LAUNCHER) { - bprint(" tries to put the pin back in\n"); + print_all(" tries to put the pin back in\n"); } else { - bprint(" becomes bored with "); + print_all(" becomes bored with "); if(targ.pronoun != PRO_NONE) { - bprint(pronoun_possessive(targ.pronoun), " "); + print_all(pronoun_possessive(targ.pronoun), " "); } - bprint("life\n"); + print_all("life\n"); } return TRUE; @@ -1242,19 +1327,19 @@ float(entity targ, entity attacker) obit_teamkill = { attacker.frags--; if(rnum < 0.25) { - bprint(" mows down a teammate\n"); + print_all(" mows down a teammate\n"); } else if(rnum < 0.50) { if(attacker.pronoun == PRO_NONE) { - bprint(" needs new glasses\n"); + print_all(" needs new glasses\n"); } else { - bprint(" checks ", + print_all(" checks ", pronoun_possessive(attacker.pronoun), " glasses\n"); } } else if(rnum < 0.75) { - bprint(" gets a frag for the other team\n"); + print_all(" gets a frag for the other team\n"); } else { - bprint(" loses another friend\n"); + print_all(" loses another friend\n"); } return TRUE; @@ -1312,7 +1397,7 @@ float(entity targ, entity attacker) obit_pkill = { break; } - bprint(targ.netname, deathstring, attacker.netname, deathstring2); + print_all(targ.netname, deathstring, attacker.netname, deathstring2); return TRUE; }; @@ -1321,107 +1406,107 @@ float(entity targ, entity attacker) obit_monster = { switch(attacker.classname) { case "monster_army": if(random() < 0.5) { - bprint(" was shot by a Grunt\n"); + print_all(" was shot by a Grunt\n"); } else { - bprint(" was blasted by a Grunt\n"); + print_all(" was blasted by a Grunt\n"); } break; case "monster_demon1": if(targ.pronoun == PRO_NONE) { - bprint(" had a Fiend lobotomy\n"); + print_all(" had a Fiend lobotomy\n"); } else { - bprint(" had ", + print_all(" had ", pronoun_possessive(targ.pronoun), " head ripped off by a Fiend\n"); } break; case "monster_dog": if(random() < 0.5) { - bprint(" was eaten by a Rottweiler\n"); + print_all(" was eaten by a Rottweiler\n"); } else { - bprint(" was mauled by a Rottweiler\n"); + print_all(" was mauled by a Rottweiler\n"); } break; case "monster_enforcer": if(random() < 0.5) { - bprint(" was lazed by an Enforcer\n"); + print_all(" was lazed by an Enforcer\n"); } else { - bprint(" stood in an Enforcer's way\n"); + print_all(" stood in an Enforcer's way\n"); } break; case "monster_fish": if(targ.pronoun == PRO_NONE || random() < 0.5) { - bprint(" was fed to a Rotfish\n"); + print_all(" was fed to a Rotfish\n"); } else { - bprint(" enjoys ", + print_all(" enjoys ", pronoun_possessive(targ.pronoun), " new life under the sea\n"); } break; case "monster_hell_knight": if(random() < 0.5) { - bprint(" was killed to death by a Death Knight\n"); + print_all(" was killed to death by a Death Knight\n"); } else { - bprint(" was slain by a Death Knight\n"); + print_all(" was slain by a Death Knight\n"); } break; case "monster_knight": if(random() < 0.1) { - bprint(" was enamored by the Knight's intricate animations\n"); + print_all(" was enamored by the Knight's intricate animations\n"); } else { - bprint(" was slashed by a Knight\n"); + print_all(" was slashed by a Knight\n"); } break; case "monster_ogre": if(random() < 0.05) { - bprint(" knows that it's all Ogre now\n"); + print_all(" knows that it's all Ogre now\n"); } else { - bprint(" was destroyed by an Ogre\n"); + print_all(" was destroyed by an Ogre\n"); } break; case "monster_oldone": if(targ.pronoun == PRO_NONE) { - bprint(" became one with Shub-Niggurath\n"); + print_all(" became one with Shub-Niggurath\n"); } else { - bprint(" accepted ", pronoun_possessive(targ.pronoun), " fate\n"); + print_all(" accepted ", pronoun_possessive(targ.pronoun), " fate\n"); } break; case "monster_shalrath": if(random() < 0.5) { - bprint(" was merged with a Shalrath\n"); + print_all(" was merged with a Shalrath\n"); } else { - bprint(" couldn't evade the Vore\n"); + print_all(" couldn't evade the Vore\n"); } break; case "monster_shambler": if(random() < 0.5) { - bprint(" was Shambled off this mortal coil\n"); + print_all(" was Shambled off this mortal coil\n"); } else { - bprint(" was fried by a Shambler\n"); + print_all(" was fried by a Shambler\n"); } break; case "monster_tarbaby": if(random() < 0.5) { - bprint(" was consumed by the Spawn\n"); + print_all(" was consumed by the Spawn\n"); } else { - bprint(" found ", + print_all(" found ", pronoun_possessive(targ.pronoun), " place with the Spawn\n"); } break; case "monster_wizard": if(random() < 0.5) { - bprint(" wasn't ready for the Wizard\n"); + print_all(" wasn't ready for the Wizard\n"); } else { - bprint(" was scragged by a Scrag\n"); + print_all(" was scragged by a Scrag\n"); } break; case "monster_zombie": if(random() < 0.05) { - bprint(". You are the demons\nAnd then ", + print_all(". You are the demons\nAnd then ", targ.netname, " was a zombie."); } else { - bprint(" joins the Zombies\n"); + print_all(" joins the Zombies\n"); } break; default: @@ -1435,9 +1520,9 @@ float(entity targ, entity attacker) obit_falling = { if(targ.deathtype == "falling") { targ.deathtype = string_null; if(targ.pronoun == PRO_NONE) { - bprint(" hit the ground too hard\n"); + print_all(" hit the ground too hard\n"); } else { - bprint(" fell to ", pronoun_possessive(targ.pronoun), " death\n"); + print_all(" fell to ", pronoun_possessive(targ.pronoun), " death\n"); } return TRUE; } else { @@ -1448,29 +1533,29 @@ float(entity targ, entity attacker) obit_falling = { float(entity targ, entity attacker) obit_water = { switch(targ.watertype) { case CONTENT_SKY: - bprint(" tried to buy the sky and sell the sky\n"); + print_all(" tried to buy the sky and sell the sky\n"); break; case CONTENT_WATER: if(random() < 0.5) { - bprint(" sleeps with the fishes\n"); + print_all(" sleeps with the fishes\n"); } else { - bprint(" was quite thirsty\n"); + print_all(" was quite thirsty\n"); } break; case CONTENT_SLIME: if(random() < 0.5) { - bprint(" gulped a load of slime\n"); + print_all(" gulped a load of slime\n"); } else { - bprint(" can't exist on slime alone\n"); + print_all(" can't exist on slime alone\n"); } break; case CONTENT_LAVA: if(targ.health < -15) { - bprint(" burst into flames\n"); + print_all(" burst into flames\n"); } else if(random() < 0.5) { - bprint(" turned into hot slag\n"); + print_all(" turned into hot slag\n"); } else { - bprint(" visits the Volcano God\n"); + print_all(" visits the Volcano God\n"); } break; default: @@ -1483,17 +1568,17 @@ float(entity targ, entity attacker) obit_water = { float(entity targ, entity attacker) obit_trap = { switch(attacker.classname) { case "explo_box": - bprint(" blew up\n"); break; + print_all(" blew up\n"); break; case "trap_shooter": case "trap_spikeshooter": - bprint(" was spiked\n"); break; + print_all(" was spiked\n"); break; case "fireball": - bprint(" ate a lavaball\n"); break; + print_all(" ate a lavaball\n"); break; case "trigger_changelevel": if(targ.pronoun == PRO_NONE) { - bprint(" tried to leave\n"); + print_all(" tried to leave\n"); } else { - bprint(" tried to leave, but ", + print_all(" tried to leave, but ", pronoun_subject(targ.pronoun), " failed\n"); } @@ -1511,7 +1596,7 @@ float(entity targ, entity attacker) obit_worldkill = { if(attacker.flags & FL_MONSTER) { return obit_monster(targ, attacker); } else if(attacker.solid == SOLID_BSP && attacker != world) { - bprint(" was squished\n"); + print_all(" was squished\n"); return TRUE; } else { return obit_falling(targ, attacker) || @@ -1522,19 +1607,19 @@ float(entity targ, entity attacker) obit_worldkill = { /* =========== -ClientObituary +client_obituary called when a player dies ============ */ -void(entity targ, entity attacker) ClientObituary = { +void(entity targ, entity attacker) client_obituary = { float did_message; if(targ.classname != "player") { return; } - bprint(targ.netname); + print_all(targ.netname); switch(attacker.classname) { case "teledeath": @@ -1546,7 +1631,7 @@ void(entity targ, entity attacker) ClientObituary = { case "player": if(targ == attacker) { did_message = obit_suicide(targ, attacker); - } else if(teamplay == 2 && SameTeam(targ, attacker)) { + } else if(teamplay == 2 && is_same_team(targ, attacker)) { did_message = obit_teamkill(targ, attacker); } else { did_message = obit_pkill(targ, attacker); @@ -1559,7 +1644,7 @@ void(entity targ, entity attacker) ClientObituary = { if(!did_message) { // hell if I know; they're just dead!!! - bprint(" died\n"); + print_all(" died\n"); } }; @@ -1574,7 +1659,7 @@ void() ClientKill = { if(!self.spectating) { reset_death_vel(); self.frags--; // extra penalty - ClientObituary(self, self); + client_obituary(self, self); set_suicide_frame(); self.modelindex = modelindex_player; respawn(); diff --git a/source/combat.qc b/source/combat.qc index 59a05b2..2ca5b8e 100644 --- a/source/combat.qc +++ b/source/combat.qc @@ -1,12 +1,12 @@ // combat.qc: entity-entity damage functions -float(entity targ, entity attacker) SameTeam = { +float(entity targ, entity attacker) is_same_team = { return targ != attacker && targ.team > 0 && targ.team == attacker.team; }; -float(entity targ, entity attacker) BothPlayers = { +float(entity targ, entity attacker) are_both_players = { return targ != attacker && targ.classname == "player" && attacker.classname == "player"; @@ -14,16 +14,16 @@ float(entity targ, entity attacker) BothPlayers = { /* ============ -CanDamage +can_damage Returns true if the inflictor can directly damage the target. Used for explosions and melee attacks. ============ */ -float(entity targ, entity inflictor) CanDamage = { +float(entity targ, entity inflictor) can_damage = { // bmodels need special checking because their origin is 0,0,0 if(targ.movetype == MOVETYPE_PUSH) { - traceline(inflictor.origin, 0.5 * (targ.absmin + targ.absmax), TRUE, self); + trace_line(inflictor.origin, 0.5 * (targ.absmin + targ.absmax), TRUE, self); if(trace_fraction == 1) { return TRUE; } @@ -33,23 +33,23 @@ float(entity targ, entity inflictor) CanDamage = { return FALSE; } - traceline(inflictor.origin, targ.origin, TRUE, self); + trace_line(inflictor.origin, targ.origin, TRUE, self); if(trace_fraction == 1) { return TRUE; } - traceline(inflictor.origin, targ.origin + '15 15 0', TRUE, self); + trace_line(inflictor.origin, targ.origin + '15 15 0', TRUE, self); if(trace_fraction == 1) { return TRUE; } - traceline(inflictor.origin, targ.origin + '-15 -15 0', TRUE, self); + trace_line(inflictor.origin, targ.origin + '-15 -15 0', TRUE, self); if(trace_fraction == 1) { return TRUE; } - traceline(inflictor.origin, targ.origin + '-15 15 0', TRUE, self); + trace_line(inflictor.origin, targ.origin + '-15 15 0', TRUE, self); if(trace_fraction == 1) { return TRUE; } - traceline(inflictor.origin, targ.origin + '15 -15 0', TRUE, self); + trace_line(inflictor.origin, targ.origin + '15 -15 0', TRUE, self); if(trace_fraction == 1) { return TRUE; } @@ -59,10 +59,10 @@ float(entity targ, entity inflictor) CanDamage = { /* ============ -Killed +killed ============ */ -void(entity targ, entity attacker) Killed = { +void(entity targ, entity attacker) killed = { entity oself; oself = self; @@ -84,13 +84,13 @@ void(entity targ, entity attacker) Killed = { // bump the monster counter if(self.flags & FL_MONSTER) { killed_monsters = killed_monsters + 1; - WriteByte(MSG_ALL, SVC_KILLEDMONSTER); + write_byte(MSG_ALL, SVC_KILLEDMONSTER); } - ClientObituary(self, attacker); + client_obituary(self, attacker); self.takedamage = DAMAGE_NO; - self.touch = SUB_Null; + self.touch = sub_null; monster_death_use(); self.th_die(); @@ -100,24 +100,24 @@ void(entity targ, entity attacker) Killed = { /* ============ -T_Damage +ent_damage The damage is coming from inflictor, but get mad at attacker This should be the only function that ever reduces health. ============ */ -void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = { +void(entity targ, entity inflictor, entity attacker, float damage) ent_damage = { vector dir; entity oldself; float save; float take; // team play damage avoidance - if(teamplay == 1 && SameTeam(targ, attacker)) { + if(teamplay == 1 && is_same_team(targ, attacker)) { return; } - if(teamplay == 3 && BothPlayers(targ, attacker)) { + if(teamplay == 3 && are_both_players(targ, attacker)) { return; } @@ -177,7 +177,7 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = { targ.health = targ.health - take; if(targ.health <= 0) { - Killed(targ, attacker); + killed(targ, attacker); return; } @@ -194,7 +194,7 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = { self.oldenemy = self.enemy; } self.enemy = attacker; - FoundTarget(); + found_target(); } } } @@ -212,21 +212,21 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = { /* ============ -T_RadiusDamage +ent_radius_damage ============ */ -void(entity inflictor, entity attacker, float damage, entity ignore) T_RadiusDamage = { +void(entity inflictor, entity attacker, float damage, entity ignore) ent_radius_damage = { float points; entity head; vector org; - head = findradius(inflictor.origin, damage + 40); + head = find_radius(inflictor.origin, damage + 40); while(head) { if(head != ignore) { if(head.takedamage) { org = head.origin + (head.mins + head.maxs) * 0.5; - points = 0.5 * vlen(inflictor.origin - org); + points = 0.5 * vec_len(inflictor.origin - org); if(points < 0) { points = 0; } @@ -235,12 +235,12 @@ void(entity inflictor, entity attacker, float damage, entity ignore) T_RadiusDam points = points * 0.5; } if(points > 0) { - if(CanDamage(head, inflictor)) { + if(can_damage(head, inflictor)) { // shambler takes half damage from all explosions if(head.classname == "monster_shambler") { - T_Damage(head, inflictor, attacker, points * 0.5); + ent_damage(head, inflictor, attacker, points * 0.5); } else { - T_Damage(head, inflictor, attacker, points); + ent_damage(head, inflictor, attacker, points); } } } @@ -252,18 +252,18 @@ void(entity inflictor, entity attacker, float damage, entity ignore) T_RadiusDam /* ============ -T_BeamDamage +beam_damage ============ */ -void(entity attacker, float damage) T_BeamDamage = { +void(entity attacker, float damage) beam_damage = { float points; entity head; - head = findradius(attacker.origin, damage + 40); + head = find_radius(attacker.origin, damage + 40); while(head) { if(head.takedamage) { - points = 0.5 * vlen(attacker.origin - head.origin); + points = 0.5 * vec_len(attacker.origin - head.origin); if(points < 0) { points = 0; } @@ -272,11 +272,11 @@ void(entity attacker, float damage) T_BeamDamage = { points = points * 0.5; } if(points > 0) { - if(CanDamage(head, attacker)) { + if(can_damage(head, attacker)) { if(head.classname == "monster_shambler") { - T_Damage(head, attacker, attacker, points * 0.5); + ent_damage(head, attacker, attacker, points * 0.5); } else { - T_Damage(head, attacker, attacker, points); + ent_damage(head, attacker, attacker, points); } } } diff --git a/source/common.qc b/source/common.qc index 09383ed..455385e 100644 --- a/source/common.qc +++ b/source/common.qc @@ -41,7 +41,7 @@ float(entity targ) range = { spot1 = self.origin + self.view_ofs; spot2 = targ.origin + targ.view_ofs; - r = vlen(spot1 - spot2); + r = vec_len(spot1 - spot2); if(r < 120) { return RANGE_MELEE; } @@ -60,7 +60,7 @@ float(entity targ) visible = { spot1 = self.origin + self.view_ofs; spot2 = targ.origin + targ.view_ofs; - traceline(spot1, spot2, TRUE, self); // see through other monsters + trace_line(spot1, spot2, TRUE, self); // see through other monsters if(trace_inopen && trace_inwater) { return FALSE; // sight line crossed contents @@ -74,7 +74,7 @@ float(entity targ) infront = { vector vec; float dot; - makevectors(self.angles); + make_vectors(self.angles); vec = normalize(targ.origin - self.origin); dot = vec * v_forward; diff --git a/source/defs.qc b/source/defs.qc index b9c4950..88ec671 100644 --- a/source/defs.qc +++ b/source/defs.qc @@ -34,9 +34,9 @@ float killed_monsters; // number of monsters killed float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16; // global variables set by built in functions -vector v_forward, v_up, v_right; // set by makevectors() +vector v_forward, v_up, v_right; // set by make_vectors() -// set by traceline / tracebox +// set by trace_line / tracebox float trace_allsolid; float trace_startsolid; float trace_fraction; @@ -188,17 +188,17 @@ void end_sys_fields; // flag for structure dumping // builtin functions ---------------------------------------------------------| -void(vector ang) makevectors = #1; // sets v_forward, etc globals -void(entity e, vector o) setorigin = #2; -void(entity e, string m) setmodel = #3; // set movetype and solid first -void(entity e, vector min, vector max) setsize = #4; +void(vector ang) make_vectors = #1; // sets v_forward, etc globals +void(entity e, vector o) set_origin = #2; +void(entity e, string m) set_model = #3; // set movetype and solid first +void(entity e, vector min, vector max) set_size = #4; float() random = #7; // returns 0 - 1 void(entity e, float chan, string samp, float vol, float atten) sound = #8; vector(vector v) normalize = #9; [[noreturn]] void(string e) error = #10; -[[noreturn]] void(string e) objerror = #11; -float(vector v) vlen = #12; -float(vector v) vectoyaw = #13; +[[noreturn]] void(string e) error_obj = #11; +float(vector v) vec_len = #12; +float(vector v) vec_yaw = #13; entity() spawn = #14; void(entity e) remove = #15; @@ -208,76 +208,76 @@ void(entity e) remove = #15; * forent->owner == test, or test->owner == forent * a forent of world is ignored */ -void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16; +void(vector v1, vector v2, float nomonsters, entity forent) trace_line = #16; -entity() checkclient = #17; // returns a client to look for +entity() check_client = #17; // returns a client to look for entity(entity start, .string fld, string match) find = #18; string(string s) precache_sound = #19; string(string s) precache_model = #20; -void(entity client, string s) stuffcmd = #21; -entity(vector org, float rad) findradius = #22; -void(string... s) bprint = #23; -void(entity client, string... s) sprint = #24; -void(string... s) dprint = #25; +void(entity client, string s) cmd_client = #21; +entity(vector org, float rad) find_radius = #22; +void(string... s) print_all = #23; +void(entity client, string... s) print_cl = #24; +void(string... s) print_dbg = #25; string(float f) ftos = #26; string(vector v) vtos = #27; -void() coredump = #28; // prints all edicts -void() traceon = #29; // turns statment trace on -void() traceoff = #30; -void(entity e) eprint = #31; // prints an entire edict -float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE -float() droptofloor = #34; // TRUE if landed on floor -void(float style, string value) lightstyle = #35; +void() core_dump = #28; // prints all edicts +void() trace_on = #29; // turns statment trace on +void() trace_off = #30; +void(entity e) print_ent = #31; // prints an entire edict +float(float yaw, float dist) walk_move = #32; // returns TRUE or FALSE +float() drop_to_floor = #34; // TRUE if landed on floor +void(float style, string value) light_style = #35; float(float v) rint = #36; // round to nearest int float(float v) floor = #37; // largest integer <= v float(float v) ceil = #38; // smallest integer >= v -float(entity e) checkbottom = #40; // true if self is on ground -float(vector v) pointcontents = #41; // returns a CONTENT_* +float(entity e) check_bottom = #40; // true if self is on ground +float(vector v) point_contents = #41; // returns a CONTENT_* float(float f) fabs = #43; vector(entity e, float speed) aim = #44; // returns the shooting vector float(string s) cvar = #45; // return cvar.value -void(string s) localcmd = #46; // put string into que -entity(entity e) nextent = #47; // for looping through all ents +void(string s) cmd_server = #46; // put string into que +entity(entity e) next_ent = #47; // for looping through all ents // start a particle effect void(vector o, vector d, float color, float count) particle = #48; -void() ChangeYaw = #49; // turn towards self.ideal_yaw at self.yaw_speed -vector(vector v) vectoangles = #51; +void() change_yaw = #49; // turn towards self.ideal_yaw at self.yaw_speed +vector(vector v) vec_to_angles = #51; // direct client message generation -void(float to, float f) WriteByte = #52; -void(float to, float f) WriteChar = #53; -void(float to, float f) WriteShort = #54; -void(float to, float f) WriteLong = #55; -void(float to, float f) WriteCoord = #56; -void(float to, float f) WriteAngle = #57; -void(float to, string s) WriteString = #58; -void(float to, entity s) WriteEntity = #59; +void(float to, float f) write_byte = #52; +void(float to, float f) write_char = #53; +void(float to, float f) write_short = #54; +void(float to, float f) write_long = #55; +void(float to, float f) write_coord = #56; +void(float to, float f) write_angle = #57; +void(float to, string s) write_string = #58; +void(float to, entity s) write_entity = #59; -void(float step) movetogoal = #67; +void(float step) move_to_goal = #67; string(string s) precache_file = #68; // no effect except for -copy -void(entity e) makestatic = #69; -void(string s) changelevel = #70; +void(entity e) make_static = #69; +void(string s) change_level = #70; void(string var, string val) cvar_set = #72; // sets cvar.value -void(entity client, string... s) centerprint = #73; // sprint, but in middle -void(vector pos, string samp, float vol, float atten) ambientsound = #74; +void(entity client, string... s) print_center = #73; // print_cl, but in middle +void(vector pos, string samp, float vol, float atten) ambient_sound = #74; string(string s) precache_model2 = #75; // registered version only string(string s) precache_sound2 = #76; // registered version only string(string s) precache_file2 = #77; // registered version only // set parm1... to the values at level start for coop respawn -void(entity e) setspawnparms = #78; +void(entity e) set_spawn_parms = #78; -float(string s) checkextension = #99; +float(string s) check_extension = #99; float(string str, string sub, float startpos) strstrofs = #221; float(string str, float ofs) str2chr = #222; string(float... c) chr2str = #223; string(float ccase, float calpha, float cnum, string... s) strconv = #224; string(float chars, string... s) strpad = #225; -string(string info, string key, string... value) infoadd = #226; -string(string info, string key) infoget = #227; +string(string info, string key, string... value) info_add = #226; +string(string info, string key) info_get = #227; float(string s1, string s2, float len) strncmp = #228; float(string s1, string s2) strcasecmp = #229; float(string s1, string s2, float len) strncasecmp = #230; @@ -569,6 +569,10 @@ enum { SIGIL_4 = 8, }; +enum { + CHANGELEVEL_NO_INTERMISSION = 1, +}; + // super co-op additions enum { PRO_NONE, @@ -614,7 +618,7 @@ entity newmis; // launch_spike sets this after spawning it entity activator; // the entity that activated a trigger or brush -entity damage_attacker; // set by T_Damage +entity damage_attacker; // set by ent_damage float framecount; float skill; @@ -778,66 +782,62 @@ float ext_strings; // functions -----------------------------------------------------------------| -// subs.qc -void(float normal) SUB_AttackFinished; -void(vector tdest, float tspeed, void() func) SUB_CalcMove; -void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt; -void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove; -void() SUB_CalcMoveDone; -void() SUB_CalcAngleMoveDone; -void(void() thinkst) SUB_CheckRefire; -void() SUB_Null; -void(entity attacker, float damage) SUB_PainNull; -void() SUB_UseTargets; -void() SUB_Remove; +void(float normal) sub_attack_finished; +void(vector tdest, float tspeed, void() func) sub_calc_move; +void(entity ent, vector tdest, float tspeed, void() func) sub_calc_move_ent; +void(vector destangle, float tspeed, void() func) sub_calc_angle_move; +void() sub_calc_move_done; +void() sub_calc_angle_move_done; +void(void() thinkst) sub_check_refire; +void() sub_null; +void(entity attacker, float damage) sub_pain_null; +void() sub_use_targets; +void() sub_remove; -// combat.qc -float(entity e, float healamount, float ignore) T_Heal; // health function -float(entity targ, entity inflictor) CanDamage; -void() T_MissileTouch; -void(entity bomb, entity attacker, float rad, entity ignore) T_RadiusDamage; -void(entity targ, entity inflictor, entity attacker, float damage) T_Damage; -void(entity targ, entity inflictor, entity attacker, float damage) T_Damage; +float(entity e, float healamount, float ignore) ent_heal; +float(entity targ, entity inflictor) can_damage; +void() ent_missile_touch; +void(entity bomb, entity attacker, float rad, entity ignore) ent_radius_damage; +void(entity targ, entity inflictor, entity attacker, float damage) ent_damage; -// weapons.qc -void(float wep) W_ChangeWeapon; -void() W_CycleWeaponReverse; -void() W_CycleWeapon; -void() W_FireAxe; -void() W_FireShotgun; -void() W_FireSuperShotgun; -void() W_FireRocket; -void() W_FireLightning; -void() W_FireGrenade; -void(float ox) W_FireSpikes; -void() W_FireSuperSpikes; -float() W_BestWeapon; -void() W_SetCurrentAmmo; -void() W_WeaponFrame; +void(float wep) wep_change_weapon; +void() wep_cycle_weapon_reverse; +void() wep_cycle_weapon; +void() wep_fire_axe; +void() wep_fire_shotgun; +void() wep_fire_super_shotgun; +void() wep_fire_rocket; +void() wep_fire_lightning; +void() wep_fire_grenade; +void(float ox) wep_fire_nail; +void() wep_fire_super_nail; +float() wep_best_weapon; +void() wep_set_current_ammo; +void() wep_weapon_frame; -// items.qc -string() Key1Name; -string() Key2Name; +string() key_1_name; +string() key_2_name; void() army_fire; +float() army_check_attack; -float() DemonCheckAttack; -void() Demon_JumpTouch; -void(float side) Demon_Melee; +float() demon_check_attack; +void() demon_jump_touch; +void(float side) demon_melee; -float() DogCheckAttack; +float() dog_check_attack; void() dog_leap1; void() dog_run1; -void() ShalHome; -void() ShalMissile; -void() ShalMissileTouch; +void() shalrath_home; +void() shalrath_missile; +void() shalrath_missile_touch; -float(entity targ, entity attacker) SameTeam; -void() DecodeLevelParms; -void(entity ent) CopyToBodyQue; -void() InitBodyQue; -void() SuperDamageSound; +float(entity targ, entity attacker) is_same_team; +void() decode_level_parms; +void(entity ent) copy_to_body_queue; +void() init_body_queue; +void() super_damage_sound; void() ai_face; void() armor_touch; void() bubble_bob; @@ -876,18 +876,19 @@ void() t_movetarget; void() train_next; -void(entity targ, entity attacker) ClientObituary; -void(float num_bubbles) DeathBubbles; -void(vector dest) ChooseTurn; -void(vector org, vector vec) LaunchLaser; -void(vector org, vector vel, float damage) SpawnBlood; -void() BecomeExplosion; +void(entity targ, entity attacker) client_obituary; +void(float num_bubbles) death_bubbles; +void(vector dest) choose_turn; +void(vector org, vector vec) launch_laser; +void(vector org, vector vel, float damage) spawn_blood; +void() become_explosion; void() hknight_char_a1; void() hknight_run1; void() ogre_smash1; void() ogre_swing1; +float() ogre_check_attack; void() plat_center_touch; void() plat_crush; @@ -902,7 +903,7 @@ void() knight_bow6; void() knight_runatk1; void() knight_walk1; -void() PlayerDie; +void() player_die; void() player_axe1; void() player_axeb1; void() player_axec1; @@ -926,11 +927,12 @@ void() sham_smash1; void() sham_swingl1; void() sham_swingr1; void() sham_swingr1; +float() sham_check_attack; void() tbaby_jump1; void() tbaby_jump5; -float() WizardCheckAttack; +float() wiz_check_attack; void() wiz_run1; void() wiz_side1; @@ -943,6 +945,6 @@ void() func_train_find; void(vector p) boss_missile; -void() ImpulseCommands; +void() impulse_commands; // EOF diff --git a/source/demon.qc b/source/demon.qc index 64b512f..8a0386e 100644 --- a/source/demon.qc +++ b/source/demon.qc @@ -71,8 +71,8 @@ void() demon1_jump3 = [ $leap3, demon1_jump4 ] {ai_face();}; void() demon1_jump4 = [ $leap4, demon1_jump5 ] { ai_face(); - self.touch = Demon_JumpTouch; - makevectors(self.angles); + self.touch = demon_jump_touch; + make_vectors(self.angles); self.origin_z = self.origin_z + 1; self.velocity = v_forward * 600 + '0 0 250'; if(self.flags & FL_ONGROUND) { @@ -96,13 +96,13 @@ void() demon1_atta1 = [ $attacka1, demon1_atta2 ] {ai_charge(4);}; void() demon1_atta2 = [ $attacka2, demon1_atta3 ] {ai_charge(0);}; void() demon1_atta3 = [ $attacka3, demon1_atta4 ] {ai_charge(0);}; void() demon1_atta4 = [ $attacka4, demon1_atta5 ] {ai_charge(1);}; -void() demon1_atta5 = [ $attacka5, demon1_atta6 ] {ai_charge(2); Demon_Melee(200);}; +void() demon1_atta5 = [ $attacka5, demon1_atta6 ] {ai_charge(2); demon_melee(200);}; void() demon1_atta6 = [ $attacka6, demon1_atta7 ] {ai_charge(1);}; void() demon1_atta7 = [ $attacka7, demon1_atta8 ] {ai_charge(6);}; void() demon1_atta8 = [ $attacka8, demon1_atta9 ] {ai_charge(8);}; void() demon1_atta9 = [ $attacka9, demon1_atta10] {ai_charge(4);}; void() demon1_atta10 = [ $attacka10, demon1_atta11] {ai_charge(2);}; -void() demon1_atta11 = [ $attacka11, demon1_atta12] {Demon_Melee(-200);}; +void() demon1_atta11 = [ $attacka11, demon1_atta12] {demon_melee(-200);}; void() demon1_atta12 = [ $attacka12, demon1_atta13] {ai_charge(5);}; void() demon1_atta13 = [ $attacka13, demon1_atta14] {ai_charge(8);}; void() demon1_atta14 = [ $attacka14, demon1_atta15] {ai_charge(4);}; @@ -116,7 +116,7 @@ void() demon1_pain5 = [ $pain5, demon1_pain6 ] {}; void() demon1_pain6 = [ $pain6, demon1_run1 ] {}; void(entity attacker, float damage) demon1_pain = { - if(self.touch == Demon_JumpTouch) { + if(self.touch == demon_jump_touch) { return; } @@ -151,10 +151,10 @@ void() demon_die = { // check for gib if(self.health < -80) { sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); - ThrowHead("progs/h_demon.mdl", self.health); - ThrowGib("progs/gib1.mdl", self.health); - ThrowGib("progs/gib1.mdl", self.health); - ThrowGib("progs/gib1.mdl", self.health); + throw_head("progs/h_demon.mdl", self.health); + throw_gib("progs/gib1.mdl", self.health); + throw_gib("progs/gib1.mdl", self.health); + throw_gib("progs/gib1.mdl", self.health); return; } @@ -162,7 +162,7 @@ void() demon_die = { demon1_die1(); }; -void() Demon_MeleeAttack = { +void() demon_melee_attack = { demon1_atta1(); }; @@ -187,16 +187,16 @@ void() monster_demon1 = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/demon.mdl"); + set_model(self, "progs/demon.mdl"); - setsize(self, '-32 -32 -24', '32 32 64'); + set_size(self, '-32 -32 -24', '32 32 64'); self.health = 300; self.th_stand = demon1_stand1; self.th_walk = demon1_walk1; self.th_run = demon1_run1; self.th_die = demon_die; - self.th_melee = Demon_MeleeAttack; // one of two attacks + self.th_melee = demon_melee_attack; // one of two attacks self.th_missile = demon1_jump1; // jump attack self.th_pain = demon1_pain; @@ -213,12 +213,12 @@ DEMON /* ============== -CheckDemonMelee +demon_check_melee Returns TRUE if a melee attack would hit right now ============== */ -float() CheckDemonMelee = { +float() demon_check_melee = { if(enemy_range == RANGE_MELEE) { // FIXME: check canreach self.attack_state = AS_MELEE; @@ -229,11 +229,11 @@ float() CheckDemonMelee = { /* ============== -CheckDemonJump +demon_check_jump ============== */ -float() CheckDemonJump = { +float() demon_check_jump = { vector dist; float d; @@ -250,7 +250,7 @@ float() CheckDemonJump = { dist = self.enemy.origin - self.origin; dist_z = 0; - d = vlen(dist); + d = vec_len(dist); if(d < 100) { return FALSE; @@ -265,16 +265,16 @@ float() CheckDemonJump = { return TRUE; }; -float() DemonCheckAttack = { +float() demon_check_attack = { vector vec; // if close enough for slashing, go for it - if(CheckDemonMelee()) { + if(demon_check_melee()) { self.attack_state = AS_MELEE; return TRUE; } - if(CheckDemonJump()) { + if(demon_check_jump()) { self.attack_state = AS_MISSILE; sound(self, CHAN_VOICE, "demon/djump.wav", 1, ATTN_NORM); return TRUE; @@ -285,31 +285,31 @@ float() DemonCheckAttack = { //=========================================================================== -void(float side) Demon_Melee = { +void(float side) demon_melee = { float ldmg; vector delta; ai_face(); - walkmove(self.ideal_yaw, 12); // allow a little closing + walk_move(self.ideal_yaw, 12); // allow a little closing delta = self.enemy.origin - self.origin; - if(vlen(delta) > 100) { + if(vec_len(delta) > 100) { return; } - if(!CanDamage(self.enemy, self)) { + if(!can_damage(self.enemy, self)) { return; } sound(self, CHAN_WEAPON, "demon/dhit2.wav", 1, ATTN_NORM); ldmg = 10 + 5 * random(); - T_Damage(self.enemy, self, self, ldmg); + ent_damage(self.enemy, self, self, ldmg); - makevectors(self.angles); - SpawnMeatSpray(self.origin + v_forward * 16, side * v_right); + make_vectors(self.angles); + spawn_meat_spray(self.origin + v_forward * 16, side * v_right); }; -void() Demon_JumpTouch = { +void() demon_jump_touch = { float ldmg; if(self.health <= 0) { @@ -317,17 +317,17 @@ void() Demon_JumpTouch = { } if(other.takedamage) { - if(vlen(self.velocity) > 400) { + if(vec_len(self.velocity) > 400) { ldmg = 40 + 10 * random(); - T_Damage(other, self, self, ldmg); + ent_damage(other, self, self, ldmg); } } - if(!checkbottom(self)) { + if(!check_bottom(self)) { if(self.flags & FL_ONGROUND) { // jump randomly to not get hung up - //dprint("popjump\n"); - self.touch = SUB_Null; + //print_dbg("popjump\n"); + self.touch = sub_null; self.think = demon1_jump1; self.nextthink = time + 0.1; // self.velocity_x = (random() - 0.5) * 600; @@ -338,7 +338,7 @@ void() Demon_JumpTouch = { return; // not on ground yet } - self.touch = SUB_Null; + self.touch = sub_null; self.think = demon1_jump11; self.nextthink = time + 0.1; }; diff --git a/source/dog.qc b/source/dog.qc index 448bc14..36d6caf 100644 --- a/source/dog.qc +++ b/source/dog.qc @@ -41,21 +41,21 @@ void() dog_bite = { ai_charge(10); - if(!CanDamage(self.enemy, self)) { + if(!can_damage(self.enemy, self)) { return; } delta = self.enemy.origin - self.origin; - if(vlen(delta) > 100) { + if(vec_len(delta) > 100) { return; } ldmg = (random() + random() + random()) * 8; - T_Damage(self.enemy, self, self, ldmg); + ent_damage(self.enemy, self, self, ldmg); }; -void() Dog_JumpTouch = { +void() dog_jump_touch = { float ldmg; if(self.health <= 0) { @@ -63,17 +63,17 @@ void() Dog_JumpTouch = { } if(other.takedamage) { - if(vlen(self.velocity) > 300) { + if(vec_len(self.velocity) > 300) { ldmg = 10 + 10 * random(); - T_Damage(other, self, self, ldmg); + ent_damage(other, self, self, ldmg); } } - if(!checkbottom(self)) { + if(!check_bottom(self)) { if(self.flags & FL_ONGROUND) { // jump randomly to not get hung up - //dprint("popjump\n"); - self.touch = SUB_Null; + //print_dbg("popjump\n"); + self.touch = sub_null; self.think = dog_leap1; self.nextthink = time + 0.1; // self.velocity_x = (random() - 0.5) * 600; @@ -84,7 +84,7 @@ void() Dog_JumpTouch = { return; // not on ground yet } - self.touch = SUB_Null; + self.touch = sub_null; self.think = dog_run1; self.nextthink = time + 0.1; }; @@ -147,8 +147,8 @@ void() dog_leap1 = [ $leap1, dog_leap2 ] {ai_face();}; void() dog_leap2 = [ $leap2, dog_leap3 ] { ai_face(); - self.touch = Dog_JumpTouch; - makevectors(self.angles); + self.touch = dog_jump_touch; + make_vectors(self.angles); self.origin_z = self.origin_z + 1; self.velocity = v_forward * 300 + '0 0 200'; if(self.flags & FL_ONGROUND) { @@ -222,10 +222,10 @@ void() dog_die = { // check for gib if(self.health < -35) { sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); - ThrowGib("progs/gib3.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); - ThrowHead("progs/h_dog.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); + throw_head("progs/h_dog.mdl", self.health); return; } @@ -244,12 +244,12 @@ void() dog_die = { /* ============== -CheckDogMelee +dog_check_melee Returns TRUE if a melee attack would hit right now ============== */ -float() CheckDogMelee = { +float() dog_check_melee = { if(enemy_range == RANGE_MELEE) { // FIXME: check canreach self.attack_state = AS_MELEE; @@ -260,11 +260,11 @@ float() CheckDogMelee = { /* ============== -CheckDogJump +dog_check_jump ============== */ -float() CheckDogJump = { +float() dog_check_jump = { vector dist; float d; @@ -281,7 +281,7 @@ float() CheckDogJump = { dist = self.enemy.origin - self.origin; dist_z = 0; - d = vlen(dist); + d = vec_len(dist); if(d < 80) { return FALSE; @@ -294,16 +294,16 @@ float() CheckDogJump = { return TRUE; }; -float() DogCheckAttack = { +float() dog_check_attack = { vector vec; // if close enough for slashing, go for it - if(CheckDogMelee()) { + if(dog_check_melee()) { self.attack_state = AS_MELEE; return TRUE; } - if(CheckDogJump()) { + if(dog_check_jump()) { self.attack_state = AS_MISSILE; return TRUE; } @@ -333,9 +333,9 @@ void() monster_dog = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/dog.mdl"); + set_model(self, "progs/dog.mdl"); - setsize(self, '-32 -32 -24', '32 32 40'); + set_size(self, '-32 -32 -24', '32 32 40'); self.health = 25; self.th_stand = dog_stand1; diff --git a/source/doors.qc b/source/doors.qc index 2a43017..0d47562 100644 --- a/source/doors.qc +++ b/source/doors.qc @@ -22,7 +22,7 @@ THINK FUNCTIONS */ void() door_blocked = { - T_Damage(other, self, self, self.dmg); + ent_damage(other, self, self, self.dmg); // if a door has a negative wait, it would never come back if blocked, // so let it just squash the object to death real fast @@ -58,7 +58,7 @@ void() door_go_down = { } self.state = STATE_DOWN; - SUB_CalcMove(self.pos1, self.speed, door_hit_bottom); + sub_calc_move(self.pos1, self.speed, door_hit_bottom); }; void() door_go_up = { @@ -74,9 +74,9 @@ void() door_go_up = { sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); self.state = STATE_UP; - SUB_CalcMove(self.pos2, self.speed, door_hit_top); + sub_calc_move(self.pos2, self.speed, door_hit_top); - SUB_UseTargets(); + sub_use_targets(); }; /* @@ -92,7 +92,7 @@ void() door_fire = { entity starte; if(self.owner != self) { - objerror("door_fire: self.owner != self"); + error_obj("door_fire: self.owner != self"); } // play use key sound @@ -182,7 +182,7 @@ void() door_touch = { self.owner.attack_finished = time + 2; if(self.owner.message != string_null) { - centerprint(other, self.owner.message); + print_center(other, self.owner.message); sound(other, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM); } @@ -194,17 +194,17 @@ void() door_touch = { // FIXME: blink key on player's status bar if((self.items & other.items) != self.items) { switch(self.owner.items) { - case IT_KEY1: centerprint(other, "You need the ", Key1Name()); break; - case IT_KEY2: centerprint(other, "You need the ", Key2Name()); break; + case IT_KEY1: print_center(other, "You need the ", key_1_name()); break; + case IT_KEY2: print_center(other, "You need the ", key_2_name()); break; } sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM); return; } other.items = other.items - self.items; - self.touch = SUB_Null; + self.touch = sub_null; if(self.enemy) { - self.enemy.touch = SUB_Null; // get paired door + self.enemy.touch = sub_null; // get paired door } door_use(); }; @@ -229,11 +229,11 @@ entity(vector fmins, vector fmaxs) spawn_field = { t1 = fmins; t2 = fmaxs; - setsize(trigger, t1 - '60 60 8', t2 + '60 60 8'); + set_size(trigger, t1 - '60 60 8', t2 + '60 60 8'); return(trigger); }; -float(entity e1, entity e2) EntitiesTouching = { +float(entity e1, entity e2) entities_touching = { if(e1.mins_x > e2.maxs_x) { return FALSE; } @@ -257,11 +257,11 @@ float(entity e1, entity e2) EntitiesTouching = { /* ============= -LinkDoors +link_doors ============= */ -void() LinkDoors = { +void() link_doors = { entity t, starte; vector cmins, cmaxs; @@ -308,9 +308,9 @@ void() LinkDoors = { self.owner.trigger_field = spawn_field(cmins, cmaxs); return; } - if(EntitiesTouching(self, t)) { + if(entities_touching(self, t)) { if(t.enemy) { - objerror("cross connected doors"); + error_obj("cross connected doors"); } self.enemy = t; self = t; @@ -414,13 +414,13 @@ void() func_door = { self.noise2 = "doors/ddoor1.wav"; } - SetMovedir(); + set_move_dir(); self.max_health = self.health; self.solid = SOLID_BSP; self.movetype = MOVETYPE_PUSH; - setorigin(self, self.origin); - setmodel(self, self.model); + set_origin(self, self.origin); + set_model(self, self.model); self.classname = "door"; self.blocked = door_blocked; @@ -452,7 +452,7 @@ void() func_door = { // DOOR_START_OPEN is to allow an entity to be lighted in the closed position // but spawn in the open position if(self.spawnflags & DOOR_START_OPEN) { - setorigin(self, self.pos2); + set_origin(self, self.pos2); self.pos2 = self.pos1; self.pos1 = self.origin; } @@ -470,9 +470,9 @@ void() func_door = { self.touch = door_touch; - // LinkDoors can't be done until all of the doors have been spawned, so + // link_doors can't be done until all of the doors have been spawned, so // the sizes can be detected properly. - self.think = LinkDoors; + self.think = link_doors; self.nextthink = self.ltime + 0.1; }; @@ -496,10 +496,10 @@ void() fd_secret_use = { self.message = string_null; // no more message - SUB_UseTargets(); // fire all targets / killtargets + sub_use_targets(); // fire all targets / killtargets if(!(self.spawnflags & SECRET_NO_SHOOT)) { - self.th_pain = SUB_PainNull; + self.th_pain = sub_pain_null; self.takedamage = DAMAGE_NO; } self.velocity = VEC_ORIGIN; @@ -510,7 +510,7 @@ void() fd_secret_use = { self.nextthink = self.ltime + 0.1; temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1 - makevectors(self.mangle); + make_vectors(self.mangle); if(!self.t_width) { if(self.spawnflags & SECRET_1ST_DOWN) { @@ -531,7 +531,7 @@ void() fd_secret_use = { } self.dest2 = self.dest1 + v_forward * self.t_length; - SUB_CalcMove(self.dest1, self.speed, fd_secret_move1); + sub_calc_move(self.dest1, self.speed, fd_secret_move1); sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); }; void(entity attacker, float damage) fd_secret_pain = {fd_secret_use();}; @@ -546,7 +546,7 @@ void() fd_secret_move1 = { // Start moving sideways w/sound... void() fd_secret_move2 = { sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); - SUB_CalcMove(self.dest2, self.speed, fd_secret_move3); + sub_calc_move(self.dest2, self.speed, fd_secret_move3); }; // Wait here until time to go back... @@ -561,7 +561,7 @@ void() fd_secret_move3 = { // Move backward... void() fd_secret_move4 = { sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); - SUB_CalcMove(self.dest1, self.speed, fd_secret_move5); + sub_calc_move(self.dest1, self.speed, fd_secret_move5); }; // Wait 1 second... @@ -573,7 +573,7 @@ void() fd_secret_move5 = { void() fd_secret_move6 = { sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); - SUB_CalcMove(self.oldorigin, self.speed, fd_secret_done); + sub_calc_move(self.oldorigin, self.speed, fd_secret_done); }; void() fd_secret_done = { @@ -590,7 +590,7 @@ void() secret_blocked = { return; } self.attack_finished = time + 0.5; - T_Damage(other, self, self, self.dmg); + ent_damage(other, self, self, self.dmg); }; /* @@ -611,7 +611,7 @@ void() secret_touch = { self.attack_finished = time + 2; if(self.message) { - centerprint(other, self.message); + print_center(other, self.message); sound(other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM); } }; @@ -670,8 +670,8 @@ void() func_door_secret = { self.solid = SOLID_BSP; self.movetype = MOVETYPE_PUSH; self.classname = "door"; - setmodel(self, self.model); - setorigin(self, self.origin); + set_model(self, self.model); + set_origin(self, self.origin); self.touch = secret_touch; self.blocked = secret_blocked; diff --git a/source/enforcer.qc b/source/enforcer.qc index dc460fa..93772b6 100644 --- a/source/enforcer.qc +++ b/source/enforcer.qc @@ -31,14 +31,14 @@ $frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8 $frame paind9 paind10 paind11 paind12 paind13 paind14 paind15 paind16 $frame paind17 paind18 paind19 -void() Laser_Touch = { +void() laser_touch = { vector org; if(other == self.owner) { return; // don't explode on owner } - if(pointcontents(self.origin) == CONTENT_SKY) { + if(point_contents(self.origin) == CONTENT_SKY) { remove(self); return; } @@ -47,20 +47,20 @@ void() Laser_Touch = { org = self.origin - 8 * normalize(self.velocity); if(other.health) { - SpawnBlood(org, self.velocity * 0.2, 15); - T_Damage(other, self, self.owner, 15); + spawn_blood(org, self.velocity * 0.2, 15); + ent_damage(other, self, self.owner, 15); } else { - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_GUNSHOT); - WriteCoord(MSG_BROADCAST, org_x); - WriteCoord(MSG_BROADCAST, org_y); - WriteCoord(MSG_BROADCAST, org_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_GUNSHOT); + write_coord(MSG_BROADCAST, org_x); + write_coord(MSG_BROADCAST, org_y); + write_coord(MSG_BROADCAST, org_z); } remove(self); }; -void(vector org, vector vec_to) LaunchLaser = { +void(vector org, vector vec_to) launch_laser = { vector vec; if(self.classname == "monster_enforcer") { @@ -75,17 +75,17 @@ void(vector org, vector vec_to) LaunchLaser = { newmis.solid = SOLID_BBOX; newmis.effects = EF_DIMLIGHT; - setmodel(newmis, "progs/laser.mdl"); - setsize(newmis, VEC_ORIGIN, VEC_ORIGIN); + set_model(newmis, "progs/laser.mdl"); + set_size(newmis, VEC_ORIGIN, VEC_ORIGIN); - setorigin(newmis, org); + set_origin(newmis, org); newmis.velocity = vec * 600; - newmis.angles = vectoangles(newmis.velocity); + newmis.angles = vec_to_angles(newmis.velocity); newmis.nextthink = time + 5; - newmis.think = SUB_Remove; - newmis.touch = Laser_Touch; + newmis.think = sub_remove; + newmis.touch = laser_touch; }; @@ -93,11 +93,11 @@ void() enforcer_fire = { vector org; self.effects = self.effects | EF_MUZZLEFLASH; - makevectors(self.angles); + make_vectors(self.angles); org = self.origin + v_forward * 30 + v_right * 8.5 + '0 0 16'; - LaunchLaser(org, self.enemy.origin - self.origin); + launch_laser(org, self.enemy.origin - self.origin); }; //============================================================================ @@ -160,7 +160,7 @@ void() enf_atk11 = [ $attack7, enf_atk12 ] {ai_face();}; void() enf_atk12 = [ $attack8, enf_atk13 ] {ai_face();}; void() enf_atk13 = [ $attack9, enf_atk14 ] {ai_face();}; void() enf_atk14 = [ $attack10, enf_run1 ] {ai_face(); - SUB_CheckRefire(enf_atk1); + sub_check_refire(enf_atk1); }; void() enf_paina1 = [ $paina1, enf_paina2 ] {}; @@ -239,7 +239,7 @@ void(entity attacker, float damage) enf_pain = { void() enf_die1 = [ $death1, enf_die2 ] {}; void() enf_die2 = [ $death2, enf_die3 ] {}; void() enf_die3 = [ $death3, enf_die4 ] -{self.solid = SOLID_NOT; self.ammo_cells = 5; DropBackpack();}; +{self.solid = SOLID_NOT; self.ammo_cells = 5; drop_backpack();}; void() enf_die4 = [ $death4, enf_die5 ] {ai_forward(14);}; void() enf_die5 = [ $death5, enf_die6 ] {ai_forward(2);}; void() enf_die6 = [ $death6, enf_die7 ] {}; @@ -257,7 +257,7 @@ void() enf_fdie1 = [ $fdeath1, enf_fdie2 ] { }; void() enf_fdie2 = [ $fdeath2, enf_fdie3 ] {}; void() enf_fdie3 = [ $fdeath3, enf_fdie4 ] -{self.solid = SOLID_NOT; self.ammo_cells = 5; DropBackpack();}; +{self.solid = SOLID_NOT; self.ammo_cells = 5; drop_backpack();}; void() enf_fdie4 = [ $fdeath4, enf_fdie5 ] {}; void() enf_fdie5 = [ $fdeath5, enf_fdie6 ] {}; void() enf_fdie6 = [ $fdeath6, enf_fdie7 ] {}; @@ -271,10 +271,10 @@ void() enf_die = { // check for gib if(self.health < -35) { sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); - ThrowHead("progs/h_mega.mdl", self.health); - ThrowGib("progs/gib1.mdl", self.health); - ThrowGib("progs/gib2.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); + throw_head("progs/h_mega.mdl", self.health); + throw_gib("progs/gib1.mdl", self.health); + throw_gib("progs/gib2.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); return; } @@ -313,9 +313,9 @@ void() monster_enforcer = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/enforcer.mdl"); + set_model(self, "progs/enforcer.mdl"); - setsize(self, '-16 -16 -24', '16 16 40'); + set_size(self, '-16 -16 -24', '16 16 40'); self.health = 80; self.th_stand = enf_stand1; diff --git a/source/fight.qc b/source/fight.qc index 35c05ca..44c7a52 100644 --- a/source/fight.qc +++ b/source/fight.qc @@ -13,7 +13,7 @@ void() knight_attack = { float len; // decide if now is a good swing time - len = vlen(self.enemy.origin + self.enemy.view_ofs - (self.origin + self.view_ofs)); + len = vec_len(self.enemy.origin + self.enemy.view_ofs - (self.origin + self.view_ofs)); if(len < 80) { knight_atk1(); @@ -26,13 +26,13 @@ void() knight_attack = { /* =========== -CheckAttack +check_attack The player is in view, so decide to move or launch an attack Returns FALSE if movement should continue ============ */ -float() CheckAttack = { +float() check_attack = { vector spot1, spot2; entity targ; float chance; @@ -43,7 +43,7 @@ float() CheckAttack = { spot1 = self.origin + self.view_ofs; spot2 = targ.origin + targ.view_ofs; - traceline(spot1, spot2, FALSE, self); + trace_line(spot1, spot2, FALSE, self); if(trace_ent != targ) { return FALSE; // don't have a clear shot @@ -99,7 +99,7 @@ float() CheckAttack = { if(random() < chance) { self.th_missile(); - SUB_AttackFinished(2 * random()); + sub_attack_finished(2 * random()); return TRUE; } @@ -114,8 +114,8 @@ Stay facing the enemy ============= */ void() ai_face = { - self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin); - ChangeYaw(); + self.ideal_yaw = vec_yaw(self.enemy.origin - self.origin); + change_yaw(); }; /* @@ -127,7 +127,7 @@ The monster is in a melee attack, so get as close as possible to .enemy */ void(float d) ai_charge = { ai_face(); - movetogoal(d); // done in C code... + move_to_goal(d); // done in C code... }; void() ai_charge_side = { @@ -136,14 +136,14 @@ void() ai_charge_side = { // aim to the left of the enemy for a flyby - self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin); - ChangeYaw(); + self.ideal_yaw = vec_yaw(self.enemy.origin - self.origin); + change_yaw(); - makevectors(self.angles); + make_vectors(self.angles); dtemp = self.enemy.origin - 30 * v_right; - heading = vectoyaw(dtemp - self.origin); + heading = vec_yaw(dtemp - self.origin); - walkmove(heading, 20); + walk_move(heading, 20); }; /* @@ -162,12 +162,12 @@ void() ai_melee = { delta = self.enemy.origin - self.origin; - if(vlen(delta) > 60) { + if(vec_len(delta) > 60) { return; } ldmg = (random() + random() + random()) * 3; - T_Damage(self.enemy, self, self, ldmg); + ent_damage(self.enemy, self, self, ldmg); }; void() ai_melee_side = { @@ -182,203 +182,13 @@ void() ai_melee_side = { delta = self.enemy.origin - self.origin; - if(vlen(delta) > 60) { + if(vec_len(delta) > 60) { return; } - if(!CanDamage(self.enemy, self)) { + if(!can_damage(self.enemy, self)) { return; } ldmg = (random() + random() + random()) * 3; - T_Damage(self.enemy, self, self, ldmg); -}; - -//============================================================================= - -/* -=========== -SoldierCheckAttack - -The player is in view, so decide to move or launch an attack -Returns FALSE if movement should continue -============ -*/ -float() SoldierCheckAttack = { - vector spot1, spot2; - entity targ; - float chance; - - targ = self.enemy; - - // see if any entities are in the way of the shot - spot1 = self.origin + self.view_ofs; - spot2 = targ.origin + targ.view_ofs; - - traceline(spot1, spot2, FALSE, self); - - if(trace_inopen && trace_inwater) { - return FALSE; // sight line crossed contents - } - - if(trace_ent != targ) { - return FALSE; // don't have a clear shot - } - - // missile attack - if(time < self.attack_finished) { - return FALSE; - } - - if(enemy_range == RANGE_FAR) { - return FALSE; - } - - if(enemy_range == RANGE_MELEE) { - chance = 0.9; - } else if(enemy_range == RANGE_NEAR) { - chance = 0.4; - } else if(enemy_range == RANGE_MID) { - chance = 0.05; - } else { - chance = 0; - } - - if(random() < chance) { - self.th_missile(); - SUB_AttackFinished(1 + random()); - if(random() < 0.3) { - self.lefty = !self.lefty; - } - return TRUE; - } - - return FALSE; -}; -//============================================================================= - -/* -=========== -ShamCheckAttack - -The player is in view, so decide to move or launch an attack -Returns FALSE if movement should continue -============ -*/ -float() ShamCheckAttack = { - vector spot1, spot2; - entity targ; - float chance; - float enemy_yaw; - - if(enemy_range == RANGE_MELEE) { - if(CanDamage(self.enemy, self)) { - self.attack_state = AS_MELEE; - return TRUE; - } - } - - if(time < self.attack_finished) { - return FALSE; - } - - if(!enemy_vis) { - return FALSE; - } - - targ = self.enemy; - - // see if any entities are in the way of the shot - spot1 = self.origin + self.view_ofs; - spot2 = targ.origin + targ.view_ofs; - - if(vlen(spot1 - spot2) > 600) { - return FALSE; - } - - traceline(spot1, spot2, FALSE, self); - - if(trace_inopen && trace_inwater) { - return FALSE; // sight line crossed contents - } - - if(trace_ent != targ) { - return FALSE; // don't have a clear shot - } - - // missile attack - if(enemy_range == RANGE_FAR) { - return FALSE; - } - - self.attack_state = AS_MISSILE; - SUB_AttackFinished(2 + 2 * random()); - return TRUE; -}; - -//============================================================================ - -/* -=========== -OgreCheckAttack - -The player is in view, so decide to move or launch an attack -Returns FALSE if movement should continue -============ -*/ -float() OgreCheckAttack = { - vector spot1, spot2; - entity targ; - float chance; - - if(enemy_range == RANGE_MELEE) { - if(CanDamage(self.enemy, self)) { - self.attack_state = AS_MELEE; - return TRUE; - } - } - - if(time < self.attack_finished) { - return FALSE; - } - - if(!enemy_vis) { - return FALSE; - } - - targ = self.enemy; - - // see if any entities are in the way of the shot - spot1 = self.origin + self.view_ofs; - spot2 = targ.origin + targ.view_ofs; - - traceline(spot1, spot2, FALSE, self); - - if(trace_inopen && trace_inwater) { - return FALSE; // sight line crossed contents - } - - if(trace_ent != targ) { - return FALSE; // don't have a clear shot - } - - // missile attack - if(time < self.attack_finished) { - return FALSE; - } - - if(enemy_range == RANGE_FAR) { - return FALSE; - } - - else if(enemy_range == RANGE_NEAR) { - chance = 0.10; - } else if(enemy_range == RANGE_MID) { - chance = 0.05; - } else { - chance = 0; - } - - self.attack_state = AS_MISSILE; - SUB_AttackFinished(1 + 2 * random()); - return TRUE; + ent_damage(self.enemy, self, self, ldmg); }; diff --git a/source/fish.qc b/source/fish.qc index 9a44165..2cfa801 100644 --- a/source/fish.qc +++ b/source/fish.qc @@ -82,13 +82,13 @@ void() fish_melee = { delta = self.enemy.origin - self.origin; - if(vlen(delta) > 60) { + if(vec_len(delta) > 60) { return; } sound(self, CHAN_VOICE, "fish/bite.wav", 1, ATTN_NORM); ldmg = (random() + random()) * 3; - T_Damage(self.enemy, self, self, ldmg); + ent_damage(self.enemy, self, self, ldmg); }; void() f_attack1 = [ $attack1, f_attack2 ] {ai_charge(10);}; @@ -167,9 +167,9 @@ void() monster_fish = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/fish.mdl"); + set_model(self, "progs/fish.mdl"); - setsize(self, '-16 -16 -24', '16 16 24'); + set_size(self, '-16 -16 -24', '16 16 24'); self.health = 25; self.th_stand = f_stand1; diff --git a/source/hknight.qc b/source/hknight.qc index fb55bbe..5013451 100644 --- a/source/hknight.qc +++ b/source/hknight.qc @@ -55,10 +55,10 @@ void(float offset) hknight_shot = { vector offang; vector org, vec; - offang = vectoangles(self.enemy.origin - self.origin); + offang = vec_to_angles(self.enemy.origin - self.origin); offang_y = offang_y + offset * 6; - makevectors(offang); + make_vectors(offang); org = self.origin + self.mins + self.size * 0.5 + v_forward * 20; @@ -68,13 +68,13 @@ void(float offset) hknight_shot = { launch_spike(org, vec); newmis.classname = "knightspike"; - setmodel(newmis, "progs/k_spike.mdl"); - setsize(newmis, VEC_ORIGIN, VEC_ORIGIN); + set_model(newmis, "progs/k_spike.mdl"); + set_size(newmis, VEC_ORIGIN, VEC_ORIGIN); newmis.velocity = vec * 300; sound(self, CHAN_WEAPON, "hknight/attack1.wav", 1, ATTN_NORM); }; -void() CheckForCharge = { +void() check_for_charge = { // check for mad charge if(!enemy_vis) { return; @@ -85,19 +85,19 @@ void() CheckForCharge = { if(fabs(self.origin_z - self.enemy.origin_z) > 20) { return; // too much height change } - if(vlen(self.origin - self.enemy.origin) < 80) { + if(vec_len(self.origin - self.enemy.origin) < 80) { return; // use regular attack } // charge - SUB_AttackFinished(2); + sub_attack_finished(2); hknight_char_a1(); }; -void() CheckContinueCharge = { +void() check_continue_charge = { if(time > self.attack_finished) { - SUB_AttackFinished(3); + sub_attack_finished(3); hknight_run1(); return; // done charging } @@ -151,7 +151,7 @@ void() hknight_walk20 = [ $walk20, hknight_walk1 ] {ai_walk(2);}; void() hknight_run1 = [ $run1, hknight_run2 ] { hknight_idle_sound(); ai_run(20); - CheckForCharge(); + check_for_charge(); }; void() hknight_run2 = [ $run2, hknight_run3 ] {ai_run(25);}; void() hknight_run3 = [ $run3, hknight_run4 ] {ai_run(18);}; @@ -200,10 +200,10 @@ void() hknight_die = { // check for gib if(self.health < -40) { sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); - ThrowHead("progs/h_hellkn.mdl", self.health); - ThrowGib("progs/gib1.mdl", self.health); - ThrowGib("progs/gib2.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); + throw_head("progs/h_hellkn.mdl", self.health); + throw_gib("progs/gib1.mdl", self.health); + throw_gib("progs/gib2.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); return; } @@ -285,7 +285,7 @@ void() hknight_char_a16 = [ $char_a16, hknight_run1 ] {ai_charge(13);}; //=========================================================================== void() hknight_char_b1 = [ $char_b1, hknight_char_b2 ] -{CheckContinueCharge(); ai_charge(23); ai_melee();}; +{check_continue_charge(); ai_charge(23); ai_melee();}; void() hknight_char_b2 = [ $char_b2, hknight_char_b3 ] {ai_charge(17); ai_melee();}; void() hknight_char_b3 = [ $char_b3, hknight_char_b4 ] {ai_charge(12); ai_melee();}; void() hknight_char_b4 = [ $char_b4, hknight_char_b5 ] {ai_charge(22); ai_melee();}; @@ -408,9 +408,9 @@ void() monster_hell_knight = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/hknight.mdl"); + set_model(self, "progs/hknight.mdl"); - setsize(self, '-16 -16 -24', '16 16 40'); + set_size(self, '-16 -16 -24', '16 16 40'); self.health = 250; self.th_stand = hknight_stand1; diff --git a/source/items.qc b/source/items.qc index 7f22faf..db83033 100644 --- a/source/items.qc +++ b/source/items.qc @@ -1,6 +1,6 @@ // items.qc: items the player can pick up -string() Key1Name = { +string() key_1_name = { switch(world.worldtype) { case WORLD_MEDIEVAL: return "silver key"; @@ -13,7 +13,7 @@ string() Key1Name = { } }; -string() Key2Name = { +string() key_2_name = { switch(world.worldtype) { case WORLD_MEDIEVAL: return "gold key"; @@ -30,11 +30,11 @@ string() Key2Name = { BE .8 .3 .4 IN COLOR */ -void() SUB_regen = { +void() sub_regen = { self.model = self.mdl; // restore original model self.solid = SOLID_TRIGGER; // allow it to be touched again sound(self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM); // play respawn sound - setorigin(self, self.origin); + set_origin(self, self.origin); }; @@ -43,7 +43,7 @@ void() SUB_regen = { prints a warning message when spawned */ void() noclass = { - dprint("noclass spawned at", vtos(self.origin), "\n"); + print_dbg("noclass spawned at", vtos(self.origin), "\n"); remove(self); }; @@ -51,12 +51,12 @@ void() noclass = { /* ============ -PlaceItem +place_item plants the object on the floor ============ */ -void() PlaceItem = { +void() place_item = { float oldz; self.mdl = self.model; // so it can be restored on respawn @@ -66,8 +66,8 @@ void() PlaceItem = { self.velocity = VEC_ORIGIN; self.origin_z = self.origin_z + 6; oldz = self.origin_z; - if(!droptofloor()) { - dprint("Bonus item fell out of level at ", vtos(self.origin), "\n"); + if(!drop_to_floor()) { + print_dbg("Bonus item fell out of level at ", vtos(self.origin), "\n"); remove(self); return; } @@ -75,14 +75,14 @@ void() PlaceItem = { /* ============ -StartItem +start_item Sets the clipping size and plants the object on the floor ============ */ -void() StartItem = { +void() start_item = { self.nextthink = time + 0.2; // items start after other solids - self.think = PlaceItem; + self.think = place_item; }; /* @@ -93,10 +93,10 @@ HEALTH BOX ========================================================================= */ // -// T_Heal: add health to an entity, limiting health to max_health +// ent_heal: add health to an entity, limiting health to max_health // "ignore" will ignore max_health limit // -float(entity e, float healamount, float ignore) T_Heal = { +float(entity e, float healamount, float ignore) ent_heal = { if(e.health <= 0 || (!ignore && e.health >= other.max_health)) { return 0; } @@ -126,27 +126,27 @@ void() item_health = { if(self.spawnflags & HEALTH_ROTTEN) { precache_model("maps/b_bh10.bsp"); precache_sound("items/r_item1.wav"); - setmodel(self, "maps/b_bh10.bsp"); + set_model(self, "maps/b_bh10.bsp"); self.noise = "items/r_item1.wav"; self.healamount = 15; self.healtype = 0; } else if(self.spawnflags & HEALTH_MEGA) { precache_model("maps/b_bh100.bsp"); precache_sound("items/r_item2.wav"); - setmodel(self, "maps/b_bh100.bsp"); + set_model(self, "maps/b_bh100.bsp"); self.noise = "items/r_item2.wav"; self.healamount = 100; self.healtype = 2; } else { precache_model("maps/b_bh25.bsp"); precache_sound("items/health1.wav"); - setmodel(self, "maps/b_bh25.bsp"); + set_model(self, "maps/b_bh25.bsp"); self.noise = "items/health1.wav"; self.healamount = 25; self.healtype = 1; } - setsize(self, VEC_ORIGIN, '32 32 56'); - StartItem(); + set_size(self, VEC_ORIGIN, '32 32 56'); + start_item(); }; @@ -158,19 +158,19 @@ void() health_touch = { } if(self.healtype == 2) { // Megahealth? Ignore max_health... - if(other.health >= 250 || !T_Heal(other, self.healamount, TRUE)) { + if(other.health >= 250 || !ent_heal(other, self.healamount, TRUE)) { return; } - } else if(!T_Heal(other, self.healamount, FALSE)) { + } else if(!ent_heal(other, self.healamount, FALSE)) { return; } - sprint(other, "You receive ", ftos(self.healamount), " health\n"); + print_cl(other, "You receive ", ftos(self.healamount), " health\n"); // health touch sound sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM); - stuffcmd(other, "bf\n"); + cmd_client(other, "bf\n"); self.model = string_null; self.solid = SOLID_NOT; @@ -186,12 +186,12 @@ void() health_touch = { if(deathmatch) { self.nextthink = time + 20; } - self.think = SUB_regen; + self.think = sub_regen; } } activator = other; - SUB_UseTargets(); // fire all targets / killtargets + sub_use_targets(); // fire all targets / killtargets }; void() item_megahealth_rot = { @@ -209,7 +209,7 @@ void() item_megahealth_rot = { if(deathmatch == 1) { // deathmatch 2 is silly old rules self.nextthink = time + 20; - self.think = SUB_regen; + self.think = sub_regen; } }; @@ -259,15 +259,15 @@ void() armor_touch = { if(deathmatch == 1) { self.nextthink = time + 20; } - self.think = SUB_regen; + self.think = sub_regen; - sprint(other, "You got armor\n"); + print_cl(other, "You got armor\n"); // armor touch sound sound(other, CHAN_ITEM, "items/armor1.wav", 1, ATTN_NORM); - stuffcmd(other, "bf\n"); + cmd_client(other, "bf\n"); activator = other; - SUB_UseTargets(); // fire all targets / killtargets + sub_use_targets(); // fire all targets / killtargets }; @@ -277,10 +277,10 @@ void() armor_touch = { void() item_armor1 = { self.touch = armor_touch; precache_model("progs/armor.mdl"); - setmodel(self, "progs/armor.mdl"); + set_model(self, "progs/armor.mdl"); self.skin = 0; - setsize(self, '-16 -16 0', '16 16 56'); - StartItem(); + set_size(self, '-16 -16 0', '16 16 56'); + start_item(); }; /*QUAKED item_armor2(0 .5 .8) (-16 -16 0) (16 16 32) @@ -289,10 +289,10 @@ void() item_armor1 = { void() item_armor2 = { self.touch = armor_touch; precache_model("progs/armor.mdl"); - setmodel(self, "progs/armor.mdl"); + set_model(self, "progs/armor.mdl"); self.skin = 1; - setsize(self, '-16 -16 0', '16 16 56'); - StartItem(); + set_size(self, '-16 -16 0', '16 16 56'); + start_item(); }; /*QUAKED item_armorInv(0 .5 .8) (-16 -16 0) (16 16 32) @@ -301,10 +301,10 @@ void() item_armor2 = { void() item_armorInv = { self.touch = armor_touch; precache_model("progs/armor.mdl"); - setmodel(self, "progs/armor.mdl"); + set_model(self, "progs/armor.mdl"); self.skin = 2; - setsize(self, '-16 -16 0', '16 16 56'); - StartItem(); + set_size(self, '-16 -16 0', '16 16 56'); + start_item(); }; /* @@ -331,7 +331,7 @@ void(entity e) bound_ammo = { }; -float(float w) RankForWeapon = { +float(float w) wep_rank_for_weapon = { switch(w) { case IT_LIGHTNING: return 1; case IT_ROCKET_LAUNCHER: return 2; @@ -345,17 +345,17 @@ float(float w) RankForWeapon = { /* ============= -Deathmatch_Weapon +wep_deathmatch_weapon Deathmatch weapon change rules for picking up a weapon ============= */ -void(float old, float new) Deathmatch_Weapon = { +void(float old, float new) wep_deathmatch_weapon = { float or, nr; // change self.weapon if desired - or = RankForWeapon(self.weapon); - nr = RankForWeapon(new); + or = wep_rank_for_weapon(self.weapon); + nr = wep_rank_for_weapon(new); if(nr < or) { self.weapon = new; } @@ -379,7 +379,7 @@ void() weapon_touch = { // better stemp = self; self = other; - best = W_BestWeapon(); + best = wep_best_weapon(); self = stemp; leave = (deathmatch == 2 || coop); @@ -434,13 +434,13 @@ void() weapon_touch = { other.ammo_cells = other.ammo_cells + 15; break; default: - objerror("weapon_touch: unknown classname"); + error_obj("weapon_touch: unknown classname"); } - sprint(other, "You got the ", self.netname, "\n"); + print_cl(other, "You got the ", self.netname, "\n"); // weapon touch sound sound(other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM); - stuffcmd(other, "bf\n"); + cmd_client(other, "bf\n"); bound_ammo(other); @@ -454,10 +454,10 @@ void() weapon_touch = { if(!deathmatch) { self.weapon = new; } else { - Deathmatch_Weapon(old, new); + wep_deathmatch_weapon(old, new); } - W_SetCurrentAmmo(); + wep_set_current_ammo(); self = stemp; @@ -471,10 +471,10 @@ void() weapon_touch = { if(deathmatch == 1) { self.nextthink = time + 30; } - self.think = SUB_regen; + self.think = sub_regen; activator = other; - SUB_UseTargets(); // fire all targets / killtargets + sub_use_targets(); // fire all targets / killtargets }; @@ -483,12 +483,12 @@ void() weapon_touch = { void() weapon_supershotgun = { precache_model("progs/g_shot.mdl"); - setmodel(self, "progs/g_shot.mdl"); + set_model(self, "progs/g_shot.mdl"); self.weapon = IT_SUPER_SHOTGUN; self.netname = WEPNAME_SUPER_SHOTGUN; self.touch = weapon_touch; - setsize(self, '-16 -16 0', '16 16 56'); - StartItem(); + set_size(self, '-16 -16 0', '16 16 56'); + start_item(); }; /*QUAKED weapon_nailgun(0 .5 .8) (-16 -16 0) (16 16 32) @@ -496,12 +496,12 @@ void() weapon_supershotgun = { void() weapon_nailgun = { precache_model("progs/g_nail.mdl"); - setmodel(self, "progs/g_nail.mdl"); + set_model(self, "progs/g_nail.mdl"); self.weapon = IT_NAILGUN; self.netname = WEPNAME_NAILGUN; self.touch = weapon_touch; - setsize(self, '-16 -16 0', '16 16 56'); - StartItem(); + set_size(self, '-16 -16 0', '16 16 56'); + start_item(); }; /*QUAKED weapon_supernailgun(0 .5 .8) (-16 -16 0) (16 16 32) @@ -509,12 +509,12 @@ void() weapon_nailgun = { void() weapon_supernailgun = { precache_model("progs/g_nail2.mdl"); - setmodel(self, "progs/g_nail2.mdl"); + set_model(self, "progs/g_nail2.mdl"); self.weapon = IT_SUPER_NAILGUN; self.netname = WEPNAME_SUPER_NAILGUN; self.touch = weapon_touch; - setsize(self, '-16 -16 0', '16 16 56'); - StartItem(); + set_size(self, '-16 -16 0', '16 16 56'); + start_item(); }; /*QUAKED weapon_grenadelauncher(0 .5 .8) (-16 -16 0) (16 16 32) @@ -522,12 +522,12 @@ void() weapon_supernailgun = { void() weapon_grenadelauncher = { precache_model("progs/g_rock.mdl"); - setmodel(self, "progs/g_rock.mdl"); + set_model(self, "progs/g_rock.mdl"); self.weapon = 3; self.netname = WEPNAME_GRENADE_LAUNCHER; self.touch = weapon_touch; - setsize(self, '-16 -16 0', '16 16 56'); - StartItem(); + set_size(self, '-16 -16 0', '16 16 56'); + start_item(); }; /*QUAKED weapon_rocketlauncher(0 .5 .8) (-16 -16 0) (16 16 32) @@ -535,12 +535,12 @@ void() weapon_grenadelauncher = { void() weapon_rocketlauncher = { precache_model("progs/g_rock2.mdl"); - setmodel(self, "progs/g_rock2.mdl"); + set_model(self, "progs/g_rock2.mdl"); self.weapon = 3; self.netname = WEPNAME_ROCKET_LAUNCHER; self.touch = weapon_touch; - setsize(self, '-16 -16 0', '16 16 56'); - StartItem(); + set_size(self, '-16 -16 0', '16 16 56'); + start_item(); }; @@ -549,12 +549,12 @@ void() weapon_rocketlauncher = { void() weapon_lightning = { precache_model("progs/g_light.mdl"); - setmodel(self, "progs/g_light.mdl"); + set_model(self, "progs/g_light.mdl"); self.weapon = 3; self.netname = WEPNAME_LIGHTNING; self.touch = weapon_touch; - setsize(self, '-16 -16 0', '16 16 56'); - StartItem(); + set_size(self, '-16 -16 0', '16 16 56'); + start_item(); }; @@ -576,7 +576,7 @@ void(.float ammo, float max) distribute_ammo = { bound_ammo(pl); stemp = self; self = pl; - W_SetCurrentAmmo(); + wep_set_current_ammo(); self = stemp; pl = find(pl, classname, "player"); } @@ -601,7 +601,7 @@ void() ammo_touch = { // better stemp = self; self = other; - best = W_BestWeapon(); + best = wep_best_weapon(); self = stemp; switch(self.weapon) { @@ -619,25 +619,25 @@ void() ammo_touch = { break; } - sprint(other, "You got the ", self.netname, "\n"); + print_cl(other, "You got the ", self.netname, "\n"); // ammo touch sound sound(other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM); - stuffcmd(other, "bf\n"); + cmd_client(other, "bf\n"); // change to a better weapon if appropriate if(other.weapon == best) { stemp = self; self = other; - self.weapon = W_BestWeapon(); - W_SetCurrentAmmo(); + self.weapon = wep_best_weapon(); + wep_set_current_ammo(); self = stemp; } // if changed current ammo, update it stemp = self; self = other; - W_SetCurrentAmmo(); + wep_set_current_ammo(); self = stemp; // remove it in single player, or setup for respawning in deathmatch @@ -646,10 +646,10 @@ void() ammo_touch = { if(deathmatch == 1) { self.nextthink = time + 30; } - self.think = SUB_regen; + self.think = sub_regen; activator = other; - SUB_UseTargets(); // fire all targets / killtargets + sub_use_targets(); // fire all targets / killtargets }; /*QUAKED item_shells(0 .5 .8) (0 0 0) (32 32 32) big @@ -659,17 +659,17 @@ void() item_shells = { if(self.spawnflags & AMMO_BIG) { precache_model("maps/b_shell1.bsp"); - setmodel(self, "maps/b_shell1.bsp"); + set_model(self, "maps/b_shell1.bsp"); self.aflag = 40; } else { precache_model("maps/b_shell0.bsp"); - setmodel(self, "maps/b_shell0.bsp"); + set_model(self, "maps/b_shell0.bsp"); self.aflag = 20; } self.weapon = 1; self.netname = "shells"; - setsize(self, VEC_ORIGIN, '32 32 56'); - StartItem(); + set_size(self, VEC_ORIGIN, '32 32 56'); + start_item(); }; /*QUAKED item_spikes(0 .5 .8) (0 0 0) (32 32 32) big @@ -679,17 +679,17 @@ void() item_spikes = { if(self.spawnflags & AMMO_BIG) { precache_model("maps/b_nail1.bsp"); - setmodel(self, "maps/b_nail1.bsp"); + set_model(self, "maps/b_nail1.bsp"); self.aflag = 50; } else { precache_model("maps/b_nail0.bsp"); - setmodel(self, "maps/b_nail0.bsp"); + set_model(self, "maps/b_nail0.bsp"); self.aflag = 25; } self.weapon = 2; self.netname = "nails"; - setsize(self, VEC_ORIGIN, '32 32 56'); - StartItem(); + set_size(self, VEC_ORIGIN, '32 32 56'); + start_item(); }; /*QUAKED item_rockets(0 .5 .8) (0 0 0) (32 32 32) big @@ -699,17 +699,17 @@ void() item_rockets = { if(self.spawnflags & AMMO_BIG) { precache_model("maps/b_rock1.bsp"); - setmodel(self, "maps/b_rock1.bsp"); + set_model(self, "maps/b_rock1.bsp"); self.aflag = 10; } else { precache_model("maps/b_rock0.bsp"); - setmodel(self, "maps/b_rock0.bsp"); + set_model(self, "maps/b_rock0.bsp"); self.aflag = 5; } self.weapon = 3; self.netname = "rockets"; - setsize(self, VEC_ORIGIN, '32 32 56'); - StartItem(); + set_size(self, VEC_ORIGIN, '32 32 56'); + start_item(); }; @@ -721,17 +721,17 @@ void() item_cells = { if(self.spawnflags & AMMO_BIG) { precache_model("maps/b_batt1.bsp"); - setmodel(self, "maps/b_batt1.bsp"); + set_model(self, "maps/b_batt1.bsp"); self.aflag = 12; } else { precache_model("maps/b_batt0.bsp"); - setmodel(self, "maps/b_batt0.bsp"); + set_model(self, "maps/b_batt0.bsp"); self.aflag = 6; } self.weapon = 4; self.netname = "cells"; - setsize(self, VEC_ORIGIN, '32 32 56'); - StartItem(); + set_size(self, VEC_ORIGIN, '32 32 56'); + start_item(); }; /* @@ -752,10 +752,10 @@ void() key_touch = { return; } - sprint(other, "You got the ", self.netname, "\n"); + print_cl(other, "You got the ", self.netname, "\n"); sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM); - stuffcmd(other, "bf\n"); + cmd_client(other, "bf\n"); other.items = other.items | self.items; if(!coop) { @@ -764,7 +764,7 @@ void() key_touch = { } activator = other; - SUB_UseTargets(); // fire all targets / killtargets + sub_use_targets(); // fire all targets / killtargets }; @@ -797,26 +797,26 @@ following: */ void() item_key1 = { - self.netname = Key1Name(); + self.netname = key_1_name(); switch(world.worldtype) { case WORLD_MEDIEVAL: precache_model("progs/w_s_key.mdl"); - setmodel(self, "progs/w_s_key.mdl"); + set_model(self, "progs/w_s_key.mdl"); break; case WORLD_METAL: precache_model("progs/m_s_key.mdl"); - setmodel(self, "progs/m_s_key.mdl"); + set_model(self, "progs/m_s_key.mdl"); break; case WORLD_BASE: precache_model2("progs/b_s_key.mdl"); - setmodel(self, "progs/b_s_key.mdl"); + set_model(self, "progs/b_s_key.mdl"); break; } key_setsounds(); self.touch = key_touch; self.items = IT_KEY1; - setsize(self, '-16 -16 -24', '16 16 32'); - StartItem(); + set_size(self, '-16 -16 -24', '16 16 32'); + start_item(); }; /*QUAKED item_key2(0 .5 .8) (-16 -16 -24) (16 16 32) @@ -831,26 +831,26 @@ following: */ void() item_key2 = { - self.netname = Key2Name(); + self.netname = key_2_name(); switch(world.worldtype) { case WORLD_MEDIEVAL: precache_model("progs/w_g_key.mdl"); - setmodel(self, "progs/w_g_key.mdl"); + set_model(self, "progs/w_g_key.mdl"); break; case WORLD_METAL: precache_model("progs/m_g_key.mdl"); - setmodel(self, "progs/m_g_key.mdl"); + set_model(self, "progs/m_g_key.mdl"); break; case WORLD_BASE: precache_model2("progs/b_g_key.mdl"); - setmodel(self, "progs/b_g_key.mdl"); + set_model(self, "progs/b_g_key.mdl"); break; } key_setsounds(); self.touch = key_touch; self.items = IT_KEY2; - setsize(self, '-16 -16 -24', '16 16 32'); - StartItem(); + set_size(self, '-16 -16 -24', '16 16 32'); + start_item(); }; @@ -871,17 +871,17 @@ void() sigil_touch = { return; } - centerprint(other, "You got the rune!"); + print_center(other, "You got the rune!"); sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM); - stuffcmd(other, "bf\n"); + cmd_client(other, "bf\n"); self.solid = SOLID_NOT; self.model = string_null; serverflags = serverflags | (self.spawnflags & 15); self.classname = string_null; // so rune doors won't find it activator = other; - SUB_UseTargets(); // fire all targets / killtargets + sub_use_targets(); // fire all targets / killtargets }; @@ -891,7 +891,7 @@ End of level sigil, pick up to end episode and return to jrstart. void() item_sigil = { if(!self.spawnflags) { - objerror("no spawnflags"); + error_obj("no spawnflags"); } precache_sound("misc/runekey.wav"); @@ -899,24 +899,24 @@ void() item_sigil = { if(self.spawnflags & SIGIL_1) { precache_model("progs/end1.mdl"); - setmodel(self, "progs/end1.mdl"); + set_model(self, "progs/end1.mdl"); } if(self.spawnflags & SIGIL_2) { precache_model2("progs/end2.mdl"); - setmodel(self, "progs/end2.mdl"); + set_model(self, "progs/end2.mdl"); } if(self.spawnflags & SIGIL_3) { precache_model2("progs/end3.mdl"); - setmodel(self, "progs/end3.mdl"); + set_model(self, "progs/end3.mdl"); } if(self.spawnflags & SIGIL_4) { precache_model2("progs/end4.mdl"); - setmodel(self, "progs/end4.mdl"); + set_model(self, "progs/end4.mdl"); } self.touch = sigil_touch; - setsize(self, '-16 -16 -24', '16 16 32'); - StartItem(); + set_size(self, '-16 -16 -24', '16 16 32'); + start_item(); }; /* @@ -935,7 +935,7 @@ void() powerup_touch = { return; } - sprint(other, "You got the ", self.netname, "\n"); + print_cl(other, "You got the ", self.netname, "\n"); if(deathmatch) { self.mdl = self.model; @@ -945,11 +945,11 @@ void() powerup_touch = { } else { self.nextthink = time + 60; } - self.think = SUB_regen; + self.think = sub_regen; } sound(other, CHAN_VOICE, self.noise, 1, ATTN_NORM); - stuffcmd(other, "bf\n"); + cmd_client(other, "bf\n"); self.solid = SOLID_NOT; other.items = other.items | self.items; self.model = string_null; @@ -976,7 +976,7 @@ void() powerup_touch = { } activator = other; - SUB_UseTargets(); // fire all targets / killtargets + sub_use_targets(); // fire all targets / killtargets }; @@ -992,11 +992,11 @@ void() item_artifact_invulnerability = { precache_sound("items/protect2.wav"); precache_sound("items/protect3.wav"); self.noise = "items/protect.wav"; - setmodel(self, "progs/invulner.mdl"); + set_model(self, "progs/invulner.mdl"); self.netname = "Pentagram of Protection"; self.items = IT_INVULNERABILITY; - setsize(self, '-16 -16 -24', '16 16 32'); - StartItem(); + set_size(self, '-16 -16 -24', '16 16 32'); + start_item(); }; /*QUAKED item_artifact_envirosuit(0 .5 .8) (-16 -16 -24) (16 16 32) @@ -1009,11 +1009,11 @@ void() item_artifact_envirosuit = { precache_sound("items/suit.wav"); precache_sound("items/suit2.wav"); self.noise = "items/suit.wav"; - setmodel(self, "progs/suit.mdl"); + set_model(self, "progs/suit.mdl"); self.netname = "Biosuit"; self.items = IT_SUIT; - setsize(self, '-16 -16 -24', '16 16 32'); - StartItem(); + set_size(self, '-16 -16 -24', '16 16 32'); + start_item(); }; @@ -1028,11 +1028,11 @@ void() item_artifact_invisibility = { precache_sound("items/inv2.wav"); precache_sound("items/inv3.wav"); self.noise = "items/inv1.wav"; - setmodel(self, "progs/invisibl.mdl"); + set_model(self, "progs/invisibl.mdl"); self.netname = "Ring of Shadows"; self.items = IT_INVISIBILITY; - setsize(self, '-16 -16 -24', '16 16 32'); - StartItem(); + set_size(self, '-16 -16 -24', '16 16 32'); + start_item(); }; @@ -1047,11 +1047,11 @@ void() item_artifact_super_damage = { precache_sound("items/damage2.wav"); precache_sound("items/damage3.wav"); self.noise = "items/damage.wav"; - setmodel(self, "progs/quaddama.mdl"); + set_model(self, "progs/quaddama.mdl"); self.netname = "Quad Damage"; self.items = IT_QUAD; - setsize(self, '-16 -16 -24', '16 16 32'); - StartItem(); + set_size(self, '-16 -16 -24', '16 16 32'); + start_item(); }; @@ -1064,7 +1064,7 @@ PLAYER BACKPACKS =============================================================================== */ -void() BackpackTouch = { +void() backpack_touch = { float best, old, new; entity stemp; float acount; @@ -1074,18 +1074,18 @@ void() BackpackTouch = { } acount = 0; - sprint(other, "You get "); + print_cl(other, "You get "); if(self.weapon && (other.items & self.weapon) == 0) { acount = 1; - sprint(other, "the ", self.netname); + print_cl(other, "the ", self.netname); } // if the player was using their best weapon, change up to the new one if // better stemp = self; self = other; - best = W_BestWeapon(); + best = wep_best_weapon(); self = stemp; // change weapons @@ -1105,51 +1105,51 @@ void() BackpackTouch = { if(self.ammo_shells) { if(acount) { - sprint(other, ", "); + print_cl(other, ", "); } acount = 1; - sprint(other, ftos(self.ammo_shells), " shells"); + print_cl(other, ftos(self.ammo_shells), " shells"); } if(self.ammo_nails) { if(acount) { - sprint(other, ", "); + print_cl(other, ", "); } acount = 1; - sprint(other, ftos(self.ammo_nails), " nails"); + print_cl(other, ftos(self.ammo_nails), " nails"); } if(self.ammo_rockets) { if(acount) { - sprint(other, ", "); + print_cl(other, ", "); } acount = 1; - sprint(other, ftos(self.ammo_rockets), " rockets"); + print_cl(other, ftos(self.ammo_rockets), " rockets"); } if(self.ammo_cells) { if(acount) { - sprint(other, ", "); + print_cl(other, ", "); } acount = 1; - sprint(other, ftos(self.ammo_cells), " cells"); + print_cl(other, ftos(self.ammo_cells), " cells"); } if(self.items & IT_KEY1) { if(acount) { - sprint(other, ", "); + print_cl(other, ", "); } acount = 1; - sprint(other, Key1Name()); + print_cl(other, key_1_name()); } if(self.items & IT_KEY2) { if(acount) { - sprint(other, ", "); + print_cl(other, ", "); } acount = 1; - sprint(other, Key2Name()); + print_cl(other, key_2_name()); } - sprint(other, "\n"); + print_cl(other, "\n"); // backpack touch sound sound(other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM); - stuffcmd(other, "bf\n"); + cmd_client(other, "bf\n"); // remove the backpack, change self to the player remove(self); @@ -1159,18 +1159,18 @@ void() BackpackTouch = { if(!deathmatch) { self.weapon = new; } else { - Deathmatch_Weapon(old, new); + wep_deathmatch_weapon(old, new); } - W_SetCurrentAmmo(); + wep_set_current_ammo(); }; /* =============== -DropBackpack +drop_backpack =============== */ -entity() DropBackpack = { +entity() drop_backpack = { entity item; item = spawn(); @@ -1220,12 +1220,12 @@ entity() DropBackpack = { item.flags = FL_ITEM; item.solid = SOLID_TRIGGER; item.movetype = MOVETYPE_TOSS; - setmodel(item, "progs/backpack.mdl"); - setsize(item, '-16 -16 0', '16 16 56'); - item.touch = BackpackTouch; + set_model(item, "progs/backpack.mdl"); + set_size(item, '-16 -16 0', '16 16 56'); + item.touch = backpack_touch; item.nextthink = time + 120; // remove after 2 minutes - item.think = SUB_Remove; + item.think = sub_remove; return item; }; diff --git a/source/knight.qc b/source/knight.qc index 21d6e57..5cb37ba 100644 --- a/source/knight.qc +++ b/source/knight.qc @@ -205,10 +205,10 @@ void() knight_die = { // check for gib if(self.health < -40) { sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); - ThrowHead("progs/h_knight.mdl", self.health); - ThrowGib("progs/gib1.mdl", self.health); - ThrowGib("progs/gib2.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); + throw_head("progs/h_knight.mdl", self.health); + throw_gib("progs/gib1.mdl", self.health); + throw_gib("progs/gib2.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); return; } @@ -241,9 +241,9 @@ void() monster_knight = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/knight.mdl"); + set_model(self, "progs/knight.mdl"); - setsize(self, '-16 -16 -24', '16 16 40'); + set_size(self, '-16 -16 -24', '16 16 40'); self.health = 75; self.th_stand = knight_stand1; diff --git a/source/misc.qc b/source/misc.qc index 1df3e3f..f735216 100644 --- a/source/misc.qc +++ b/source/misc.qc @@ -17,10 +17,10 @@ void() info_notnull = { void() light_use = { if(self.spawnflags & LIGHT_START_OFF) { - lightstyle(self.style, "m"); + light_style(self.style, "m"); self.spawnflags = self.spawnflags - LIGHT_START_OFF; } else { - lightstyle(self.style, "a"); + light_style(self.style, "a"); self.spawnflags = self.spawnflags + LIGHT_START_OFF; } }; @@ -41,9 +41,9 @@ void() light = { if(self.style >= 32) { self.use = light_use; if(self.spawnflags & LIGHT_START_OFF) { - lightstyle(self.style, "a"); + light_style(self.style, "a"); } else { - lightstyle(self.style, "m"); + light_style(self.style, "m"); } } }; @@ -59,14 +59,14 @@ void() light_fluoro = { if(self.style >= 32) { self.use = light_use; if(self.spawnflags & LIGHT_START_OFF) { - lightstyle(self.style, "a"); + light_style(self.style, "a"); } else { - lightstyle(self.style, "m"); + light_style(self.style, "m"); } } precache_sound("ambience/fl_hum1.wav"); - ambientsound(self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC); + ambient_sound(self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC); }; /*QUAKED light_fluorospark(0 1 0) (-8 -8 -8) (8 8 8) @@ -81,7 +81,7 @@ void() light_fluorospark = { } precache_sound("ambience/buzz1.wav"); - ambientsound(self.origin, "ambience/buzz1.wav", 0.5, ATTN_STATIC); + ambient_sound(self.origin, "ambience/buzz1.wav", 0.5, ATTN_STATIC); }; /*QUAKED light_globe(0 1 0) (-8 -8 -8) (8 8 8) @@ -91,14 +91,14 @@ Default style is 0 */ void() light_globe = { precache_model("progs/s_light.spr"); - setmodel(self, "progs/s_light.spr"); - makestatic(self); + set_model(self, "progs/s_light.spr"); + make_static(self); }; -void() FireAmbient = { +void() fire_ambient = { precache_sound("ambience/fire1.wav"); // attenuate fast - ambientsound(self.origin, "ambience/fire1.wav", 0.5, ATTN_STATIC); + ambient_sound(self.origin, "ambience/fire1.wav", 0.5, ATTN_STATIC); }; /*QUAKED light_torch_small_walltorch(0 .5 0) (-10 -10 -20) (10 10 20) @@ -108,9 +108,9 @@ Default style is 0 */ void() light_torch_small_walltorch = { precache_model("progs/flame.mdl"); - setmodel(self, "progs/flame.mdl"); - FireAmbient(); - makestatic(self); + set_model(self, "progs/flame.mdl"); + fire_ambient(); + make_static(self); }; /*QUAKED light_flame_large_yellow(0 1 0) (-10 -10 -12) (12 12 18) @@ -118,10 +118,10 @@ Large yellow flame ball */ void() light_flame_large_yellow = { precache_model("progs/flame2.mdl"); - setmodel(self, "progs/flame2.mdl"); + set_model(self, "progs/flame2.mdl"); self.frame = 1; - FireAmbient(); - makestatic(self); + fire_ambient(); + make_static(self); }; /*QUAKED light_flame_small_yellow(0 1 0) (-8 -8 -8) (8 8 8) START_OFF @@ -129,9 +129,9 @@ Small yellow flame ball */ void() light_flame_small_yellow = { precache_model("progs/flame2.mdl"); - setmodel(self, "progs/flame2.mdl"); - FireAmbient(); - makestatic(self); + set_model(self, "progs/flame2.mdl"); + fire_ambient(); + make_static(self); }; /*QUAKED light_flame_small_white(0 1 0) (-10 -10 -40) (10 10 40) START_OFF @@ -139,9 +139,9 @@ Small white flame ball */ void() light_flame_small_white = { precache_model("progs/flame2.mdl"); - setmodel(self, "progs/flame2.mdl"); - FireAmbient(); - makestatic(self); + set_model(self, "progs/flame2.mdl"); + fire_ambient(); + make_static(self); }; //============================================================================ @@ -171,11 +171,11 @@ void() fire_fly = { fireball.velocity_y = (random() * 100) - 50; fireball.velocity_z = self.speed + (random() * 200); fireball.classname = "fireball"; - setmodel(fireball, "progs/lavaball.mdl"); - setsize(fireball, VEC_ORIGIN, VEC_ORIGIN); - setorigin(fireball, self.origin); + set_model(fireball, "progs/lavaball.mdl"); + set_size(fireball, VEC_ORIGIN, VEC_ORIGIN); + set_origin(fireball, self.origin); fireball.nextthink = time + 5; - fireball.think = SUB_Remove; + fireball.think = sub_remove; fireball.touch = fire_touch; self.nextthink = time + (random() * 5) + 3; @@ -183,7 +183,7 @@ void() fire_fly = { }; void() fire_touch = { - T_Damage(other, self, self, 20); + ent_damage(other, self, self, 20); remove(self); }; @@ -193,12 +193,12 @@ void() barrel_explode = { self.takedamage = DAMAGE_NO; self.classname = "explo_box"; // did say self.owner - T_RadiusDamage(self, self, 160, world); + ent_radius_damage(self, self, 160, world); sound(self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM); particle(self.origin, VEC_ORIGIN, 75, 255); self.origin_z = self.origin_z + 32; - BecomeExplosion(); + become_explosion(); }; @@ -212,7 +212,7 @@ void() misc_explobox = { self.solid = SOLID_BBOX; self.movetype = MOVETYPE_NONE; precache_model("maps/b_explob.bsp"); - setmodel(self, "maps/b_explob.bsp"); + set_model(self, "maps/b_explob.bsp"); precache_sound("weapons/r_exp3.wav"); self.health = 20; self.th_die = barrel_explode; @@ -220,9 +220,9 @@ void() misc_explobox = { self.origin_z = self.origin_z + 2; oldz = self.origin_z; - droptofloor(); + drop_to_floor(); if(oldz - self.origin_z > 250) { - dprint("item fell out of level at ", vtos(self.origin), "\n"); + print_dbg("item fell out of level at ", vtos(self.origin), "\n"); remove(self); } }; @@ -239,7 +239,7 @@ void() misc_explobox2 = { self.solid = SOLID_BBOX; self.movetype = MOVETYPE_NONE; precache_model2("maps/b_exbox2.bsp"); - setmodel(self, "maps/b_exbox2.bsp"); + set_model(self, "maps/b_exbox2.bsp"); precache_sound("weapons/r_exp3.wav"); self.health = 20; self.th_die = barrel_explode; @@ -247,9 +247,9 @@ void() misc_explobox2 = { self.origin_z = self.origin_z + 2; oldz = self.origin_z; - droptofloor(); + drop_to_floor(); if(oldz - self.origin_z > 250) { - dprint("item fell out of level at ", vtos(self.origin), "\n"); + print_dbg("item fell out of level at ", vtos(self.origin), "\n"); remove(self); } }; @@ -259,7 +259,7 @@ void() misc_explobox2 = { void() spikeshooter_use = { if(self.spawnflags & SPIKESHOOTER_LASER) { sound(self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM); - LaunchLaser(self.origin, self.movedir); + launch_laser(self.origin, self.movedir); } else { sound(self, CHAN_VOICE, "weapons/spike2.wav", 1, ATTN_NORM); launch_spike(self.origin, self.movedir); @@ -282,7 +282,7 @@ Laser is only for REGISTERED. */ void() trap_spikeshooter = { - SetMovedir(); + set_move_dir(); self.use = spikeshooter_use; if(self.spawnflags & SPIKESHOOTER_LASER) { precache_model2("progs/laser.mdl"); @@ -334,8 +334,8 @@ void() make_bubbles = { entity bubble; bubble = spawn(); - setmodel(bubble, "progs/s_bubble.spr"); - setorigin(bubble, self.origin); + set_model(bubble, "progs/s_bubble.spr"); + set_origin(bubble, self.origin); bubble.movetype = MOVETYPE_NOCLIP; bubble.solid = SOLID_NOT; bubble.velocity = '0 0 15'; @@ -345,7 +345,7 @@ void() make_bubbles = { bubble.classname = "bubble"; bubble.frame = 0; bubble.cnt = 0; - setsize(bubble, '-8 -8 -8', '8 8 8'); + set_size(bubble, '-8 -8 -8', '8 8 8'); self.nextthink = time + random() + 0.5; self.think = make_bubbles; }; @@ -353,8 +353,8 @@ void() make_bubbles = { void() bubble_split = { entity bubble; bubble = spawn(); - setmodel(bubble, "progs/s_bubble.spr"); - setorigin(bubble, self.origin); + set_model(bubble, "progs/s_bubble.spr"); + set_origin(bubble, self.origin); bubble.movetype = MOVETYPE_NOCLIP; bubble.solid = SOLID_NOT; bubble.velocity = self.velocity; @@ -364,7 +364,7 @@ void() bubble_split = { bubble.classname = "bubble"; bubble.frame = 1; bubble.cnt = 10; - setsize(bubble, '-8 -8 -8', '8 8 8'); + set_size(bubble, '-8 -8 -8', '8 8 8'); self.frame = 1; self.cnt = 10; if(self.waterlevel != 3) { @@ -374,7 +374,7 @@ void() bubble_split = { void() bubble_remove = { if(other.classname == self.classname) { - // dprint("bump"); + // print_dbg("bump"); return; } remove(self); @@ -437,7 +437,7 @@ void() viewthing = { self.movetype = MOVETYPE_NONE; self.solid = SOLID_NOT; precache_model("progs/player.mdl"); - setmodel(self, "progs/player.mdl"); + set_model(self, "progs/player.mdl"); }; /* @@ -461,7 +461,7 @@ void() func_wall = { self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self.solid = SOLID_BSP; self.use = func_wall_use; - setmodel(self, self.model); + set_model(self, self.model); }; /*QUAKED func_illusionary(0 .5 .8) ? @@ -471,8 +471,8 @@ void() func_illusionary = { self.angles = VEC_ORIGIN; self.movetype = MOVETYPE_NONE; self.solid = SOLID_NOT; - setmodel(self, self.model); - makestatic(self); + set_model(self, self.model); + make_static(self); }; /*QUAKED func_episodegate(0 .5 .8) ? E1 E2 E3 E4 @@ -487,7 +487,7 @@ void() func_episodegate = { self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self.solid = SOLID_BSP; self.use = func_wall_use; - setmodel(self, self.model); + set_model(self, self.model); }; /*QUAKED func_bossgate(0 .5 .8) ? @@ -501,7 +501,7 @@ void() func_bossgate = { self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self.solid = SOLID_BSP; self.use = func_wall_use; - setmodel(self, self.model); + set_model(self, self.model); }; //============================================================================ @@ -509,57 +509,57 @@ void() func_bossgate = { */ void() ambient_suck_wind = { precache_sound("ambience/suck1.wav"); - ambientsound(self.origin, "ambience/suck1.wav", 1, ATTN_STATIC); + ambient_sound(self.origin, "ambience/suck1.wav", 1, ATTN_STATIC); }; /*QUAKED ambient_drone(0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void() ambient_drone = { precache_sound("ambience/drone6.wav"); - ambientsound(self.origin, "ambience/drone6.wav", 0.5, ATTN_STATIC); + ambient_sound(self.origin, "ambience/drone6.wav", 0.5, ATTN_STATIC); }; /*QUAKED ambient_flouro_buzz(0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void() ambient_flouro_buzz = { precache_sound("ambience/buzz1.wav"); - ambientsound(self.origin, "ambience/buzz1.wav", 1, ATTN_STATIC); + ambient_sound(self.origin, "ambience/buzz1.wav", 1, ATTN_STATIC); }; /*QUAKED ambient_drip(0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void() ambient_drip = { precache_sound("ambience/drip1.wav"); - ambientsound(self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC); + ambient_sound(self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC); }; /*QUAKED ambient_comp_hum(0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void() ambient_comp_hum = { precache_sound("ambience/comp1.wav"); - ambientsound(self.origin, "ambience/comp1.wav", 1, ATTN_STATIC); + ambient_sound(self.origin, "ambience/comp1.wav", 1, ATTN_STATIC); }; /*QUAKED ambient_thunder(0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void() ambient_thunder = { precache_sound("ambience/thunder1.wav"); - ambientsound(self.origin, "ambience/thunder1.wav", 0.5, ATTN_STATIC); + ambient_sound(self.origin, "ambience/thunder1.wav", 0.5, ATTN_STATIC); }; /*QUAKED ambient_light_buzz(0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void() ambient_light_buzz = { precache_sound("ambience/fl_hum1.wav"); - ambientsound(self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC); + ambient_sound(self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC); }; /*QUAKED ambient_swamp1(0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void() ambient_swamp1 = { precache_sound("ambience/swamp1.wav"); - ambientsound(self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC); + ambient_sound(self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC); }; /*QUAKED ambient_swamp2(0.3 0.1 0.6) (-10 -10 -8) (10 10 8) */ void() ambient_swamp2 = { precache_sound("ambience/swamp2.wav"); - ambientsound(self.origin, "ambience/swamp2.wav", 0.5, ATTN_STATIC); + ambient_sound(self.origin, "ambience/swamp2.wav", 0.5, ATTN_STATIC); }; //============================================================================ diff --git a/source/monsters.qc b/source/monsters.qc index 54d2306..dea0bf8 100644 --- a/source/monsters.qc +++ b/source/monsters.qc @@ -40,7 +40,7 @@ void() monster_use = { // heard self.enemy = activator; self.nextthink = time + 0.1; - self.think = FoundTarget; + self.think = found_target; }; /* @@ -67,7 +67,7 @@ void() monster_death_use = { } activator = self.enemy; - SUB_UseTargets(); + sub_use_targets(); }; //============================================================================ @@ -77,10 +77,10 @@ void() walkmonster_start_go = { entity etemp; self.origin_z = self.origin_z + 1; // raise off floor a bit - droptofloor(); + drop_to_floor(); - if(!walkmove(0, 0)) { - dprint("walkmonster in wall at: ", vtos(self.origin), "\n"); + if(!walk_move(0, 0)) { + print_dbg("walkmonster in wall at: ", vtos(self.origin), "\n"); } self.takedamage = DAMAGE_AIM; @@ -96,11 +96,11 @@ void() walkmonster_start_go = { if(self.target) { self.goalentity = self.movetarget = find(world, targetname, self.target); - self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin); + self.ideal_yaw = vec_yaw(self.goalentity.origin - self.origin); if(!self.movetarget) { - dprint("Monster can't find target at ", vtos(self.origin), "\n"); + print_dbg("Monster can't find target at ", vtos(self.origin), "\n"); } - // this used to be an objerror + // this used to be an error_obj if(self.movetarget.classname == "path_corner") { self.th_walk(); } else { @@ -138,16 +138,16 @@ void() flymonster_start_go = { self.flags = self.flags | FL_FLY; self.flags = self.flags | FL_MONSTER; - if(!walkmove(0, 0)) { - dprint("flymonster in wall at: ", vtos(self.origin), "\n"); + if(!walk_move(0, 0)) { + print_dbg("flymonster in wall at: ", vtos(self.origin), "\n"); } if(self.target) { self.goalentity = self.movetarget = find(world, targetname, self.target); if(!self.movetarget) { - dprint("Monster can't find target at ", vtos(self.origin), "\n"); + print_dbg("Monster can't find target at ", vtos(self.origin), "\n"); } - // this used to be an objerror + // this used to be an error_obj if(self.movetarget.classname == "path_corner") { self.th_walk(); } else { @@ -189,10 +189,10 @@ void() swimmonster_start_go = { if(self.target) { self.goalentity = self.movetarget = find(world, targetname, self.target); if(!self.movetarget) { - dprint("Monster can't find target at ", vtos(self.origin), "\n"); + print_dbg("Monster can't find target at ", vtos(self.origin), "\n"); } - // this used to be an objerror - self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin); + // this used to be an error_obj + self.ideal_yaw = vec_yaw(self.goalentity.origin - self.origin); self.th_walk(); } else { self.pausetime = 99999999; diff --git a/source/ogre.qc b/source/ogre.qc index fe543bc..01c5e99 100644 --- a/source/ogre.qc +++ b/source/ogre.qc @@ -41,31 +41,99 @@ $frame bdeath7 bdeath8 bdeath9 bdeath10 $frame pull1 pull2 pull3 pull4 pull5 pull6 pull7 pull8 pull9 pull10 pull11 +//============================================================================ + +/* +=========== +ogre_check_attack + +The player is in view, so decide to move or launch an attack +Returns FALSE if movement should continue +============ +*/ +float() ogre_check_attack = { + vector spot1, spot2; + entity targ; + float chance; + + if(enemy_range == RANGE_MELEE) { + if(can_damage(self.enemy, self)) { + self.attack_state = AS_MELEE; + return TRUE; + } + } + + if(time < self.attack_finished) { + return FALSE; + } + + if(!enemy_vis) { + return FALSE; + } + + targ = self.enemy; + + // see if any entities are in the way of the shot + spot1 = self.origin + self.view_ofs; + spot2 = targ.origin + targ.view_ofs; + + trace_line(spot1, spot2, FALSE, self); + + if(trace_inopen && trace_inwater) { + return FALSE; // sight line crossed contents + } + + if(trace_ent != targ) { + return FALSE; // don't have a clear shot + } + + // missile attack + if(time < self.attack_finished) { + return FALSE; + } + + if(enemy_range == RANGE_FAR) { + return FALSE; + } + + else if(enemy_range == RANGE_NEAR) { + chance = 0.10; + } else if(enemy_range == RANGE_MID) { + chance = 0.05; + } else { + chance = 0; + } + + self.attack_state = AS_MISSILE; + sub_attack_finished(1 + 2 * random()); + return TRUE; +}; + //============================================================================= -void() OgreGrenadeExplode = { - T_RadiusDamage(self, self.owner, 40, world); +void() ogre_grenade_explode = { + ent_radius_damage(self, self.owner, 40, world); sound(self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM); - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_EXPLOSION); - WriteCoord(MSG_BROADCAST, self.origin_x); - WriteCoord(MSG_BROADCAST, self.origin_y); - WriteCoord(MSG_BROADCAST, self.origin_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_EXPLOSION); + write_coord(MSG_BROADCAST, self.origin_x); + write_coord(MSG_BROADCAST, self.origin_y); + write_coord(MSG_BROADCAST, self.origin_z); self.velocity = VEC_ORIGIN; - self.touch = SUB_Null; - setmodel(self, "progs/s_explod.spr"); + self.touch = sub_null; + set_model(self, "progs/s_explod.spr"); self.solid = SOLID_NOT; s_explode1(); }; -void() OgreGrenadeTouch = { +void() ogre_grenade_touch = { if(other == self.owner) { return; // don't explode on owner } if(other.takedamage == DAMAGE_AIM) { - OgreGrenadeExplode(); + ogre_grenade_explode(); return; } sound(self, CHAN_VOICE, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound @@ -76,10 +144,10 @@ void() OgreGrenadeTouch = { /* ================ -OgreFireGrenade +ogre_fire_grenade ================ */ -void() OgreFireGrenade = { +void() ogre_fire_grenade = { entity missile, mpuff; self.effects = self.effects | EF_MUZZLEFLASH; @@ -93,7 +161,7 @@ void() OgreFireGrenade = { // set missile speed - makevectors(self.angles); + make_vectors(self.angles); missile.velocity = normalize(self.enemy.origin - self.origin); missile.velocity = missile.velocity * 600; @@ -101,17 +169,17 @@ void() OgreFireGrenade = { missile.avelocity = '300 300 300'; - missile.angles = vectoangles(missile.velocity); + missile.angles = vec_to_angles(missile.velocity); - missile.touch = OgreGrenadeTouch; + missile.touch = ogre_grenade_touch; // set missile duration missile.nextthink = time + 2.5; - missile.think = OgreGrenadeExplode; + missile.think = ogre_grenade_explode; - setmodel(missile, "progs/grenade.mdl"); - setsize(missile, VEC_ORIGIN, VEC_ORIGIN); - setorigin(missile, self.origin); + set_model(missile, "progs/grenade.mdl"); + set_size(missile, VEC_ORIGIN, VEC_ORIGIN); + set_origin(missile, self.origin); }; //============================================================================= @@ -130,7 +198,7 @@ void(float side) chainsaw = { if(!self.enemy) { return; } - if(!CanDamage(self.enemy, self)) { + if(!can_damage(self.enemy, self)) { return; } @@ -138,19 +206,19 @@ void(float side) chainsaw = { delta = self.enemy.origin - self.origin; - if(vlen(delta) > 100) { + if(vec_len(delta) > 100) { return; } ldmg = (random() + random() + random()) * 4; - T_Damage(self.enemy, self, self, ldmg); + ent_damage(self.enemy, self, self, ldmg); if(side) { - makevectors(self.angles); + make_vectors(self.angles); if(side == 1) { - SpawnMeatSpray(self.origin + v_forward * 16, crandom() * 100 * v_right); + spawn_meat_spray(self.origin + v_forward * 16, crandom() * 100 * v_right); } else { - SpawnMeatSpray(self.origin + v_forward * 16, side * v_right); + spawn_meat_spray(self.origin + v_forward * 16, side * v_right); } } }; @@ -250,7 +318,7 @@ void() ogre_smash14 = [ $smash14, ogre_run1 ] {ai_charge(12);}; void() ogre_nail1 = [ $shoot1, ogre_nail2 ] {ai_face();}; void() ogre_nail2 = [ $shoot2, ogre_nail3 ] {ai_face();}; void() ogre_nail3 = [ $shoot2, ogre_nail4 ] {ai_face();}; -void() ogre_nail4 = [ $shoot3, ogre_nail5 ] {ai_face(); OgreFireGrenade();}; +void() ogre_nail4 = [ $shoot3, ogre_nail5 ] {ai_face(); ogre_fire_grenade();}; void() ogre_nail5 = [ $shoot4, ogre_nail6 ] {ai_face();}; void() ogre_nail6 = [ $shoot5, ogre_nail7 ] {ai_face();}; void() ogre_nail7 = [ $shoot6, ogre_run1 ] {ai_face();}; @@ -340,7 +408,7 @@ void() ogre_die2 = [ $death2, ogre_die3 ] {}; void() ogre_die3 = [ $death3, ogre_die4 ] { self.solid = SOLID_NOT; self.ammo_rockets = 2; - DropBackpack(); + drop_backpack(); }; void() ogre_die4 = [ $death4, ogre_die5 ] {}; void() ogre_die5 = [ $death5, ogre_die6 ] {}; @@ -359,7 +427,7 @@ void() ogre_bdie2 = [ $bdeath2, ogre_bdie3 ] {ai_forward(5);}; void() ogre_bdie3 = [ $bdeath3, ogre_bdie4 ] { self.solid = SOLID_NOT; self.ammo_rockets = 2; - DropBackpack(); + drop_backpack(); }; void() ogre_bdie4 = [ $bdeath4, ogre_bdie5 ] {ai_forward(1);}; void() ogre_bdie5 = [ $bdeath5, ogre_bdie6 ] {ai_forward(3);}; @@ -373,10 +441,10 @@ void() ogre_die = { // check for gib if(self.health < -80) { sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); - ThrowHead("progs/h_ogre.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); + throw_head("progs/h_ogre.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); return; } @@ -420,9 +488,9 @@ void() monster_ogre = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/ogre.mdl"); + set_model(self, "progs/ogre.mdl"); - setsize(self, '-32 -32 -24', '32 32 64'); + set_size(self, '-32 -32 -24', '32 32 64'); self.health = 200; self.th_stand = ogre_stand1; diff --git a/source/oldone.qc b/source/oldone.qc index 8160f8d..620aa20 100644 --- a/source/oldone.qc +++ b/source/oldone.qc @@ -65,30 +65,30 @@ void() old_idle44 = [ $old44, old_idle45 ] {}; void() old_idle45 = [ $old45, old_idle46 ] {}; void() old_idle46 = [ $old46, old_idle1 ] {}; -void() old_thrash1 = [ $shake1, old_thrash2 ] {lightstyle(0, "m");}; -void() old_thrash2 = [ $shake2, old_thrash3 ] {lightstyle(0, "k");}; -void() old_thrash3 = [ $shake3, old_thrash4 ] {lightstyle(0, "k");}; -void() old_thrash4 = [ $shake4, old_thrash5 ] {lightstyle(0, "i");}; -void() old_thrash5 = [ $shake5, old_thrash6 ] {lightstyle(0, "g");}; -void() old_thrash6 = [ $shake6, old_thrash7 ] {lightstyle(0, "e");}; -void() old_thrash7 = [ $shake7, old_thrash8 ] {lightstyle(0, "c");}; -void() old_thrash8 = [ $shake8, old_thrash9 ] {lightstyle(0, "a");}; -void() old_thrash9 = [ $shake9, old_thrash10 ] {lightstyle(0, "c");}; -void() old_thrash10 = [ $shake10, old_thrash11 ] {lightstyle(0, "e");}; -void() old_thrash11 = [ $shake11, old_thrash12 ] {lightstyle(0, "g");}; -void() old_thrash12 = [ $shake12, old_thrash13 ] {lightstyle(0, "i");}; -void() old_thrash13 = [ $shake13, old_thrash14 ] {lightstyle(0, "k");}; -void() old_thrash14 = [ $shake14, old_thrash15 ] {lightstyle(0, "m");}; -void() old_thrash15 = [ $shake15, old_thrash16 ] {lightstyle(0, "m"); +void() old_thrash1 = [ $shake1, old_thrash2 ] {light_style(0, "m");}; +void() old_thrash2 = [ $shake2, old_thrash3 ] {light_style(0, "k");}; +void() old_thrash3 = [ $shake3, old_thrash4 ] {light_style(0, "k");}; +void() old_thrash4 = [ $shake4, old_thrash5 ] {light_style(0, "i");}; +void() old_thrash5 = [ $shake5, old_thrash6 ] {light_style(0, "g");}; +void() old_thrash6 = [ $shake6, old_thrash7 ] {light_style(0, "e");}; +void() old_thrash7 = [ $shake7, old_thrash8 ] {light_style(0, "c");}; +void() old_thrash8 = [ $shake8, old_thrash9 ] {light_style(0, "a");}; +void() old_thrash9 = [ $shake9, old_thrash10 ] {light_style(0, "c");}; +void() old_thrash10 = [ $shake10, old_thrash11 ] {light_style(0, "e");}; +void() old_thrash11 = [ $shake11, old_thrash12 ] {light_style(0, "g");}; +void() old_thrash12 = [ $shake12, old_thrash13 ] {light_style(0, "i");}; +void() old_thrash13 = [ $shake13, old_thrash14 ] {light_style(0, "k");}; +void() old_thrash14 = [ $shake14, old_thrash15 ] {light_style(0, "m");}; +void() old_thrash15 = [ $shake15, old_thrash16 ] {light_style(0, "m"); self.cnt = self.cnt + 1; if(self.cnt != 3) { self.think = old_thrash1; } }; -void() old_thrash16 = [ $shake16, old_thrash17 ] {lightstyle(0, "g");}; -void() old_thrash17 = [ $shake17, old_thrash18 ] {lightstyle(0, "c");}; -void() old_thrash18 = [ $shake18, old_thrash19 ] {lightstyle(0, "b");}; -void() old_thrash19 = [ $shake19, old_thrash20 ] {lightstyle(0, "a");}; +void() old_thrash16 = [ $shake16, old_thrash17 ] {light_style(0, "g");}; +void() old_thrash17 = [ $shake17, old_thrash18 ] {light_style(0, "c");}; +void() old_thrash18 = [ $shake18, old_thrash19 ] {light_style(0, "b");}; +void() old_thrash19 = [ $shake19, old_thrash20 ] {light_style(0, "a");}; void() old_thrash20 = [ $shake20, old_thrash20 ] {finale_4();}; //============================================================================ @@ -111,8 +111,8 @@ void() finale_1 = { } remove(pl); - WriteByte(MSG_ALL, SVC_FINALE); - WriteString(MSG_ALL, string_null); + write_byte(MSG_ALL, SVC_FINALE); + write_string(MSG_ALL, string_null); pl = find(world, classname, "player"); while(pl != world) { @@ -126,7 +126,7 @@ void() finale_1 = { pl.movetype = MOVETYPE_NONE; pl.modelindex = 0; pl.spectating = SPECTATING_FINALE; - setorigin(pl, pos.origin); + set_origin(pl, pos.origin); pl = find(pl, classname, "player"); } @@ -145,11 +145,11 @@ void() finale_2 = { // start a teleport splash inside shub o = shub.origin - '0 100 0'; - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_TELEPORT); - WriteCoord(MSG_BROADCAST, o_x); - WriteCoord(MSG_BROADCAST, o_y); - WriteCoord(MSG_BROADCAST, o_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_TELEPORT); + write_coord(MSG_BROADCAST, o_x); + write_coord(MSG_BROADCAST, o_y); + write_coord(MSG_BROADCAST, o_z); sound(shub, CHAN_VOICE, "misc/r_tele1.wav", 1, ATTN_NORM); @@ -161,10 +161,19 @@ void() finale_3 = { // start shub thrashing wildly shub.think = old_thrash1; sound(shub, CHAN_VOICE, "boss2/death.wav", 1, ATTN_NORM); - lightstyle(0, "abcdefghijklmlkjihgfedcb"); + light_style(0, "abcdefghijklmlkjihgfedcb"); }; void() finale_4 = { + const string FINALE_SHUB = + "Congratulations and well done! You have\n" + "beaten the hideous Shub-Niggurath, and\n" + "her hundreds of ugly changelings and\n" + "monsters. You have proven that your\n" + "skill and your cunning are greater than\n" + "all the powers of Quake. You are the\n" + "master now. Id Software salutes you."; + // throw tons of meat chunks vector oldo; float x, y, z; @@ -186,11 +195,11 @@ void() finale_4 = { self.origin_z = oldo_z + z; r = random(); if(r < 0.3) { - ThrowGib("progs/gib1.mdl", -999); + throw_gib("progs/gib1.mdl", -999); } else if(r < 0.6) { - ThrowGib("progs/gib2.mdl", -999); + throw_gib("progs/gib2.mdl", -999); } else { - ThrowGib("progs/gib3.mdl", -999); + throw_gib("progs/gib3.mdl", -999); } y = y + 32; } @@ -198,25 +207,26 @@ void() finale_4 = { } z = z + 96; } + // start the end text - WriteByte(MSG_ALL, SVC_FINALE); - WriteString(MSG_ALL, "Congratulations and well done! You have\nbeaten the hideous Shub-Niggurath, and\nher hundreds of ugly changelings and\nmonsters. You have proven that your\nskill and your cunning are greater than\nall the powers of Quake. You are the\nmaster now. Id Software salutes you."); + write_byte(MSG_ALL, SVC_FINALE); + write_string(MSG_ALL, FINALE_SHUB); // put a player model down n = spawn(); - setmodel(n, "progs/player.mdl"); + set_model(n, "progs/player.mdl"); oldo = oldo - '32 264 0'; - setorigin(n, oldo); + set_origin(n, oldo); n.angles = '0 290 0'; n.frame = 1; remove(self); // change cd track - WriteByte(MSG_ALL, SVC_CDTRACK); - WriteByte(MSG_ALL, 3); - WriteByte(MSG_ALL, 3); - lightstyle(0, "m"); + write_byte(MSG_ALL, SVC_CDTRACK); + write_byte(MSG_ALL, 3); + write_byte(MSG_ALL, 3); + light_style(0, "m"); }; //============================================================================ @@ -245,8 +255,8 @@ void() monster_oldone = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/oldone.mdl"); - setsize(self, '-160 -128 -24', '160 128 256'); + set_model(self, "progs/oldone.mdl"); + set_size(self, '-160 -128 -24', '160 128 256'); self.health = 40000; // kill by telefrag self.think = old_idle1; diff --git a/source/plats.qc b/source/plats.qc index ee346b4..bbc9b0b 100644 --- a/source/plats.qc +++ b/source/plats.qc @@ -29,7 +29,7 @@ void() plat_spawn_inside_trigger = { tmax_y = tmin_y + 1; } - setsize(trigger, tmin, tmax); + set_size(trigger, tmin, tmax); }; void() plat_hit_top = { @@ -47,13 +47,13 @@ void() plat_hit_bottom = { void() plat_go_down = { sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM); self.state = STATE_DOWN; - SUB_CalcMove(self.pos2, self.speed, plat_hit_bottom); + sub_calc_move(self.pos2, self.speed, plat_hit_bottom); }; void() plat_go_up = { sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM); self.state = STATE_UP; - SUB_CalcMove(self.pos1, self.speed, plat_hit_top); + sub_calc_move(self.pos1, self.speed, plat_hit_top); }; void() plat_center_touch = { @@ -82,7 +82,7 @@ void() plat_outside_touch = { return; } - //dprint("plat_outside_touch\n"); + //print_dbg("plat_outside_touch\n"); self = self.enemy; if(self.state == STATE_TOP) { plat_go_down(); @@ -97,23 +97,23 @@ void() plat_trigger_use = { }; void() plat_crush = { - //dprint("plat_crush\n"); + //print_dbg("plat_crush\n"); - T_Damage(other, self, self, 1); + ent_damage(other, self, self, 1); if(self.state == STATE_UP) { plat_go_down(); } else if(self.state == STATE_DOWN) { plat_go_up(); } else { - objerror("plat_crush: bad self.state\n"); + error_obj("plat_crush: bad self.state\n"); } }; void() plat_use = { - self.use = SUB_Null; + self.use = sub_null; if(self.state != STATE_UP) { - objerror("plat_use: not in up state"); + error_obj("plat_use: not in up state"); } plat_go_down(); }; @@ -166,9 +166,9 @@ void() func_plat = { self.classname = "plat"; self.solid = SOLID_BSP; self.movetype = MOVETYPE_PUSH; - setorigin(self, self.origin); - setmodel(self, self.model); - setsize(self, self.mins, self.maxs); + set_origin(self, self.origin); + set_model(self, self.model); + set_size(self, self.mins, self.maxs); self.blocked = plat_crush; if(!self.speed) { @@ -192,7 +192,7 @@ void() func_plat = { self.state = STATE_UP; self.use = plat_use; } else { - setorigin(self, self.pos2); + set_origin(self, self.pos2); self.state = STATE_BOTTOM; } }; @@ -204,7 +204,7 @@ void() train_blocked = { return; } self.attack_finished = time + 0.5; - T_Damage(other, self, self, self.dmg); + ent_damage(other, self, self, self.dmg); }; void() train_use = { if(self.think != func_train_find) { @@ -230,7 +230,7 @@ void() train_next = { targ = find(world, targetname, self.target); self.target = targ.target; if(!self.target) { - objerror("train_next: no next target"); + error_obj("train_next: no next target"); } if(targ.wait) { self.wait = targ.wait; @@ -238,7 +238,7 @@ void() train_next = { self.wait = 0; } sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM); - SUB_CalcMove(targ.origin - self.mins, self.speed, train_wait); + sub_calc_move(targ.origin - self.mins, self.speed, train_wait); }; void() func_train_find = { @@ -246,7 +246,7 @@ void() func_train_find = { targ = find(world, targetname, self.target); self.target = targ.target; - setorigin(self, targ.origin - self.mins); + set_origin(self, targ.origin - self.mins); if(!self.targetname) { // not triggered, so start immediately self.nextthink = self.ltime + 0.1; @@ -270,7 +270,7 @@ void() func_train = { self.speed = 100; } if(!self.target) { - objerror("func_train without a target"); + error_obj("func_train without a target"); } if(!self.dmg) { self.dmg = 2; @@ -297,9 +297,9 @@ void() func_train = { self.use = train_use; self.classname = "train"; - setmodel(self, self.model); - setsize(self, self.mins, self.maxs); - setorigin(self, self.origin); + set_model(self, self.model); + set_size(self, self.mins, self.maxs); + set_origin(self, self.origin); // start trains on the second frame, to make sure their targets have had // a chance to spawn @@ -315,7 +315,7 @@ void() misc_teleporttrain = { self.speed = 100; } if(!self.target) { - objerror("func_train without a target"); + error_obj("func_train without a target"); } self.cnt = 1; @@ -331,9 +331,9 @@ void() misc_teleporttrain = { precache_sound("misc/null.wav"); precache_model2("progs/teleport.mdl"); - setmodel(self, "progs/teleport.mdl"); - setsize(self, self.mins, self.maxs); - setorigin(self, self.origin); + set_model(self, "progs/teleport.mdl"); + set_size(self, self.mins, self.maxs); + set_origin(self, self.origin); // start trains on the second frame, to make sure their targets have had // a chance to spawn diff --git a/source/player.qc b/source/player.qc index 5e0d265..4a71d4e 100644 --- a/source/player.qc +++ b/source/player.qc @@ -129,22 +129,22 @@ void() player_shot6 = [$shotatt6, player_run ] {self.weaponframe = 6;}; void() player_axe1 = [$axatt1, player_axe2 ] {self.weaponframe = 1;}; void() player_axe2 = [$axatt2, player_axe3 ] {self.weaponframe = 2;}; -void() player_axe3 = [$axatt3, player_axe4 ] {self.weaponframe = 3; W_FireAxe();}; +void() player_axe3 = [$axatt3, player_axe4 ] {self.weaponframe = 3; wep_fire_axe();}; void() player_axe4 = [$axatt4, player_run ] {self.weaponframe = 4;}; void() player_axeb1 = [$axattb1, player_axeb2 ] {self.weaponframe = 5;}; void() player_axeb2 = [$axattb2, player_axeb3 ] {self.weaponframe = 6;}; -void() player_axeb3 = [$axattb3, player_axeb4 ] {self.weaponframe = 7; W_FireAxe();}; +void() player_axeb3 = [$axattb3, player_axeb4 ] {self.weaponframe = 7; wep_fire_axe();}; void() player_axeb4 = [$axattb4, player_run ] {self.weaponframe = 8;}; void() player_axec1 = [$axattc1, player_axec2 ] {self.weaponframe = 1;}; void() player_axec2 = [$axattc2, player_axec3 ] {self.weaponframe = 2;}; -void() player_axec3 = [$axattc3, player_axec4 ] {self.weaponframe = 3; W_FireAxe();}; +void() player_axec3 = [$axattc3, player_axec4 ] {self.weaponframe = 3; wep_fire_axe();}; void() player_axec4 = [$axattc4, player_run ] {self.weaponframe = 4;}; void() player_axed1 = [$axattd1, player_axed2 ] {self.weaponframe = 5;}; void() player_axed2 = [$axattd2, player_axed3 ] {self.weaponframe = 6;}; -void() player_axed3 = [$axattd3, player_axed4 ] {self.weaponframe = 7; W_FireAxe();}; +void() player_axed3 = [$axattd3, player_axed4 ] {self.weaponframe = 7; wep_fire_axe();}; void() player_axed4 = [$axattd4, player_run ] {self.weaponframe = 8;}; //============================================================================ @@ -160,8 +160,8 @@ void() player_nail1 = [$nailatt1, player_nail2 ] { if(self.weaponframe == 9) { self.weaponframe = 1; } - SuperDamageSound(); - W_FireSpikes(4); + super_damage_sound(); + wep_fire_nail(4); self.attack_finished = time + 0.2; }; void() player_nail2 = [$nailatt2, player_nail1 ] { @@ -175,8 +175,8 @@ void() player_nail2 = [$nailatt2, player_nail1 ] { if(self.weaponframe == 9) { self.weaponframe = 1; } - SuperDamageSound(); - W_FireSpikes(-4); + super_damage_sound(); + wep_fire_nail(-4); self.attack_finished = time + 0.2; }; @@ -193,8 +193,8 @@ void() player_light1 = [$light1, player_light2 ] { if(self.weaponframe == 5) { self.weaponframe = 1; } - SuperDamageSound(); - W_FireLightning(); + super_damage_sound(); + wep_fire_lightning(); self.attack_finished = time + 0.2; }; void() player_light2 = [$light2, player_light1 ] { @@ -208,8 +208,8 @@ void() player_light2 = [$light2, player_light1 ] { if(self.weaponframe == 5) { self.weaponframe = 1; } - SuperDamageSound(); - W_FireLightning(); + super_damage_sound(); + wep_fire_lightning(); self.attack_finished = time + 0.2; }; @@ -224,7 +224,7 @@ void() player_rocket4 = [$rockatt4, player_rocket5 ] {self.weaponframe = 4;}; void() player_rocket5 = [$rockatt5, player_rocket6 ] {self.weaponframe = 5;}; void() player_rocket6 = [$rockatt6, player_run ] {self.weaponframe = 6;}; -void() PainSound = { +void() player_pain_sound = { float rs; if(self.health < 0) { @@ -238,7 +238,7 @@ void() PainSound = { // water pain sounds if(self.watertype == CONTENT_WATER && self.waterlevel == 3) { - DeathBubbles(1); + death_bubbles(1); if(random() > 0.5) { sound(self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM); } else { @@ -303,14 +303,14 @@ void() PainSound = { return; }; -void() player_pain1 = [ $pain1, player_pain2 ] {PainSound(); self.weaponframe = 0;}; +void() player_pain1 = [ $pain1, player_pain2 ] {player_pain_sound(); self.weaponframe = 0;}; void() player_pain2 = [ $pain2, player_pain3 ] {}; void() player_pain3 = [ $pain3, player_pain4 ] {}; void() player_pain4 = [ $pain4, player_pain5 ] {}; void() player_pain5 = [ $pain5, player_pain6 ] {}; void() player_pain6 = [ $pain6, player_run ] {}; -void() player_axpain1 = [ $axpain1, player_axpain2 ] {PainSound(); self.weaponframe = 0;}; +void() player_axpain1 = [ $axpain1, player_axpain2 ] {player_pain_sound(); self.weaponframe = 0;}; void() player_axpain2 = [ $axpain2, player_axpain3 ] {}; void() player_axpain3 = [ $axpain3, player_axpain4 ] {}; void() player_axpain4 = [ $axpain4, player_axpain5 ] {}; @@ -333,14 +333,14 @@ void(entity attacker, float damage) player_pain = { } }; -void() DeathBubblesSpawn = { +void() player_death_bubbles_spawn = { entity bubble; if(self.owner.waterlevel != 3) { return; } bubble = spawn(); - setmodel(bubble, "progs/s_bubble.spr"); - setorigin(bubble, self.owner.origin + '0 0 24'); + set_model(bubble, "progs/s_bubble.spr"); + set_origin(bubble, self.owner.origin + '0 0 24'); bubble.movetype = MOVETYPE_NOCLIP; bubble.solid = SOLID_NOT; bubble.velocity = '0 0 15'; @@ -349,36 +349,36 @@ void() DeathBubblesSpawn = { bubble.classname = "bubble"; bubble.frame = 0; bubble.cnt = 0; - setsize(bubble, '-8 -8 -8', '8 8 8'); + set_size(bubble, '-8 -8 -8', '8 8 8'); self.nextthink = time + 0.1; - self.think = DeathBubblesSpawn; + self.think = player_death_bubbles_spawn; self.air_finished = self.air_finished + 1; if(self.air_finished >= self.bubble_count) { remove(self); } }; -void(float num_bubbles) DeathBubbles = { +void(float num_bubbles) death_bubbles = { entity bubble_spawner; bubble_spawner = spawn(); - setorigin(bubble_spawner, self.origin); + set_origin(bubble_spawner, self.origin); bubble_spawner.movetype = MOVETYPE_NONE; bubble_spawner.solid = SOLID_NOT; bubble_spawner.nextthink = time + 0.1; - bubble_spawner.think = DeathBubblesSpawn; + bubble_spawner.think = player_death_bubbles_spawn; bubble_spawner.air_finished = 0; bubble_spawner.owner = self; bubble_spawner.bubble_count = num_bubbles; return; }; -void() DeathSound = { +void() player_death_sound = { float rs; // water death sounds if(self.waterlevel == 3) { - DeathBubbles(20); + death_bubbles(20); sound(self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE); return; } @@ -404,13 +404,13 @@ void() DeathSound = { return; }; -void() PlayerDead = { +void() player_dead = { self.nextthink = -1; // allow respawn after a certain time self.deadflag = DEAD_DEAD; }; -vector(float dm) VelocityForDamage = { +vector(float dm) player_velocity_for_damage = { vector v; v_x = 100 * crandom(); @@ -418,10 +418,10 @@ vector(float dm) VelocityForDamage = { v_z = 200 + 100 * random(); if(dm > -50) { - // dprint("level 1\n"); + // print_dbg("level 1\n"); v = v * 0.7; } else if(dm > -200) { - // dprint("level 3\n"); + // print_dbg("level 3\n"); v = v * 2; } else { v = v * 10; @@ -430,46 +430,46 @@ vector(float dm) VelocityForDamage = { return v; }; -void(string gibname, float dm) ThrowGib = { +void(string gibname, float dm) throw_gib = { entity new; new = spawn(); new.origin = self.origin; - setmodel(new, gibname); - setsize(new, VEC_ORIGIN, VEC_ORIGIN); - new.velocity = VelocityForDamage(dm); + set_model(new, gibname); + set_size(new, VEC_ORIGIN, VEC_ORIGIN); + new.velocity = player_velocity_for_damage(dm); new.movetype = MOVETYPE_BOUNCE; new.solid = SOLID_NOT; new.avelocity_x = random() * 600; new.avelocity_y = random() * 600; new.avelocity_z = random() * 600; - new.think = SUB_Remove; + new.think = sub_remove; new.ltime = time; new.nextthink = time + 10 + random() * 10; new.frame = 0; new.flags = 0; }; -void(string gibname, float dm) ThrowHead = { - setmodel(self, gibname); +void(string gibname, float dm) throw_head = { + set_model(self, gibname); self.frame = 0; self.nextthink = -1; self.movetype = MOVETYPE_BOUNCE; self.takedamage = DAMAGE_NO; self.solid = SOLID_NOT; self.view_ofs = '0 0 8'; - setsize(self, '-16 -16 0', '16 16 56'); - self.velocity = VelocityForDamage(dm); + set_size(self, '-16 -16 0', '16 16 56'); + self.velocity = player_velocity_for_damage(dm); self.origin_z = self.origin_z - 24; self.flags = self.flags - (self.flags & FL_ONGROUND); self.avelocity = crandom() * '0 600 0'; }; -void() GibPlayer = { - ThrowHead("progs/h_player.mdl", self.health); - ThrowGib("progs/gib1.mdl", self.health); - ThrowGib("progs/gib2.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); +void() player_gib = { + throw_head("progs/h_player.mdl", self.health); + throw_gib("progs/gib1.mdl", self.health); + throw_gib("progs/gib2.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); self.deadflag = DEAD_DEAD; @@ -490,7 +490,7 @@ void() GibPlayer = { } }; -void() PlayerDie = { +void() player_die = { float i; self.items = self.items - (self.items & IT_INVISIBILITY); @@ -501,7 +501,7 @@ void() PlayerDie = { self.modelindex = modelindex_player; // don't use eyes if(deathmatch || coop) { - DropBackpack(); + drop_backpack(); } self.weaponmodel = string_null; @@ -515,11 +515,11 @@ void() PlayerDie = { } if(self.health < -40) { - GibPlayer(); + player_gib(); return; } - DeathSound(); + player_death_sound(); self.angles_x = 0; self.angles_z = 0; @@ -567,7 +567,7 @@ void() player_diea7 = [ $deatha7, player_diea8 ] {}; void() player_diea8 = [ $deatha8, player_diea9 ] {}; void() player_diea9 = [ $deatha9, player_diea10 ] {}; void() player_diea10 = [ $deatha10, player_diea11 ] {}; -void() player_diea11 = [ $deatha11, player_diea11 ] {PlayerDead();}; +void() player_diea11 = [ $deatha11, player_diea11 ] {player_dead();}; void() player_dieb1 = [ $deathb1, player_dieb2 ] {}; void() player_dieb2 = [ $deathb2, player_dieb3 ] {}; @@ -577,7 +577,7 @@ void() player_dieb5 = [ $deathb5, player_dieb6 ] {}; void() player_dieb6 = [ $deathb6, player_dieb7 ] {}; void() player_dieb7 = [ $deathb7, player_dieb8 ] {}; void() player_dieb8 = [ $deathb8, player_dieb9 ] {}; -void() player_dieb9 = [ $deathb9, player_dieb9 ] {PlayerDead();}; +void() player_dieb9 = [ $deathb9, player_dieb9 ] {player_dead();}; void() player_diec1 = [ $deathc1, player_diec2 ] {}; void() player_diec2 = [ $deathc2, player_diec3 ] {}; @@ -593,7 +593,7 @@ void() player_diec11 = [ $deathc11, player_diec12 ] {}; void() player_diec12 = [ $deathc12, player_diec13 ] {}; void() player_diec13 = [ $deathc13, player_diec14 ] {}; void() player_diec14 = [ $deathc14, player_diec15 ] {}; -void() player_diec15 = [ $deathc15, player_diec15 ] {PlayerDead();}; +void() player_diec15 = [ $deathc15, player_diec15 ] {player_dead();}; void() player_died1 = [ $deathd1, player_died2 ] {}; void() player_died2 = [ $deathd2, player_died3 ] {}; @@ -603,7 +603,7 @@ void() player_died5 = [ $deathd5, player_died6 ] {}; void() player_died6 = [ $deathd6, player_died7 ] {}; void() player_died7 = [ $deathd7, player_died8 ] {}; void() player_died8 = [ $deathd8, player_died9 ] {}; -void() player_died9 = [ $deathd9, player_died9 ] {PlayerDead();}; +void() player_died9 = [ $deathd9, player_died9 ] {player_dead();}; void() player_diee1 = [ $deathe1, player_diee2 ] {}; void() player_diee2 = [ $deathe2, player_diee3 ] {}; @@ -613,7 +613,7 @@ void() player_diee5 = [ $deathe5, player_diee6 ] {}; void() player_diee6 = [ $deathe6, player_diee7 ] {}; void() player_diee7 = [ $deathe7, player_diee8 ] {}; void() player_diee8 = [ $deathe8, player_diee9 ] {}; -void() player_diee9 = [ $deathe9, player_diee9 ] {PlayerDead();}; +void() player_diee9 = [ $deathe9, player_diee9 ] {player_dead();}; void() player_die_ax1 = [ $axdeth1, player_die_ax2 ] {}; void() player_die_ax2 = [ $axdeth2, player_die_ax3 ] {}; @@ -623,4 +623,4 @@ void() player_die_ax5 = [ $axdeth5, player_die_ax6 ] {}; void() player_die_ax6 = [ $axdeth6, player_die_ax7 ] {}; void() player_die_ax7 = [ $axdeth7, player_die_ax8 ] {}; void() player_die_ax8 = [ $axdeth8, player_die_ax9 ] {}; -void() player_die_ax9 = [ $axdeth9, player_die_ax9 ] {PlayerDead();}; +void() player_die_ax9 = [ $axdeth9, player_die_ax9 ] {player_dead();}; diff --git a/source/shalrath.qc b/source/shalrath.qc index c8fced6..5e5b389 100644 --- a/source/shalrath.qc +++ b/source/shalrath.qc @@ -65,7 +65,7 @@ void() shal_attack5 = [ $attack5, shal_attack6 ] {ai_face();}; void() shal_attack6 = [ $attack6, shal_attack7 ] {ai_face();}; void() shal_attack7 = [ $attack7, shal_attack8 ] {ai_face();}; void() shal_attack8 = [ $attack8, shal_attack9 ] {ai_face();}; -void() shal_attack9 = [ $attack9, shal_attack10 ] {ShalMissile();}; +void() shal_attack9 = [ $attack9, shal_attack10 ] {shalrath_missile();}; void() shal_attack10 = [ $attack10, shal_attack11 ] {ai_face();}; void() shal_attack11 = [ $attack11, shal_run1 ] {}; @@ -97,10 +97,10 @@ void() shalrath_die = { // check for gib if(self.health < -90) { sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); - ThrowHead("progs/h_shal.mdl", self.health); - ThrowGib("progs/gib1.mdl", self.health); - ThrowGib("progs/gib2.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); + throw_head("progs/h_shal.mdl", self.health); + throw_gib("progs/gib1.mdl", self.health); + throw_gib("progs/gib2.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); return; } @@ -112,16 +112,16 @@ void() shalrath_die = { /* ================ -ShalMissile +shalrath_missile ================ */ -void() ShalMissile = { +void() shalrath_missile = { entity missile; vector dir; float dist, flytime; dir = normalize((self.enemy.origin + '0 0 10') - self.origin); - dist = vlen(self.enemy.origin - self.origin); + dist = vec_len(self.enemy.origin - self.origin); flytime = dist * 0.002; if(flytime < 0.1) { flytime = 0.1; @@ -135,20 +135,20 @@ void() ShalMissile = { missile.solid = SOLID_BBOX; missile.movetype = MOVETYPE_FLYMISSILE; - setmodel(missile, "progs/v_spike.mdl"); + set_model(missile, "progs/v_spike.mdl"); - setsize(missile, VEC_ORIGIN, VEC_ORIGIN); + set_size(missile, VEC_ORIGIN, VEC_ORIGIN); missile.origin = self.origin + '0 0 10'; missile.velocity = dir * 400; missile.avelocity = '300 300 300'; missile.nextthink = flytime + time; - missile.think = ShalHome; + missile.think = shalrath_home; missile.enemy = self.enemy; - missile.touch = ShalMissileTouch; + missile.touch = shalrath_missile_touch; }; -void() ShalHome = { +void() shalrath_home = { vector dir, vtemp; vtemp = self.enemy.origin + '0 0 10'; if(self.enemy.health < 1) { @@ -162,29 +162,29 @@ void() ShalHome = { self.velocity = dir * 250; } self.nextthink = time + 0.2; - self.think = ShalHome; + self.think = shalrath_home; }; -void() ShalMissileTouch = { +void() shalrath_missile_touch = { if(other == self.owner) { return; // don't explode on owner } if(other.classname == "monster_zombie") { - T_Damage(other, self, self, 110); + ent_damage(other, self, self, 110); } - T_RadiusDamage(self, self.owner, 40, world); + ent_radius_damage(self, self.owner, 40, world); sound(self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM); - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_EXPLOSION); - WriteCoord(MSG_BROADCAST, self.origin_x); - WriteCoord(MSG_BROADCAST, self.origin_y); - WriteCoord(MSG_BROADCAST, self.origin_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_EXPLOSION); + write_coord(MSG_BROADCAST, self.origin_x); + write_coord(MSG_BROADCAST, self.origin_y); + write_coord(MSG_BROADCAST, self.origin_z); self.velocity = VEC_ORIGIN; - self.touch = SUB_Null; - setmodel(self, "progs/s_explod.spr"); + self.touch = sub_null; + set_model(self, "progs/s_explod.spr"); self.solid = SOLID_NOT; s_explode1(); }; @@ -212,8 +212,8 @@ void() monster_shalrath = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/shalrath.mdl"); - setsize(self, '-32 -32 -24', '32 32 64'); + set_model(self, "progs/shalrath.mdl"); + set_size(self, '-32 -32 -24', '32 32 64'); self.health = 400; self.th_stand = shal_stand; diff --git a/source/shambler.qc b/source/shambler.qc index bb6a4c2..606a950 100644 --- a/source/shambler.qc +++ b/source/shambler.qc @@ -30,6 +30,65 @@ $frame pain1 pain2 pain3 pain4 pain5 pain6 $frame death1 death2 death3 death4 death5 death6 $frame death7 death8 death9 death10 death11 +/* +=========== +sham_check_attack + +The player is in view, so decide to move or launch an attack +Returns FALSE if movement should continue +============ +*/ +float() sham_check_attack = { + vector spot1, spot2; + entity targ; + float chance; + float enemy_yaw; + + if(enemy_range == RANGE_MELEE) { + if(can_damage(self.enemy, self)) { + self.attack_state = AS_MELEE; + return TRUE; + } + } + + if(time < self.attack_finished) { + return FALSE; + } + + if(!enemy_vis) { + return FALSE; + } + + targ = self.enemy; + + // see if any entities are in the way of the shot + spot1 = self.origin + self.view_ofs; + spot2 = targ.origin + targ.view_ofs; + + if(vec_len(spot1 - spot2) > 600) { + return FALSE; + } + + trace_line(spot1, spot2, FALSE, self); + + if(trace_inopen && trace_inwater) { + return FALSE; // sight line crossed contents + } + + if(trace_ent != targ) { + return FALSE; // don't have a clear shot + } + + // missile attack + if(enemy_range == RANGE_FAR) { + return FALSE; + } + + self.attack_state = AS_MISSILE; + sub_attack_finished(2 + 2 * random()); + return TRUE; +}; + void() sham_stand1 = [ $stand1, sham_stand2 ] {ai_stand();}; void() sham_stand2 = [ $stand2, sham_stand3 ] {ai_stand();}; void() sham_stand3 = [ $stand3, sham_stand4 ] {ai_stand();}; @@ -99,24 +158,24 @@ void() sham_smash10 = [ $smash10, sham_smash11 ] { delta = self.enemy.origin - self.origin; - if(vlen(delta) > 100) { + if(vec_len(delta) > 100) { return; } - if(!CanDamage(self.enemy, self)) { + if(!can_damage(self.enemy, self)) { return; } ldmg = (random() + random() + random()) * 40; - T_Damage(self.enemy, self, self, ldmg); + ent_damage(self.enemy, self, self, ldmg); sound(self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM); - SpawnMeatSpray(self.origin + v_forward * 16, crandom() * 100 * v_right); - SpawnMeatSpray(self.origin + v_forward * 16, crandom() * 100 * v_right); + spawn_meat_spray(self.origin + v_forward * 16, crandom() * 100 * v_right); + spawn_meat_spray(self.origin + v_forward * 16, crandom() * 100 * v_right); }; void() sham_smash11 = [ $smash11, sham_smash12 ] {ai_charge(5);}; void() sham_smash12 = [ $smash12, sham_run1 ] {ai_charge(4);}; -void(float side) ShamClaw = { +void(float side) sham_claw = { vector delta; float ldmg; @@ -127,17 +186,17 @@ void(float side) ShamClaw = { delta = self.enemy.origin - self.origin; - if(vlen(delta) > 100) { + if(vec_len(delta) > 100) { return; } ldmg = (random() + random() + random()) * 20; - T_Damage(self.enemy, self, self, ldmg); + ent_damage(self.enemy, self, self, ldmg); sound(self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM); if(side) { - makevectors(self.angles); - SpawnMeatSpray(self.origin + v_forward * 16, side * v_right); + make_vectors(self.angles); + spawn_meat_spray(self.origin + v_forward * 16, side * v_right); } }; @@ -150,7 +209,7 @@ void() sham_swingl3 = [ $swingl3, sham_swingl4 ] {ai_charge(7);}; void() sham_swingl4 = [ $swingl4, sham_swingl5 ] {ai_charge(3);}; void() sham_swingl5 = [ $swingl5, sham_swingl6 ] {ai_charge(7);}; void() sham_swingl6 = [ $swingl6, sham_swingl7 ] {ai_charge(9);}; -void() sham_swingl7 = [ $swingl7, sham_swingl8 ] {ai_charge(5); ShamClaw(250);}; +void() sham_swingl7 = [ $swingl7, sham_swingl8 ] {ai_charge(5); sham_claw(250);}; void() sham_swingl8 = [ $swingl8, sham_swingl9 ] {ai_charge(4);}; void() sham_swingl9 = [ $swingl9, sham_run1 ] { ai_charge(8); @@ -168,7 +227,7 @@ void() sham_swingr3 = [ $swingr3, sham_swingr4 ] {ai_charge(14);}; void() sham_swingr4 = [ $swingr4, sham_swingr5 ] {ai_charge(7);}; void() sham_swingr5 = [ $swingr5, sham_swingr6 ] {ai_charge(3);}; void() sham_swingr6 = [ $swingr6, sham_swingr7 ] {ai_charge(6);}; -void() sham_swingr7 = [ $swingr7, sham_swingr8 ] {ai_charge(6); ShamClaw(-250);}; +void() sham_swingr7 = [ $swingr7, sham_swingr8 ] {ai_charge(6); sham_claw(-250);}; void() sham_swingr8 = [ $swingr8, sham_swingr9 ] {ai_charge(3);}; void() sham_swingr9 = [ $swingr9, sham_run1 ] {ai_charge(1); ai_charge(10); @@ -192,7 +251,7 @@ void() sham_melee = { //============================================================================ -void() CastLightning = { +void() sham_cast_lightning = { vector org, dir; self.effects = self.effects | EF_MUZZLEFLASH; @@ -204,19 +263,19 @@ void() CastLightning = { dir = self.enemy.origin + '0 0 16' - org; dir = normalize(dir); - traceline(org, self.origin + dir * 600, TRUE, self); + trace_line(org, self.origin + dir * 600, TRUE, self); - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_LIGHTNING1); - WriteEntity(MSG_BROADCAST, self); - WriteCoord(MSG_BROADCAST, org_x); - WriteCoord(MSG_BROADCAST, org_y); - WriteCoord(MSG_BROADCAST, org_z); - WriteCoord(MSG_BROADCAST, trace_endpos_x); - WriteCoord(MSG_BROADCAST, trace_endpos_y); - WriteCoord(MSG_BROADCAST, trace_endpos_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_LIGHTNING1); + write_entity(MSG_BROADCAST, self); + write_coord(MSG_BROADCAST, org_x); + write_coord(MSG_BROADCAST, org_y); + write_coord(MSG_BROADCAST, org_z); + write_coord(MSG_BROADCAST, trace_endpos_x); + write_coord(MSG_BROADCAST, trace_endpos_y); + write_coord(MSG_BROADCAST, trace_endpos_z); - LightningDamage(org, trace_endpos, self, 10); + lightning_damage(org, trace_endpos, self, 10); }; void() sham_magic1 = [ $magic1, sham_magic2 ] {ai_face(); @@ -231,11 +290,11 @@ void() sham_magic3 = [ $magic3, sham_magic4 ] {ai_face(); ai_face(); self.owner = spawn(); o = self.owner; - setmodel(o, "progs/s_light.mdl"); - setorigin(o, self.origin); + set_model(o, "progs/s_light.mdl"); + set_origin(o, self.origin); o.angles = self.angles; o.nextthink = time + 0.7; - o.think = SUB_Remove; + o.think = sub_remove; }; void() sham_magic4 = [ $magic4, sham_magic5 ] { self.effects = self.effects | EF_MUZZLEFLASH; @@ -247,16 +306,16 @@ void() sham_magic5 = [ $magic5, sham_magic6 ] { }; void() sham_magic6 = [ $magic6, sham_magic9 ] { remove(self.owner); - CastLightning(); + sham_cast_lightning(); sound(self, CHAN_WEAPON, "shambler/sboom.wav", 1, ATTN_NORM); }; void() sham_magic9 = [ $magic9, sham_magic10 ] -{CastLightning();}; +{sham_cast_lightning();}; void() sham_magic10 = [ $magic10, sham_magic11 ] -{CastLightning();}; +{sham_cast_lightning();}; void() sham_magic11 = [ $magic11, sham_magic12 ] { if(skill == 3) { - CastLightning(); + sham_cast_lightning(); } }; void() sham_magic12 = [ $magic12, sham_run1 ] {}; @@ -306,10 +365,10 @@ void() sham_die = { // check for gib if(self.health < -60) { sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); - ThrowHead("progs/h_shams.mdl", self.health); - ThrowGib("progs/gib1.mdl", self.health); - ThrowGib("progs/gib2.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); + throw_head("progs/h_shams.mdl", self.health); + throw_gib("progs/gib1.mdl", self.health); + throw_gib("progs/gib2.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); return; } @@ -344,9 +403,9 @@ void() monster_shambler = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/shambler.mdl"); + set_model(self, "progs/shambler.mdl"); - setsize(self, '-32 -32 -24', '32 32 64'); + set_size(self, '-32 -32 -24', '32 32 64'); self.health = 600; self.th_stand = sham_stand1; diff --git a/source/soldier.qc b/source/soldier.qc index 0f84dfd..29ebeae 100644 --- a/source/soldier.qc +++ b/source/soldier.qc @@ -31,6 +31,68 @@ $frame prowl_1 prowl_2 prowl_3 prowl_4 prowl_5 prowl_6 prowl_7 prowl_8 $frame prowl_9 prowl_10 prowl_11 prowl_12 prowl_13 prowl_14 prowl_15 prowl_16 $frame prowl_17 prowl_18 prowl_19 prowl_20 prowl_21 prowl_22 prowl_23 prowl_24 +//============================================================================= + +/* +=========== +army_check_attack + +The player is in view, so decide to move or launch an attack +Returns FALSE if movement should continue +============ +*/ +float() army_check_attack = { + vector spot1, spot2; + entity targ; + float chance; + + targ = self.enemy; + + // see if any entities are in the way of the shot + spot1 = self.origin + self.view_ofs; + spot2 = targ.origin + targ.view_ofs; + + trace_line(spot1, spot2, FALSE, self); + + if(trace_inopen && trace_inwater) { + return FALSE; // sight line crossed contents + } + + if(trace_ent != targ) { + return FALSE; // don't have a clear shot + } + + // missile attack + if(time < self.attack_finished) { + return FALSE; + } + + if(enemy_range == RANGE_FAR) { + return FALSE; + } + + if(enemy_range == RANGE_MELEE) { + chance = 0.9; + } else if(enemy_range == RANGE_NEAR) { + chance = 0.4; + } else if(enemy_range == RANGE_MID) { + chance = 0.05; + } else { + chance = 0; + } + + if(random() < chance) { + self.th_missile(); + sub_attack_finished(1 + random()); + if(random() < 0.3) { + self.lefty = !self.lefty; + } + return TRUE; + } + + return FALSE; +}; + /* ============================================================================== SOLDIER CODE @@ -99,7 +161,7 @@ void() army_atk5 = [ $shoot5, army_atk6 ] {ai_face(); self.effects = self.effects | EF_MUZZLEFLASH; }; void() army_atk6 = [ $shoot6, army_atk7 ] {ai_face();}; -void() army_atk7 = [ $shoot7, army_atk8 ] {ai_face(); SUB_CheckRefire(army_atk1);}; +void() army_atk7 = [ $shoot7, army_atk8 ] {ai_face(); sub_check_refire(army_atk1);}; void() army_atk8 = [ $shoot8, army_atk9 ] {ai_face();}; void() army_atk9 = [ $shoot9, army_run1 ] {ai_face();}; @@ -177,14 +239,14 @@ void() army_fire = { dir = en.origin - en.velocity * 0.2; dir = normalize(dir - self.origin); - FireBullets(4, dir, '0.1 0.1 0'); + fire_bullets(4, dir, '0.1 0.1 0'); }; void() army_die1 = [ $death1, army_die2 ] {}; void() army_die2 = [ $death2, army_die3 ] {}; void() army_die3 = [ $death3, army_die4 ] -{self.solid = SOLID_NOT; self.ammo_shells = 5; DropBackpack();}; +{self.solid = SOLID_NOT; self.ammo_shells = 5; drop_backpack();}; void() army_die4 = [ $death4, army_die5 ] {}; void() army_die5 = [ $death5, army_die6 ] {}; void() army_die6 = [ $death6, army_die7 ] {}; @@ -196,7 +258,7 @@ void() army_die10 = [ $death10, army_die10 ] {}; void() army_cdie1 = [ $deathc1, army_cdie2 ] {}; void() army_cdie2 = [ $deathc2, army_cdie3 ] {ai_back(5);}; void() army_cdie3 = [ $deathc3, army_cdie4 ] -{self.solid = SOLID_NOT; self.ammo_shells = 5; DropBackpack(); ai_back(4);}; +{self.solid = SOLID_NOT; self.ammo_shells = 5; drop_backpack(); ai_back(4);}; void() army_cdie4 = [ $deathc4, army_cdie5 ] {ai_back(13);}; void() army_cdie5 = [ $deathc5, army_cdie6 ] {ai_back(3);}; void() army_cdie6 = [ $deathc6, army_cdie7 ] {ai_back(4);}; @@ -210,10 +272,10 @@ void() army_die = { // check for gib if(self.health < -35) { sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); - ThrowHead("progs/h_guard.mdl", self.health); - ThrowGib("progs/gib1.mdl", self.health); - ThrowGib("progs/gib2.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); + throw_head("progs/h_guard.mdl", self.health); + throw_gib("progs/gib1.mdl", self.health); + throw_gib("progs/gib2.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); return; } @@ -251,9 +313,9 @@ void() monster_army = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/soldier.mdl"); + set_model(self, "progs/soldier.mdl"); - setsize(self, '-16 -16 -24', '16 16 40'); + set_size(self, '-16 -16 -24', '16 16 40'); self.health = 30; self.th_stand = army_stand1; diff --git a/source/subs.qc b/source/subs.qc index f4c400a..a8bd16a 100644 --- a/source/subs.qc +++ b/source/subs.qc @@ -1,20 +1,20 @@ // subs.qc: subroutines for think frames -void() SUB_Null = {}; -void(entity attacker, float damage) SUB_PainNull = {}; -void() SUB_Remove = {remove(self);}; +void() sub_null = {}; +void(entity attacker, float damage) sub_pain_null = {}; +void() sub_remove = {remove(self);}; /* QuakeEd only writes a single float for angles(bad idea), so up and down are just constant angles. */ -void() SetMovedir = { +void() set_move_dir = { if(self.angles == '0 -1 0') { self.movedir = '0 0 1'; } else if(self.angles == '0 -2 0') { self.movedir = '0 0 -1'; } else { - makevectors(self.angles); + make_vectors(self.angles); self.movedir = v_forward; } @@ -23,17 +23,17 @@ void() SetMovedir = { /* ================ -InitTrigger +init_trigger ================ */ -void() InitTrigger = { +void() init_trigger = { // trigger angles are used for one-way touches. An angle of 0 is assumed // to mean no restrictions, so use a yaw of 360 instead. if(self.angles != VEC_ORIGIN) { - SetMovedir(); + set_move_dir(); } self.solid = SOLID_TRIGGER; - setmodel(self, self.model); // set size and link into world + set_model(self, self.model); // set size and link into world self.movetype = MOVETYPE_NONE; self.modelindex = 0; self.model = string_null; @@ -41,32 +41,32 @@ void() InitTrigger = { /* ============= -SUB_CalcMove +sub_calc_move calculate self.velocity and self.nextthink to reach dest from self.origin traveling at speed =============== */ -void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt = { +void(entity ent, vector tdest, float tspeed, void() func) sub_calc_move_ent = { entity stemp; stemp = self; self = ent; - SUB_CalcMove(tdest, tspeed, func); + sub_calc_move(tdest, tspeed, func); self = stemp; }; -void(vector tdest, float tspeed, void() func) SUB_CalcMove = { +void(vector tdest, float tspeed, void() func) sub_calc_move = { vector vdestdelta; float len, traveltime; if(!tspeed) { - objerror("No speed is defined!"); + error_obj("No speed is defined!"); } self.think1 = func; self.finaldest = tdest; - self.think = SUB_CalcMoveDone; + self.think = sub_calc_move_done; if(tdest == self.origin) { self.velocity = VEC_ORIGIN; @@ -78,7 +78,7 @@ void(vector tdest, float tspeed, void() func) SUB_CalcMove = { vdestdelta = tdest - self.origin; // calculate length of vector - len = vlen(vdestdelta); + len = vec_len(vdestdelta); // divide by speed to get time to reach dest traveltime = len / tspeed; @@ -101,8 +101,8 @@ void(vector tdest, float tspeed, void() func) SUB_CalcMove = { After moving, set origin to exact final destination ============ */ -void() SUB_CalcMoveDone = { - setorigin(self, self.finaldest); +void() sub_calc_move_done = { + set_origin(self, self.finaldest); self.velocity = VEC_ORIGIN; self.nextthink = -1; if(self.think1) { @@ -112,7 +112,7 @@ void() SUB_CalcMoveDone = { /* ============= -SUB_CalcAngleMove +sub_calc_angle_move calculate self.avelocity and self.nextthink to reach destangle from self.angles rotating @@ -120,27 +120,27 @@ self.angles rotating The calling function should make sure self.think is valid =============== */ -void(entity ent, vector destangle, float tspeed, void() func) SUB_CalcAngleMoveEnt = { +void(entity ent, vector destangle, float tspeed, void() func) sub_calc_angle_moveEnt = { entity stemp; stemp = self; self = ent; - SUB_CalcAngleMove(destangle, tspeed, func); + sub_calc_angle_move(destangle, tspeed, func); self = stemp; }; -void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove = { +void(vector destangle, float tspeed, void() func) sub_calc_angle_move = { vector destdelta; float len, traveltime; if(!tspeed) { - objerror("No speed is defined!"); + error_obj("No speed is defined!"); } // set destdelta to the vector needed to move destdelta = destangle - self.angles; // calculate length of vector - len = vlen(destdelta); + len = vec_len(destdelta); // divide by speed to get time to reach dest traveltime = len / tspeed; @@ -153,7 +153,7 @@ void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove = { self.think1 = func; self.finalangle = destangle; - self.think = SUB_CalcAngleMoveDone; + self.think = sub_calc_angle_move_done; }; /* @@ -161,7 +161,7 @@ void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove = { After rotating, set angle to exact final angle ============ */ -void() SUB_CalcAngleMoveDone = { +void() sub_calc_angle_move_done = { self.angles = self.finalangle; self.avelocity = VEC_ORIGIN; self.nextthink = -1; @@ -172,20 +172,20 @@ void() SUB_CalcAngleMoveDone = { //============================================================================= -void() DelayThink = { +void() delay_think = { activator = self.enemy; - SUB_UseTargets(); + sub_use_targets(); remove(self); }; /* ============================== -SUB_UseTargets +sub_use_targets the global "activator" should be set to the entity that initiated the firing. If self.delay is set, a DelayedUse entity will be created that will actually -do the SUB_UseTargets after that many seconds have passed. +do the sub_use_targets after that many seconds have passed. Centerprints any self.message to the activator. @@ -197,7 +197,7 @@ match(string)self.target and call their .use function ============================== */ -void() SUB_UseTargets = { +void() sub_use_targets = { entity t, stemp, otemp, act; // @@ -208,7 +208,7 @@ void() SUB_UseTargets = { t = spawn(); t.classname = "DelayedUse"; t.nextthink = time + self.delay; - t.think = DelayThink; + t.think = delay_think; t.enemy = activator; t.message = self.message; t.killtarget = self.killtarget; @@ -220,7 +220,7 @@ void() SUB_UseTargets = { // print the message // if(activator.classname == "player" && self.message != string_null) { - centerprint(activator, self.message); + print_center(activator, self.message); if(!self.noise) { sound(activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM); } @@ -255,7 +255,7 @@ void() SUB_UseTargets = { otemp = other; self = t; other = stemp; - if(self.use != SUB_Null) { + if(self.use != sub_null) { if(self.use) { self.use(); } @@ -275,14 +275,14 @@ some monsters refire twice automatically */ -void(float normal) SUB_AttackFinished = { +void(float normal) sub_attack_finished = { self.cnt = 0; // refire count for nightmare if(skill != 3) { self.attack_finished = time + normal; } }; -void(void() thinkst) SUB_CheckRefire = { +void(void() thinkst) sub_check_refire = { if(skill != 3) { return; } diff --git a/source/tarbaby.qc b/source/tarbaby.qc index 39116e8..299ebf5 100644 --- a/source/tarbaby.qc +++ b/source/tarbaby.qc @@ -78,24 +78,24 @@ void() tbaby_run25 = [ $run25, tbaby_run1 ] {ai_run(2);}; //============================================================================ -void() Tar_JumpTouch = { +void() tbaby_jump_touch = { float ldmg; if(other.takedamage && other.classname != self.classname) { - if(vlen(self.velocity) > 400) { + if(vec_len(self.velocity) > 400) { ldmg = 10 + 10 * random(); - T_Damage(other, self, self, ldmg); + ent_damage(other, self, self, ldmg); sound(self, CHAN_WEAPON, "blob/hit1.wav", 1, ATTN_NORM); } } else { sound(self, CHAN_WEAPON, "blob/land1.wav", 1, ATTN_NORM); } - if(!checkbottom(self)) { + if(!check_bottom(self)) { if(self.flags & FL_ONGROUND) { // jump randomly to not get hung up - //dprint("popjump\n"); - self.touch = SUB_Null; + //print_dbg("popjump\n"); + self.touch = sub_null; self.think = tbaby_run1; self.movetype = MOVETYPE_STEP; self.nextthink = time + 0.1; @@ -107,7 +107,7 @@ void() Tar_JumpTouch = { return; // not on ground yet } - self.touch = SUB_Null; + self.touch = sub_null; self.think = tbaby_jump1; self.nextthink = time + 0.1; }; @@ -118,7 +118,7 @@ void() tbaby_fly3 = [ $fly3, tbaby_fly4 ] {}; void() tbaby_fly4 = [ $fly4, tbaby_fly1 ] { self.cnt = self.cnt + 1; if(self.cnt == 4) { - //dprint("spawn hop\n"); + //print_dbg("spawn hop\n"); tbaby_jump5(); } }; @@ -129,8 +129,8 @@ void() tbaby_jump3 = [ $jump3, tbaby_jump4 ] {ai_face();}; void() tbaby_jump4 = [ $jump4, tbaby_jump5 ] {ai_face();}; void() tbaby_jump5 = [ $jump5, tbaby_jump6 ] { self.movetype = MOVETYPE_BOUNCE; - self.touch = Tar_JumpTouch; - makevectors(self.angles); + self.touch = tbaby_jump_touch; + make_vectors(self.angles); self.origin_z = self.origin_z + 1; self.velocity = v_forward * 600 + '0 0 200'; self.velocity_z = self.velocity_z + random() * 150; @@ -148,18 +148,18 @@ void() tbaby_die1 = [ $exp, tbaby_die2 ] { self.takedamage = DAMAGE_NO; }; void() tbaby_die2 = [ $exp, tbaby_run1 ] { - T_RadiusDamage(self, self, 120, world); + ent_radius_damage(self, self, 120, world); sound(self, CHAN_VOICE, "blob/death1.wav", 1, ATTN_NORM); self.origin = self.origin - 8 * normalize(self.velocity); - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_TAREXPLOSION); - WriteCoord(MSG_BROADCAST, self.origin_x); - WriteCoord(MSG_BROADCAST, self.origin_y); - WriteCoord(MSG_BROADCAST, self.origin_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_TAREXPLOSION); + write_coord(MSG_BROADCAST, self.origin_x); + write_coord(MSG_BROADCAST, self.origin_y); + write_coord(MSG_BROADCAST, self.origin_z); - BecomeExplosion(); + become_explosion(); }; //============================================================================= @@ -181,9 +181,9 @@ void() monster_tarbaby = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/tarbaby.mdl"); + set_model(self, "progs/tarbaby.mdl"); - setsize(self, '-16 -16 -24', '16 16 40'); + set_size(self, '-16 -16 -24', '16 16 40'); self.health = 80; self.th_stand = tbaby_stand1; diff --git a/source/triggers.qc b/source/triggers.qc index 8b72373..c425395 100644 --- a/source/triggers.qc +++ b/source/triggers.qc @@ -28,7 +28,7 @@ void() multi_trigger = { return; } found_secrets = found_secrets + 1; - WriteByte(MSG_ALL, SVC_FOUNDSECRET); + write_byte(MSG_ALL, SVC_FOUNDSECRET); } if(self.noise) { @@ -40,7 +40,7 @@ void() multi_trigger = { activator = self.enemy; - SUB_UseTargets(); + sub_use_targets(); if(self.wait > 0) { self.think = multi_wait; @@ -48,9 +48,9 @@ void() multi_trigger = { } else { // we can't just remove(self) here, because this is a touch function // called wheil C code is looping through area links... - self.touch = SUB_Null; + self.touch = sub_null; self.nextthink = time + 0.1; - self.think = SUB_Remove; + self.think = sub_remove; } }; @@ -71,7 +71,7 @@ void() multi_touch = { // if the trigger has an angles field, check player's facing direction if(self.movedir != VEC_ORIGIN) { - makevectors(other.angles); + make_vectors(other.angles); if(v_forward * self.movedir < 0) { return; // not facing the right way } @@ -111,17 +111,17 @@ void() trigger_multiple = { } self.use = multi_use; - InitTrigger(); + init_trigger(); if(self.health) { if(self.spawnflags & MULTIPLE_NOTOUCH) { - objerror("health and notouch don't make sense\n"); + error_obj("health and notouch don't make sense\n"); } self.max_health = self.health; self.th_die = multi_killed; self.takedamage = DAMAGE_YES; self.solid = SOLID_BBOX; - setorigin(self, self.origin); // make sure it links into the world + set_origin(self, self.origin); // make sure it links into the world } else { if(!(self.spawnflags & MULTIPLE_NOTOUCH)) { self.touch = multi_touch; @@ -153,7 +153,7 @@ void() trigger_once = { This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages. */ void() trigger_relay = { - self.use = SUB_UseTargets; + self.use = sub_use_targets; }; //============================================================================= @@ -200,20 +200,20 @@ void() counter_use = { if(activator.classname == "player" && (self.spawnflags & COUNTER_NOMESSAGE) == 0) { if(self.count >= 4) { - centerprint(activator, "There are more to go..."); + print_center(activator, "There are more to go..."); } else if(self.count == 3) { - centerprint(activator, "Only 3 more to go..."); + print_center(activator, "Only 3 more to go..."); } else if(self.count == 2) { - centerprint(activator, "Only 2 more to go..."); + print_center(activator, "Only 2 more to go..."); } else { - centerprint(activator, "Only 1 more to go..."); + print_center(activator, "Only 1 more to go..."); } } return; } if(activator.classname == "player" && (self.spawnflags & COUNTER_NOMESSAGE) == 0) { - centerprint(activator, "Sequence completed!"); + print_center(activator, "Sequence completed!"); } self.enemy = activator; multi_trigger(); @@ -272,11 +272,11 @@ void(vector org) spawn_tfog = { s.nextthink = time + 0.2; s.think = play_teleport; - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_TELEPORT); - WriteCoord(MSG_BROADCAST, org_x); - WriteCoord(MSG_BROADCAST, org_y); - WriteCoord(MSG_BROADCAST, org_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_TELEPORT); + write_coord(MSG_BROADCAST, org_x); + write_coord(MSG_BROADCAST, org_y); + write_coord(MSG_BROADCAST, org_z); }; void() tdeath_touch = { @@ -291,13 +291,13 @@ void() tdeath_touch = { } if(self.owner.classname != "player") { // other monsters explode themselves - T_Damage(self.owner, self, self, 50000); + ent_damage(self.owner, self, self, 50000); return; } } if(other.health) { - T_Damage(other, self, self, 50000); + ent_damage(other, self, self, 50000); } }; @@ -309,11 +309,11 @@ void(vector org, entity death_owner) spawn_tdeath = { death.movetype = MOVETYPE_NONE; death.solid = SOLID_TRIGGER; death.angles = VEC_ORIGIN; - setsize(death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1'); - setorigin(death, org); + set_size(death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1'); + set_origin(death, org); death.touch = tdeath_touch; death.nextthink = time + 0.2; - death.think = SUB_Remove; + death.think = sub_remove; death.owner = death_owner; force_retouch = 2; // make sure even still objects get hit @@ -340,18 +340,18 @@ void() teleport_touch = { return; } - SUB_UseTargets(); + sub_use_targets(); // put a tfog where the player was spawn_tfog(other.origin); t = find(world, targetname, self.target); if(!t) { - objerror("couldn't find target"); + error_obj("couldn't find target"); } // spawn a tfog flash in front of the destination - makevectors(t.mangle); + make_vectors(t.mangle); org = t.origin + 32 * v_forward; spawn_tfog(org); @@ -364,7 +364,7 @@ void() teleport_touch = { return; } - setorigin(other, t.origin); + set_origin(other, t.origin); other.angles = t.mangle; if(other.classname == "player") { other.fixangle = 1; // turn this way immediately @@ -387,14 +387,14 @@ void() info_teleport_destination = { self.model = string_null; self.origin = self.origin + '0 0 27'; if(!self.targetname) { - objerror("no targetname"); + error_obj("no targetname"); } }; void() teleport_use = { self.nextthink = time + 0.2; force_retouch = 2; // make sure even still objects get hit - self.think = SUB_Null; + self.think = sub_null; }; /*QUAKED trigger_teleport(.5 .5 .5) ? PLAYER_ONLY SILENT @@ -405,18 +405,18 @@ If the trigger_teleport has a targetname, it will only teleport entities when it void() trigger_teleport = { vector o; - InitTrigger(); + init_trigger(); self.touch = teleport_touch; // find the destination if(!self.target) { - objerror("no target"); + error_obj("no target"); } self.use = teleport_use; if(!(self.spawnflags & TELE_SILENT)) { precache_sound("ambience/hum1.wav"); o = (self.mins + self.maxs) * 0.5; - ambientsound(o, "ambience/hum1.wav", 0.5, ATTN_STATIC); + ambient_sound(o, "ambience/hum1.wav", 0.5, ATTN_STATIC); } }; @@ -441,7 +441,7 @@ sets skill level to the value of "message". Only used on start map. */ void() trigger_setskill = { - InitTrigger(); + init_trigger(); self.touch = trigger_skill_touch; }; @@ -464,11 +464,11 @@ void() trigger_onlyregistered_touch = { self.attack_finished = time + 2; if(cvar("registered")) { self.message = string_null; - SUB_UseTargets(); + sub_use_targets(); remove(self); } else { if(self.message != string_null) { - centerprint(other, self.message); + print_center(other, self.message); sound(other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM); } } @@ -479,7 +479,7 @@ Only fires if playing the registered version, otherwise prints the message */ void() trigger_onlyregistered = { precache_sound("misc/talk.wav"); - InitTrigger(); + init_trigger(); self.touch = trigger_onlyregistered_touch; }; @@ -493,7 +493,7 @@ void() hurt_on = { void() hurt_touch = { if(other.takedamage) { self.solid = SOLID_NOT; - T_Damage(other, self, self, self.dmg); + ent_damage(other, self, self, self.dmg); self.think = hurt_on; self.nextthink = time + 1; } @@ -507,7 +507,7 @@ set dmg to damage amount defalt dmg = 5 */ void() trigger_hurt = { - InitTrigger(); + init_trigger(); self.touch = hurt_touch; if(!self.dmg) { self.dmg = 5; @@ -537,7 +537,7 @@ void() trigger_push_touch = { Pushes the player */ void() trigger_push = { - InitTrigger(); + init_trigger(); precache_sound("ambience/windfly.wav"); self.touch = trigger_push_touch; if(!self.speed) { @@ -580,7 +580,7 @@ void() trigger_monsterjump = { if(self.angles == VEC_ORIGIN) { self.angles = '0 360 0'; } - InitTrigger(); + init_trigger(); self.touch = trigger_monsterjump_touch; }; diff --git a/source/weapons.qc b/source/weapons.qc index 78af0cd..d7a1769 100644 --- a/source/weapons.qc +++ b/source/weapons.qc @@ -1,7 +1,7 @@ // weapons.qc: weapon functions // called by worldspawn -void() W_Precache = { +void() wep_precache = { precache_sound("weapons/r_exp3.wav"); // new rocket explosion precache_sound("weapons/rocket1i.wav"); // spike gun precache_sound("weapons/sgun1.wav"); @@ -18,16 +18,16 @@ void() W_Precache = { /* ================ -W_FireAxe +wep_fire_axe ================ */ -void() W_FireAxe = { +void() wep_fire_axe = { vector source; vector org; - makevectors(self.v_angle); + make_vectors(self.v_angle); source = self.origin + '0 0 16'; - traceline(source, source + v_forward * 64, FALSE, self); + trace_line(source, source + v_forward * 64, FALSE, self); if(trace_fraction == 1.0) { return; } @@ -36,16 +36,16 @@ void() W_FireAxe = { if(trace_ent.takedamage) { trace_ent.axhitme = 1; - SpawnBlood(org, VEC_ORIGIN, 20); - T_Damage(trace_ent, self, self, 20); + spawn_blood(org, VEC_ORIGIN, 20); + ent_damage(trace_ent, self, self, 20); } else { // hit wall sound(self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM); - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_GUNSHOT); - WriteCoord(MSG_BROADCAST, org_x); - WriteCoord(MSG_BROADCAST, org_y); - WriteCoord(MSG_BROADCAST, org_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_GUNSHOT); + write_coord(MSG_BROADCAST, org_x); + write_coord(MSG_BROADCAST, org_y); + write_coord(MSG_BROADCAST, org_z); } }; @@ -64,10 +64,10 @@ vector() wall_velocity = { /* ================ -SpawnMeatSpray +spawn_meat_spray ================ */ -void(vector org, vector vel) SpawnMeatSpray = { +void(vector org, vector vel) spawn_meat_spray = { entity missile, mpuff; vector org; @@ -76,7 +76,7 @@ void(vector org, vector vel) SpawnMeatSpray = { missile.movetype = MOVETYPE_BOUNCE; missile.solid = SOLID_NOT; - makevectors(self.angles); + make_vectors(self.angles); missile.velocity = vel; missile.velocity_z = missile.velocity_z + 250 + 50 * random(); @@ -85,19 +85,19 @@ void(vector org, vector vel) SpawnMeatSpray = { // set missile duration missile.nextthink = time + 1; - missile.think = SUB_Remove; + missile.think = sub_remove; - setmodel(missile, "progs/zom_gib.mdl"); - setsize(missile, VEC_ORIGIN, VEC_ORIGIN); - setorigin(missile, org); + set_model(missile, "progs/zom_gib.mdl"); + set_size(missile, VEC_ORIGIN, VEC_ORIGIN); + set_origin(missile, org); }; /* ================ -SpawnBlood +spawn_blood ================ */ -void(vector org, vector vel, float damage) SpawnBlood = { +void(vector org, vector vel, float damage) spawn_blood = { particle(org, vel * 0.1, 73, damage * 2); }; @@ -110,15 +110,15 @@ void(float damage) spawn_touchblood = { vector vel; vel = wall_velocity() * 0.2; - SpawnBlood(self.origin + vel * 0.01, vel, damage); + spawn_blood(self.origin + vel * 0.01, vel, damage); }; /* ================ -SpawnChunk +spawn_chunk ================ */ -void(vector org, vector vel) SpawnChunk = { +void(vector org, vector vel) spawn_chunk = { particle(org, vel * 0.02, 0, 10); }; @@ -132,25 +132,25 @@ Collects multiple small damages into a single damage ============================================================================== */ -void() ClearMultiDamage = { +void() multi_damage_clear = { multi_ent = world; multi_damage = 0; }; -void() ApplyMultiDamage = { +void() multi_damage_apply = { if(!multi_ent) { return; } - T_Damage(multi_ent, self, self, multi_damage); + ent_damage(multi_ent, self, self, multi_damage); }; -void(entity hit, float damage) AddMultiDamage = { +void(entity hit, float damage) multi_damage_add = { if(!hit) { return; } if(hit != multi_ent) { - ApplyMultiDamage(); + multi_damage_apply(); multi_damage = damage; multi_ent = hit; } else { @@ -168,10 +168,10 @@ BULLETS /* ================ -TraceAttack +trace_attack ================ */ -void(float damage, vector dir) TraceAttack = { +void(float damage, vector dir) trace_attack = { vector vel, org; vel = normalize(dir + v_up * crandom() + v_right * crandom()); @@ -181,52 +181,52 @@ void(float damage, vector dir) TraceAttack = { org = trace_endpos - dir * 4; if(trace_ent.takedamage) { - SpawnBlood(org, vel * 0.2, damage); - AddMultiDamage(trace_ent, damage); + spawn_blood(org, vel * 0.2, damage); + multi_damage_add(trace_ent, damage); } else { - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_GUNSHOT); - WriteCoord(MSG_BROADCAST, org_x); - WriteCoord(MSG_BROADCAST, org_y); - WriteCoord(MSG_BROADCAST, org_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_GUNSHOT); + write_coord(MSG_BROADCAST, org_x); + write_coord(MSG_BROADCAST, org_y); + write_coord(MSG_BROADCAST, org_z); } }; /* ================ -FireBullets +fire_bullets Used by shotgun, super shotgun, and enemy soldier firing Go to the trouble of combining multiple pellets into a single damage call. ================ */ -void(float shotcount, vector dir, vector spread) FireBullets = { +void(float shotcount, vector dir, vector spread) fire_bullets = { vector direction; vector src; - makevectors(self.v_angle); + make_vectors(self.v_angle); src = self.origin + v_forward * 10; src_z = self.absmin_z + self.size_z * 0.7; - ClearMultiDamage(); + multi_damage_clear(); while(shotcount > 0) { direction = dir + crandom() * spread_x * v_right + crandom() * spread_y * v_up; - traceline(src, src + direction * 2048, FALSE, self); + trace_line(src, src + direction * 2048, FALSE, self); if(trace_fraction != 1.0) { - TraceAttack(4, direction); + trace_attack(4, direction); } shotcount = shotcount - 1; } - ApplyMultiDamage(); + multi_damage_apply(); }; /* ================ -W_FireShotgun +wep_fire_shotgun ================ */ -void() W_FireShotgun = { +void() wep_fire_shotgun = { vector dir; sound(self, CHAN_WEAPON, "weapons/guncock.wav", 1, ATTN_NORM); @@ -235,19 +235,19 @@ void() W_FireShotgun = { self.currentammo = self.ammo_shells = self.ammo_shells - 1; dir = aim(self, 100000); - FireBullets(6, dir, '0.04 0.04 0'); + fire_bullets(6, dir, '0.04 0.04 0'); }; /* ================ -W_FireSuperShotgun +wep_fire_super_shotgun ================ */ -void() W_FireSuperShotgun = { +void() wep_fire_super_shotgun = { vector dir; if(self.currentammo == 1) { - W_FireShotgun(); + wep_fire_shotgun(); return; } @@ -257,7 +257,7 @@ void() W_FireSuperShotgun = { self.currentammo = self.ammo_shells = self.ammo_shells - 2; dir = aim(self, 100000); - FireBullets(14, dir, '0.14 0.08 0'); + fire_bullets(14, dir, '0.14 0.08 0'); }; /* @@ -273,25 +273,25 @@ void() s_explode2 = [1, s_explode3] {}; void() s_explode3 = [2, s_explode4] {}; void() s_explode4 = [3, s_explode5] {}; void() s_explode5 = [4, s_explode6] {}; -void() s_explode6 = [5, SUB_Remove] {}; +void() s_explode6 = [5, sub_remove] {}; -void() BecomeExplosion = { +void() become_explosion = { self.movetype = MOVETYPE_NONE; self.velocity = VEC_ORIGIN; - self.touch = SUB_Null; - setmodel(self, "progs/s_explod.spr"); + self.touch = sub_null; + set_model(self, "progs/s_explod.spr"); self.solid = SOLID_NOT; s_explode1(); }; -void() T_MissileTouch = { +void() ent_missile_touch = { float damg; if(other == self.owner) { return; // don't explode on owner } - if(pointcontents(self.origin) == CONTENT_SKY) { + if(point_contents(self.origin) == CONTENT_SKY) { remove(self); return; } @@ -302,32 +302,32 @@ void() T_MissileTouch = { if(other.classname == "monster_shambler") { damg = damg * 0.5; // mostly immune } - T_Damage(other, self, self.owner, damg); + ent_damage(other, self, self.owner, damg); } // don't do radius damage to the other, because all the damage // was done in the impact - T_RadiusDamage(self, self.owner, 120, other); + ent_radius_damage(self, self.owner, 120, other); // sound(self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM); self.origin = self.origin - 8 * normalize(self.velocity); - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_EXPLOSION); - WriteCoord(MSG_BROADCAST, self.origin_x); - WriteCoord(MSG_BROADCAST, self.origin_y); - WriteCoord(MSG_BROADCAST, self.origin_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_EXPLOSION); + write_coord(MSG_BROADCAST, self.origin_x); + write_coord(MSG_BROADCAST, self.origin_y); + write_coord(MSG_BROADCAST, self.origin_z); - BecomeExplosion(); + become_explosion(); }; /* ================ -W_FireRocket +wep_fire_rocket ================ */ -void() W_FireRocket = { +void() wep_fire_rocket = { entity missile, mpuff; self.currentammo = self.ammo_rockets = self.ammo_rockets - 1; @@ -344,20 +344,20 @@ void() W_FireRocket = { // set missile speed - makevectors(self.v_angle); + make_vectors(self.v_angle); missile.velocity = aim(self, 1000); missile.velocity = missile.velocity * 1000; - missile.angles = vectoangles(missile.velocity); + missile.angles = vec_to_angles(missile.velocity); - missile.touch = T_MissileTouch; + missile.touch = ent_missile_touch; // set missile duration missile.nextthink = time + 5; - missile.think = SUB_Remove; + missile.think = sub_remove; - setmodel(missile, "progs/missile.mdl"); - setsize(missile, VEC_ORIGIN, VEC_ORIGIN); - setorigin(missile, self.origin + v_forward * 8 + '0 0 16'); + set_model(missile, "progs/missile.mdl"); + set_size(missile, VEC_ORIGIN, VEC_ORIGIN); + set_origin(missile, self.origin + v_forward * 8 + '0 0 16'); }; /* @@ -370,10 +370,10 @@ LIGHTNING /* ================= -LightningDamage +lightning_damage ================= */ -void(vector p1, vector p2, entity from, float damage) LightningDamage = { +void(vector p1, vector p2, entity from, float damage) lightning_damage = { entity e1, e2; vector f; @@ -386,39 +386,37 @@ void(vector p1, vector p2, entity from, float damage) LightningDamage = { e1 = e2 = world; - traceline(p1, p2, FALSE, self); + trace_line(p1, p2, FALSE, self); if(trace_ent.takedamage) { particle(trace_endpos, '0 0 100', 225, damage * 4); - T_Damage(trace_ent, from, from, damage); - if(self.classname == "player") { - if(other.classname == "player") { - trace_ent.velocity_z = trace_ent.velocity_z + 400; - } + ent_damage(trace_ent, from, from, damage); + if(self.classname == "player" && other.classname == "player") { + trace_ent.velocity_z = trace_ent.velocity_z + 400; } } e1 = trace_ent; - traceline(p1 + f, p2 + f, FALSE, self); + trace_line(p1 + f, p2 + f, FALSE, self); if(trace_ent != e1 && trace_ent.takedamage) { particle(trace_endpos, '0 0 100', 225, damage * 4); - T_Damage(trace_ent, from, from, damage); + ent_damage(trace_ent, from, from, damage); } e2 = trace_ent; - traceline(p1 - f, p2 - f, FALSE, self); + trace_line(p1 - f, p2 - f, FALSE, self); if(trace_ent != e1 && trace_ent != e2 && trace_ent.takedamage) { particle(trace_endpos, '0 0 100', 225, damage * 4); - T_Damage(trace_ent, from, from, damage); + ent_damage(trace_ent, from, from, damage); } }; -void() W_FireLightning = { +void() wep_fire_lightning = { vector org; float cells; if(self.ammo_cells < 1) { - self.weapon = W_BestWeapon(); - W_SetCurrentAmmo(); + self.weapon = wep_best_weapon(); + wep_set_current_ammo(); return; } @@ -426,8 +424,8 @@ void() W_FireLightning = { if(self.waterlevel > 1) { cells = self.ammo_cells; self.ammo_cells = 0; - W_SetCurrentAmmo(); - T_RadiusDamage(self, self, 35 * cells, world); + wep_set_current_ammo(); + ent_radius_damage(self, self, 35 * cells, world); return; } @@ -441,41 +439,41 @@ void() W_FireLightning = { org = self.origin + '0 0 16'; - traceline(org, org + v_forward * 600, TRUE, self); + trace_line(org, org + v_forward * 600, TRUE, self); - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_LIGHTNING2); - WriteEntity(MSG_BROADCAST, self); - WriteCoord(MSG_BROADCAST, org_x); - WriteCoord(MSG_BROADCAST, org_y); - WriteCoord(MSG_BROADCAST, org_z); - WriteCoord(MSG_BROADCAST, trace_endpos_x); - WriteCoord(MSG_BROADCAST, trace_endpos_y); - WriteCoord(MSG_BROADCAST, trace_endpos_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_LIGHTNING2); + write_entity(MSG_BROADCAST, self); + write_coord(MSG_BROADCAST, org_x); + write_coord(MSG_BROADCAST, org_y); + write_coord(MSG_BROADCAST, org_z); + write_coord(MSG_BROADCAST, trace_endpos_x); + write_coord(MSG_BROADCAST, trace_endpos_y); + write_coord(MSG_BROADCAST, trace_endpos_z); - LightningDamage(self.origin, trace_endpos + v_forward * 4, self, 30); + lightning_damage(self.origin, trace_endpos + v_forward * 4, self, 30); }; //============================================================================= -void() GrenadeExplode = { - T_RadiusDamage(self, self.owner, 120, world); +void() grenade_explode = { + ent_radius_damage(self, self.owner, 120, world); - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_EXPLOSION); - WriteCoord(MSG_BROADCAST, self.origin_x); - WriteCoord(MSG_BROADCAST, self.origin_y); - WriteCoord(MSG_BROADCAST, self.origin_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_EXPLOSION); + write_coord(MSG_BROADCAST, self.origin_x); + write_coord(MSG_BROADCAST, self.origin_y); + write_coord(MSG_BROADCAST, self.origin_z); - BecomeExplosion(); + become_explosion(); }; -void() GrenadeTouch = { +void() grenade_touch = { if(other == self.owner) { return; // don't explode on owner } if(other.takedamage == DAMAGE_AIM) { - GrenadeExplode(); + grenade_explode(); return; } sound(self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound @@ -486,10 +484,10 @@ void() GrenadeTouch = { /* ================ -W_FireGrenade +wep_fire_grenade ================ */ -void() W_FireGrenade = { +void() wep_fire_grenade = { entity missile, mpuff; self.currentammo = self.ammo_rockets = self.ammo_rockets - 1; @@ -506,7 +504,7 @@ void() W_FireGrenade = { // set missile speed - makevectors(self.v_angle); + make_vectors(self.v_angle); if(self.v_angle_x) { missile.velocity = v_forward * 600 + v_up * 200 + crandom() * v_right * 10 + crandom() * v_up * 10; @@ -518,17 +516,17 @@ void() W_FireGrenade = { missile.avelocity = '300 300 300'; - missile.angles = vectoangles(missile.velocity); + missile.angles = vec_to_angles(missile.velocity); - missile.touch = GrenadeTouch; + missile.touch = grenade_touch; // set missile duration missile.nextthink = time + 2.5; - missile.think = GrenadeExplode; + missile.think = grenade_explode; - setmodel(missile, "progs/grenade.mdl"); - setsize(missile, VEC_ORIGIN, VEC_ORIGIN); - setorigin(missile, self.origin); + set_model(missile, "progs/grenade.mdl"); + set_size(missile, VEC_ORIGIN, VEC_ORIGIN); + set_origin(missile, self.origin); }; //============================================================================= @@ -546,20 +544,20 @@ void(vector org, vector dir) launch_spike = { newmis.movetype = MOVETYPE_FLYMISSILE; newmis.solid = SOLID_BBOX; - newmis.angles = vectoangles(dir); + newmis.angles = vec_to_angles(dir); newmis.touch = spike_touch; newmis.classname = "spike"; - newmis.think = SUB_Remove; + newmis.think = sub_remove; newmis.nextthink = time + 6; - setmodel(newmis, "progs/spike.mdl"); - setsize(newmis, VEC_ORIGIN, VEC_ORIGIN); - setorigin(newmis, org); + set_model(newmis, "progs/spike.mdl"); + set_size(newmis, VEC_ORIGIN, VEC_ORIGIN); + set_origin(newmis, org); newmis.velocity = dir * 1000; }; -void() W_FireSuperSpikes = { +void() wep_fire_super_nail = { vector dir; entity old; @@ -569,25 +567,25 @@ void() W_FireSuperSpikes = { dir = aim(self, 1000); launch_spike(self.origin + '0 0 16', dir); newmis.touch = superspike_touch; - setmodel(newmis, "progs/s_spike.mdl"); - setsize(newmis, VEC_ORIGIN, VEC_ORIGIN); + set_model(newmis, "progs/s_spike.mdl"); + set_size(newmis, VEC_ORIGIN, VEC_ORIGIN); self.punchangle_x = -2; }; -void(float ox) W_FireSpikes = { +void(float ox) wep_fire_nail = { vector dir; entity old; - makevectors(self.v_angle); + make_vectors(self.v_angle); if(self.ammo_nails >= 2 && self.weapon == IT_SUPER_NAILGUN) { - W_FireSuperSpikes(); + wep_fire_super_nail(); return; } if(self.ammo_nails < 1) { - self.weapon = W_BestWeapon(); - W_SetCurrentAmmo(); + self.weapon = wep_best_weapon(); + wep_set_current_ammo(); return; } @@ -610,7 +608,7 @@ void() spike_touch = { return; // trigger field, do nothing } - if(pointcontents(self.origin) == CONTENT_SKY) { + if(point_contents(self.origin) == CONTENT_SKY) { remove(self); return; } @@ -618,19 +616,19 @@ void() spike_touch = { // hit something that bleeds if(other.takedamage) { spawn_touchblood(9); - T_Damage(other, self, self.owner, 9); + ent_damage(other, self, self.owner, 9); } else { - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); if(self.classname == "wizspike") { - WriteByte(MSG_BROADCAST, TE_WIZSPIKE); + write_byte(MSG_BROADCAST, TE_WIZSPIKE); } else if(self.classname == "knightspike") { - WriteByte(MSG_BROADCAST, TE_KNIGHTSPIKE); + write_byte(MSG_BROADCAST, TE_KNIGHTSPIKE); } else { - WriteByte(MSG_BROADCAST, TE_SPIKE); + write_byte(MSG_BROADCAST, TE_SPIKE); } - WriteCoord(MSG_BROADCAST, self.origin_x); - WriteCoord(MSG_BROADCAST, self.origin_y); - WriteCoord(MSG_BROADCAST, self.origin_z); + write_coord(MSG_BROADCAST, self.origin_x); + write_coord(MSG_BROADCAST, self.origin_y); + write_coord(MSG_BROADCAST, self.origin_z); } remove(self); @@ -647,7 +645,7 @@ void() superspike_touch = { return; // trigger field, do nothing } - if(pointcontents(self.origin) == CONTENT_SKY) { + if(point_contents(self.origin) == CONTENT_SKY) { remove(self); return; } @@ -655,13 +653,13 @@ void() superspike_touch = { // hit something that bleeds if(other.takedamage) { spawn_touchblood(18); - T_Damage(other, self, self.owner, 18); + ent_damage(other, self, self.owner, 18); } else { - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_SUPERSPIKE); - WriteCoord(MSG_BROADCAST, self.origin_x); - WriteCoord(MSG_BROADCAST, self.origin_y); - WriteCoord(MSG_BROADCAST, self.origin_z); + write_byte(MSG_BROADCAST, SVC_TEMPENTITY); + write_byte(MSG_BROADCAST, TE_SUPERSPIKE); + write_coord(MSG_BROADCAST, self.origin_x); + write_coord(MSG_BROADCAST, self.origin_y); + write_coord(MSG_BROADCAST, self.origin_z); } remove(self); @@ -676,7 +674,7 @@ PLAYER WEAPON USE =============================================================================== */ -void() W_SetCurrentAmmo = { +void() wep_set_current_ammo = { player_run(); // get out of any weapon firing states self.items &= ~(IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS); @@ -737,7 +735,7 @@ void() W_SetCurrentAmmo = { } }; -float() W_BestWeapon = { +float() wep_best_weapon = { float it; it = self.items; @@ -762,21 +760,21 @@ float() W_BestWeapon = { /* ============ -W_Attack +wep_attack An attack impulse can be triggered now ============ */ -void() W_Attack = { +void() wep_attack = { float r; if(self.currentammo <= 0 && self.weapon != IT_AXE) { - self.weapon = W_BestWeapon(); - W_SetCurrentAmmo(); + self.weapon = wep_best_weapon(); + wep_set_current_ammo(); return; } - makevectors(self.v_angle); // calculate forward angle for velocity + make_vectors(self.v_angle); // calculate forward angle for velocity self.show_hostile = time + 1; // wake monsters up switch(self.weapon) { @@ -796,12 +794,12 @@ void() W_Attack = { break; case IT_SHOTGUN: player_shot1(); - W_FireShotgun(); + wep_fire_shotgun(); self.attack_finished = time + 0.5; break; case IT_SUPER_SHOTGUN: player_shot1(); - W_FireSuperShotgun(); + wep_fire_super_shotgun(); self.attack_finished = time + 0.7; break; case IT_NAILGUN: @@ -810,12 +808,12 @@ void() W_Attack = { break; case IT_GRENADE_LAUNCHER: player_rocket1(); - W_FireGrenade(); + wep_fire_grenade(); self.attack_finished = time + 0.6; break; case IT_ROCKET_LAUNCHER: player_rocket1(); - W_FireRocket(); + wep_fire_rocket(); self.attack_finished = time + 0.8; break; case IT_LIGHTNING: @@ -828,11 +826,11 @@ void() W_Attack = { /* ============ -W_ChangeWeapon +wep_change_weapon ============ */ -void(float wep) W_ChangeWeapon = { +void(float wep) wep_change_weapon = { float it, am, fl; it = self.items; @@ -888,29 +886,29 @@ void(float wep) W_ChangeWeapon = { if(!(self.items & fl)) { // don't have the weapon or the ammo - sprint(self, "no weapon.\n"); + print_cl(self, "no weapon.\n"); return; } if(am) { // don't have the ammo - sprint(self, "not enough ammo.\n"); + print_cl(self, "not enough ammo.\n"); return; } // set weapon, set ammo self.weapon = fl; - W_SetCurrentAmmo(); + wep_set_current_ammo(); }; /* ============ -W_CycleWeapon +wep_cycle_weapon Go to the next weapon with ammo ============ */ -void() W_CycleWeapon = { +void() wep_cycle_weapon = { float it, am; it = self.items; @@ -967,7 +965,7 @@ void() W_CycleWeapon = { return; } if((it & self.weapon) && am == 0) { - W_SetCurrentAmmo(); + wep_set_current_ammo(); return; } } @@ -975,12 +973,12 @@ void() W_CycleWeapon = { /* ============ -W_CycleWeaponReverse +wep_cycle_weapon_reverse Go to the prev weapon with ammo ============ */ -void() W_CycleWeaponReverse = { +void() wep_cycle_weapon_reverse = { float it, am; it = self.items; @@ -1037,7 +1035,7 @@ void() W_CycleWeaponReverse = { return; } if((it & self.weapon) && am == 0) { - W_SetCurrentAmmo(); + wep_set_current_ammo(); return; } } @@ -1045,27 +1043,27 @@ void() W_CycleWeaponReverse = { /* ============ -W_WeaponFrame +wep_weapon_frame Called every frame so impulse events can be handled as well as possible ============ */ -void() W_WeaponFrame = { +void() wep_weapon_frame = { // check for attack if(self.button0) { - SuperDamageSound(); - W_Attack(); + super_damage_sound(); + wep_attack(); } }; /* ======== -SuperDamageSound +super_damage_sound Plays sound if needed ======== */ -void() SuperDamageSound = { +void() super_damage_sound = { if(self.super_damage_finished > time) { if(self.super_sound < time) { self.super_sound = time + 1; diff --git a/source/wizard.qc b/source/wizard.qc index b9a68fb..41a1d44 100644 --- a/source/wizard.qc +++ b/source/wizard.qc @@ -31,24 +31,24 @@ will duck back out and catch it. /* ============= -LaunchMissile +launch_missile Sets the given entities velocity and angles so that it will hit self.enemy if self.enemy maintains it's current velocity 0.1 is moderately accurate, 0.0 is totally accurate ============= */ -void(entity missile, float mspeed, float accuracy) LaunchMissile = { +void(entity missile, float mspeed, float accuracy) launch_missile = { vector vec, move; float fly; - makevectors(self.angles); + make_vectors(self.angles); // set missile speed vec = self.enemy.origin + self.enemy.mins + self.enemy.size * 0.7 - missile.origin; // calc aproximate time for missile to reach vec - fly = vlen(vec) / mspeed; + fly = vec_len(vec) / mspeed; // get the entities xy velocity move = self.enemy.velocity; @@ -63,19 +63,19 @@ void(entity missile, float mspeed, float accuracy) LaunchMissile = { missile.velocity = vec * mspeed; missile.angles = VEC_ORIGIN; - missile.angles_y = vectoyaw(missile.velocity); + missile.angles_y = vec_yaw(missile.velocity); // set missile duration missile.nextthink = time + 5; - missile.think = SUB_Remove; + missile.think = sub_remove; }; /* ================= -WizardCheckAttack +wiz_check_attack ================= */ -float() WizardCheckAttack = { +float() wiz_check_attack = { vector spot1, spot2; entity targ; float chance; @@ -101,7 +101,7 @@ float() WizardCheckAttack = { spot1 = self.origin + self.view_ofs; spot2 = targ.origin + targ.view_ofs; - traceline(spot1, spot2, FALSE, self); + trace_line(spot1, spot2, FALSE, self); if(trace_ent != targ) { // don't have a clear shot, so move to a side @@ -144,10 +144,10 @@ float() WizardCheckAttack = { /* ================= -WizardAttackFinished +wiz_attack_finished ================= */ -void() WizardAttackFinished = { +void() wiz_attack_finished = { if(enemy_range >= RANGE_MID || !enemy_vis) { self.attack_state = AS_STRAIGHT; self.think = wiz_run1; @@ -165,13 +165,13 @@ FAST ATTACKS ============================================================================== */ -void() Wiz_FastFire = { +void() wiz_fast_fire = { vector vec; vector dst; if(self.owner.health > 0) { self.owner.effects = self.owner.effects | EF_MUZZLEFLASH; - makevectors(self.enemy.angles); + make_vectors(self.enemy.angles); dst = self.enemy.origin - 13 * self.movedir; vec = normalize(dst - self.origin); sound(self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM); @@ -179,43 +179,43 @@ void() Wiz_FastFire = { newmis.velocity = vec * 600; newmis.owner = self.owner; newmis.classname = "wizspike"; - setmodel(newmis, "progs/w_spike.mdl"); - setsize(newmis, VEC_ORIGIN, VEC_ORIGIN); + set_model(newmis, "progs/w_spike.mdl"); + set_size(newmis, VEC_ORIGIN, VEC_ORIGIN); } remove(self); }; -void() Wiz_StartFast = { +void() wiz_start_fast = { entity missile; sound(self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM); self.v_angle = self.angles; - makevectors(self.angles); + make_vectors(self.angles); missile = spawn(); missile.owner = self; missile.nextthink = time + 0.6; - setsize(missile, VEC_ORIGIN, VEC_ORIGIN); - setorigin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * 14); + set_size(missile, VEC_ORIGIN, VEC_ORIGIN); + set_origin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * 14); missile.enemy = self.enemy; missile.nextthink = time + 0.8; - missile.think = Wiz_FastFire; + missile.think = wiz_fast_fire; missile.movedir = v_right; missile = spawn(); missile.owner = self; missile.nextthink = time + 1; - setsize(missile, VEC_ORIGIN, VEC_ORIGIN); - setorigin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * -14); + set_size(missile, VEC_ORIGIN, VEC_ORIGIN); + set_origin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * -14); missile.enemy = self.enemy; missile.nextthink = time + 0.3; - missile.think = Wiz_FastFire; + missile.think = wiz_fast_fire; missile.movedir = VEC_ORIGIN - v_right; }; -void() Wiz_idlesound = { +void() wiz_idle_sound = { float wr; wr = random() * 5; @@ -241,7 +241,7 @@ void() wiz_stand7 = [ $hover7, wiz_stand8 ] {ai_stand();}; void() wiz_stand8 = [ $hover8, wiz_stand1 ] {ai_stand();}; void() wiz_walk1 = [ $hover1, wiz_walk2 ] {ai_walk(8); - Wiz_idlesound(); + wiz_idle_sound(); }; void() wiz_walk2 = [ $hover2, wiz_walk3 ] {ai_walk(8);}; void() wiz_walk3 = [ $hover3, wiz_walk4 ] {ai_walk(8);}; @@ -252,7 +252,7 @@ void() wiz_walk7 = [ $hover7, wiz_walk8 ] {ai_walk(8);}; void() wiz_walk8 = [ $hover8, wiz_walk1 ] {ai_walk(8);}; void() wiz_side1 = [ $hover1, wiz_side2 ] {ai_run(8); - Wiz_idlesound(); + wiz_idle_sound(); }; void() wiz_side2 = [ $hover2, wiz_side3 ] {ai_run(8);}; void() wiz_side3 = [ $hover3, wiz_side4 ] {ai_run(8);}; @@ -263,7 +263,7 @@ void() wiz_side7 = [ $hover7, wiz_side8 ] {ai_run(8);}; void() wiz_side8 = [ $hover8, wiz_side1 ] {ai_run(8);}; void() wiz_run1 = [ $fly1, wiz_run2 ] {ai_run(16); - Wiz_idlesound(); + wiz_idle_sound(); }; void() wiz_run2 = [ $fly2, wiz_run3 ] {ai_run(16);}; void() wiz_run3 = [ $fly3, wiz_run4 ] {ai_run(16);}; @@ -279,7 +279,7 @@ void() wiz_run12 = [ $fly12, wiz_run13 ] {ai_run(16);}; void() wiz_run13 = [ $fly13, wiz_run14 ] {ai_run(16);}; void() wiz_run14 = [ $fly14, wiz_run1 ] {ai_run(16);}; -void() wiz_fast1 = [ $magatt1, wiz_fast2 ] {ai_face(); Wiz_StartFast();}; +void() wiz_fast1 = [ $magatt1, wiz_fast2 ] {ai_face(); wiz_start_fast();}; void() wiz_fast2 = [ $magatt2, wiz_fast3 ] {ai_face();}; void() wiz_fast3 = [ $magatt3, wiz_fast4 ] {ai_face();}; void() wiz_fast4 = [ $magatt4, wiz_fast5 ] {ai_face();}; @@ -288,7 +288,7 @@ void() wiz_fast6 = [ $magatt6, wiz_fast7 ] {ai_face();}; void() wiz_fast7 = [ $magatt5, wiz_fast8 ] {ai_face();}; void() wiz_fast8 = [ $magatt4, wiz_fast9 ] {ai_face();}; void() wiz_fast9 = [ $magatt3, wiz_fast10 ] {ai_face();}; -void() wiz_fast10 = [ $magatt2, wiz_run1 ] {ai_face(); SUB_AttackFinished(2); WizardAttackFinished();}; +void() wiz_fast10 = [ $magatt2, wiz_run1 ] {ai_face(); sub_attack_finished(2); wiz_attack_finished();}; void() wiz_pain1 = [ $pain1, wiz_pain2 ] {}; void() wiz_pain2 = [ $pain2, wiz_pain3 ] {}; @@ -315,17 +315,17 @@ void() wiz_die = { // check for gib if(self.health < -40) { sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM); - ThrowHead("progs/h_wizard.mdl", self.health); - ThrowGib("progs/gib2.mdl", self.health); - ThrowGib("progs/gib2.mdl", self.health); - ThrowGib("progs/gib2.mdl", self.health); + throw_head("progs/h_wizard.mdl", self.health); + throw_gib("progs/gib2.mdl", self.health); + throw_gib("progs/gib2.mdl", self.health); + throw_gib("progs/gib2.mdl", self.health); return; } wiz_death1(); }; -void(entity attacker, float damage) Wiz_Pain = { +void(entity attacker, float damage) wiz_pain = { sound(self, CHAN_VOICE, "wizard/wpain.wav", 1, ATTN_NORM); if(random() * 70 > damage) { return; // didn't flinch @@ -334,7 +334,7 @@ void(entity attacker, float damage) Wiz_Pain = { wiz_pain1(); }; -void() Wiz_Missile = { +void() wiz_missile = { wiz_fast1(); }; @@ -360,16 +360,16 @@ void() monster_wizard = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/wizard.mdl"); + set_model(self, "progs/wizard.mdl"); - setsize(self, '-16 -16 -24', '16 16 40'); + set_size(self, '-16 -16 -24', '16 16 40'); self.health = 80; self.th_stand = wiz_stand1; self.th_walk = wiz_walk1; self.th_run = wiz_run1; - self.th_missile = Wiz_Missile; - self.th_pain = Wiz_Pain; + self.th_missile = wiz_missile; + self.th_pain = wiz_pain; self.th_die = wiz_die; flymonster_start(); diff --git a/source/world.qc b/source/world.qc index d75d150..4798e33 100644 --- a/source/world.qc +++ b/source/world.qc @@ -15,11 +15,11 @@ World Types: */ void() worldspawn = { lastspawn = world; - InitBodyQue(); + init_body_queue(); if(cvar("pr_checkextension")) { - ext_con_set = checkextension("DP_CON_SET"); - ext_strings = checkextension("FTE_STRINGS"); + ext_con_set = check_extension("DP_CON_SET"); + ext_strings = check_extension("FTE_STRINGS"); } // custom map attributes @@ -32,7 +32,7 @@ void() worldspawn = { // the area based ambient sounds MUST be the first precache_sounds // player precaches - W_Precache(); // get weapon precaches + wep_precache(); // get weapon precaches // sounds used from C physics code precache_sound("demon/dland2.wav"); // landing thud @@ -142,45 +142,45 @@ void() worldspawn = { // // 0 normal - lightstyle(0, "m"); + light_style(0, "m"); // 1 FLICKER(first variety) - lightstyle(1, "mmnmmommommnonmmonqnmmo"); + light_style(1, "mmnmmommommnonmmonqnmmo"); // 2 SLOW STRONG PULSE - lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); + light_style(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); // 3 CANDLE(first variety) - lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg"); + light_style(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg"); // 4 FAST STROBE - lightstyle(4, "mamamamamama"); + light_style(4, "mamamamamama"); // 5 GENTLE PULSE 1 - lightstyle(5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj"); + light_style(5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj"); // 6 FLICKER(second variety) - lightstyle(6, "nmonqnmomnmomomno"); + light_style(6, "nmonqnmomnmomomno"); // 7 CANDLE(second variety) - lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm"); + light_style(7, "mmmaaaabcdefgmmmmaaaammmaamm"); // 8 CANDLE(third variety) - lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa"); + light_style(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa"); // 9 SLOW STROBE(fourth variety) - lightstyle(9, "aaaaaaaazzzzzzzz"); + light_style(9, "aaaaaaaazzzzzzzz"); // 10 FLUORESCENT FLICKER - lightstyle(10, "mmamammmmammamamaaamammma"); + light_style(10, "mmamammmmammamamaaamammma"); // 11 SLOW PULSE NOT FADE TO BLACK - lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba"); + light_style(11, "abcdefghijklmnopqrrqponmlkjihgfedcba"); // styles 32-62 are assigned by the light program for switchable lights // 63 testing - lightstyle(63, "a"); + light_style(63, "a"); }; void() StartFrame = { @@ -205,11 +205,11 @@ void() StartFrame = { if(all_players_are_dead) { delta = time - all_players_are_dead; if(delta >= 9.95) { - localcmd("restart\n"); + cmd_server("restart\n"); } else if(rint(delta * 10) == rint(delta) * 10) { pl = find(world, classname, "player"); while(pl != world) { - centerprint(pl, "Mission failed.\nRestarting in ", + print_center(pl, "Mission failed.\nRestarting in ", ftos(10 - rint(delta)), " seconds"); pl = find(pl, classname, "player"); } @@ -239,7 +239,7 @@ entity() spawn_bodyque = { return e; }; -void() InitBodyQue = { +void() init_body_queue = { entity e; float i; @@ -258,7 +258,7 @@ void() InitBodyQue = { // make a body que entry for the given ent so the ent can be // respawned elsewhere -void(entity ent) CopyToBodyQue = { +void(entity ent) copy_to_body_queue = { bodyque_head.angles = ent.angles; bodyque_head.model = ent.model; bodyque_head.modelindex = ent.modelindex; @@ -267,8 +267,8 @@ void(entity ent) CopyToBodyQue = { bodyque_head.movetype = ent.movetype; bodyque_head.velocity = ent.velocity; bodyque_head.flags = 0; - setorigin(bodyque_head, ent.origin); - setsize(bodyque_head, ent.mins, ent.maxs); + set_origin(bodyque_head, ent.origin); + set_size(bodyque_head, ent.mins, ent.maxs); bodyque_head = bodyque_head.owner; }; diff --git a/source/zombie.qc b/source/zombie.qc index a780e69..3ad12ab 100644 --- a/source/zombie.qc +++ b/source/zombie.qc @@ -134,12 +134,12 @@ ATTACKS ============================================================================= */ -void() ZombieGrenadeTouch = { +void() zombie_grenade_touch = { if(other == self.owner) { return; // don't explode on owner } if(other.takedamage) { - T_Damage(other, self, self.owner, 10); + ent_damage(other, self, self.owner, 10); sound(self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM); remove(self); return; @@ -147,15 +147,15 @@ void() ZombieGrenadeTouch = { sound(self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound self.velocity = VEC_ORIGIN; self.avelocity = VEC_ORIGIN; - self.touch = SUB_Remove; + self.touch = sub_remove; }; /* ================ -ZombieFireGrenade +zombie_fire_grenade ================ */ -void(vector st) ZombieFireGrenade = { +void(vector st) zombie_fire_grenade = { entity missile, mpuff; vector org; @@ -171,7 +171,7 @@ void(vector st) ZombieFireGrenade = { // set missile speed - makevectors(self.angles); + make_vectors(self.angles); missile.velocity = normalize(self.enemy.origin - org); missile.velocity = missile.velocity * 600; @@ -179,15 +179,15 @@ void(vector st) ZombieFireGrenade = { missile.avelocity = '3000 1000 2000'; - missile.touch = ZombieGrenadeTouch; + missile.touch = zombie_grenade_touch; // set missile duration missile.nextthink = time + 2.5; - missile.think = SUB_Remove; + missile.think = sub_remove; - setmodel(missile, "progs/zom_gib.mdl"); - setsize(missile, VEC_ORIGIN, VEC_ORIGIN); - setorigin(missile, org); + set_model(missile, "progs/zom_gib.mdl"); + set_size(missile, VEC_ORIGIN, VEC_ORIGIN); + set_origin(missile, org); }; void() zombie_atta1 = [ $atta1, zombie_atta2 ] {ai_face();}; @@ -202,7 +202,7 @@ void() zombie_atta9 = [ $atta9, zombie_atta10 ] {ai_face();}; void() zombie_atta10 = [ $atta10, zombie_atta11 ] {ai_face();}; void() zombie_atta11 = [ $atta11, zombie_atta12 ] {ai_face();}; void() zombie_atta12 = [ $atta12, zombie_atta13 ] {ai_face();}; -void() zombie_atta13 = [ $atta13, zombie_run1 ] {ai_face(); ZombieFireGrenade('-10 -22 30');}; +void() zombie_atta13 = [ $atta13, zombie_run1 ] {ai_face(); zombie_fire_grenade('-10 -22 30');}; void() zombie_attb1 = [ $attb1, zombie_attb2 ] {ai_face();}; void() zombie_attb2 = [ $attb2, zombie_attb3 ] {ai_face();}; @@ -217,7 +217,7 @@ void() zombie_attb10 = [ $attb10, zombie_attb11 ] {ai_face();}; void() zombie_attb11 = [ $attb11, zombie_attb12 ] {ai_face();}; void() zombie_attb12 = [ $attb12, zombie_attb13 ] {ai_face();}; void() zombie_attb13 = [ $attb13, zombie_attb14 ] {ai_face();}; -void() zombie_attb14 = [ $attb13, zombie_run1 ] {ai_face(); ZombieFireGrenade('-10 -24 29');}; +void() zombie_attb14 = [ $attb13, zombie_run1 ] {ai_face(); zombie_fire_grenade('-10 -24 29');}; void() zombie_attc1 = [ $attc1, zombie_attc2 ] {ai_face();}; void() zombie_attc2 = [ $attc2, zombie_attc3 ] {ai_face();}; @@ -230,7 +230,7 @@ void() zombie_attc8 = [ $attc8, zombie_attc9 ] {ai_face();}; void() zombie_attc9 = [ $attc9, zombie_attc10 ] {ai_face();}; void() zombie_attc10 = [ $attc10, zombie_attc11 ] {ai_face();}; void() zombie_attc11 = [ $attc11, zombie_attc12 ] {ai_face();}; -void() zombie_attc12 = [ $attc12, zombie_run1 ] {ai_face(); ZombieFireGrenade('-12 -19 29');}; +void() zombie_attc12 = [ $attc12, zombie_run1 ] {ai_face(); zombie_fire_grenade('-12 -19 29');}; void() zombie_missile = { float r; @@ -351,7 +351,7 @@ void() zombie_paine12 = [ $paine12, zombie_paine13 ] { self.health = 60; sound(self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE); self.solid = SOLID_SLIDEBOX; - if(!walkmove(0, 0)) { + if(!walk_move(0, 0)) { self.think = zombie_paine11; self.solid = SOLID_NOT; return; @@ -378,10 +378,10 @@ void() zombie_paine30 = [ $paine30, zombie_run1 ] {}; void() zombie_die = { sound(self, CHAN_VOICE, "zombie/z_gib.wav", 1, ATTN_NORM); - ThrowHead("progs/h_zombie.mdl", self.health); - ThrowGib("progs/gib1.mdl", self.health); - ThrowGib("progs/gib2.mdl", self.health); - ThrowGib("progs/gib3.mdl", self.health); + throw_head("progs/h_zombie.mdl", self.health); + throw_gib("progs/gib1.mdl", self.health); + throw_gib("progs/gib2.mdl", self.health); + throw_gib("progs/gib3.mdl", self.health); }; /* @@ -481,9 +481,9 @@ void() monster_zombie = { self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_STEP; - setmodel(self, "progs/zombie.mdl"); + set_model(self, "progs/zombie.mdl"); - setsize(self, '-16 -16 -24', '16 16 40'); + set_size(self, '-16 -16 -24', '16 16 40'); self.health = 60; self.th_stand = zombie_stand1; diff --git a/todo b/todo index e968fcf..e09129e 100644 --- a/todo +++ b/todo @@ -5,7 +5,6 @@ none refactoring: add expansion pack entities -rename all functions to be lower_underscore core features: @@ -36,4 +35,5 @@ enforcers are broken impulse command for spectating lives counting no friendly fire +rename all functions to be lower_underscore restart map after 10 seconds when everyone is dead