From 582f04c55cf8c39474391a8edd1bff5065484742 Mon Sep 17 00:00:00 2001 From: Jakob MG Date: Tue, 12 Apr 2011 17:36:55 +0200 Subject: [PATCH] Add bumblebee code frame --- qcsrc/client/View.qc | 7 ++ qcsrc/client/vehicles/vehicles.qc | 73 +++++++++++++++- qcsrc/common/constants.qh | 8 +- qcsrc/server/vehicles/bumblebee.qc | 133 +++++++++++++++++++++++++++++ qcsrc/server/vehicles/spiderbot.qc | 45 ---------- qcsrc/server/vehicles/vehicles.qh | 1 + vehicle_bumblebee.cfg | 32 +++++++ 7 files changed, 247 insertions(+), 52 deletions(-) create mode 100644 qcsrc/server/vehicles/bumblebee.qc create mode 100644 vehicle_bumblebee.cfg diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index c54b44465..56b690e76 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -831,6 +831,8 @@ void CSQC_UpdateView(float w, float h) CSQC_WAKIZASHI_HUD(); else if(hud == HUD_RAPTOR) CSQC_RAPTOR_HUD(); + else if(hud == HUD_BUMBLEBEE) + CSQC_BUMBLE_HUD(); else { if(gametype == GAME_FREEZETAG) @@ -1311,6 +1313,11 @@ void CSQC_common_hud(void) case HUD_WAKIZASHI: CSQC_WAKIZASHI_HUD(); break; + + case HUD_BUMBLEBEE: + CSQC_BUMBLE_HUD(); + break; + } } diff --git a/qcsrc/client/vehicles/vehicles.qc b/qcsrc/client/vehicles/vehicles.qc index 1daefac01..76c65111c 100644 --- a/qcsrc/client/vehicles/vehicles.qc +++ b/qcsrc/client/vehicles/vehicles.qc @@ -30,6 +30,7 @@ entity dropmark; void CSQC_WAKIZASHI_HUD(); void CSQC_SPIDER_HUD(); void CSQC_RAPTOR_HUD(); +void CSQC_BUMBLE_HUD(); #define MAX_AXH 4 entity AuxiliaryXhair[MAX_AXH]; @@ -193,7 +194,14 @@ void Net_VehicleSetup() AuxiliaryXhair[1].axh_scale = 0.25; AuxiliaryXhair[1].alpha = 0.75; AuxiliaryXhair[1].axh_drawflag = DRAWFLAG_NORMAL; - + break; + case HUD_BUMBLEBEE: + // Plasma cannons + AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-ring.tga"; + AuxiliaryXhair[0].axh_scale = 0.25; + // Raygun + AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-special1.tga"; + AuxiliaryXhair[1].axh_scale = 0.25; break; } } @@ -206,6 +214,69 @@ void Net_VehicleSetup() float ammo2 = getstati(STAT_VEHICLESTAT_AMMO2); \ float reload2 = getstati(STAT_VEHICLESTAT_RELOAD2); +void CSQC_BUMBLE_HUD() +{ + vector picsize, hudloc; + + // Fetch health & ammo stats + HUD_GETSTATS + + hudloc_y = 4; + hudloc_x = 4; + + picsize = drawgetimagesize(spider_h) * 0.5; + drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); + + picsize = drawgetimagesize(spider_a2) * 0.5; + drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); + + drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL); + drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL); + drawstring(hudloc + '136 102 0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL); + + picsize = drawgetimagesize(spider_a1) * 0.85; + if(ammo2 == 9) + { + drawpic(hudloc + '132 54 0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL); + drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL); + } + else + { + drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); + drawstring(hudloc + '179 69 0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL); + } + + picsize = drawgetimagesize(spider_b) * 0.5; + hudloc_y = 10.5; + hudloc_x = 10.5; + + ammo1 /= 100; + shield /= 100; + health /= 100; + reload2 /= 100; + + drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL); + drawpic(hudloc, spider_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL); + drawpic(hudloc, spider_r, picsize, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL); + drawpic(hudloc, spider_g, picsize, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL); + + + if (scoreboard_showscores) + { + HUD_DrawScoreboard(); + HUD_DrawCenterPrint(); + } + else + { + picsize = drawgetimagesize(SPIDER_CROSS); + picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size; + picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size; + + drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), SPIDER_CROSS, picsize, '1 1 1', autocvar_cl_vehicle_spiderbot_cross_alpha, DRAWFLAG_ADDITIVE); + } +} + + void CSQC_SPIDER_HUD() { vector picsize, hudloc; diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index c56bda74c..6c4db1836 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -335,6 +335,8 @@ const float HUD_NORMAL = 0; const float HUD_SPIDERBOT = 10; const float HUD_WAKIZASHI = 11; const float HUD_RAPTOR = 12; +const float HUD_BUMBLEBEE = 13; + const vector eX = '1 0 0'; const vector eY = '0 1 0'; const vector eZ = '0 0 1'; @@ -357,12 +359,6 @@ const float STAT_PINKALIVE = 103; const float STAT_FROZEN = 104; const float STAT_REVIVE_PROGRESS = 105; -//const float STAT_SPIDERBOT_AIM 53 // compressShotOrigin -//const float STAT_SPIDERBOT_TARGET 54 // compressShotOrigin - - - - // moved that here so the client knows the max. // # of maps, I'll use arrays for them :P #define MAPVOTE_COUNT 10 diff --git a/qcsrc/server/vehicles/bumblebee.qc b/qcsrc/server/vehicles/bumblebee.qc new file mode 100644 index 000000000..79ec50ba4 --- /dev/null +++ b/qcsrc/server/vehicles/bumblebee.qc @@ -0,0 +1,133 @@ +// Auto cvars +float autocvar_g_vehicle_bumblebee_speed_forward; +float autocvar_g_vehicle_bumblebee_speed_strafe; +float autocvar_g_vehicle_bumblebee_turnspeed; +float autocvar_g_vehicle_bumblebee_pitchspeed; +float autocvar_g_vehicle_bumblebee_friction; + +float autocvar_g_vehicle_bumblebee_energy; +float autocvar_g_vehicle_bumblebee_energy_regen; +float autocvar_g_vehicle_bumblebee_energy_regen_pause; + +float autocvar_g_vehicle_bumblebee_health; +float autocvar_g_vehicle_bumblebee_health_regen; +float autocvar_g_vehicle_bumblebee_health_regen_pause; + +float autocvar_g_vehicle_bumblebee_shield; +float autocvar_g_vehicle_bumblebee_shield_regen; +float autocvar_g_vehicle_bumblebee_shield_regen_pause; + +float autocvar_g_vehicle_bumblebee_cannon_cost; +float autocvar_g_vehicle_bumblebee_cannon_damage; +float autocvar_g_vehicle_bumblebee_cannon_radius; +float autocvar_g_vehicle_bumblebee_cannon_refire; +float autocvar_g_vehicle_bumblebee_cannon_speed; +float autocvar_g_vehicle_bumblebee_cannon_spread; +float autocvar_g_vehicle_bumblebee_cannon_force; + +float autocvar_g_vehicle_bumblebee_respawntime; + +float autocvar_g_vehicle_bumblebee_blowup_radius; +float autocvar_g_vehicle_bumblebee_blowup_coredamage; +float autocvar_g_vehicle_bumblebee_blowup_edgedamage; +float autocvar_g_vehicle_bumblebee_blowup_forceintensity; + + +#define BUMB_MIN '-120 -120 -40' +#define BUMB_MAX '120 120 40' + +.entity gunner1; +.entity gunner2; + +float bumb_frame() +{ + entity pilot, gunner, vehic; + + + return 1; +} + +void bumb_think() +{ +} + +void bumb_enter() +{ +} + +void bumb_exit(float eject) +{ +} + +void bumb_spawn() +{ + self.movetype = MOVETYPE_FLY; + setorigin(self, self.origin + '0 0 150'); +} + +void bumb_die() +{ + self.health = 0; + self.event_damage = SUB_Null; + self.iscreature = FALSE; + self.solid = SOLID_CORPSE; + self.takedamage = DAMAGE_NO; + self.deadflag = DEAD_DYING; + self.movetype = MOVETYPE_BOUNCE; + + pointparticles(particleeffectnum("rocket_explode"), findbetterlocation (self.origin, 16), '0 0 0', 1); +} + +void bumb_dinit() +{ + if not (vehicle_initialize( + "Bumblebee", + "models/vehicles/bumblebee_body.dpm", + "", + "models/vehicles/wakizashi_cockpit.dpm", + "", "", "tag_viewport", + HUD_WAKIZASHI, + BUMB_MIN, BUMB_MAX, + FALSE, + bumb_spawn, autocvar_g_vehicle_bumblebee_respawntime, + bumb_frame, + bumb_enter, bumb_exit, + bumb_die, bumb_think)) + { + remove(self); + return; + } + self.gun1 = spawn(); + self.gun2 = spawn(); + setmodel(self.gun1, "models/vehicles/bumblebee_plasma_left.dpm"); + setmodel(self.gun2, "models/vehicles/bumblebee_plasma_right.dpm"); + setattachment(self.gun1, self, "tag_hardpoint02"); + setattachment(self.gun2, self, "tag_hardpoint01"); +} + +void spawnfunc_vehicle_bumblebee() +{ + + precache_model ("models/vehicles/bumblebee_body.dpm"); + precache_model ("models/vehicles/bumblebee_plasma_left.dpm"); + precache_model ("models/vehicles/bumblebee_plasma_right.dpm"); + precache_model ("models/vehicles/bumblebee_ray.dpm"); + + //vehicles_configcheck("vehicle_bumblebee.cfg", autocvar_g_vehicle_bumblebee_health); + + if(autocvar_g_vehicle_bumblebee_energy) + if(autocvar_g_vehicle_bumblebee_energy_regen) + self.vehicle_flags |= VHF_ENERGYREGEN; + + if(autocvar_g_vehicle_bumblebee_shield) + self.vehicle_flags |= VHF_HASSHIELD; + + if(autocvar_g_vehicle_bumblebee_shield_regen) + self.vehicle_flags |= VHF_SHIELDREGEN; + + if(autocvar_g_vehicle_bumblebee_health_regen) + self.vehicle_flags |= VHF_HEALTHREGEN; + + self.think = bumb_dinit; + self.nextthink = time + 1; +} \ No newline at end of file diff --git a/qcsrc/server/vehicles/spiderbot.qc b/qcsrc/server/vehicles/spiderbot.qc index 531207b18..f2fb4c06f 100644 --- a/qcsrc/server/vehicles/spiderbot.qc +++ b/qcsrc/server/vehicles/spiderbot.qc @@ -453,51 +453,6 @@ void spiderbot_exit(float eject) self.owner = world; } -// Better way of determening whats crushable needed! (fl_crushable?) -float spiderbot_crushable(entity e) -{ - if(e.classname == "corpse") - return 1; - - if(e.classname == "player") - return 1; - - if(e.classname == "monster_zombie") - return 1; - - return 0; -} - -/*void spiderbot_touch( -{ - //vehicles_touch(); - if(self.owner) - { - if(vlen(self.velocity) == 0) - return; - - if not (spiderbot_crushable(other)) - return; - - //todo: add check for velocity/angle here (so we dont cush players runing into us from behind) - - Damage(other, self, self.owner,autocvar_g_vehicle_spiderbot_crush_dmg,DEATH_VHCRUSH, '0 0 0', normalize(other.origin - self.origin) * autocvar_g_vehicle_spiderbot_crush_force); - return; - } - - if(other.classname != "player") - return; - - if(other.deadflag != DEAD_NO) - return; - - if(other.vehicle != world) - return; - - vehicles_enter(); -}*/ - - void spiderbot_spawn() { self.frame = 5; diff --git a/qcsrc/server/vehicles/vehicles.qh b/qcsrc/server/vehicles/vehicles.qh index 83cfa56f0..59641407f 100644 --- a/qcsrc/server/vehicles/vehicles.qh +++ b/qcsrc/server/vehicles/vehicles.qh @@ -5,4 +5,5 @@ #include "racer.qc" #include "spiderbot.qc" #include "raptor.qc" +#include "bumblebee.qc" #endif diff --git a/vehicle_bumblebee.cfg b/vehicle_bumblebee.cfg new file mode 100644 index 000000000..70fa22197 --- /dev/null +++ b/vehicle_bumblebee.cfg @@ -0,0 +1,32 @@ +set g_vehicle_bumblebee_speed_forward 400 +set g_vehicle_bumblebee_speed_strafe 200 +set g_vehicle_bumblebee_turnspeed 180 +set g_vehicle_bumblebee_pitchspeed 90 +set g_vehicle_bumblebee_friction 0.25 + +set g_vehicle_bumblebee_energy 500 +set g_vehicle_bumblebee_energy_regen 50 +set g_vehicle_bumblebee_energy_regen_pause 1 + +set g_vehicle_bumblebee_health 750 +set g_vehicle_bumblebee_health_regen 25 +set g_vehicle_bumblebee_health_regen_pause 5 + +set g_vehicle_bumblebee_shield 250 +set g_vehicle_bumblebee_shield_regen 100 +set g_vehicle_bumblebee_shield_regen_pause 2 + +set g_vehicle_bumblebee_cannon_cost 10 +set g_vehicle_bumblebee_cannon_damage 75 +set g_vehicle_bumblebee_cannon_radius 150 +set g_vehicle_bumblebee_cannon_refire 1.5 +set g_vehicle_bumblebee_cannon_speed 5000 +set g_vehicle_bumblebee_cannon_spread 0.0125 +set g_vehicle_bumblebee_cannon_force 400 + +set g_vehicle_bumblebee_respawntime 10 + +set g_vehicle_bumblebee_blowup_radius 500 +set g_vehicle_bumblebee_blowup_coredamage 500 +set g_vehicle_bumblebee_blowup_edgedamage 100 +set g_vehicle_bumblebee_blowup_forceintensity 600 \ No newline at end of file -- 2.39.2