| 41 | VARFP(showeditingsettings, 0, 0, 3, { if(showeditingsettings){ toucheditingsettings(true); }else{ keepshowingeditingsettingsfrom = keepshowingeditingsettingstill = 0; }}); // 0:almost entirely off, 1: all off after duration, 2: text off after duration, 3: permanent |
| 42 | |
| 43 | void toggleedit(bool force) |
| 44 | { |
| 45 | if(player1->state==CS_DEAD) return; // do not allow dead players to edit to avoid state confusion |
| 46 | if(!force && !editmode && !allowedittoggle()) return; // not in most multiplayer modes |
| 47 | if(player1->state == CS_SPECTATE) |
| 48 | { |
| 49 | if(watchingdemo) |
| 50 | { |
| 51 | if(player1->spectatemode != SM_FLY) spectatemode(SM_FLY); // release in a place of followed player |
| 52 | } |
| 53 | else return; |
| 54 | } |
| 55 | |
| 56 | if(!(editmode = !editmode)) |
| 57 | { |
| 58 | float oldz = player1->o.z; |
| 59 | entinmap(player1); // find spawn closest to current floating pos |
| 60 | player1->timeinair = player1->o.z == oldz ? 0: 300; |
| 61 | } |
| 62 | else |
| 63 | { |
| 64 | player1->attacking = false; |
| 65 | toucheditingsettings(true); |
| 66 | } |
| 67 | keyrepeat(editmode, KR_EDITMODE); |
| 68 | editing = editmode ? 1 : 0; |
| 69 | editing_sp = editmode && !multiplayer(NULL) ? 1 : 0; |
| 70 | player1->state = editing ? CS_EDITING : (watchingdemo ? CS_SPECTATE : CS_ALIVE); |
| 71 | if(editing && player1->onladder) player1->onladder = false; |
| 72 | if(editing && (player1->weaponsel->type == GUN_SNIPER && ((sniperrifle *)player1->weaponsel)->scoped)) ((sniperrifle *)player1->weaponsel)->onownerdies(); // or ondeselecting() |
| 73 | if(editing && (player1->weaponsel->type == GUN_GRENADE) && ((grenades *)player1->weaponsel)->state < GST_THROWING) ((grenades *)player1->weaponsel)->onownerdies(); |
| 74 | if(!force) addmsg(SV_EDITMODE, "ri", editing); |
| 75 | } |
| 76 | |
| 77 | void edittoggle() { toggleedit(false); } |
| 78 |
no test coverage detected