From 1e20bace2e299eef343eeea7574a2fb07c78d9ce Mon Sep 17 00:00:00 2001 From: Bukz Date: Fri, 29 Apr 2011 14:04:41 +0000 Subject: [PATCH] inWater command, akimboautoswitch slider, akimboendaction defaults to 1 (switch back to primary) git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6390 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/docs.cfg | 4 ++++ config/menus_settings.cfg | 1 + docs/reference.xml | 17 +++++++++++++++++ source/src/physics.cpp | 7 ++++++- source/src/weapon.cpp | 2 +- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/config/docs.cfg b/config/docs.cfg index 4fc7b2d2..858b5e37 100644 --- a/config/docs.cfg +++ b/config/docs.cfg @@ -644,6 +644,10 @@ docargument [V] [Note: This is turned on by default.] [min 0/max 1/default 1]; docident [survival] [Prepares a round of bot survival mode on the specified map.]; docargument [M] [the map to use] [] [0]; docremark [All official maps are compatible with survival, if you want to play survival on a custom map, prior edits/additions to the script are necessary, such as adding a zone for that specific map.]; +docident [inWater] [Determines if the local player is standing in water or submerged.]; +docargument [T] [check if submerged instead?] [min 0/max 1/default 0] [0]; +docexample [if (inWater) [echo in water] [echo not in water]] [Example output: in water]; +docexample [if (inWater 1) [echo submerged] [echo not submerged]] [Example output: not submerged]; docsection [Editing] docident [addpath1way1] []; docident [addpath1way2] []; diff --git a/config/menus_settings.cfg b/config/menus_settings.cfg index 060354f1..f66c4011 100644 --- a/config/menus_settings.cfg +++ b/config/menus_settings.cfg @@ -384,6 +384,7 @@ menuitem "Change to the enemy team" [ changeteam ] menuitem "Change weapon..." [ showmenu Weapons ] menuitem "Change player skin..." [ showmenu (at [CLA RVSF] (curteam)) ] menuitem "Edit kill messages" [ showmenu "Kill Messages" ] +menuitemcheckbox "Auto switch to akimbo upon pickup: " "$akimboautoswitch" [ akimboautoswitch $arg1 ] menuitemslider "Akimbo end action: " 0 2 "$akimboendaction" 1 [ "Switch to pistol" "Switch to primary weapon" "Switch to grenades" ] [ akimboendaction $arg1 ] __fontsetting = 0 // Initial setting for status of fonts so AC doesn't give errors. diff --git a/docs/reference.xml b/docs/reference.xml index 1b0a9751..6306e272 100644 --- a/docs/reference.xml +++ b/docs/reference.xml @@ -2699,6 +2699,23 @@ Output: If this alias exists, it will be automatically executed on the last minute remaining mark. + + + Determines if the local player is standing in water or submerged. + + + + Example output: in water + + + + Example output: not submerged + + + + + + diff --git a/source/src/physics.cpp b/source/src/physics.cpp index 47a91094..8c5fc709 100644 --- a/source/src/physics.cpp +++ b/source/src/physics.cpp @@ -766,7 +766,11 @@ void crouch(bool on) player1->trycrouch = on; } - +int inWater(int type = 0) +{ + if(type ? hdr.waterlevel > player1->o.z : hdr.waterlevel > (player1->o.z - player1->eyeheight)) return 1; + else return 0; +} COMMAND(backward, ARG_DOWN); COMMAND(forward, ARG_DOWN); @@ -775,6 +779,7 @@ COMMAND(right, ARG_DOWN); COMMANDN(jump, jumpn, ARG_DOWN); COMMAND(attack, ARG_DOWN); COMMAND(crouch, ARG_DOWN); +COMMAND(inWater, ARG_1EXP); void fixcamerarange(physent *cam) { diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 7cea6353..9d3c7a6b 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -6,7 +6,7 @@ VARP(autoreload, 0, 1, 1); VARP(akimboautoswitch, 0, 1, 1); -VARP(akimboendaction, 0, 0, 2); // 0: stay with pistol, 1: back to primary, 2: grenade - all fallback to previous one w/o ammo for target +VARP(akimboendaction, 0, 1, 2); // 0: stay with pistol, 1: back to primary, 2: grenade - all fallback to previous one w/o ammo for target struct sgray { int ds; // damage flag: outer, medium, center: SGSEGDMG_* vec rv; // ray vector