summaryrefslogtreecommitdiff
path: root/src/client/term.c
diff options
context:
space:
mode:
authorTomas Chvatal (scarabeus) <tomas.chvatal@gmail.com>2008-10-22 22:50:54 +0200
committerTomas Chvatal (scarabeus) <tomas.chvatal@gmail.com>2008-10-22 22:50:54 +0200
commite12753d2ec9db83ec08bb9db63902a82fb245cdd (patch)
tree6e4a63b790d6335f969f88b797a927e0fb25f37a /src/client/term.c
parent0b4d9821c7333b8c4bdf7e0eeb750aef502a1137 (diff)
X
Diffstat (limited to 'src/client/term.c')
-rw-r--r--src/client/term.c216
1 files changed, 114 insertions, 102 deletions
diff --git a/src/client/term.c b/src/client/term.c
index 6cad4d4..7619900 100644
--- a/src/client/term.c
+++ b/src/client/term.c
@@ -18,139 +18,151 @@ static bool_t activeTerm;
static my_time_t lastActive;
static my_time_t lastRefresh;
-void initTerm()
+void
+initTerm()
{
- listText = newList();
+ listText = newList();
- activeTerm = FALSE;
- lastActive = getMyTime();
- lastRefresh = lastActive;
+ activeTerm = FALSE;
+ lastActive = getMyTime();
+ lastRefresh = lastActive;
}
-static char* getStrGun(int gun)
+static char *
+getStrGun(int gun)
{
- switch( gun )
- {
- case GUN_SIMPLE : return "revolver";
- case GUN_DUAL_SIMPLE : return "dual revolver";
- case GUN_SCATTER : return "scatter";
- case GUN_TOMMY : return "tommy";
- case GUN_LASSER : return "lasser";
- case GUN_MINE : return "mine";
- case GUN_BOMBBALL : return "bombball";
- default : return "none";
- }
-
- return "gun_unknow";
+ switch (gun) {
+ case GUN_SIMPLE:
+ return "revolver";
+ case GUN_DUAL_SIMPLE:
+ return "dual revolver";
+ case GUN_SCATTER:
+ return "scatter";
+ case GUN_TOMMY:
+ return "tommy";
+ case GUN_LASSER:
+ return "lasser";
+ case GUN_MINE:
+ return "mine";
+ case GUN_BOMBBALL:
+ return "bombball";
+ default:
+ return "none";
+ }
+
+ return "gun_unknow";
}
-static char* getStrBonus(int bonus)
+static char *
+getStrBonus(int bonus)
{
- switch( bonus )
- {
- case BONUS_SPEED : return "speed";
- case BONUS_SHOT : return "shot";
- case BONUS_TELEPORT : return "teleport";
- case BONUS_GHOST : return "ghost";
- case BONUS_4X : return "4X";
- case BONUS_HIDDEN : return "hidden";
- default : return "none";
- }
-
- return "bonus_unknow";
+ switch (bonus) {
+ case BONUS_SPEED:
+ return "speed";
+ case BONUS_SHOT:
+ return "shot";
+ case BONUS_TELEPORT:
+ return "teleport";
+ case BONUS_GHOST:
+ return "ghost";
+ case BONUS_4X:
+ return "4X";
+ case BONUS_HIDDEN:
+ return "hidden";
+ default:
+ return "none";
+ }
+
+ return "bonus_unknow";
}
-static void action_refreshTerm(space_t *space, tux_t *tux, void *p)
+static void
+action_refreshTerm(space_t * space, tux_t * tux, void *p)
{
- char str[STR_SIZE];
-
- sprintf(str,
- "name: %s "
- "score: %d "
- "gun: %s "
- "shot: %d "
- "bonus: %s",
-
- tux->name, tux->score,
- getStrGun(tux->gun),
- tux->shot[tux->gun],
- getStrBonus(tux->bonus)
- );
-
- addList(listText, strdup(str) );
+ char str[STR_SIZE];
+
+ sprintf(str,
+ "name: %s "
+ "score: %d "
+ "gun: %s "
+ "shot: %d "
+ "bonus: %s",
+ tux->name, tux->score,
+ getStrGun(tux->gun), tux->shot[tux->gun], getStrBonus(tux->bonus)
+ );
+
+ addList(listText, strdup(str));
}
-static void refreshTerm()
+static void
+refreshTerm()
{
- arena_t *arena;
+ arena_t *arena;
- arena = getCurrentArena();
+ arena = getCurrentArena();
- destroyListItem(listText, free);
- listText = newList();
+ destroyListItem(listText, free);
+ listText = newList();
- actionSpace(arena->spaceTux, action_refreshTerm, NULL);
+ actionSpace(arena->spaceTux, action_refreshTerm, NULL);
- //printf("refresh term..\n");
+ //printf("refresh term..\n");
}
-void drawTerm()
+void
+drawTerm()
{
- int i;
+ int i;
- if( activeTerm == FALSE )
- {
- return;
- }
+ if (activeTerm == FALSE) {
+ return;
+ }
- for( i = 0 ; i < listText->count ; i++ )
- {
- char *line;
+ for (i = 0; i < listText->count; i++) {
+ char *line;
- line = (char *) listText->list[i];
- drawFont(line, 10, 10 + i*20, COLOR_WHITE);
- }
+ line = (char *) listText->list[i];
+ drawFont(line, 10, 10 + i * 20, COLOR_WHITE);
+ }
}
-static void switchTerm()
+static void
+switchTerm()
{
- if( activeTerm == TRUE )
- {
- activeTerm = FALSE;
- }
- else
- {
- activeTerm = TRUE;
- }
+ if (activeTerm == TRUE) {
+ activeTerm = FALSE;
+ }
+ else {
+ activeTerm = TRUE;
+ }
}
-void eventTerm()
+void
+eventTerm()
{
- my_time_t currentTime;
- Uint8 *mapa;
-
- mapa = SDL_GetKeyState(NULL);
-
- currentTime = getMyTime();
-
- if( currentTime - lastRefresh > TERM_REFRESH_TIME_INTERVAL )
- {
- lastRefresh = currentTime;
- refreshTerm();
- }
-
- if( mapa[SDLK_TAB] == SDL_PRESSED )
- {
- if( currentTime - lastActive > TERM_ACTIVE_TIME_INTERVAL )
- {
- lastActive = currentTime;
- switchTerm();
- }
- }
+ my_time_t currentTime;
+ Uint8 *mapa;
+
+ mapa = SDL_GetKeyState(NULL);
+
+ currentTime = getMyTime();
+
+ if (currentTime - lastRefresh > TERM_REFRESH_TIME_INTERVAL) {
+ lastRefresh = currentTime;
+ refreshTerm();
+ }
+
+ if (mapa[SDLK_TAB] == SDL_PRESSED) {
+ if (currentTime - lastActive > TERM_ACTIVE_TIME_INTERVAL) {
+ lastActive = currentTime;
+ switchTerm();
+ }
+ }
}
-void quitTerm()
+void
+quitTerm()
{
- assert( listText != NULL );
- destroyListItem(listText, free);
+ assert(listText != NULL);
+ destroyListItem(listText, free);
}