summaryrefslogtreecommitdiff
path: root/src/shot.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-12 16:36:13 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-12 16:36:13 +0000
commit9751218f594526982877332d6ca0fa90b67bbb7b (patch)
tree2acbc70e3d8432bb80ef70470bda75ba93bc2593 /src/shot.c
parent4919e623c6695a80aaf96187253756dcbb72bf87 (diff)
- prva cast prepisu kodu pre pozuivanie space_t a space_t API, ktore je optimalizovany pre ukladanie informacii o
objektoch vo velkych mapach. POZOR: nie je vhodne kompilovat ako gameserver ( pre istotu to ani nejde ) // este to msusim doorbit :) git-svn-id: http://opensvn.csie.org/tuxanci_ng@63 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/shot.c')
-rw-r--r--src/shot.c82
1 files changed, 81 insertions, 1 deletions
diff --git a/src/shot.c b/src/shot.c
index 2db8424..65d2147 100644
--- a/src/shot.c
+++ b/src/shot.c
@@ -72,7 +72,7 @@ shot_t* newShot(int x,int y, int px, int py, int gun, int author_id)
new->position = POSITION_UNKNOWN;
- author = getTuxID(getCurrentArena()->listTux, author_id);
+ author = getObjectFromSpaceWithID(getCurrentArena()->spaceTux, author_id);
if( author != NULL )
{
@@ -311,6 +311,86 @@ void eventMoveListShot(list_t *listShot)
}
}
+static int myAbs(int n)
+{
+ return ( n > 0 ? n : -n );
+}
+
+
+static int getSppedShot(shot_t *shot)
+{
+ return ( myAbs(shot->px) > myAbs(shot->py) ? myAbs(shot->px) : myAbs(shot->py) );
+}
+
+
+void checkShotIsInTuxScreen(arena_t *arena)
+{
+ return;
+/*
+ int screen_x, screen_y;
+ shot_t *thisShot;
+ tux_t *thisTux;
+ int speed;
+ int i, j;
+
+ if( getNetTypeGame() != NET_GAME_TYPE_SERVER )
+ {
+ return;
+ }
+
+ for( i = 0 ; i < arena->listTux->count ; i++ )
+ {
+ thisTux = (tux_t *)arena->listTux->list[i];
+
+ if( thisTux->control != TUX_CONTROL_NET )
+ {
+ continue;
+ }
+
+ getCenterScreen(&screen_x, &screen_y, thisTux->x, thisTux->y);
+
+ for( j = 0 ; j < arena->listShot->count ; j++ )
+ {
+ thisShot = (shot_t *)arena->listShot->list[j];
+
+ speed = getSppedShot(thisShot);
+
+ if( conflictSpace(thisShot->x, thisShot->y, thisShot->w, thisShot->h,
+ screen_x-speed, screen_y, speed, WINDOW_SIZE_Y) )
+ {
+ client_t *thisClient;
+ thisClient = getClientFromTux(thisTux);
+ proto_send_shot_server(PROTO_SEND_ONE, thisClient, thisShot);
+ }
+
+ if( conflictSpace(thisShot->x, thisShot->y, thisShot->w, thisShot->h,
+ screen_x+WINDOW_SIZE_X, screen_y, speed, WINDOW_SIZE_Y) )
+ {
+ client_t *thisClient;
+ thisClient = getClientFromTux(thisTux);
+ proto_send_shot_server(PROTO_SEND_ONE, thisClient, thisShot);
+ }
+
+ if( conflictSpace(thisShot->x, thisShot->y, thisShot->w, thisShot->h,
+ screen_x, screen_y-speed, WINDOW_SIZE_X, speed) )
+ {
+ client_t *thisClient;
+ thisClient = getClientFromTux(thisTux);
+ proto_send_shot_server(PROTO_SEND_ONE, thisClient, thisShot);
+ }
+
+ if( conflictSpace(thisShot->x, thisShot->y, thisShot->w, thisShot->h,
+ screen_x, screen_y+WINDOW_SIZE_Y, WINDOW_SIZE_X, speed) )
+ {
+ client_t *thisClient;
+ thisClient = getClientFromTux(thisTux);
+ proto_send_shot_server(PROTO_SEND_ONE, thisClient, thisShot);
+ }
+ }
+ }
+*/
+}
+
/*
static int getSppedShot(shot_t *shot)
{