Subversion Repositories eduke32

Rev

Rev 8688 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5196 hendricks2 1
//-------------------------------------------------------------------------
2
/*
3
Copyright (C) 1997, 2005 - 3D Realms Entertainment
4
 
5
This file is part of Shadow Warrior version 1.2
6
 
7
Shadow Warrior is free software; you can redistribute it and/or
8
modify it under the terms of the GNU General Public License
9
as published by the Free Software Foundation; either version 2
10
of the License, or (at your option) any later version.
11
 
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
 
16
See the GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21
 
22
Original Source: 1997 - Frank Maddin and Jim Norwood
23
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
24
*/
25
//-------------------------------------------------------------------------
26
 
27
// CONSOLE.C
28
// Handles all argument storing and user console variable modifications.
29
// Copyright (c) 1996 by Jim Norwood
30
 
31
#include "build.h"
32
 
33
#include "mytypes.h"
34
#include "keys.h"
35
#include "names2.h"
36
#include "panel.h"
37
#include "game.h"
38
#include "tags.h"
39
#include "player.h"
40
#include "lists.h"
41
#include "warp.h"
42
#include "quake.h"
43
 
44
#include "common_game.h"
45
#include "function.h"
46
#include "control.h"
47
#include "trigger.h"
48
 
49
#include "savedef.h"
50
#include "menus.h"
7443 hendricks2 51
#include "network.h"
5196 hendricks2 52
#include "pal.h"
53
 
54
#include "weapon.h"
55
#include "text.h"
56
#include "jsector.h"
57
 
58
// DEFINES ///////////////////////////////////////////////////////////////////////////////////
59
#define MAX_USER_ARGS           100
60
#define MAX_CONSOLE_COMMANDS    100
61
#define MAX_HISTORY             20
62
 
5198 hendricks2 63
SWBOOL SpriteInfo = FALSE;
64
extern SWBOOL QuitFlag;
5196 hendricks2 65
 
66
// FUNCTION PROTOTYPES ///////////////////////////////////////////////////////////////////////
67
void CON_ProcessOptions(void);
68
void CON_ClearConsole(void);
5198 hendricks2 69
uint8_t CON_CommandCmp(const char *str1, const char *str2, int len);
5196 hendricks2 70
void CheatInput(void);
71
 
72
// Modify actor routines
73
void CON_ModXrepeat(void);
74
void CON_ModYrepeat(void);
75
void CON_ModTranslucent(void);
76
void CON_GetHelp(void);
77
void CON_Sound(void);
78
void CON_Reverb(void);
79
void CON_Heap(void);
80
void CON_Cache(void);
81
void CON_SoundTest(void);
82
void CON_SpriteInfo(void);
83
void CON_KillSprite(void);
84
void CON_SpriteDetail(void);
85
void CON_UserDetail(void);
86
void CON_Quit(void);
87
void CON_LoadSetup(void);
88
void CON_DamageData(void);
89
void CON_WinPachinko(void);
90
void CON_Tweak(void);
91
void CON_Bunny(void);
92
void CON_CheckHeap(void);
93
void CON_DumpHeap(void);
94
void CON_ShowMirror(void);
95
void CON_MultiNameChange(void);
96
void CON_DumpSoundList(void);
97
 
98
// STRUCTURES ////////////////////////////////////////////////////////////////////////////////
99
 
100
typedef struct
101
{
102
    const char *command;              // Text string representing the command that calls this function
103
    void (*function)(void);     // Function assigned to the command, take no parameters
104
 
105
} CON_COMMAND, *CON_COMMANDp;
106
 
107
// Contains any commands that don't get added by particular setup functions
108
CON_COMMAND pre_commands[] =
109
{
110
#if DEBUG
111
    {"bobbing",     CON_ProcessOptions},
112
    {"swnext",      CheatInput},
113
    {"swprev",      CheatInput},
114
    {"swsecret",    CheatInput},
115
    {"swstart",     CheatInput},
116
    {"swres",       CheatInput},
117
    {"swloc",       CheatInput},
118
    {"swroom",      CheatInput},
119
    {"swmap",       CheatInput},
120
    {"swvox",       CheatInput},
121
    {"swsave",      CheatInput},
122
#endif
123
#if DEBUG
124
    {"george",      CheatInput},
125
    {"blackburn",   CheatInput},
126
    {"reverb",      CON_Reverb},
127
    {"mem",         CON_Heap},
128
    {"cache",       CON_Cache},
129
    {"xrepeat",     CON_ModXrepeat},
130
    {"yrepeat",     CON_ModYrepeat},
131
    {"translucent", CON_ModTranslucent},
132
    {"spriteinfo",  CON_SpriteInfo},
133
    {"kill",        CON_KillSprite},
134
    {"showsprite",  CON_SpriteDetail},
135
    {"showuser",    CON_UserDetail},
136
    {"damage",      CON_DamageData},
137
    {"tweak",       CON_Tweak},
138
    {"checkheap",   CON_CheckHeap},
139
    {"dumpheap",    CON_DumpHeap},
140
    {"showmirror",  CON_ShowMirror},
141
    {"clear",       CON_ClearConsole},
142
    {"dumpsounds",  CON_DumpSoundList},
143
    {"help",        CON_GetHelp},
144
//{"quit",        CON_Quit},
145
#endif
146
    {"swchan",      CheatInput},
147
    {"swgimme",     CheatInput},
148
    {"swtrek##",    CheatInput},
149
    {"swgreed",     CheatInput},
150
    {"swghost",     CheatInput},
151
    {"swstart",     CheatInput},
152
    {"swres",       CheatInput},
153
    {"swloc",       CheatInput},
154
    {"swmap",       CheatInput},
155
    {"swsave",      CheatInput},
156
    {"sound",       CON_SoundTest},
157
    {"winpachinko", CON_WinPachinko},
158
    {"config",      CON_LoadSetup},
159
    {"swtrix",      CON_Bunny},
160
    {"swname",      CON_MultiNameChange},
161
    {NULL, NULL}
162
};
163
 
164
 
165
// GLOBALS ///////////////////////////////////////////////////////////////////////////////////
166
 
167
CON_COMMAND commandlist[MAX_CONSOLE_COMMANDS];  // Console command array
168
CON_COMMANDp commandptr;    // Pointer to a command
169
 
5198 hendricks2 170
int16_t numcommands=0;    // Total number of commands in the command list
5196 hendricks2 171
 
172
char command_history[MAX_HISTORY][256]; // History of what has been typed in lately
5198 hendricks2 173
int16_t curr_history=0; // Line currently being pointed to in the history array
174
int16_t numhistory=0;
5196 hendricks2 175
 
176
// Array which stores all the user arguments passed into the game.
177
static char user_args[MAX_USER_ARGS][256];
5198 hendricks2 178
static uint8_t con_argnum=0;   // Total number of arguments that were passed into the game
5196 hendricks2 179
 
180
char con_message[80]; // Holds the current console message to send to adduserquote
181
 
182
// FUNCTIONS /////////////////////////////////////////////////////////////////////////////////
183
 
184
 
185
//
186
// Frank's neato input string checker, useful for my stuff too.
187
//
5198 hendricks2 188
uint8_t CON_CommandCmp(const char *str1, const char *str2, int len)
5196 hendricks2 189
{
190
    const char *cp1 = str1;
191
    const char *cp2 = str2;
192
 
193
    do
194
    {
195
        if (*cp1 != *cp2)
196
        {
197
            if (*cp1 != '#' && *cp2 != '#')
198
                return FALSE;
199
            else if ((*cp1 == '#' && !isdigit(*cp2)) || (*cp2 == '#' && !isdigit(*cp1)))
200
                return FALSE;
201
        }
202
 
203
        cp1++;
204
        cp2++;
205
    }
206
    while (--len);
207
 
208
    return TRUE;
209
}
210
 
5198 hendricks2 211
SWBOOL IsCommand(char *str)
5196 hendricks2 212
{
213
    int i;
214
    char first[512];
215
 
216
    sscanf(str,"%s",first);
217
 
218
    for (i = 0; i < numcommands; i++)
219
    {
220
        // Don't even try if they aren't the same length
221
        if (strlen(first) != strlen(commandlist[i].command))
222
            continue;
223
 
224
        // See if it's in there
225
        if (CON_CommandCmp(first, commandlist[i].command, strlen(first)))
226
        {
227
            return TRUE;
228
        }
229
    }
230
 
231
    return FALSE;
232
}
233
 
234
//
235
// Sends a message to the user quote array
236
//
237
 
238
void CON_Message(const char *message, ...)
239
{
240
    va_list argptr;
241
 
242
    va_start(argptr,message);
243
    vsprintf(&con_message[0],message,argptr);
244
    va_end(argptr);
245
 
246
    // Send message to user quote array for immediate display
247
    adduserquote(&con_message[0]);
248
}
249
 
250
//
251
// Sends a message to the console quote array
252
//
253
 
254
void CON_ConMessage(const char *message, ...)
255
{
256
    va_list argptr;
257
 
258
    va_start(argptr,message);
259
    vsprintf(&con_message[0],message,argptr);
260
    va_end(argptr);
261
 
262
    // Send message to user quote array for immediate display
263
    addconquote(&con_message[0]);
264
}
265
 
266
//
267
// Stores user arguments passed in on the command line for later inspection
268
//
269
void CON_StoreArg(const char *userarg)
270
{
271
    if (con_argnum < MAX_USER_ARGS)
272
    {
273
        strcpy(&user_args[con_argnum][0],userarg);
274
        Bstrlwr(&user_args[con_argnum][0]);
275
        con_argnum++;
276
    }
277
}
278
 
279
//
280
// Checkes the user command array to see if user did in fact pass in a particular argument
281
//
5198 hendricks2 282
SWBOOL CON_CheckParm(const char *userarg)
5196 hendricks2 283
{
5198 hendricks2 284
    int16_t i;
5196 hendricks2 285
 
286
    for (i=0; i<con_argnum; i++)
287
    {
288
        if (!strcmp(&user_args[i][0],userarg))
289
            return TRUE;   // Yep, it's in there
290
    }
291
 
292
    return FALSE;   // Not a parameter that was passed in
293
}
294
 
295
//
296
// Scrolls up and down through previous user commands like DosKey
297
// Copies the history text string into the MessageInputCommand
298
//
299
void CON_CommandHistory(signed char dir)
300
{
301
    if (curr_history + dir < numhistory)
302
        curr_history += dir;
303
    if (curr_history < 0) curr_history = 0;
304
    if (curr_history > MAX_HISTORY) curr_history = MAX_HISTORY;
305
 
306
    strcpy(MessageInputString, command_history[curr_history]);
307
}
308
 
309
void CON_AddHistory(const char *commandstr)
310
{
311
    int i;
312
 
313
    for (i=MAX_HISTORY-1; i>=0; i--)
314
    {
315
        strcpy(command_history[i],command_history[i-1]);
316
    }
317
    strcpy(command_history[0],commandstr);
318
    if ((++numhistory) > MAX_HISTORY) numhistory = MAX_HISTORY;
319
}
320
 
321
 
322
//
323
// Adds a command name to the command list and assigns the appropriate function pointer
324
//
5198 hendricks2 325
SWBOOL CON_AddCommand(const char *command, void (*function)(void))
5196 hendricks2 326
{
327
    if (command != NULL && function != NULL && numcommands < MAX_CONSOLE_COMMANDS)
328
    {
329
//      strcpy(commandlist[numcommands].command, command);
330
        commandlist[numcommands].command = command;
331
        commandlist[numcommands].function = function;
332
 
333
        // Increment counter to set up for next command insertion
334
        numcommands++;
335
 
336
        ASSERT(numcommands <= MAX_CONSOLE_COMMANDS);
337
 
338
        return TRUE;
339
    }
340
 
341
    return FALSE;
342
}
343
 
344
//
345
// Process commands
346
// Returns TRUE upon success
347
//
348
void CON_ProcessUserCommand(void)
349
{
5198 hendricks2 350
    int16_t i=0;
5196 hendricks2 351
    char temp_message[256],command_str[256];
352
 
353
    strcpy(temp_message,MessageInputString);
354
    sscanf(Bstrlwr(temp_message),"%s", command_str); // Get the base command type
355
 
356
    for (i = 0; i < numcommands; i++)
357
    {
358
        // Don't even try if they aren't the same length
359
        if (strlen(command_str) != strlen(commandlist[i].command)) continue;
360
        // See if it's in there
361
        if (CON_CommandCmp(command_str, commandlist[i].command, strlen(command_str)))
362
        {
363
            if (commandlist[i].function)
364
            {
365
                (*commandlist[i].function)();
366
                CON_AddHistory(MessageInputString); // Keep history only of valid input
367
                return;
368
            }
369
        }
370
    }
371
 
372
    if (ConPanel)
373
        CON_ConMessage("Syntax Error or Command not enabled!");
374
}
375
 
376
//
377
// Initialize the console command list with the pre_command startup array
378
//
379
void CON_InitConsole(void)
380
{
381
    CON_COMMANDp i;
382
 
383
    for (i = &pre_commands[0]; i->command != NULL; i++)
384
    {
385
        if (!CON_AddCommand(i->command, i->function))
386
        {
387
            printf("CON_InitConsole: Failed to add command contained in pre_commands list.\n");
388
            TerminateGame();
389
            exit(0);
390
        }
391
    }
392
 
393
    //printf("CON_InitConsole: Command list initialized.\n");
394
}
395
 
396
//
397
// Process as a command, anything that could be set in the options menu as well
398
//
399
void CON_ProcessOptions(void)
400
{
401
 
402
}
403
 
404
// Clear the console screen
405
void CON_ClearConsole(void)
406
{
407
    short i;
408
 
409
    for (i=0; i<MAXCONQUOTES; i++)
410
        strcpy(con_quote[i],"\0");
411
}
412
 
413
/////////////////////////////////////////////////////////////////////////////////////////////
414
// The user console programming function library ////////////////////////////////////////////
415
/////////////////////////////////////////////////////////////////////////////////////////////
416
 
5198 hendricks2 417
SWBOOL CheckValidSprite(short SpriteNum)
5196 hendricks2 418
{
419
    if (SpriteNum < 0 || SpriteNum > 6144)
420
    {
421
        CON_ConMessage("ERROR: Sprite %d is out of range.",SpriteNum);
422
        return FALSE;
423
    }
424
    return TRUE;
425
}
426
 
427
// Get help on a console command
428
void CON_GetHelp(void)
429
{
430
    char base[80], command[80];
431
 
432
    if (sscanf(MessageInputString,"%s %s",base,command) < 2)
433
    {
434
        CON_ConMessage("Usage: help [keyword]");
435
        return;
436
    }
437
 
438
    Bstrlwr(command);    // Make sure operator is all lower case
439
 
440
    if (!strcmp(command, "xrepeat"))
441
    {
442
        CON_ConMessage("Usage: xrepeat [repeat value 0-255],");
443
        CON_ConMessage("   [User ID (-1 for all ID's)], [SpriteNum (-1 for all of type ID)]");
444
        return;
445
    }
446
    else if (!strcmp(command, "yrepeat"))
447
    {
448
        CON_ConMessage("Usage: yrepeat [repeat value 0-255],");
449
        CON_ConMessage("   [User ID (-1 for all ID's)], [SpriteNum (-1 for all of type ID)]");
450
        return;
451
    }
452
    else if (!strcmp(command, "translucent"))
453
    {
454
        CON_ConMessage("Usage: translucent [OFF/ON 0-1],");
455
        CON_ConMessage("   [User ID (-1 for all ID's)], [SpriteNum (-1 for all of type ID)]");
456
        return;
457
    }
458
    else
459
    {
460
        CON_ConMessage("No help was located on that subject.");
461
    }
462
}
463
 
464
// Modify sprites xrepeat value
465
void CON_ModXrepeat(void)
466
{
467
    char base[80];
5198 hendricks2 468
    int16_t op1=64,op2=-1,op3=-1;
5196 hendricks2 469
    short i;
470
 
471
 
472
    if (sscanf(MessageInputString,"%s %hd %hd %hd",base,&op1,&op2,&op3) < 4)
473
    {
474
        strcpy(MessageInputString,"help xrepeat");
475
        CON_GetHelp();
476
        return;
477
    }
478
 
479
    if (op3 == -1)
480
    {
481
        for (i=0; i<MAXSPRITES; i++)
482
        {
483
            SPRITEp sp = &sprite[i];
484
            USERp u = User[i];
485
 
486
            if (op2 == -1)
487
                sp->xrepeat = op1;
488
            else
489
            {
490
                if (u->ID == op2)
491
                    sp->xrepeat = op1;
492
            }
493
        }
494
        if (op2 == -1)
495
            CON_ConMessage("Xrepeat set to %d for all u->ID's for all sprites.",op1);
496
        else
497
            CON_ConMessage("Xrepeat set to %d for u->ID = %d for all sprites.",op1,op2);
498
    }
499
    else
500
    {
501
        // Do it only for one sprite
502
        SPRITEp sp = &sprite[op3];
503
 
504
        if (!CheckValidSprite(op3)) return;
505
 
506
        sp->xrepeat = op1;
507
        CON_ConMessage("Xrepeat set to %d for sprite %d.",op1,op3);
508
    }
509
}
510
 
511
// Modify sprites yrepeat value
512
void CON_ModYrepeat(void)
513
{
514
    char base[80];
5198 hendricks2 515
    int16_t op1=64,op2=-1,op3=-1;
5196 hendricks2 516
    short i;
517
 
518
 
519
    if (sscanf(MessageInputString,"%s %hd %hd %hd",base,&op1,&op2,&op3) < 4)
520
    {
521
        strcpy(MessageInputString,"help yrepeat");
522
        CON_GetHelp();
523
        return;
524
    }
525
 
526
 
527
    if (op3 == -1)
528
    {
529
        for (i=0; i<MAXSPRITES; i++)
530
        {
531
            SPRITEp sp = &sprite[i];
532
            USERp u = User[i];
533
 
534
            if (op2 == -1)
535
                sp->yrepeat = op1;
536
            else
537
            {
538
                if (u->ID == op2)
539
                    sp->yrepeat = op1;
540
            }
541
        }
542
        if (op2 == -1)
543
            CON_ConMessage("Yrepeat set to %d for all u->ID's for all sprites.",op1);
544
        else
545
            CON_ConMessage("Yrepeat set to %d for u->ID = %d for all sprites.",op1,op2);
546
    }
547
    else
548
    {
549
        // Do it only for one sprite
550
        SPRITEp sp = &sprite[op3];
551
 
552
        if (!CheckValidSprite(op3)) return;
553
 
554
        sp->yrepeat = op1;
555
        CON_ConMessage("Yrepeat set to %d for sprite %d.",op1,op3);
556
    }
557
}
558
 
559
void CON_ModTranslucent(void)
560
{
561
    char base[80];
5198 hendricks2 562
    int16_t op1=0;
5196 hendricks2 563
    SPRITEp sp;
564
 
565
    // Format: translucent [SpriteNum]
566
    if (sscanf(MessageInputString,"%s %hd",base,&op1) < 2)
567
    {
568
        strcpy(MessageInputString,"help translucent");
569
        CON_GetHelp();
570
        return;
571
    }
572
 
573
    if (!CheckValidSprite(op1)) return;
574
 
575
    sp = &sprite[op1];
576
 
577
    if (TEST(sp->cstat,CSTAT_SPRITE_TRANSLUCENT))
578
    {
579
        RESET(sp->cstat,CSTAT_SPRITE_TRANSLUCENT);
580
        CON_ConMessage("Translucence RESET for sprite %d.",op1);
581
    }
582
    else
583
    {
584
        SET(sp->cstat,CSTAT_SPRITE_TRANSLUCENT);
585
        CON_ConMessage("Translucence SET for sprite %d.",op1);
586
    }
587
}
588
 
589
void CON_SoundTest(void)
590
{
591
    int zero=0;
592
    char base[80];
5198 hendricks2 593
    int16_t op1=0;
5196 hendricks2 594
 
595
    // Format: sound [number]
596
    if (sscanf(MessageInputString,"%s %hd",base,&op1) < 2)
597
    {
598
        strcpy(MessageInputString,"help sound");
599
        CON_GetHelp();
600
        return;
601
    }
602
 
603
    if (op1 < 0 || op1 >= DIGI_MAX)
604
    {
605
        CON_ConMessage("Sound number out of range.");
606
        return;
607
    }
608
 
8688 ny00123 609
    PlaySound(op1,&zero,&zero,&zero,v3df_none);
5196 hendricks2 610
}
611
 
612
 
613
void CON_Reverb(void)
614
{
615
    char base[80];
5198 hendricks2 616
    int16_t op1=0;
5196 hendricks2 617
    PLAYERp pp = Player + screenpeek;
618
 
619
    // Format: reverb [number]
620
    if (sscanf(MessageInputString,"%s %hd",base,&op1) < 2)
621
    {
622
        strcpy(MessageInputString,"help reverb");
623
        CON_GetHelp();
624
        return;
625
    }
626
 
627
    CON_ConMessage("Reverb is now set to %d.",op1);
628
    COVER_SetReverb(op1);
629
    pp->Reverb = op1;
630
}
631
 
632
void CON_Heap(void)
633
{
634
    /*
635
    int totalmemory=0;
636
    extern int TotalMemory, ActualHeap;
637
    int i;
638
    void *testheap;
639
 
640
    totalmemory = Z_AvailHeap();
641
    CON_ConMessage("Total heap at game startup = %d", TotalMemory);
642
    CON_ConMessage("ActualHeap reserved for non-cache use = %d", ActualHeap);
643
    CON_ConMessage("Total unallocated blocks in bytes minus reserved heap = %d", totalmemory);
644
    CON_ConMessage("NOTE: Allocation exceeding ActualHeap will result in out of memory");
645
    // Find remaining heap space unused
646
    i = ActualHeap;
647
    while(i>0)
648
    {
649
    testheap = AllocMem(i);
650
    if(!testheap)
651
        i-=1024L; // Decrease in 1k increments
652
    else
653
        {
654
        CON_ConMessage("Heap test result (+ or - 1k):");
655
        CON_ConMessage("=============================");
656
        CON_ConMessage("Unallocated heap space remaining  = %d",i);
657
        CON_ConMessage("Unallocated heap space used  = %d",ActualHeap - i);
658
        FreeMem(testheap);
659
        i=0; // Beam us out of here Scotty!
660
        }
661
    }
662
 
663
    if(ActualHeap < 50000L)
664
    {
665
    CON_ConMessage("ALERT: Memory is critically low!");
666
    }
667
    */
668
}
669
 
670
int TileRangeMem(int start)
671
{
672
    int i;
673
    int total=0;
674
 
675
    switch (start)
676
    {
677
    case 4096: // Evil Ninja
678
        for (i=4096; i<=4239; i++)
5204 hendricks2 679
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 680
        break;
681
    case 800:  // Hornet
682
        for (i=800; i<=811; i++)
5204 hendricks2 683
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 684
        break;
685
    case 817:
686
        for (i=817; i<=819; i++) // Bouncing Betty
5204 hendricks2 687
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 688
        break;
689
    case 820: // Skull
690
        for (i=820; i<=854; i++)
5204 hendricks2 691
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 692
        break;
693
    case 960:
694
        for (i=960; i<=1016; i++) // Serpent God
5204 hendricks2 695
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 696
        for (i=1300; i<=1314; i++)
5204 hendricks2 697
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 698
        break;
699
    case 1024:
700
        for (i=1024; i<=1175; i++) // LoWang
5204 hendricks2 701
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 702
        break;
703
    case 1320:
704
        for (i=1320; i<=1396; i++) // Skeletor Priest
5204 hendricks2 705
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 706
        break;
707
    case 1400:
708
        for (i=1400; i<=1440; i++) // Coolie
5204 hendricks2 709
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 710
        for (i=4260; i<=4266; i++)
5204 hendricks2 711
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 712
        break;
713
    case 1441:
714
        for (i=1441; i<=1450; i++) // Coolie Ghost
5204 hendricks2 715
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 716
        for (i=4267; i<=4312; i++)
5204 hendricks2 717
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 718
        break;
719
    case 1469:
720
        for (i=1469; i<=1497; i++) // Guardian
5204 hendricks2 721
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 722
        for (i=1504; i<=1518; i++)
5204 hendricks2 723
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 724
        break;
725
    case 1580:
726
        for (i=1580; i<=1644; i++) // Little Ripper
5204 hendricks2 727
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 728
        break;
729
    case 4320:
730
        for (i=4320; i<=4427; i++) // Big Ripper
5204 hendricks2 731
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 732
        break;
733
    case 2540:
734
        for (i=2540; i<=2546; i++) // Trashcan
5204 hendricks2 735
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 736
        break;
737
    case 4430:
738
        for (i=4430; i<=4479; i++) // Fish
5204 hendricks2 739
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 740
        break;
741
    case 4490:
742
        for (i=4490; i<=4544; i++) // Sumo
5204 hendricks2 743
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 744
        break;
745
    case 5023:
746
        for (i=5023; i<=5026; i++) // Toilet Girl
5204 hendricks2 747
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 748
        break;
749
    case 5032:
750
        for (i=5032; i<=5035; i++) // Wash Girl
5204 hendricks2 751
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 752
        break;
753
    case 2000:
754
        for (i=2000; i<=2002; i++) // Chop Stick Panel
5204 hendricks2 755
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 756
        break;
757
    case 2004:
758
        for (i=2004; i<=2009; i++) // Uzi Panel
5204 hendricks2 759
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 760
        for (i=2040; i<=2043; i++) // Uzi Overlays
5204 hendricks2 761
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 762
        break;
763
    case 2010:
764
        for (i=2010; i<=2019; i++) // Rail Panel
5204 hendricks2 765
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 766
        break;
767
    case 2130:
768
        for (i=2130; i<=2137; i++) // Shuriken Panel
5204 hendricks2 769
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 770
        break;
771
    case 2050:
772
        for (i=2050; i<=2053; i++) // Heart Panel
5204 hendricks2 773
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 774
        break;
775
    case 2054:
776
        for (i=2054; i<=2057; i++) // HotHead Panel
5204 hendricks2 777
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 778
        break;
779
    case 2070:
780
        for (i=2070; i<=2077; i++) // Rocket Launcher Panel
5204 hendricks2 781
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 782
        break;
783
    case 2080:
784
        for (i=2080; i<=2083; i++) // Sword Panel
5204 hendricks2 785
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 786
        break;
787
    case 4090:
788
        for (i=4090; i<=4093; i++) // Bloody Sword Panel
5204 hendricks2 789
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 790
        break;
791
    case 2121:
792
        for (i=2121; i<=2126; i++) // 40MM Panel
5204 hendricks2 793
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 794
        break;
795
    case 2211:
796
        for (i=2211; i<=2216; i++) // Shotgun Panel
5204 hendricks2 797
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 798
        for (i=2225; i<=2227; i++) // Shotgun Quad-Mode Panel
5204 hendricks2 799
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 800
        break;
801
    case 2220:
802
        for (i=2220; i<=2224; i++) // Sticky Bomb Panel
5204 hendricks2 803
            total += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 804
        break;
805
    }
806
 
807
    return total;
808
}
809
 
810
void CON_Cache(void)
811
{
7562 hendricks2 812
    char incache[MAXTILES]{};
8685 ny00123 813
    int i,tottiles,totsprites,totactors;
5196 hendricks2 814
 
815
    // Calculate all level tiles, non-actor stuff
816
    for (i=0; i<numsectors; i++)
817
    {
818
        incache[sector[i].ceilingpicnum] = 1;
819
        incache[sector[i].floorpicnum] = 1;
820
    }
821
 
822
    for (i=0; i<numwalls; i++)
823
    {
824
        incache[wall[i].picnum] = 1;
825
        if (wall[i].overpicnum >= 0)
826
            incache[wall[i].overpicnum] = 1;
827
    }
828
 
829
    tottiles = 0;
7562 hendricks2 830
    for (i=0; i<MAXTILES; i++)
5196 hendricks2 831
        if (incache[i] > 0)
5204 hendricks2 832
            tottiles += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 833
 
834
    //////////////////////////////////////////////
835
 
7562 hendricks2 836
    memset(incache, 0, sizeof(incache));
5196 hendricks2 837
 
838
    // Sprites on the stat list get counted as cached, others don't
839
    for (i=0; i<MAXSPRITES; i++)
840
        if (sprite[i].statnum < MAXSTATUS)
841
            incache[sprite[i].picnum] = 1;
842
 
843
    totsprites = 0;
844
    totactors = 0;
845
 
7562 hendricks2 846
    for (i=0; i<MAXTILES; i++)
5196 hendricks2 847
    {
848
        if (incache[i] > 0)
849
        {
850
            switch (i)
851
            {
852
            case 4096:
853
                totactors+=TileRangeMem(4096);
854
                incache[4096]=0;
855
                break;
856
            case 800:
857
                totactors+=TileRangeMem(800);
858
                incache[800]=0;
859
                break;
860
            case 817:
861
                totactors+=TileRangeMem(817);
862
                incache[817]=0;
863
                break;
864
            case 820:
865
                totactors+=TileRangeMem(820);
866
                incache[820]=0;
867
                break;
868
            case 960:
869
                totactors+=TileRangeMem(960);
870
                incache[960]=0;
871
                break;
872
            //case 1024:   // Lo Wang is calculated later
873
            //     totactors+=TileRangeMem(1024);
874
            //     incache[1024]=0;
875
            //break;
876
            case 1320:
877
                totactors+=TileRangeMem(1320);
878
                incache[1320]=0;
879
                break;
880
            case 1400:
881
                totactors+=TileRangeMem(1400);
882
                incache[1400]=0;
883
                break;
884
            case 1441:
885
                totactors+=TileRangeMem(1441);
886
                incache[1441]=0;
887
                break;
888
            case 1469:
889
                totactors+=TileRangeMem(1469);
890
                incache[1469]=0;
891
                break;
892
            case 1580:
893
                totactors+=TileRangeMem(1580);
894
                incache[1580]=0;
895
                break;
896
            case 4320:
897
                totactors+=TileRangeMem(4320);
898
                incache[4320]=0;
899
                break;
900
            case 2540:
901
                totactors+=TileRangeMem(2540);
902
                incache[2540]=0;
903
                break;
904
            case 4430:
905
                totactors+=TileRangeMem(4430);
906
                incache[4430]=0;
907
                break;
908
            case 4490:
909
                totactors+=TileRangeMem(4490);
910
                incache[4490]=0;
911
                break;
912
            case 5023:
913
                totactors+=TileRangeMem(5023);
914
                incache[5023]=0;
915
                break;
916
            case 5032:
917
                totactors+=TileRangeMem(5032);
918
                incache[5032]=0;
919
                break;
920
            case 2000:
921
                totactors+=TileRangeMem(2000);
922
                incache[2000]=0;
923
                break;
924
            case 2004:
925
                totactors+=TileRangeMem(2004);
926
                incache[2004]=0;
927
                break;
928
            case 2010:
929
                totactors+=TileRangeMem(2010);
930
                incache[2010]=0;
931
                break;
932
            case 2130:
933
                totactors+=TileRangeMem(2130);
934
                incache[2130]=0;
935
                break;
936
            case 2050:
937
                totactors+=TileRangeMem(2050);
938
                incache[2050]=0;
939
                break;
940
            case 2054:
941
                totactors+=TileRangeMem(2054);
942
                incache[2054]=0;
943
                break;
944
            case 2070:
945
                totactors+=TileRangeMem(2070);
946
                incache[2070]=0;
947
                break;
948
            case 2080:
949
                totactors+=TileRangeMem(2080);
950
                incache[2080]=0;
951
                break;
952
            case 4090:
953
                totactors+=TileRangeMem(4090);
954
                incache[4090]=0;
955
                break;
956
            case 2121:
957
                totactors+=TileRangeMem(2121);
958
                incache[2121]=0;
959
                break;
960
            case 2211:
961
                totactors+=TileRangeMem(2211);
962
                incache[2211]=0;
963
                break;
964
            case 2220:
965
                totactors+=TileRangeMem(2220);
966
                incache[2220]=0;
967
                break;
968
 
5204 hendricks2 969
            default: totsprites += tilesiz[i].x*tilesiz[i].y;
5196 hendricks2 970
            }
971
        }
972
    }
973
 
974
    CON_ConMessage("/////////////////////////////////////////////");
975
    CON_ConMessage("Current Memory Consumption:");
976
    CON_ConMessage("Total Tiles        = %d",tottiles);
977
    CON_ConMessage("Total Sprites      = %d",totsprites);
978
    CON_ConMessage("Total Actors       = %d",totactors);
979
    CON_ConMessage("Total Memory       = %d",(tottiles+totsprites+totactors));
980
    CON_ConMessage("Total with LoWang  = %d",(tottiles+totsprites+totactors+TileRangeMem(1024)));
981
    CON_ConMessage("/////////////////////////////////////////////");
982
 
983
}
984
 
985
void CON_SpriteInfo(void)
986
{
987
    SpriteInfo++;
988
    if (SpriteInfo > 2) SpriteInfo = 0;
989
 
990
    if (SpriteInfo == 0)
991
        CON_ConMessage("Sprite information is OFF.");
992
    else if (SpriteInfo == 1)
993
        CON_ConMessage("Sprite information is ON (Brief Mode).");
994
    else
995
        CON_ConMessage("Sprite information is ON (Verbose Mode).");
996
}
997
 
998
void CON_KillSprite(void)
999
{
1000
    char base[80];
5198 hendricks2 1001
    int16_t op1=0;
5196 hendricks2 1002
    short i;
1003
    USERp u;
1004
 
1005
    // Format: kill [SpriteNum]
1006
    if (sscanf(MessageInputString,"%s %hd",base,&op1) < 2)
1007
    {
1008
        strcpy(MessageInputString,"help kill");
1009
        CON_GetHelp();
1010
        return;
1011
    }
1012
 
1013
    if (op1 == -1)
1014
    {
1015
        for (i=0; i<MAXSPRITES; i++)
1016
        {
1017
            u = User[i];
1018
            if (!u->PlayerP)
1019
                SetSuicide(i);
1020
        }
1021
        CON_ConMessage("Killed all sprites except Players.");
1022
    }
1023
    else
1024
    {
1025
        if (!CheckValidSprite(op1)) return;
1026
 
1027
        SetSuicide(op1);
1028
        CON_ConMessage("Killed sprite %d.",op1);
1029
    }
1030
 
1031
}
1032
 
1033
void CON_SpriteDetail(void)
1034
{
1035
    char base[80];
5198 hendricks2 1036
    int16_t op1=0;
5196 hendricks2 1037
 
1038
    // Format: showsprite [SpriteNum]
1039
    if (sscanf(MessageInputString,"%s %hd",base,&op1) < 2)
1040
    {
1041
        strcpy(MessageInputString,"help showsprite");
1042
        CON_GetHelp();
1043
        return;
1044
    }
1045
 
1046
    if (!CheckValidSprite(op1)) return;
7525 hendricks2 1047
    auto const sp = (uspritetype const *)&sprite[op1];
5196 hendricks2 1048
 
1049
    CON_ConMessage("x = %d, y = %d, z = %d",sp->x,sp->y,sp->z);
1050
    CON_ConMessage("cstat = %d, picnum = %d",sp->cstat,sp->picnum);
1051
    CON_ConMessage("shade = %d, pal = %d, clipdist = %d",sp->shade,sp->pal,sp->clipdist);
1052
    CON_ConMessage("xrepeat = %d, yrepeat = %d",sp->xrepeat, sp->yrepeat);
1053
    CON_ConMessage("xoffset = %d, yoffset = %d",sp->xoffset, sp->yoffset);
1054
    CON_ConMessage("sectnum = %d, statnum = %d",sp->sectnum, sp->statnum);
1055
    CON_ConMessage("ang = %d, owner = %d",sp->ang,sp->owner);
1056
    CON_ConMessage("xvel = %d, yvel = %d, zvel = %d",sp->xvel,sp->yvel,sp->zvel);
1057
    CON_ConMessage("lotag = %d, hitag = %d, extra = %d",sp->lotag,sp->hitag,sp->extra);
1058
}
1059
 
1060
void CON_UserDetail(void)
1061
{
1062
    char base[80];
5198 hendricks2 1063
    int16_t op1=0;
5196 hendricks2 1064
    USERp u;
1065
 
1066
    // Format: showuser [SpriteNum]
1067
    if (sscanf(MessageInputString,"%s %hd",base,&op1) < 2)
1068
    {
1069
        strcpy(MessageInputString,"help showsprite");
1070
        CON_GetHelp();
1071
        return;
1072
    }
1073
 
1074
    if (!CheckValidSprite(op1)) return;
1075
    u = User[op1];
1076
 
1077
    if (!u) return;
1078
 
1079
    CON_ConMessage("State = %p, Rot = %p",u->State,u->Rot);
1080
    CON_ConMessage("StateStart = %p, StateEnd = %p",u->StateStart,u->StateEnd);
1081
    CON_ConMessage("ActorActionFunc = %p",u->ActorActionFunc);
1082
    CON_ConMessage("ActorActionSet = %p",u->ActorActionSet);
1083
    CON_ConMessage("Personality = %p",u->Personality);
1084
    CON_ConMessage("Attrib = %p",u->Attrib);
1085
    CON_ConMessage("Flags = %d, Flags2 = %d, Tics = %d",u->Flags,u->Flags2,u->Tics);
1086
    CON_ConMessage("RotNum = %d, ID = %d",u->RotNum,u->ID);
1087
    CON_ConMessage("Health = %d, MaxHealth = %d",u->Health,u->MaxHealth);
1088
    CON_ConMessage("LastDamage = %d, PainThreshold = %d",u->LastDamage,u->PainThreshold);
1089
    CON_ConMessage("jump_speed = %d, jump_grav = %d",u->jump_speed,u->jump_grav);
1090
    CON_ConMessage("xchange = %d, ychange = %d, zchange = %d",u->xchange,u->ychange,u->zchange);
1091
    CON_ConMessage("ret = %d, WaitTics = %d, spal = %d",u->ret,u->WaitTics,u->spal);
1092
}
1093
 
1094
void CON_Quit(void)
1095
{
1096
    if (CommPlayers >= 2)
1097
        MultiPlayQuitFlag = TRUE;
1098
    else
1099
        QuitFlag = TRUE;
8751 ny00123 1100
    OSD_ShowDisplay(0);
5196 hendricks2 1101
}
1102
 
1103
void CON_MultiNameChange(void)
1104
{
1105
    char base[16],command[16];
1106
 
1107
    // Format: swname [name]
1108
    if (sscanf(MessageInputString,"%6s %12s",base,command) < 2)
1109
        return;
1110
 
1111
    SendMulitNameChange(command);
1112
}
1113
 
1114
void CON_LoadSetup(void)
1115
{
1116
    /*
1117
    char base[80],command[80];
1118
 
1119
    // Format: showuser [SpriteNum]
1120
    if (sscanf(MessageInputString,"%s %s",base,command) < 2)
1121
    {
1122
    strcpy(MessageInputString,"help config");
1123
    CON_GetHelp();
1124
    return;
1125
    }
1126
 
1127
    if (!SafeFileExists(command))
1128
    {
1129
    CON_ConMessage("CON_LoadSetup: %s does not exist.",command);
1130
    return;
1131
    } else
1132
    {
1133
    strcpy(setupfilename,command);
1134
    }
1135
    initkeys();
1136
    CONFIG_ReadSetup();
1137
    CONTROL_Startup( ControllerType, &GetTime, 120 );
1138
    SetupGameButtons();
1139
 
1140
    if (CONTROL_JoystickEnabled)
1141
    {
1142
    CONTROL_CenterJoystick(CenterCenter, UpperLeft, LowerRight, CenterThrottle,
1143
      CenterRudder);
1144
    }
1145
    CON_ConMessage("Loaded new config file.");
1146
    */
1147
    CON_ConMessage("JonoF: Maybe later");
1148
}
1149
 
7499 hendricks2 1150
const char *damagename[] =
5196 hendricks2 1151
{
1152
    "WPN_STAR","WPN_UZI",
1153
    "WPN_SHOTGUN","WPN_MICRO",
1154
    "WPN_GRENADE","WPN_MINE",
1155
    "WPN_RAIL","WPN_HEART",
1156
    "WPN_HOTHEAD","WPN_NAPALM"
1157
    "WPN_RING","WPN_ROCKET",
1158
    "WPN_SWORD","WPN_FIST",
1159
    "DMG_NAPALM","DMG_MIRV_METEOR",
1160
    "DMG_SERP_METEOR","DMG_ELECTRO_SHARD",
1161
    "DMG_SECTOR_EXP","DMG_BOLT_EXP",
1162
    "DMG_TANK_SHELL_EXP","DMG_FIREBALL_EXP",
1163
    "DMG_NAPALM_EXP","DMG_SKULL_EXP",
1164
    "DMG_BASIC_EXP","DMG_GRENADE_EXP",
1165
    "DMG_MINE_EXP","DMG_MINE_SHRAP",
1166
    "DMG_MICRO_EXP","DMG_NUCLEAR_EXP",
1167
    "DMG_RADIATION_CLOUD","DMG_FLASHBOMB",
1168
    "DMG_FIREBALL_FLAMES","DMG_RIPPER_SLASH",
1169
    "DMG_SKEL_SLASH","DMG_COOLG_BASH",
1170
    "DMG_COOLG_FIRE","DMG_GORO_CHOP",
1171
    "DMG_GORO_FIREBALL","DMG_SERP_SLASH",
1172
    "DMG_LAVA_BOULDER","DMG_LAVA_SHARD",
1173
    "DMG_HORNET_STING","DMG_EEL_ELECTRO",
1174
    "DMG_SPEAR_TRAP","DMG_VOMIT",
1175
    "DMG_BLADE"
1176
};
1177
 
1178
void CON_DamageData(void)
1179
{
1180
 
1181
    char base[80],field[80];
5198 hendricks2 1182
    int16_t op1=0;
5196 hendricks2 1183
    unsigned int op2, i;
1184
 
1185
    // Format: damage [field] [item] [value]
1186
    if (sscanf(MessageInputString,"%s %s %hd %u",base,field,&op1,&op2) < 3)
1187
    {
1188
        strcpy(MessageInputString,"help damage");
1189
        CON_GetHelp();
1190
        return;
1191
    }
1192
 
1193
    if (op1 < -1 || op1 > 46)
1194
    {
1195
        CON_ConMessage("Damage Data index is out of range.");
1196
        return;
1197
    }
1198
 
1199
    if (!strcmp(field,"damage_lo"))
1200
    {
1201
        DamageData[op1].damage_lo = op2;
1202
        CON_ConMessage("DamageData[%s].damage_lo = %d",damagename[op1],op2);
1203
    }
1204
    else if (!strcmp(field,"damage_hi"))
1205
    {
1206
        DamageData[op1].damage_hi = op2;
1207
        CON_ConMessage("DamageData[%s].damage_hi = %d",damagename[op1],op2);
1208
    }
1209
    else if (!strcmp(field,"radius"))
1210
    {
1211
        DamageData[op1].radius = op2;
1212
        CON_ConMessage("DamageData[%s].radius = %d",damagename[op1],op2);
1213
    }
1214
    else if (!strcmp(field,"max_ammo"))
1215
    {
1216
        DamageData[op1].max_ammo = op2;
1217
        CON_ConMessage("DamageData[%s].max_ammo = %d",damagename[op1],op2);
1218
    }
1219
    else if (!strcmp(field,"min_ammo"))
1220
    {
1221
        DamageData[op1].min_ammo = op2;
1222
        CON_ConMessage("DamageData[%s].min_ammo = %d",damagename[op1],op2);
1223
    }
1224
    if (!strcmp(field,"show"))
1225
    {
1226
        if (op1 == -1)
1227
        {
1228
            for (i=op2; i<=op2+10; i+=2)
1229
            {
1230
                if (i<47)
1231
                    CON_ConMessage("[%d] = %s  [%d] = %s",i,damagename[i],i+1,damagename[i+1]);
1232
            }
1233
        }
1234
        else
1235
        {
1236
            CON_ConMessage(" ");
1237
            CON_ConMessage("Item = %s:",damagename[op1]);
1238
            CON_ConMessage("damage_lo = %d, damag_hi = %d",DamageData[op1].damage_lo,DamageData[op1].damage_hi);
1239
            CON_ConMessage("radius = %u",DamageData[op1].radius);
1240
            CON_ConMessage("min_ammo = %d, max_ammo = %d",DamageData[op1].min_ammo,DamageData[op1].max_ammo);
1241
            CON_ConMessage(" ");
1242
        }
1243
    }
1244
}
1245
 
1246
void CON_WinPachinko(void)
1247
{
5198 hendricks2 1248
    extern SWBOOL Pachinko_Win_Cheat;
5196 hendricks2 1249
    PLAYERp pp = Player + myconnectindex;
1250
    extern void CheckSndData(char *file, int line);
1251
 
1252
    if (CommEnabled)
1253
        return;
1254
 
1255
    Pachinko_Win_Cheat = !Pachinko_Win_Cheat;
1256
 
1257
    //CheckSndData( __FILE__, __LINE__ );
1258
 
1259
    if (Pachinko_Win_Cheat)
1260
        PutStringInfo(pp,"Pachinko Win Cheat Enabled");
1261
    else
1262
        PutStringInfo(pp,"Pachinko Win Cheat Disabled");
1263
}
1264
 
1265
void CON_Tweak(void)
1266
{
1267
    char base[80], command[80];
1268
    int op1=0;
1269
 
1270
    // Format: tweak [weapon] [number]
1271
    if (sscanf(MessageInputString,"%s %s %d",base,command,&op1) < 3)
1272
    {
1273
        strcpy(MessageInputString,"help tweak");
1274
        CON_GetHelp();
1275
        return;
1276
    }
1277
 
1278
    Bstrlwr(command);    // Make sure operator is all lower case
1279
    if (!strcmp(command,"adjust"))
1280
    {
1281
        extern short ADJUST;
1282
        ADJUST = op1;
1283
        CON_ConMessage("Zvelocity ADJUST set to %d.",op1);
1284
    }
1285
    else if (!strcmp(command,"adjustv"))
1286
    {
1287
        extern int ADJUSTV;
1288
        ADJUSTV = op1;
1289
        CON_ConMessage("Zvelocity ADJUSTV set to %d.",op1);
1290
    }
1291
}
1292
 
1293
void CON_Bunny(void)
1294
{
1295
    PLAYERp pp = Player + myconnectindex;
1296
 
1297
    if (CommEnabled)
1298
        return;
1299
 
1300
    pp->BunnyMode = !pp->BunnyMode;
1301
    if (pp->BunnyMode)
1302
        PutStringInfo(pp,"Bunny rockets enabled!");
1303
    else
1304
        PutStringInfo(pp,"Bunny rockets disabled!");
1305
}
1306
 
1307
void CON_CheckHeap(void)
1308
{
1309
    /*
1310
    switch( _heapchk() )
1311
    {
1312
    case _HEAPOK:
1313
      CON_ConMessage( "OK - heap is good\n" );
1314
      break;
1315
    case _HEAPEMPTY:
1316
      CON_ConMessage( "OK - heap is empty\n" );
1317
      break;
1318
    case _HEAPBADBEGIN:
1319
      CON_ConMessage( "ERROR - heap is damaged\n" );
1320
      break;
1321
    case _HEAPBADNODE:
1322
      CON_ConMessage( "ERROR - bad node in heap\n" );
1323
      break;
1324
    }
1325
    */
1326
    CON_ConMessage("JonoF: Not now");
1327
}
1328
 
1329
/*
1330
void heap_dump( void )
1331
  {
1332
    struct _heapinfo h_info;
1333
    int heap_status;
1334
 
1335
    h_info._pentry = NULL;
1336
    for(;;) {
1337
      heap_status = _heapwalk( &h_info );
1338
      if( heap_status != _HEAPOK ) break;
1339
      printf( "  %s block at %Fp of size %4.4X\n",
1340
        (h_info._useflag == _USEDENTRY ? "USED" : "FREE"),
1341
        h_info._pentry, h_info._size );
1342
 
1343
    }
1344
 
1345
    switch( heap_status ) {
1346
    case _HEAPEND:
1347
      printf( "OK - end of heap\n" );
1348
      break;
1349
    case _HEAPEMPTY:
1350
      printf( "OK - heap is empty\n" );
1351
      break;
1352
    case _HEAPBADBEGIN:
1353
      printf( "ERROR - heap is damaged\n" );
1354
      break;
1355
    case _HEAPBADPTR:
1356
      printf( "ERROR - bad pointer to heap\n" );
1357
      break;
1358
    case _HEAPBADNODE:
1359
 
1360
      printf( "ERROR - bad node in heap\n" );
1361
    }
1362
  }
1363
  */
1364
 
1365
void CON_DumpHeap(void)
1366
{
1367
    //heap_dump(); // Dump it.
1368
    CON_ConMessage("JonoF: Not now");
1369
}
1370
 
1371
void CON_ShowMirror(void)
1372
{
1373
    char base[80];
5198 hendricks2 1374
    int16_t op1=0;
5196 hendricks2 1375
 
1376
    // Format: showmirror [SpriteNum]
1377
    if (sscanf(MessageInputString,"%s %hd",base,&op1) < 2)
1378
    {
1379
        strcpy(MessageInputString,"help showmirror");
1380
        CON_GetHelp();
1381
        return;
1382
    }
1383
 
1384
    if (op1 < 0 || op1 > 9)
1385
    {
1386
        CON_ConMessage("Mirror number is out of range!");
1387
        return;
1388
    }
1389
 
1390
    CON_ConMessage("camera is the ST1 sprite used as the view spot");
1391
    CON_ConMessage("camspite is the SpriteNum of the drawtotile tile in editart");
1392
    CON_ConMessage("camspic is the tile number of the drawtotile in editart");
1393
    CON_ConMessage("iscamera is whether or not this mirror is a camera type");
1394
    CON_ConMessage(" ");
1395
    CON_ConMessage("mirror[%d].mirrorwall = %d",op1,mirror[op1].mirrorwall);
1396
    CON_ConMessage("mirror[%d].mirrorsector = %d",op1,mirror[op1].mirrorsector);
1397
    CON_ConMessage("mirror[%d].camera = %d",op1,mirror[op1].camera);
1398
    CON_ConMessage("mirror[%d].camsprite = %d",op1,mirror[op1].camsprite);
1399
    CON_ConMessage("mirror[%d].campic = %d",op1,mirror[op1].campic);
1400
    CON_ConMessage("mirror[%d].iscamera = %d",op1,mirror[op1].ismagic);
1401
}
1402
 
1403
void CON_DumpSoundList(void)
1404
{
1405
    extern void DumpSounds(void);
1406
 
1407
    DumpSounds();
1408
    CON_Message("Sounds dumped to dbg.foo");
1409
 
1410
}
1411