+#include "pong.qh"
REGISTER_MINIGAME(pong, "Pong");
// minigame flags
// Think equivalent of pong_ball_throw, used to delay throws
void pong_ball_throwthink(entity this)
{
- pong_ball_throw(self);
+ pong_ball_throw(this);
}
// Moves ball to the center and stops its motion
float distance;
float next_distance;
float min_distance = 1;
- entity ball = world;
- entity mayball = world;
+ entity ball = NULL;
+ entity mayball = NULL;
while ( ( mayball = findentity(mayball,owner,this.owner) ) )
if ( mayball.classname == "pong_ball" )
{
}
// Spawns a pong paddle
-// if real_player is world, the paddle is controlled by AI
+// if real_player is NULL, the paddle is controlled by AI
entity pong_paddle_spawn(entity minigame, int pl_team, entity real_player)
{
entity paddle = msle_spawn(minigame,"pong_paddle");
paddle.mins = pong_team_to_box_halfsize(pl_team,-paddle.pong_length,-1/16);
paddle.maxs = pong_team_to_box_halfsize(pl_team,paddle.pong_length,1/16);
- if ( real_player == world )
+ if ( real_player == NULL )
pong_ai_spawn(paddle);
else
paddle.realowner = real_player;
int i;
for ( i = 0; i < PONG_MAX_PLAYERS; i++ )
{
- if ( minigame.pong_paddles[i] == world )
+ if ( minigame.pong_paddles[i] == NULL )
{
pong_paddle_spawn(minigame,i+1,player);
return i+1;
for ( i = 0; i < PONG_MAX_PLAYERS; i++ )
{
paddle = minigame.pong_paddles[i];
- if ( paddle != world && paddle.realowner == player )
+ if ( paddle != NULL && paddle.realowner == player )
{
ai = pong_ai_spawn(paddle);
ai.pong_score = player.minigame_players.pong_score;
if ( minigame.minigame_flags & PONG_STATUS_WAIT )
for ( i = 0; i < PONG_MAX_PLAYERS; i++ )
{
- if ( minigame.pong_paddles[i] == world )
+ if ( minigame.pong_paddles[i] == NULL )
{
- pong_paddle_spawn(minigame,i+1,world);
+ pong_paddle_spawn(minigame,i+1,NULL);
return true;
}
}
for ( i = PONG_MAX_PLAYERS-1; i >= 0; i-- )
{
paddle = minigame.pong_paddles[i];
- if ( paddle != world &&
+ if ( paddle != NULL &&
paddle.realowner.classname == "pong_ai" )
{
- minigame.pong_paddles[i] = world;
- remove(paddle.realowner);
- remove(paddle);
+ minigame.pong_paddles[i] = NULL;
+ delete(paddle.realowner);
+ delete(paddle);
return true;
}
}
// Required function, draw the game status panel
void pong_hud_status(vector pos, vector mySize)
{
- HUD_Panel_DrawBg(1);
+ HUD_Panel_DrawBg();
vector ts;
ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message,
hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5);