static CMD(List) { int cmds; CON_Printf(GREEN, "Available commands:\n"); cmds = G_ListCommands(); CON_Printf(GREEN, "(%d commands)\n", cmds); }
static void CONL_ReadLogFromFile( void ) { int i; char *buffer; const char *dataDir = SYS_PrefsDir(); if ( dataDir ) { const char *data; const char *path = va( "%sconsole.log", dataDir ); size_t sz; if ( ! COM_ReadTextFile( path, &buffer, &sz ) ) { CON_Printf( "CON_ReadHistoryFromFile: failed to open \"%s\" for reading\n", path ); return; } for ( i = CON_MAX_HISTORY, data = buffer; data; ) { char line[VA_SIZE]; data = CONL_GetLine( data, line ); if ( *line ) { char **p = &clog.lines[i & ( CON_MAX_HISTORY - 1 )]; A_Free( *p ); *p = A_StrDup( line ); i++; } } clog.rover = i; clog.head = clog.rover - 1; A_Free( buffer ); CON_Printf( "Read console history from \"%s\"\n", path ); } }
static CMD(ListCvars) { cvar_t *var; CON_Printf(GREEN, "Available cvars:\n"); for(var = cvarcap; var; var = var->next) { CON_Printf(AQUA, "%s\n", var->name); } }
void CON_Warnf(const char *s, ...) { static char msg[MAX_MESSAGE_SIZE]; va_list va; va_start(va, s); vsprintf(msg, s, va); va_end(va); CON_Printf(YELLOW, "WARNING: "); CON_Printf(YELLOW, msg); }
static void CONL_StoreLogToFile( void ) { const char *dataDir = SYS_PrefsDir(); if ( dataDir ) { int i; FILE *f; const char *path = va( "%sconsole.log", dataDir ); f = fopen( path, "wb" ); if ( ! f ) { CON_Printf( "CON_StoreHistoryToFile: failed to store \"%s\"\n", path ); return; } for ( i = 0; i < CON_MAX_HISTORY; i++ ) { int idx = clog.head + 1; const char *line = clog.lines[(idx + i ) & ( CON_MAX_HISTORY - 1 )]; if ( *line ) { fprintf( f, "%s\n", line ); } } fclose( f ); } }
dboolean G_CheckDemoStatus(void) { if(endDemo) { demorecording = false; fputc(DEMOMARKER, demofp); CON_Printf(WHITE, "G_CheckDemoStatus: Demo recorded\n"); fclose(demofp); endDemo = false; return false; } if(demoplayback) { if(singledemo) { I_Quit(); } netdemo = false; netgame = false; deathmatch = false; playeringame[1] = playeringame[2] = playeringame[3] = 0; respawnparm = false; respawnitem = false; fastparm = false; nomonsters = false; consoleplayer = 0; gameaction = ga_exitdemo; endDemo = false; G_ReloadDefaults(); return true; } return false; }
void CON_CvarAutoComplete(char *partial) { cvar_t* cvar; int len; char* name = NULL; int spacinglength; dboolean match = false; char* spacing = NULL; dstrlwr(partial); len = dstrlen(partial); if(!len) return; // check functions for(cvar = cvarcap; cvar; cvar = cvar->next) { if(!dstrncmp(partial, cvar->name, len)) { if(!match) { match = true; CON_Printf(0, "\n"); } name = cvar->name; // setup spacing spacinglength = 24 - dstrlen(cvar->name); spacing = Z_Malloc(spacinglength + 1, PU_STATIC, NULL); dmemset(spacing, 0x20, spacinglength); spacing[spacinglength] = 0; // print all matching cvars CON_Printf(AQUA, "%s%s= %s (%s)\n", name, spacing, cvar->string, cvar->defvalue); Z_Free(spacing); CONCLEARINPUT(); sprintf(console_inputbuffer+1, "%s ", name); console_inputlength = dstrlen(console_inputbuffer); } } }
void CON_Init( void ) { // put some arbitrary values here so the console is logged // until resize con.bufSize = 10 * 1024; con.buf = A_MallocZero( ( size_t )con.bufSize ); con.bufWidth = 256; CONL_Init(); CON_Printf( "Console initialized\n" ); }
void CON_DPrintf(const char *s, ...) { if(devparm) { static char msg[MAX_MESSAGE_SIZE]; va_list va; va_start(va, s); vsprintf(msg, s, va); va_end(va); CON_Printf(RED, msg); } }
void CONL_Init( void ) { int i; for ( i = 0; i < CON_MAX_HISTORY; i++ ) { clog.lines[i] = A_StrDup( "" ); } clog.head = CON_MAX_HISTORY; clog.rover = clog.head + 1; CONL_ReadLogFromFile(); CON_Printf( "Console log initialized\n" ); }
static int ListCommandRecurse(action_t *action) { int count; if(!action) return 0; count = 1; if(action->children[0]) count += ListCommandRecurse(action->children[0]); if(action->name[0] == '-') count--; else CON_Printf(AQUA, " %s\n", action->name); if(action->children[1]) count += ListCommandRecurse(action->children[1]); return(count); }
static void X_Frame_f( void ) { if ( ! x_maze.bits || VAR_Changed( x_mazeWidth ) || VAR_Changed( x_mazeHeight ) ) { x_maze.size = x_view.size = c2xy( Clampf( VAR_Num( x_mazeWidth ), 64, 1024 ), Clampf( VAR_Num( x_mazeHeight ), 64, 1024 ) ); int numBytes = x_maze.size.x * x_maze.size.y; x_maze.bits = A_Realloc( x_maze.bits, numBytes * sizeof( *x_maze.bits ) ); x_view.bits = A_Realloc( x_view.bits, numBytes * sizeof( *x_view.bits ) ); GenerateTestMaze( x_maze.size, x_maze.bits ); R_BlitToTexture( x_maze.image, x_maze.bits, x_maze.size, 1 ); CON_Printf( "Changed size of the maze to %d,%d\n", x_maze.size.x, x_maze.size.y ); } if ( VAR_Changed( x_showCursor ) ) { R_ShowCursor( VAR_Num( x_showCursor ) ); } v2_t windowSize = R_GetWindowSize(); x_pixelScale = windowSize.y / ( float )x_maze.size.y; v2_t mouse = I_GetMousePositionV(); v2_t origin = v2Scale( mouse, 1 / x_pixelScale ); memset( x_view.bits, 0, sizeof( *x_view.bits ) * x_view.size.x * x_view.size.y ); if ( ! VAR_Num( x_skipMaze ) ) { // draw the textures before rasterizing // so we can draw debug stuff in the raster routine R_ColorC( colorScaleRGB( colGreen, 0.5f ) ); R_BlendPic( 0, 0, x_maze.size.x * x_pixelScale, windowSize.y, 0, 0, 1, 1, x_maze.image ); } R_Color( 1, 1, 1, 0.5 ); R_BlendPic( 0, 0, x_view.size.x * x_pixelScale, windowSize.y, 0, 0, 1, 1, x_view.image ); for ( int i = 0; i < Clampi( VAR_Num( x_numOctants ), 0, 8 ); i++ ) { RasterizeFOVOctant( origin.x, origin.y, Clampf( VAR_Num( x_losRadius ), 0, 1024 ), x_maze.size.x, x_maze.size.y, i, VAR_Num( x_skipAttenuation ), VAR_Num( x_skipClipToRadius ), VAR_Num( x_darkWalls ), x_maze.bits, x_view.bits ); } R_BlitToTexture( x_view.image, x_view.bits, x_view.size, 1 ); //X_DrawCursor( x_cp437Texture, x_cp437TextureSize, mouse ); }
void CON_CvarRegister(cvar_t *variable) { char *oldstr; // first check to see if it has allready been defined if(CON_CvarGet(variable->name)) { CON_Printf(WHITE, "CON_CvarRegister: Can't register variable %s, already defined\n", variable->name); return; } // copy the value off, because future sets will Z_Free it oldstr = variable->string; variable->string = Z_Malloc(dstrlen(variable->string)+1, PU_STATIC, 0); dstrcpy(variable->string, oldstr); variable->value = datof(variable->string); variable->defvalue = Z_Malloc(dstrlen(variable->string)+1, PU_STATIC, 0); dstrcpy(variable->defvalue, variable->string); // link the variable in variable->next = cvarcap; cvarcap = variable; }
void CON_CvarSet(char *var_name, char *value) { cvar_t *var; dboolean changed; var = CON_CvarGet(var_name); if(!var) { // there is an error in C code if this happens CON_Printf(WHITE, "CON_CvarSet: variable %s not found\n", var_name); return; } changed = dstrcmp(var->string, value); Z_Free(var->string); // free the old value string var->string = Z_Malloc(dstrlen(value)+1, PU_STATIC, 0); dstrcpy(var->string, value); var->value = datof(var->string); if(var->callback) var->callback(var); }
void print_reg_block(int x, int y, int sel, const u16 *regs, const u16 *compare_regs) { for (int j = 0; j < 4 ; j++) { for (int i = 0; i < 8 ; i++) { // Do not even display the loop stack registers. const int reg = j * 8 + i; CON_SetColor(sel == reg ? CON_BRIGHT_YELLOW : CON_GREEN); CON_Printf(x + j * 8, i + y, "%02x ", reg); if (j != 1 || i < 4) { u8 color1 = regs_equal(reg, regs[reg], compare_regs[reg]) ? CON_BRIGHT_WHITE : CON_BRIGHT_RED; for (int k = 0; k < 4; k++) { if (sel == reg && k == small_cursor_x && ui_mode == UIM_EDIT_REG) CON_SetColor(CON_BRIGHT_CYAN); else CON_SetColor(color1); CON_Printf(x + 3 + j * 8 + k, i + y, "%01x", (regs[reg] >> ((3 - k) * 4)) & 0xf); } } } }
bool_t CON_OnKeyboard( int code, bool_t down ) { if ( code == SDLK_LCTRL || code == SDLK_RCTRL ) { con.ctlDown = down; } else if ( code == SDLK_LSHIFT || code == SDLK_RSHIFT ) { con.shiftDown = down; } if ( con.show == CON_SHOW_NONE ) { return false; } if ( ! down ) { return true; } // on escape clear buffer if ( code == SDLK_ESCAPE ) { CONP_Clear(); return true; } // copy if ( con.ctlDown && ( code == SDLK_INSERT || code == SDLK_c ) ) { SYS_WriteToClipboard( prompt.buffer ); return true; } // paste if ( ( con.ctlDown && code == SDLK_v ) || ( con.shiftDown && code == SDLK_INSERT ) ) { const char *buf = SYS_ReadClipboard(); if ( *buf ) { CONP_Insert( buf, COM_StrLen( buf ) ); } return true; } if ( code == SDLK_PAGEUP ) { con.bufPage -= con.bufWidth * ( ( int )R_GetWindowSize().y / CON_SYMBOL_ADVANCEY ) / 4; return true; } if ( code == SDLK_PAGEDOWN ) { con.bufPage += con.bufWidth * ( ( int )R_GetWindowSize().y / CON_SYMBOL_ADVANCEY ) / 4; return true; } if ( code == SDLK_UP ) { CONL_OnUp(); return true; } if ( code == SDLK_DOWN ) { CONL_OnDown(); return true; } if ( code == SDLK_LEFT ) { CONP_MoveCursor( -1 ); return true; } if ( code == SDLK_RIGHT ) { CONP_MoveCursor( 1 ); return true; } if ( code == SDLK_HOME ) { CONP_Home(); return true; } if ( code == SDLK_END ) { CONP_End(); return true; } if ( code == SDLK_DELETE ) { CONP_DeleteChars( 1 ); return true; } // tab if ( code == '\t' ) { CONP_Autocomplete(); return true; } // new line if ( code == '\r' ) { // store the prompt for later UP key if ( *prompt.buffer ) { CONL_LogCommand( prompt.buffer ); } // execute the prompt string CON_Printf( ">%s\n", prompt.buffer ); CMD_ExecuteString( prompt.buffer ); CONP_Clear(); return true; } // backspace if ( code == '\b' ) { if ( CONP_MoveCursor( -1 ) ) { CONP_DeleteChars( 1 ); } return true; } return true; }
static CMD(Cheat) { player_t *player; if(gamestate != GS_LEVEL) { return; } player = &players[consoleplayer]; switch(data) { case 0: M_CheatGod(player, NULL); break; case 1: M_CheatClip(player, NULL); break; case 2: if(param[0] == NULL) { CON_Printf(GREEN, "Available give cheats:\n"); CON_Printf(GREEN, "-------------------------\n"); CON_Printf(AQUA, "all\n"); CON_Printf(AQUA, "weapon\n"); CON_Printf(AQUA, "artifact\n"); CON_Printf(AQUA, "key\n"); return; } if(!dstricmp(param[0], "all")) { M_CheatKfa(player, NULL); } else if(!dstricmp(param[0], "weapon")) { if(param[1] == NULL) { CON_Printf(GREEN, "Weapons:\n"); CON_Printf(GREEN, "-------------------------\n"); CON_Printf(AQUA, "1: Chainsaw\n"); CON_Printf(AQUA, "2: Shotgun\n"); CON_Printf(AQUA, "3: Super Shotgun\n"); CON_Printf(AQUA, "4: Chaingun\n"); CON_Printf(AQUA, "5: Rocket Launcher\n"); CON_Printf(AQUA, "6: Plasma Rifle\n"); CON_Printf(AQUA, "7: BFG 9000\n"); CON_Printf(AQUA, "8: Demon Artifact\n"); return; } if(dstrlen(param[1]) == 1) { M_CheatGiveWeapon(player, param[1]); } } else if(!dstricmp(param[0], "artifact")) { if(param[1] == NULL) { CON_Printf(GREEN, "Artifacts:\n"); CON_Printf(GREEN, "-------------------------\n"); CON_Printf(AQUA, "1: Red\n"); CON_Printf(AQUA, "2: Aqua\n"); CON_Printf(AQUA, "3: Violet\n"); return; } if(dstrlen(param[1]) == 1) { M_CheatArtifacts(player, param[1]); } } else if(!dstricmp(param[0], "key")) { if(param[1] == NULL) { CON_Printf(GREEN, "Keys:\n"); CON_Printf(GREEN, "-------------------------\n"); CON_Printf(AQUA, "1: Blue Card\n"); CON_Printf(AQUA, "2: Yellow Card\n"); CON_Printf(AQUA, "3: Red Card\n"); CON_Printf(AQUA, "4: Blue Skull\n"); CON_Printf(AQUA, "5: Yellow Skull\n"); CON_Printf(AQUA, "6: Red Skull\n"); return; } if(dstrlen(param[1]) == 1) { M_CheatGiveKey(player, param[1]); } } break; case 3: M_CheatBoyISuck(player, NULL); break; case 4: if(amCheating) { amCheating = 0; } else if(!amCheating) { amCheating = 2; } break; } }
void ST_Ticker(void) { int ind = 0; plyr = &players[consoleplayer]; // // keycard stuff // /* */ /* Tried to open a CARD or SKULL door? */ /* */ for (ind = 0; ind < NUMCARDS; ind++) { /* CHECK FOR INITIALIZATION */ if (plyr->tryopen[ind]) { plyr->tryopen[ind] = false; flashCards[ind].active = true; flashCards[ind].delay = FLASHDELAY; flashCards[ind].times = FLASHTIMES + 1; flashCards[ind].doDraw = false; } /* MIGHT AS WELL DO TICKING IN THE SAME LOOP! */ if (flashCards[ind].active && !--flashCards[ind].delay) { flashCards[ind].delay = FLASHDELAY; flashCards[ind].doDraw ^= 1; if (!--flashCards[ind].times) flashCards[ind].active = false; if (flashCards[ind].doDraw && flashCards[ind].active) S_StartSound(NULL, sfx_itemup); } } // // messages // if (plyr->message) { CON_Printf(WHITE, "%s\n", plyr->message); ST_ClearMessage(); st_msg = plyr->message; plyr->message = NULL; } if (st_msg || plyr->messagepic >= 0) { st_msgtic++; if (st_msgtic >= ST_MSGFADESTART) st_msgalpha = MAX((st_msgalpha -= ST_MSGFADETIME), 0); if (st_msgtic >= ST_MSGTIMEOUT) { ST_ClearMessage(); plyr->messagepic = -1; } } // // flashes // if (plyr->cameratarget == plyr->mo || !(plyr->cheats & CF_LOCKCAM)) ST_UpdateFlash(); // // chat stuff // for (ind = 0; ind < MAXCHATNODES; ind++) { if (stchat[ind].tics) stchat[ind].tics--; } ST_EatChatMsg(); // // damage indicator // if (p_damageindicator.value) ST_RunDamageMarkers(); // // pending weapon display // if (st_wpndisplay_show) { if (st_wpndisplay_ticks-- <= 0) { st_wpndisplay_alpha -= 8; if (st_wpndisplay_alpha <= 0) { st_wpndisplay_alpha = 0; st_wpndisplay_show = false; } } } }
// // P_TouchSpecialThing // void P_TouchSpecialThing(mobj_t* special, mobj_t* toucher) { player_t* player; fixed_t delta; int sound; int i = 0; delta = special->z - toucher->z; if(delta > toucher->height || delta < -8*FRACUNIT) { // out of reach return; } sound = sfx_itemup; player = toucher->player; // Dead thing touching. // Can happen with a sliding player corpse. if(toucher->health <= 0) { return; } // Identify by sprite. switch(special->sprite) { // armor case SPR_ARM1: if(!P_GiveArmor(player, 1)) { return; } player->message = GOTARMOR; player->messagepic = 23; break; case SPR_ARM2: if(!P_GiveArmor(player, 2)) { return; } player->message = GOTMEGA; player->messagepic = 24; break; // bonus items case SPR_BON1: player->health+=2; // can go over 100% if(player->health > 200) { player->health = 200; } player->mo->health = player->health; player->message = GOTHTHBONUS; player->messagepic = 3; break; case SPR_BON2: player->armorpoints+=2; // can go over 100% if(player->armorpoints > 200) { player->armorpoints = 200; } if(!player->armortype) { player->armortype = 1; } player->message = GOTARMBONUS; player->messagepic = 4; break; case SPR_SOUL: player->health += 100; if(player->health > 200) { player->health = 200; } player->mo->health = player->health; player->message = GOTSUPER; player->messagepic = 5; sound = sfx_powerup; break; case SPR_MEGA: player->health = 200; player->mo->health = player->health; P_GiveArmor(player,2); player->message = GOTMSPHERE; player->messagepic = 6; sound = sfx_powerup; break; // cards // leave cards for everyone case SPR_BKEY: if(!(P_GiveCard(player, special, it_bluecard))) { return; } break; case SPR_YKEY: if(!(P_GiveCard(player, special, it_yellowcard))) { return; } break; case SPR_RKEY: if(!(P_GiveCard(player, special, it_redcard))) { return; } break; case SPR_BSKU: if(!(P_GiveCard(player, special, it_blueskull))) { return; } break; case SPR_YSKU: if(!(P_GiveCard(player, special, it_yellowskull))) { return; } break; case SPR_RSKU: if(!(P_GiveCard(player, special, it_redskull))) { return; } break; // medikits, heals case SPR_STIM: if(!P_GiveBody(player, 10)) { return; } player->message = GOTSTIM; player->messagepic = 31; break; case SPR_MEDI: if(!P_GiveBody(player, 25)) { return; } if(player->health < 25) { player->message = GOTMEDINEED; player->messagepic = 32; } else { player->message = GOTMEDIKIT; player->messagepic = 33; } break; // power ups case SPR_PINV: if(!P_GivePower(player, pw_invulnerability)) { return; } player->message = GOTINVUL; player->messagepic = 34; sound = sfx_powerup; break; case SPR_PSTR: if(!P_GivePower(player, pw_strength)) { return; } player->message = GOTBERSERK; player->messagepic = 35; if(player->readyweapon != wp_fist) { player->pendingweapon = wp_fist; } sound = sfx_powerup; break; case SPR_PINS: if(!P_GivePower(player, pw_invisibility)) { return; } player->message = GOTINVIS; player->messagepic = 36; sound = sfx_powerup; break; case SPR_SUIT: if(!P_GivePower(player, pw_ironfeet)) { return; } player->message = GOTSUIT; player->messagepic = 37; sound = sfx_powerup; break; case SPR_PMAP: if(!P_GivePower(player, pw_allmap)) { return; } player->message = GOTMAP; player->messagepic = 38; sound = sfx_powerup; break; case SPR_PVIS: if(!P_GivePower(player, pw_infrared)) { return; } player->message = GOTVISOR; player->messagepic = 39; sound = sfx_powerup; break; // ammo case SPR_CLIP: if(special->flags & MF_DROPPED) { if(!P_GiveAmmo(player,am_clip,0)) { return; } } else { if(!P_GiveAmmo(player,am_clip,1)) { return; } } player->message = GOTCLIP; player->messagepic = 7; break; case SPR_AMMO: if(!P_GiveAmmo(player, am_clip,5)) { return; } player->message = GOTCLIPBOX; player->messagepic = 8; break; case SPR_RCKT: if(!P_GiveAmmo(player, am_misl,1)) { return; } player->message = GOTROCKET; player->messagepic = 9; break; case SPR_BROK: if(!P_GiveAmmo(player, am_misl,5)) { return; } player->message = GOTROCKBOX; player->messagepic = 10; break; case SPR_CELL: if(!P_GiveAmmo(player, am_cell,1)) { return; } player->message = GOTCELL; player->messagepic = 11; break; case SPR_CELP: if(!P_GiveAmmo(player, am_cell,5)) { return; } player->message = GOTCELLBOX; player->messagepic = 12; break; case SPR_SHEL: if(!P_GiveAmmo(player, am_shell,1)) { return; } player->message = (gameskill == sk_baby)?GOTSHELLS2:GOTSHELLS; //villsa player->messagepic = 13; break; case SPR_SBOX: if(!P_GiveAmmo(player, am_shell,5)) { return; } player->message = GOTSHELLBOX; player->messagepic = 14; break; case SPR_BPAK: if(!player->backpack) { for(i = 0; i < NUMAMMO; i++) { player->maxammo[i] *= 2; } player->backpack = true; } for(i = 0; i < NUMAMMO; i++) { P_GiveAmmo(player, i, 1); } player->message = GOTBACKPACK; player->messagepic = 15; break; // weapons case SPR_BFUG: if(!P_GiveWeapon(player, special, wp_bfg, false)) { return; } player->message = GOTBFG9000; player->messagepic = 16; sound = sfx_sgcock; break; case SPR_MGUN: if(!P_GiveWeapon(player, special, wp_chaingun, special->flags&MF_DROPPED)) { return; } player->message = GOTCHAINGUN; player->messagepic = 17; sound = sfx_sgcock; break; case SPR_CSAW: if(!P_GiveWeapon(player, special, wp_chainsaw, false)) { return; } player->message = GOTCHAINSAW; player->messagepic = 18; sound = sfx_sgcock; break; case SPR_LAUN: if(!P_GiveWeapon(player, special, wp_missile, false)) { return; } player->message = GOTLAUNCHER; player->messagepic = 19; sound = sfx_sgcock; break; case SPR_PLSM: if(!P_GiveWeapon(player, special, wp_plasma, false)) { return; } player->message = GOTPLASMA; player->messagepic = 20; sound = sfx_sgcock; break; case SPR_SHOT: if(!P_GiveWeapon(player, special, wp_shotgun, special->flags&MF_DROPPED)) { return; } player->message = GOTSHOTGUN; player->messagepic = 21; sound = sfx_sgcock; break; case SPR_SGN2: if(!P_GiveWeapon(player, special, wp_supershotgun, special->flags&MF_DROPPED)) { return; } player->message = GOTSHOTGUN2; player->messagepic = 22; sound = sfx_sgcock; break; case SPR_LSRG: if(!P_GiveWeapon(player, special, wp_laser, false)) { return; } player->message = GOTLASER; sound = sfx_sgcock; break; case SPR_ART1: if(netgame && player->artifacts & (1<<ART_FAST)) { return; } player->artifacts |= (1<<ART_FAST); player->message = GOTARTIFACT1; player->messagepic = 41; break; case SPR_ART2: if(netgame && player->artifacts & (1<<ART_DOUBLE)) { return; } player->artifacts |= (1<<ART_DOUBLE); player->message = GOTARTIFACT2; player->messagepic = 42; break; case SPR_ART3: if(netgame && player->artifacts & (1<<ART_TRIPLE)) { return; } player->artifacts |= (1<<ART_TRIPLE); player->message = GOTARTIFACT3; player->messagepic = 43; break; default: if(special->type != MT_FAKEITEM) { CON_Printf(YELLOW, "P_SpecialThing: Unknown gettable thing: %s\n", sprnames[special->sprite]); special->flags &= ~MF_SPECIAL; return; } break; } if(special->flags & MF_TRIGTOUCH || special->type == MT_FAKEITEM) { if(special->tid) { P_QueueSpecial(special); } } if(special->type != MT_FAKEITEM) { if(special->flags & MF_COUNTITEM) { player->itemcount++; } if(special->flags & MF_COUNTSECRET) { player->secretcount++; } P_RemoveMobj(special); player->bonuscount += BONUSADD; if(player == &players[consoleplayer]) { S_StartSound(NULL, sound); } } }