summaryrefslogtreecommitdiff
path: root/src/base/arena.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/arena.c')
-rw-r--r--src/base/arena.c93
1 files changed, 47 insertions, 46 deletions
diff --git a/src/base/arena.c b/src/base/arena.c
index a692830..e26eb6c 100644
--- a/src/base/arena.c
+++ b/src/base/arena.c
@@ -1,4 +1,3 @@
-
#include <stdlib.h>
#include <assert.h>
#include <string.h>
@@ -13,17 +12,17 @@
#include "modules.h"
#ifndef PUBLIC_SERVER
-# include "hotKey.h"
-# include "world.h"
-# include "setting.h"
-# include "layer.h"
-#endif
+#include "hotKey.h"
+#include "world.h"
+#include "setting.h"
+#include "layer.h"
+#endif /* PUBLIC_SERVER */
static arena_t *currentArena;
static int splitType;
#ifndef PUBLIC_SERVER
-static int isBigArena(arena_t * arena)
+static int isBigArena(arena_t *arena)
{
if (arena->w > WINDOW_SIZE_X || arena->h > WINDOW_SIZE_Y) {
return 1;
@@ -32,7 +31,7 @@ static int isBigArena(arena_t * arena)
}
}
-static int isTuxNear(tux_t * tux1, tux_t * tux2)
+static int isTuxNear(tux_t *tux1, tux_t *tux2)
{
if (abs(tux1->x - tux2->x) < WINDOW_SIZE_X &&
abs(tux1->y - tux2->y) < WINDOW_SIZE_Y) {
@@ -41,9 +40,9 @@ static int isTuxNear(tux_t * tux1, tux_t * tux2)
return 0;
}
-#endif
+#endif /* PUBLIC_SERVER */
-void arena_set_current(arena_t * p)
+void arena_set_current(arena_t *p)
{
currentArena = p;
}
@@ -69,12 +68,12 @@ void arena_init()
if (getParam("--split-vertical")) {
splitType = SCREEN_SPLIT_VERTICAL;
- printf("SCREEN_SPLIT_VERTICAL\n");
+ printf(_("[Debug] Set vertical screen splitting\n"));
}
if (getParam("--split-horizontal")) {
splitType = SCREEN_SPLIT_HORIZONTAL;
- printf("SCREEN_SPLIT_HORIZONTAL\n");
+ printf(_("[Debug] Set horizontal screen splitting\n"));
}
hot_key_register(SDLK_F3, hotkey_splitArena);
@@ -84,7 +83,7 @@ void arena_quit()
{
hot_key_unregister(SDLK_F3);
}
-#endif
+#endif /* PUBLIC_SERVER */
arena_t *arena_new(int w, int h)
{
@@ -96,7 +95,7 @@ arena_t *arena_new(int w, int h)
#ifndef PUBLIC_SERVER
new->background = NULL;
strcpy(new->music, "");
-#endif
+#endif /* PUBLIC_SERVER */
new->w = w;
new->h = h;
@@ -121,37 +120,41 @@ arena_t *arena_new(int w, int h)
return new;
}
-int
-arena_conflict_space(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
+int arena_conflict_space(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
{
return (x1 < x2 + w2 && x2 < x1 + w1 && y1 < y2 + h2 && y2 < y1 + h1);
}
-int arena_is_free_space(arena_t * arena, int x, int y, int w, int h)
+int arena_is_free_space(arena_t *arena, int x, int y, int w, int h)
{
if (x < 0 || y < 0 || x + w > arena->w || y + h > arena->h) {
return 0;
}
- if (space_is_conflict_with_object(arena->spaceTux, x, y, w, h))
+ if (space_is_conflict_with_object(arena->spaceTux, x, y, w, h)) {
return 0;
+ }
- if (space_is_conflict_with_object(arena->spaceShot, x, y, w, h))
+ if (space_is_conflict_with_object(arena->spaceShot, x, y, w, h)) {
return 0;
+ }
- if (space_is_conflict_with_object(arena->spaceItem, x, y, w, h))
+ if (space_is_conflict_with_object(arena->spaceItem, x, y, w, h)) {
return 0;
+ }
- if (space_is_conflict_with_object(arena->spaceShot, x, y, w, h))
+ if (space_is_conflict_with_object(arena->spaceShot, x, y, w, h)) {
return 0;
+ }
- if (module_is_conflict(x, y, w, h))
+ if (module_is_conflict(x, y, w, h)) {
return 0;
+ }
return 1;
}
-void arena_find_free_space(arena_t * arena, int *x, int *y, int w, int h)
+void arena_find_free_space(arena_t *arena, int *x, int *y, int w, int h)
{
int z_x;
int z_y;
@@ -195,24 +198,22 @@ void arena_get_center_screen(int *screen_x, int *screen_y, int x, int y, int scr
}
#ifndef PUBLIC_SERVER
-
-static void drawBackground(arena_t * arena, int screen_x, int screen_y)
+static void drawBackground(arena_t *arena, int screen_x, int screen_y)
{
-
if (isBigArena(arena)) {
int i, j;
for (i = screen_y / arena->background->h;
- i <= screen_y / arena->background->h + WINDOW_SIZE_Y / arena->background->h + 1; i++) {
-
+ i <= screen_y / arena->background->h + WINDOW_SIZE_Y / arena->background->h + 1;
+ i++) {
for (j = screen_x / arena->background->w;
- j <= screen_x / arena->background->w + WINDOW_SIZE_X / arena->background->w + 1; j++) {
-
+ j <= screen_x / arena->background->w + WINDOW_SIZE_X / arena->background->w + 1;
+ j++) {
addLayer(arena->background, j * arena->background->w,
i * arena->background->h, 0, 0, arena->background->w,
arena->background->h, -100);
- //count++;
+ /*count++;*/
}
}
} else {
@@ -220,7 +221,7 @@ static void drawBackground(arena_t * arena, int screen_x, int screen_y)
}
}
-static void action_tux_draw(space_t * space, tux_t * tux, void *p)
+static void action_tux_draw(space_t *space, tux_t *tux, void *p)
{
UNUSED(space);
UNUSED(p);
@@ -228,7 +229,7 @@ static void action_tux_draw(space_t * space, tux_t * tux, void *p)
tux_draw(tux);
}
-static void action_item_draw(space_t * space, item_t * item, void *p)
+static void action_item_draw(space_t *space, item_t *item, void *p)
{
UNUSED(space);
UNUSED(p);
@@ -236,7 +237,7 @@ static void action_item_draw(space_t * space, item_t * item, void *p)
item_draw(item);
}
-static void action_shot_draw(space_t * space, shot_t * shot, void *p)
+static void action_shot_draw(space_t *space, shot_t *shot, void *p)
{
UNUSED(space);
UNUSED(p);
@@ -244,7 +245,7 @@ static void action_shot_draw(space_t * space, shot_t * shot, void *p)
shot_draw(shot);
}
-static void drawObjects(arena_t * arena, int screen_x, int screen_y)
+static void drawObjects(arena_t *arena, int screen_x, int screen_y)
{
space_action_from_location(arena->spaceTux, action_tux_draw, NULL, screen_x, screen_y, WINDOW_SIZE_X, WINDOW_SIZE_Y);
space_action_from_location(arena->spaceItem, action_item_draw, NULL, screen_x, screen_y, WINDOW_SIZE_X, WINDOW_SIZE_Y);
@@ -253,7 +254,7 @@ static void drawObjects(arena_t * arena, int screen_x, int screen_y)
module_draw(screen_x, screen_y, WINDOW_SIZE_X, WINDOW_SIZE_Y);
}
-static void drawSplitArenaForTux(arena_t * arena, tux_t * tux, int location_x, int location_y)
+static void drawSplitArenaForTux(arena_t *arena, tux_t *tux, int location_x, int location_y)
{
int screen_x, screen_y;
@@ -267,7 +268,7 @@ static void drawSplitArenaForTux(arena_t * arena, tux_t * tux, int location_x, i
default:
screen_x = -1;
screen_y = -1;
- assert(!"stupd error ");
+ assert(!_("[Error] Unknown method of splitting the screen"));
break;
}
@@ -284,12 +285,12 @@ static void drawSplitArenaForTux(arena_t * arena, tux_t * tux, int location_x, i
default:
screen_x = -1;
screen_y = -1;
- assert(!"stupd error ");
+ assert(!_("[Error] Unknown method of splitting the screen"));
break;
}
}
-void drawSplitArena(arena_t * arena)
+void drawSplitArena(arena_t *arena)
{
tux_t *tux = NULL;
@@ -313,7 +314,7 @@ void drawSplitArena(arena_t * arena)
}
}
-void drawCenterArena(arena_t * arena, int x, int y)
+void drawCenterArena(arena_t *arena, int x, int y)
{
int screen_x, screen_y;
@@ -323,7 +324,7 @@ void drawCenterArena(arena_t * arena, int x, int y)
layer_draw_center(x, y);
}
-void drawSimpleArena(arena_t * arena)
+void drawSimpleArena(arena_t *arena)
{
int screen_x, screen_y;
tux_t *tux = NULL;
@@ -342,7 +343,7 @@ void drawSimpleArena(arena_t * arena)
layer_draw_all(tux->x, tux->y);
}
-void arena_draw(arena_t * arena)
+void arena_draw(arena_t *arena)
{
if (isBigArena(arena) &&
net_multiplayer_get_game_type() == NET_GAME_TYPE_NONE && !setting_is_ai()) {
@@ -377,9 +378,9 @@ void arena_draw(arena_t * arena)
drawSimpleArena(arena);
}
-#endif
+#endif /* PUBLIC_SERVER */
-static void action_tux(space_t * space, tux_t * tux, void *p)
+static void action_tux(space_t *space, tux_t *tux, void *p)
{
UNUSED(space);
UNUSED(p);
@@ -387,7 +388,7 @@ static void action_tux(space_t * space, tux_t * tux, void *p)
tux_event(tux);
}
-void arena_event(arena_t * arena)
+void arena_event(arena_t *arena)
{
int i;
@@ -408,7 +409,7 @@ void arena_event(arena_t * arena)
timer_event(arena->listTimer);
}
-void arena_destroy(arena_t * p)
+void arena_destroy(arena_t *p)
{
space_destroy_with_item(p->spaceTux, tux_destroy);
space_destroy_with_item(p->spaceItem, item_destroy);