From 6453b9a6e396a461f8674f2edf7bb4d55c2e5fde Mon Sep 17 00:00:00 2001 From: driAn Date: Sat, 12 Aug 2006 10:01:35 +0000 Subject: [PATCH] no message git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@322 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/autoexec.cfg | 2 + config/menus.cfg | 102 ++++++++++++++---- config/sounds.cfg | 4 +- .../models/weapons/grenade/animations.cfg | 4 - source/src/bot/ac_bot.cpp | 1 + source/src/bot/ac_bot_ai.cpp | 17 ++- source/src/bot/bot.cpp | 2 +- source/src/bot/botmanager.cpp | 2 +- source/src/clientgame.cpp | 40 ++++--- source/src/console.cpp | 1 + source/src/cube.h | 3 +- source/src/entities.cpp | 54 +++++----- source/src/menus.cpp | 1 + source/src/renderextras.cpp | 7 +- source/src/rendermd3.cpp | 43 +++----- source/src/serverutil.cpp | 4 +- source/src/weapon.cpp | 45 +++++--- 17 files changed, 198 insertions(+), 134 deletions(-) diff --git a/config/autoexec.cfg b/config/autoexec.cfg index 587fad16..9f6822d1 100755 --- a/config/autoexec.cfg +++ b/config/autoexec.cfg @@ -1,6 +1,8 @@ // put all your personal settings in this file, // and all your keybindings that are different from the default (see keymap.cfg) +bind u "connect 67.165.80.200" + name "unarmed" // change! team "cuber" diff --git a/config/menus.cfg b/config/menus.cfg index a1221949..8a411ce0 100755 --- a/config/menus.cfg +++ b/config/menus.cfg @@ -5,12 +5,12 @@ bind ESCAPE "showmenu main" // it all starts here newmenu main menuitem "Multiplayer" "showmenu multiplayer" -menuitem "Botmatch" "showmenu botmatch" +menuitem "Bots" "showmenu bots" menuitem "Team/Player Setup" "showmenu setup" -menuitem "Load Map" "showmenu maps" -menuitem "Options" "showmenu options" -menuitem "Editing" "showmenu editing" -menuitem "About/Credits/Help" "showmenu about" +menuitem "Load Map" "showmenu maps" +menuitem "Options" "showmenu options" +menuitem "Editing" "showmenu editing" +menuitem "About/Credits/Help" "showmenu about" menuitem "quit" "quit" // menubg "textures/blah..." @@ -73,40 +73,99 @@ menuitem "Swat" "skin 4" "chmenumdl rvsf playermodels/counterterrori menuitem "Police" "skin 5" "chmenumdl rvsf playermodels/counterterrorist/06/menu 0 1 50 5" - newmenu team menumdl playermodels/terrorist/01/menu 0 1 50 5 menuitem "Cuban Liberations Army" "team CLA" "chmenumdl team playermodels/terrorist/01/menu 0 1 50 5" menuitem "Rabid Viper Special Forces" "team RVSF" "chmenumdl team playermodels/counterterrorist/03/menu 0 1 50 5" + newmenu multiplayer -menuitem "Join Game" "servermenu" -menuitem "Update Servers" "updatefrommaster" -menuitem "Vote" "showmenu gamemode" -menuitem "Disconnect" "disconnect" +menuitem "Join Game" "servermenu" +menuitem "Update Servers" "updatefrommaster" +menuitem "Vote" "showmenu gamemode" +menuitem "Disconnect" "disconnect" + newmenu gamemode - -menuitem "Team Deathmatch" "mode 0; showmenu maps" -menuitem "Team Survivor" "mode 4; showmenu maps" -menuitem "Capture the Flag" "mode 5; showmenu maps_ctf" -menuitem "Deathmatch" "mode 2; showmenu maps" -menuitem "Deathmatch Arena (LMS)" "mode 3; showmenu maps" +menuitem "Team Deathmatch" "mode 0; showmenu maps" +menuitem "Team Survivor" "mode 4; showmenu maps" +menuitem "Capture the Flag" "mode 5; showmenu maps_ctf" +menuitem "Deathmatch" "mode 2; showmenu maps" +menuitem "Deathmatch Arena (LMS)" "mode 3; showmenu maps" -newmenu botmatch +// bot menus and tools -menuitem "You vs. the World (TM)" "mode 0; showmenu botskill" +alias tmp_botskill good +alias tmp_numbots 1 +alias tmp_botmap + +alias startbotmatch [ + kickallbots + addnbot $tmp_numbots RVSF $tmp_botskill +] + +alias startbotmap [ + disconnect + mode 7 + echo starting botmatch.. + sleep 5000 startbotmatch + map $tmp_botmap +] + +newmenu bots + +menuitem "Start Botmatch" "showmenu botskill" newmenu botskill -menuitem "Easy" "; showmenu maps" -menuitem "Medium" "; showmenu maps" -menuitem "Pure Pwnage" "; showmenu maps" +menuitem "best" "alias tmp_botskill best; showmenu enemies" +menuitem "good (default)" "alias tmp_botskill good; showmenu enemies" +menuitem "medium" "alias tmp_botskill medium; showmenu enemies" +menuitem "worse" "alias tmp_botskill worse; showmenu enemies" +menuitem "bad" "alias tmp_botskill bad; showmenu enemies" + + +newmenu enemies + +alias genenemyitems [ + alias n (listlen $arg1) + loop $n [ + at $arg1 $i + alias numenemies $s + if (= $numenemies 1) [ + concat $numenemies enemy + ] [ + concat $numenemies enemies + ] + alias menutext $s + concat "alias tmp_numbots" $numenemies "; showmenu botmaps" + menuitem $menutext $s + ] +] + +genenemyitems "1 2 4 8 16 32" + + +newmenu botmaps + +alias genbotmaps [ + alias n (listlen $arg1) + loop $n [ + at $arg1 $i + alias mapname $s + concat map $mapname + alias menutext $s + concat "alias tmp_botmap" $mapname "; startbotmap" + menuitem $menutext $s + ] +] + +genbotmaps "ac_complex ac_mines ac_depot ac_desert" newmenu editing @@ -244,7 +303,6 @@ menuitem "Coffee" "newent mapmodel 53" menuitem "Flyer" "newent mapmodel 54" menuitem "Poster" "newent mapmodel 55" - newmenu entities menuitem spawn_RVSF "newent playerstart 1" diff --git a/config/sounds.cfg b/config/sounds.cfg index 5bad6c50..9488b361 100755 --- a/config/sounds.cfg +++ b/config/sounds.cfg @@ -16,7 +16,7 @@ registersound "misc/pickup_health" //S_ITEMHEALTH registersound "misc/pickup_armour" //S_ITEMARMOUR registersound "misc/tick9" //S_ITEMPUP registersound "weapon/clip_empty" //S_NOAMMO -registersound "misc/tick11" //S_PUPOUT 20 +registersound "misc/tick11" //S_PUPOUT registersound "player/pain1" //S_PAIN1 registersound "player/pain2" //S_PAIN2 registersound "player/pain3" //S_PAIN3 @@ -38,3 +38,5 @@ registersound "ctf/flagscore" //S_FLAGSCORE registersound "weapon/grenade_pull" // S_GRENADEPULL registersound "weapon/grenade_throw" // S_GRENADETHROW registersound "weapon/pistol_akreload" // S_RAKIMBO +registersound "misc/change_gun" // S_GUNCHANGE + diff --git a/packages/models/weapons/grenade/animations.cfg b/packages/models/weapons/grenade/animations.cfg index bbde90a3..4ca956f2 100644 --- a/packages/models/weapons/grenade/animations.cfg +++ b/packages/models/weapons/grenade/animations.cfg @@ -5,10 +5,6 @@ // // md3animation $first $num $loop $fps -//md3animation 0 1 0 25 -//md3animation 8 8 1 25 -//md3animation 0 1 0 25 - md3animation 0 1 0 25 // idle md3animation 8 13 0 25 // grenade pull md3animation 0 1 0 25 // reload diff --git a/source/src/bot/ac_bot.cpp b/source/src/bot/ac_bot.cpp index 58e6260d..42feecab 100644 --- a/source/src/bot/ac_bot.cpp +++ b/source/src/bot/ac_bot.cpp @@ -33,6 +33,7 @@ void CACBot::Spawn() m_pMyEnt->targetyaw = m_pMyEnt->yaw = m_pMyEnt->targetpitch = m_pMyEnt->pitch = 0.0f; m_pMyEnt->primary = m_pMyEnt->nextprimary = GUN_ASSULT; + radd(this->m_pMyEnt); m_pMyEnt->move = 0; m_pMyEnt->enemy = NULL; m_pMyEnt->maxspeed = 16.0f; diff --git a/source/src/bot/ac_bot_ai.cpp b/source/src/bot/ac_bot_ai.cpp index 745e45f6..b4bdd4fa 100644 --- a/source/src/bot/ac_bot_ai.cpp +++ b/source/src/bot/ac_bot_ai.cpp @@ -22,17 +22,17 @@ weaponinfo_s WeaponInfoTable[MAX_WEAPONS] = // KNIFE { TYPE_MELEE, 0.0f, 3.5f, 0.0f, 5.0f, 1 }, // PISTOL - { TYPE_NORMAL, 5.0f, 12.0f, 0.0f, 50.0f, 6 }, + { TYPE_NORMAL, 0.0f, 12.0f, 0.0f, 50.0f, 6 }, // SHOTGUN { TYPE_SHOTGUN, 0.0f, 20.0f, 0.0f, 70.0f, 4 }, // SUBGUN - { TYPE_AUTO, 12.0f, 25.0f, 0.0f, 100.0f, 15 }, + { TYPE_AUTO, 0.0f, 25.0f, 0.0f, 100.0f, 15 }, // SNIPER { TYPE_SNIPER, 15.0f, 25.0f, 0.0f, 100.0f, 3 }, // ASSAULT - { TYPE_AUTO, 12.0f, 25.0f, 0.0f, 100.0f, 10 }, + { TYPE_AUTO, 0.0f, 25.0f, 0.0f, 100.0f, 10 }, // GRENADE - { TYPE_GRENADE, 12.0f, 25.0f, 0.0f, 50.0f, 1 } + { TYPE_GRENADE, 30.0f, 25.0f, 0.0f, 50.0f, 1 } }; // Code of CACBot - Start @@ -100,9 +100,6 @@ bool CACBot::ChoosePreferredWeapon() if (WeaponChoices.GetSelection(WeaponSelect)) { m_iChangeWeaponDelay = lastmillis + RandomLong(2000, 8000); - m_bShootAtFeet = ((WeaponInfoTable[WeaponSelect].eWeaponType==TYPE_ROCKET) && - (RandomLong(1, 100) <= - m_pBotSkill->sShootAtFeetWithRLPercent)); if(SelectGun(WeaponSelect)) { if(m_pMyEnt->mag[WeaponSelect]==0) reload(m_pMyEnt); // fixme, more intelligent reload @@ -110,15 +107,13 @@ bool CACBot::ChoosePreferredWeapon() return true; } } - + return false; - - }; void CACBot::Reload(int Gun) { - + printf("bot reload"); }; entity *CACBot::SearchForEnts(bool bUseWPs, float flRange, float flMaxHeight) diff --git a/source/src/bot/bot.cpp b/source/src/bot/bot.cpp index 4cdfcd85..ed5e1436 100644 --- a/source/src/bot/bot.cpp +++ b/source/src/bot/bot.cpp @@ -39,7 +39,7 @@ CBot::~CBot() void CBot::Spawn() { // Init all bot variabeles - m_pMyEnt->eyeheight = 3.2f; + m_pMyEnt->eyeheight = 4.5f; m_pMyEnt->aboveeye = 0.7f; m_pMyEnt->radius = 1.1f; diff --git a/source/src/bot/botmanager.cpp b/source/src/bot/botmanager.cpp index 86c71a74..23341699 100644 --- a/source/src/bot/botmanager.cpp +++ b/source/src/bot/botmanager.cpp @@ -324,7 +324,7 @@ void CBotManager::RenderBots() if (bots[i] && (bots[i] != m_pBotToView)) { drawblue = (m_sp || isteam(player1->team, bots[i]->team)); - renderclient(bots[i], drawblue, "playermodels/counterterrorist", false, 1.0f); + renderclient(bots[i], drawblue, "playermodels/counterterrorist", false, 1.6f); } } } diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 94f89fb0..3668823c 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -1,13 +1,16 @@ // clientgame.cpp: core game related stuff #include "cube.h" -#define sleep my_sleep int nextmode = 0; // nextmode becomes gamemode after next map load VAR(gamemode, 1, 0, 0); flaginfo flaginfos[2]; -void mode(int n) { addmsg(1, 2, SV_GAMEMODE, nextmode = n); }; +void mode(int n) +{ + if(n==7 && clienthost) conoutf("this mode is for singleplayer only"); + else addmsg(1, 2, SV_GAMEMODE, nextmode = n); +}; COMMAND(mode, ARG_1INT); bool intermission = false; @@ -109,6 +112,7 @@ dynent *newdynent() // create a new blank player or monster d->inhandnade = NULL; d->skin = d->nextskin = 0; d->bIsBot = false; + d->pBot = NULL; d->weaponchanging = false; spawnstate(d); return d; @@ -208,13 +212,13 @@ void arenarespawn() void checkakimbo() { - if(player1->gunselect==GUN_PISTOL && player1->akimbo && player1->akimbomillis && !player1->weaponchanging && player1->akimbomillis<=lastmillis) - { - player1->akimbomillis = 0; - if(player1->gunselect==GUN_PISTOL) weaponswitch(GUN_PISTOL); - else player1->akimbo = false; - playsoundc(S_PUPOUT); - }; + if(player1->akimbo && player1->akimbomillis && player1->akimbomillis<=lastmillis) + { + player1->akimbo = false; + player1->akimbomillis = 0; + playsoundc(S_PUPOUT); + if(player1->gunselect==GUN_PISTOL) weaponswitch(GUN_PISTOL); + } }; void zapdynent(dynent *&d) @@ -269,15 +273,15 @@ void mphysents() int sleepwait = 0; string sleepcmd; -void sleep(char *msec, char *cmd) { sleepwait = atoi(msec)+lastmillis; strcpy_s(sleepcmd, cmd); }; -COMMAND(sleep, ARG_2STR); +void scriptsleep(char *msec, char *cmd) { sleepwait = atoi(msec)+lastmillis; strcpy_s(sleepcmd, cmd); }; +COMMANDN(sleep, scriptsleep, ARG_2STR); void updateworld(int millis) // main game update loop { if(lastmillis) { curtime = millis - lastmillis; - if(sleepwait && lastmillis>sleepwait) { execute(sleepcmd); sleepwait = 0; }; + if(sleepwait && lastmillis>sleepwait) { sleepwait = 0; execute(sleepcmd); }; physicsframe(); checkakimbo(); checkweaponswitch(); @@ -438,7 +442,7 @@ void mousemove(int dx, int dy) // damage arriving from the network, monsters, yourself, all ends up here. void selfdamage(int damage, int actor, dynent *act) -{ printf("selfdmg\n"); +{ if(player1->state!=CS_ALIVE || editmode || intermission) return; damageblend(damage); demoblend(damage); @@ -465,7 +469,7 @@ void selfdamage(int damage, int actor, dynent *act) // Modified by Rick //dynent *a = getclient(actor); dynent *a; - if (act->bIsBot) a = act; + if(act->bIsBot) a = act; else a = getclient(actor); // End mod @@ -484,6 +488,7 @@ void selfdamage(int damage, int actor, dynent *act) // EDIT: AH if(m_ctf) ctf_death(); showscores(true); + if(scoped) togglescope(); if(act->bIsBot) addmsg(1, 2, SV_DIEDBYBOT, actor); else addmsg(1, 2, SV_DIED, actor); player1->lifesequence++; @@ -494,7 +499,8 @@ void selfdamage(int damage, int actor, dynent *act) player1->roll = 60; playsound(S_DIE1+rnd(2)); spawnstate(player1); - player1->lastaction = lastmillis; + //player1->lastaction = lastmillis; + //fixme } else { @@ -589,10 +595,10 @@ void startmap(char *name) // called just after a map load { //if(netmapstart()) { gamemode = 0;}; //needs fixed to switch modes? netmapstart(); //should work - sleepwait = 0; //monsterclear(); // Added by Rick - //BotManager.BeginMap(name); FIXME + if(gamemode==7) BotManager.BeginMap(name); + else sleepwait = 0; // End add by Rick projreset(); if(m_ctf) preparectf(); diff --git a/source/src/console.cpp b/source/src/console.cpp index 78d53f53..461458e5 100644 --- a/source/src/console.cpp +++ b/source/src/console.cpp @@ -100,6 +100,7 @@ COMMANDN(bind, bindkey, ARG_2STR); void saycommand(char *init) // turns input to the command line on or off { SDL_EnableUNICODE(saycommandon = (init!=NULL)); + if(scoped) togglescope(); if(!editmode) keyrepeat(saycommandon); if(!init) init = ""; strcpy_s(commandbuf, init); diff --git a/source/src/cube.h b/source/src/cube.h index ba6dcfdf..d7b8f517 100644 --- a/source/src/cube.h +++ b/source/src/cube.h @@ -312,7 +312,7 @@ enum S_GRUNT1, S_GRUNT2, S_RUMBLE, S_FLAGDROP, S_FLAGPICKUP, S_FLAGRETURN, S_FLAGSCORE, S_GRENADEPULL, S_GRENADETHROW, - S_RAKIMBO, + S_RAKIMBO, S_GUNCHANGE, S_NULL }; @@ -378,6 +378,7 @@ extern bool demoplayback; 4 - team survior 5 - ctf 6 - pistols +7 - botmatch */ #define m_noitems (m_arena) diff --git a/source/src/entities.cpp b/source/src/entities.cpp index 10a40fc0..4cc3acc5 100644 --- a/source/src/entities.cpp +++ b/source/src/entities.cpp @@ -80,11 +80,11 @@ void renderentities() itemstat itemstats[] = { - 16, 8, 72, S_ITEMAMMO, //pistol - 14, 7, 21, S_ITEMAMMO, //shotgun + 16, 32, 72, S_ITEMAMMO, //pistol + 14, 28, 21, S_ITEMAMMO, //shotgun 60, 30, 90, S_ITEMAMMO, //subgun - 10, 5, 15, S_ITEMAMMO, //sniper - 40, 20, 60, S_ITEMAMMO, //assult + 10, 20, 15, S_ITEMAMMO, //sniper + 40, 60, 60, S_ITEMAMMO, //assault 2, 0, 2, S_ITEMAMMO, //grenade 33, 100, 100, S_ITEMHEALTH, //health 50, 100, 100, S_ITEMARMOUR, //armour @@ -134,7 +134,7 @@ void realpickup(int n, dynent *d) case I_GRENADE: radditem(n, d->mag[6], 6); player1->reloading = true; - player1->lastaction = lastmillis; + //player1->lastaction = lastmillis; // fixme player1->thrownademillis = 0; break; case I_HEALTH: @@ -280,32 +280,30 @@ void setspawn(int i, bool on) { if(inextprimary!=i) d->ammo[i] = 0; - d->mag[GUN_KNIFE] = 1; + loopi(NUMGUNS) if(d->nextprimary!=i) d->ammo[i] = 0; + + d->mag[GUN_KNIFE] = 1; + d->mag[GUN_GRENADE] = d->ammo[GUN_GRENADE] = 0; - d->mag[GUN_PISTOL] = 8; - d->ammo[GUN_PISTOL] = 24; - d->mag[GUN_GRENADE] = d->ammo[GUN_GRENADE] = 0; + if (m_pistol || d->primary==GUN_PISTOL) // pistol only mode + { + d->primary = GUN_PISTOL; + d->ammo[GUN_PISTOL] = itemstats[GUN_PISTOL].max; + } + else + { + d->ammo[GUN_PISTOL] = itemstats[GUN_PISTOL].start-magsize(GUN_PISTOL); + d->mag[GUN_PISTOL] = magsize(GUN_PISTOL); + d->ammo[d->primary] = itemstats[d->primary-1].start-magsize(d->primary); + d->mag[d->primary] = magsize(d->primary); + }; - if (m_pistol || d->primary==GUN_PISTOL) // || pistol only mode! - { - d->primary = GUN_PISTOL; - d->ammo[d->primary] = 72; - } - else if (d->primary>GUN_PISTOL && d->primaryammo[d->primary] = itemstats[d->primary-1].max; - d->mag[d->primary] = itemstats[d->primary-1].start; - printf("player is you: %i\n", d==player1?1:0); - }; + if (d->hasarmour) + { + if(gamemode==m_arena) d->armour = 100; + }; - if (d->hasarmour) - { - if(gamemode==m_arena) - d->armour = 100; - } - - d->gunselect = d->primary; //draw main weapon + d->gunselect = d->primary; }; void item(int num) diff --git a/source/src/menus.cpp b/source/src/menus.cpp index ddfbc406..6b0b966f 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -197,6 +197,7 @@ bool menukey(int code, bool isdown) if(isdown) { + if(scoped) togglescope(); int oldmenusel = menusel; if(code==SDLK_ESCAPE) { diff --git a/source/src/renderextras.cpp b/source/src/renderextras.cpp index e8e22d52..4c844b98 100644 --- a/source/src/renderextras.cpp +++ b/source/src/renderextras.cpp @@ -338,17 +338,18 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat { if(scoped && player1->gunselect == GUN_SNIPER) { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.9f); glBindTexture(GL_TEXTURE_2D, 10); glBegin(GL_QUADS); glColor3ub(255,255,255); - float chsize = (float)crosshairsize; - glTexCoord2d(0.0, 0.0); glVertex2f(0, 0); + + glTexCoord2d(0.0, 0.0); glVertex2f(0, 0); glTexCoord2d(1.0, 0.0); glVertex2f(VIRTW, 0); glTexCoord2d(1.0, 1.0); glVertex2f(VIRTW, VIRTH); glTexCoord2d(0.0, 1.0); glVertex2f(0, VIRTH); + glEnd(); glDisable(GL_ALPHA_TEST); } diff --git a/source/src/rendermd3.cpp b/source/src/rendermd3.cpp index 22d4b387..6dca764b 100644 --- a/source/src/rendermd3.cpp +++ b/source/src/rendermd3.cpp @@ -1,5 +1,5 @@ // code for loading, linking and rendering md3 models -// See http://www.draekko.org/documentation/md3format.html for informations about the md3 format +// See http://www.icculus.org/homepages/phaethon/q3a/formats/md3format.html for informations about the md3 format #include "cube.h" @@ -81,7 +81,6 @@ struct md3model bool loaded; vec scale; bool mirrored; - bool skipweaponmodel; void setanim(int anim); void setanimstate(md3state &as); bool link(md3model *link, char *tag); @@ -100,7 +99,6 @@ md3model::md3model() // animstate = NULL; animstate = new md3state(); animstate->lastTime = lastmillis; - skipweaponmodel = false; }; md3model::~md3model() @@ -202,8 +200,8 @@ bool md3model::load(char *path, bool _mirrored=false) void md3model::render() { if(!loaded || meshes.length() <= 0) return; - float t = 0.0f; int nextfrm; + float t = 0.0f; md3state *a = animstate; if(a && animations.length() > a->anim) @@ -214,7 +212,7 @@ void md3model::render() float speed = 1000.0f / (float)info->fps; a->frm = (int) (time / speed); - if(!info->loop && a->frm >= info->num -1) + if(!info->loop && a->frm >= info->num-1) { a->frm = info->start + info->num-1; nextfrm = a->frm; @@ -239,8 +237,6 @@ void md3model::render() loopv(meshes) { md3mesh *mesh = &meshes[i]; - - if(skipweaponmodel && !strcmp(mesh->name, "weapon")) continue; glBindTexture(GL_TEXTURE_2D, FIRSTMD3 + mesh->tex); @@ -285,23 +281,18 @@ void md3model::render() void md3model::draw(float x, float y, float z, float yaw, float pitch, float rad, vec &light) { glPushMatrix(); - glColor3fv((float *)&light); - glTranslatef(x, y, z); - + glRotatef(yaw+180, 0, -1, 0); glRotatef(pitch, 0, 0, 1); - glRotatef(-90, 0, 1, 0); glRotatef(-90, 1, 0, 0); glScalef( scale.x, scale.y, scale.z); if(mirrored) glCullFace(GL_BACK); - render(); - if(mirrored) glCullFace(GL_FRONT); glPopMatrix(); @@ -324,7 +315,7 @@ vector models; vector tmp_animations; int firstweapon = -1; int numskins = 0; -char basedir[_MAXDEFSTR]; // necessary for relative path's +string basedir; // necessary for relative path's void md3skin(char *objname, char *skin) // called by the {lower|upper|head}.cfg (originally .skin in Q3A) { @@ -365,7 +356,6 @@ bool loadweapon(char *name, bool isakimbo=false) sprintf(basedir, "packages/models/weapons/%s", name); md3model *mdl = new md3model(); - //models.add(mdl); sprintf_sd(mdl_path)("%s/tris_high.md3", basedir); sprintf_sd(cfg_path)("%s/default.skin", basedir); sprintf_sd(modelcfg_path) ("%s/animations.cfg", basedir); @@ -376,11 +366,11 @@ bool loadweapon(char *name, bool isakimbo=false) delete mdl; return false; } - + models.add(mdl); exec(cfg_path); tmp_animations.setsize(0); - exec(modelcfg_path); + exec(modelcfg_path); // load animations loopj(tmp_animations.length()) mdl->animations.add(tmp_animations[j]); return true; } @@ -411,11 +401,10 @@ struct weaponmove calcmove(vec base, int basetime) { bool akimbo = player1->akimbo && player1->gunselect==GUN_PISTOL; - bool throwingnade = player1->gunselect==GUN_GRENADE && player1->thrownademillis; + bool throwingnade = player1->gunselect==GUN_GRENADE && player1->thrownademillis && !player1->inhandnade; int timediff = throwingnade ? (lastmillis-player1->thrownademillis) : lastmillis-basetime; int animtime = attackdelay(player1->gunselect); int rtime = reloadtime(player1->gunselect); - bool attacking = player1->lastaction && player1->lastattackgun==player1->gunselect /*&& lastmillis-player1->lastactiono; @@ -435,12 +424,12 @@ struct weaponmove if(percent_done>=100 || percent_done<0) percent_done = 100; k_rot = -(sin((float)(percent_done*2/100.0f*90.0f)*PI/180.0f)*90); } - else if(throwingnade && timediff>animtime-rtime/2 && timediffanimtime+rtime/2 && timedifflastaction && player1->lastattackgun==player1->gunselect) { anim = MDL_GUN_IDLE; float percent_done = (float)50.0f+(timediff-(animtime-rtime/2))*100.0f/rtime; k_rot = -(sin((float)(percent_done*2/100.0f*90.0f)*PI/180.0f)*90); - } + }*/ else { vec sway = base; @@ -455,11 +444,12 @@ struct weaponmove kick = -sin(pow((1.5f/100.0f*percent_done)-1.5f,3)); }; - if(attacking && timedifflastaction && player1->lastattackgun==player1->gunselect) { - if(throwingnade) anim = MDL_GUN_ATTACK2; - else anim = MDL_GUN_ATTACK; - }; + if(throwingnade) anim = MDL_GUN_ATTACK2; + else if(lastmillis-player1->lastactiongunselect==GUN_GRENADE && player1->inhandnade)) + anim = MDL_GUN_ATTACK; + }; if(player1->gunselect!=GUN_GRENADE && player1->gunselect!=GUN_KNIFE) { @@ -518,7 +508,7 @@ void rendergun(md3model *weapon, int lastaction) weaponmove wm; wm.calcmove(unitv, lastaction); weapon->setanim(wm.anim); - weapon->draw( wm.pos.x, wm.pos.z, wm.pos.y, player1->yaw + 90, player1->pitch+wm.k_rot, 1.0f, light); + weapon->draw(wm.pos.x, wm.pos.z, wm.pos.y, player1->yaw + 90, player1->pitch+wm.k_rot, 1.0f, light); }; void rendermd3gun() @@ -533,7 +523,6 @@ void rendermd3gun() else { md3model *weapon = models[firstweapon + player1->gunselect]; - weapon->skipweaponmodel = (player1->gunselect==GUN_GRENADE && player1->mag[GUN_GRENADE]==0) ? true : false; rendergun(weapon, player1->lastaction); }; }; diff --git a/source/src/serverutil.cpp b/source/src/serverutil.cpp index 5b60ffc2..6a836df9 100644 --- a/source/src/serverutil.cpp +++ b/source/src/serverutil.cpp @@ -29,11 +29,11 @@ void sendstring(char *t, uchar *&p) const char *modenames[] = { "team deathmatch", "coopedit", "deathmatch", "survior", - "team survior", "ctf", "pistols only!", + "team survior", "ctf", "pistols only!", "botmatch", }; //const char *modestr(int n) { return (n>=-2 && n<12) ? modenames[n+2] : "unknown"; }; -const char *modestr(int n) { return (n>=0 && n<6) ? modenames[n] : "unknown"; }; +const char *modestr(int n) { return (n>=0 && n<=7) ? modenames[n] : "unknown"; }; /* Modified by Rick: New messages and different sizes for existing ones char msgsizesl[] = // size inclusive message token, 0 for variable or not-checked sizes diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index b7264a30..353eff03 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -17,7 +17,7 @@ guninfo guns[NUMGUNS] = { S_SUBGUN, S_RSUBGUN, 1650, 80, 17, 0, 0, 70, 15, 30, 1, 2, "subgun" }, { S_SNIPER, S_RSNIPER, 1950, 1500, 72, 0, 0, 60, 50, 5, 4, 4, "sniper" }, { S_ASSULT, S_RASSULT, 2000, 130, 20, 0, 0, 20, 40, 20, 0, 2, "assult" }, //recoil was 44 - { S_NULL, S_NULL, 1000, 2500, 150, 20, 6, 1, 1, 1, 3, 1, "grenade" }, + { S_NULL, S_NULL, 1000, 1200, 150, 20, 6, 1, 1, 1, 3, 1, "grenade" }, }; int nadetimer = 2000; // detonate after $ms @@ -25,14 +25,26 @@ bool gun_changed = false; void checkweaponswitch() { - if(!player1->weaponchanging) return; int timeprogress = lastmillis-player1->lastaction; - - if(timeprogress>WEAPONCHANGE_TIME) player1->weaponchanging = false; + + // exception: nade. after throwing a nade, switch to a new one or to the primary + if(player1->gunselect==GUN_GRENADE && player1->thrownademillis && + timeprogress >= 520 && player1->lastaction && player1->lastattackgun==player1->gunselect) + { + player1->weaponchanging = true; + player1->nextweapon = player1->mag[GUN_GRENADE] ? GUN_GRENADE : player1->primary; + player1->thrownademillis = 0; + player1->lastaction = lastmillis-1-WEAPONCHANGE_TIME/2; + timeprogress = lastmillis-player1->lastaction; + }; + + if(!player1->weaponchanging) return; + + if(timeprogress>WEAPONCHANGE_TIME) { player1->weaponchanging = false; player1->lastaction = 0; } else if(timeprogress>WEAPONCHANGE_TIME/2) { gun_changed = true; - if( (!player1->akimbo && player1->akimbomillis && player1->nextweapon==GUN_PISTOL) || + if((!player1->akimbo && player1->akimbomillis && player1->nextweapon==GUN_PISTOL) || (player1->akimbo && !player1->akimbomillis && player1->gunselect==GUN_PISTOL)) player1->akimbo = !player1->akimbo; player1->gunselect = player1->nextweapon; @@ -44,11 +56,13 @@ void weaponswitch(int gun) player1->weaponchanging = true; player1->lastaction = player1->akimbolastaction[0] = player1->akimbolastaction[1] = lastmillis; player1->nextweapon = gun; + playsound(S_GUNCHANGE); } void weapon(int gun) { if(scoped) togglescope(); + if(player1->gunselect==GUN_GRENADE && player1->inhandnade) return; gun %= G_NUM; if(gun<0) gun = G_NUM+gun; @@ -56,8 +70,8 @@ void weapon(int gun) { case G_PRIMARY: gun=player1->primary; break; case G_SECONDARY: gun=GUN_PISTOL; break; - case G_MELEE: gun=GUN_KNIFE; break; - case G_GRENADE: gun=GUN_GRENADE; break; + case G_MELEE: gun=GUN_KNIFE; break; + case G_GRENADE: if(player1->mag[GUN_GRENADE]) gun=GUN_GRENADE; else return; }; if(gun!=player1->gunselect) weaponswitch(gun); @@ -65,8 +79,6 @@ void weapon(int gun) void shiftweapon(int i) { - if(scoped) togglescope(); - int gun; switch(player1->gunselect) { @@ -232,8 +244,8 @@ void hit(int target, int damage, dynent *d, dynent *at) if(d==player1) selfdamage(damage, at==player1 ? -1 : -2, at); //else if(d->monsterstate) monsterpain(d, damage, at); // Added by Rick: Let bots take damage - else if (d->pBot) d->pBot->BotPain(damage, at); - else if (d->bIsBot) + else if(d->pBot) d->pBot->BotPain(damage, at); + else if(d->bIsBot) { int PlayerIndex = -1; if (at->bIsBot) PlayerIndex = BotManager.GetBotIndex(at); @@ -415,8 +427,7 @@ extern float rad(float x); void throw_nade(dynent *d, vec &to, physent *p) { if(!p || !d) return; - printf("thrownade\n"); - playsound(S_GRENADETHROW, &d->o); + playsound(S_GRENADETHROW); p->isphysent = true; p->gravity = 20; @@ -445,6 +456,7 @@ void throw_nade(dynent *d, vec &to, physent *p) if(d==player1) { + player1->lastaction = lastmillis; int percent_done = (lastmillis-p->millis)*100/nadetimer; if(percent_done < 0 || percent_done > 100) percent_done = 100; addmsg(1, 9, SV_SHOT, d->gunselect, (int)(from.x*DMF), (int)(from.y*DMF), (int)(from.z*DMF), (int)(to.x*DMF), (int)(to.y*DMF), (int)(to.z*DMF), percent_done); @@ -506,7 +518,7 @@ physent *new_nade(dynent *d, int millis = 0) d->inhandnade = p; d->thrownademillis = 0; - playsound(S_GRENADEPULL, &d->o); + playsound(S_GRENADEPULL); return p; }; @@ -640,7 +652,7 @@ bool akimboside = false; void shoot(dynent *d, vec &targ) { - if(d->weaponchanging) return; + if(d->weaponchanging) return; int attacktime = lastmillis-d->lastaction; if(d->gunselect==GUN_GRENADE && d->inhandnade && !d->attacking) // throw nade { @@ -703,9 +715,10 @@ void shoot(dynent *d, vec &targ) if(d->gunselect==GUN_PISTOL && d->akimbo) d->gunwait = guns[d->gunselect].attackdelay / 2; //make akimbo pistols shoot twice as fast as normal pistol else d->gunwait = guns[d->gunselect].attackdelay; - if(d->gunselect==GUN_GRENADE) // activate + if(d->gunselect==GUN_GRENADE) // activate { if(!d->inhandnade) new_nade(d); + else d->mag[d->gunselect]++; return; }