]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/minigames/minigame/pong.qc
Merge branch 'master' into terencehill/hud_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / minigames / minigame / pong.qc
index 4bcb8c51446ee77020731131ee95bc2e9bc7ef9e..dd57fb5c66886c846458d3991ce1eef96f1707c2 100644 (file)
@@ -1,3 +1,4 @@
+#include "pong.qh"
 REGISTER_MINIGAME(pong, "Pong");
 
 // minigame flags
@@ -56,7 +57,7 @@ void pong_ball_throw(entity ball)
 // 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
@@ -209,8 +210,8 @@ void pong_ai_think(entity this)
        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" )
                {
@@ -309,7 +310,7 @@ vector pong_team_to_paddlepos(int nteam)
 }
 
 // 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");
@@ -321,7 +322,7 @@ entity pong_paddle_spawn(entity minigame, int pl_team, entity real_player)
        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;
@@ -352,7 +353,7 @@ int pong_server_event(entity minigame, string event, ...)
                        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;
@@ -370,7 +371,7 @@ int pong_server_event(entity minigame, string event, ...)
                        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;
@@ -420,9 +421,9 @@ int pong_server_event(entity minigame, string event, ...)
                                        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;
                                                        }
                                                }
@@ -438,12 +439,12 @@ int pong_server_event(entity minigame, string event, ...)
                                                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;
                                                        }
                                                }
@@ -542,7 +543,7 @@ void pong_hud_board(vector pos, vector mySize)
 // 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);