/****************************************************************************** * HandleFire - handle player firing photons * ******************************************************************************/ void HandleFire(MyProgram *data) { int r, c; if (data->score.ammo > 0) { UpdateStatus( "Firing photons", data ); AdjustValue( ICON_PHOTON, DECR_AMMO, data ); data->data.photon.enable_anim = TRUE; data->data.photon.erase_trail = TRUE; data->data.photon.hit_target = FALSE; data->data.photon.frame_count = 0; r = data->data.player.current_row; c = data->data.player.current_col; data->data.photon.direction = data->data.board[r][c]; data->data.photon.current_row = r; data->data.photon.current_col = c; data->anim.enable_anim = TRUE; EnableNextAnimFrame( data ); } else { UpdateStatus( "You don't have any ammo!", data ); } }
/****************************************************************************** * HandlePhotonCollision - handle photon collision detection * ******************************************************************************/ void HandlePhotonCollision(int r, int c, MyProgram *data) { switch( data->data.map[r][c] ) { case ICON_UFO: UpdateStatus( "You blasted a ufo", data ); AdjustValue( ICON_UFO, INCR_SCORE, data ); AdjustValue( ICON_UFO, DECR_HEALTH, data ); data->data.map[r][c] = ICON_UFO_X; data->data.photon.hit_target = TRUE; break; case ICON_PLANET: UpdateStatus( "You blasted a planet", data ); AdjustValue( ICON_PLANET, INCR_SCORE, data ); AdjustValue( ICON_PLANET, DECR_HEALTH, data ); data->data.map[r][c] = ICON_PLANET_X; data->data.photon.hit_target = TRUE; break; case ICON_ROID: UpdateStatus( "You blasted an asteroid", data ); AdjustValue( ICON_ROID, INCR_SCORE, data ); AdjustValue( ICON_ROID, DECR_HEALTH, data ); data->data.map[r][c] = ICON_ROID_X; data->data.photon.hit_target = TRUE; break; } }
void CConfigNmeaIntervalDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { if(NULL==pScrollBar) { CDialog::OnVScroll(nSBCode, nPos, pScrollBar); return; } if(SB_ENDSCROLL!=nSBCode) { AdjustValue(nPos, pScrollBar); } CDialog::OnVScroll(nSBCode, nPos, pScrollBar); }
/****************************************************************************** * HandleSlammer - handle player using planet slammer * ******************************************************************************/ void HandleSlammer(MyProgram *data) { if (data->score.slammer > 0) { UpdateStatus( "Engaging planet slammer", data ); AdjustValue( ICON_SLAMMER, DECR_SLAMMER, data ); } else { UpdateStatus( "You don't have a planet slammer!", data ); } }
/****************************************************************************** * HandleWarp - handle player warping * ******************************************************************************/ void HandleWarp(MyProgram *data) { if (data->score.warp > 0) { UpdateStatus( "Engaging warp drive", data ); InitBoard( data ); UpdateDisplay( data ); PlacePlayerIcon( MAX_GRID_ROW/2, MAX_GRID_COL/2, ICON_SHIPU, data ); AdjustValue( ICON_WARP, DECR_WARP, data ); } else { UpdateStatus( "You don't have any warp cores!", data ); } }
void OddsSpinCtrl::OnSpin(wxSpinDoubleEvent& spinEvent) { SetIncrement(); AdjustValue(); previousValue = GetValue(); spinEvent.Skip(); }
/****************************************************************************** * HandlePlayerCollision - handle player collision detection * ******************************************************************************/ void HandlePlayerCollision(int r, int c, MyProgram *data) { if ( data->data.map[r][c] == ICON_NONE ) { UpdateStatus( "Empty space", data ); } else { switch( data->data.map[r][c] ) { case ICON_HEALTH: UpdateStatus( "Picked up some health, yes", data ); AdjustValue( ICON_HEALTH, INCR_SCORE, data ); AdjustValue( ICON_HEALTH, INCR_HEALTH, data ); data->data.map[r][c] = ICON_NONE; break; case ICON_AMMO: UpdateStatus( "Picked up some ammo, blast em", data ); AdjustValue( ICON_AMMO, INCR_SCORE, data ); AdjustValue( ICON_AMMO, INCR_HEALTH, data ); AdjustValue( ICON_AMMO, INCR_AMMO, data ); data->data.map[r][c] = ICON_NONE; break; case ICON_WARP: UpdateStatus( "Picked up a warp drive, yee haaa", data ); AdjustValue( ICON_WARP, INCR_SCORE, data ); AdjustValue( ICON_WARP, INCR_HEALTH, data ); AdjustValue( ICON_WARP, INCR_WARP, data ); data->data.map[r][c] = ICON_NONE; break; case ICON_SLAMMER: UpdateStatus( "Picked up a planet slammer, groovy", data ); AdjustValue( ICON_SLAMMER, INCR_SCORE, data ); AdjustValue( ICON_SLAMMER, INCR_HEALTH, data ); AdjustValue( ICON_SLAMMER, INCR_AMMO, data ); AdjustValue( ICON_SLAMMER, INCR_SLAMMER, data ); data->data.map[r][c] = ICON_NONE; break; case ICON_UFO: UpdateStatus( "You collided with a ufo, weirdness", data ); AdjustValue( ICON_UFO, INCR_SCORE, data ); AdjustValue( ICON_UFO, DECR_HEALTH, data ); data->data.map[r][c] = ICON_UFO_X; break; case ICON_PLANET: UpdateStatus( "You smashed into a planet, major bummer", data ); AdjustValue( ICON_PLANET, INCR_SCORE, data ); AdjustValue( ICON_PLANET, DECR_HEALTH, data ); data->data.map[r][c] = ICON_PLANET; break; case ICON_ROID: UpdateStatus( "You hit an asteroid, bummer", data ); AdjustValue( ICON_ROID, INCR_SCORE, data ); AdjustValue( ICON_ROID, DECR_HEALTH, data ); data->data.map[r][c] = ICON_ROID_X; break; case ICON_BHOLE: UpdateStatus( "You fell into a black hole, crunch", data ); AdjustValue( ICON_BHOLE, DECR_HEALTH, data ); break; case ICON_WORM: UpdateStatus( "You fell into a wormhole, cowabunga", data ); AdjustValue( ICON_WORM, DECR_HEALTH, data ); InitBoard( data ); UpdateDisplay( data ); break; } } }