diff --git a/Makefile b/Makefile index 576df36..1a5b6bd 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,12 @@ SDL = `sdl-config --cflags` SPARROW_FOLDER = ../sparrow3d -#TARGET = nativ +TARGET = nativ ifdef TARGET include $(SPARROW_FOLDER)/target-files/$(TARGET).mk -#TARGET = pandora +TARGET = pandora BUILD = ./build/$(TARGET)/hase SPARROW_LIB = $(SPARROW_FOLDER)/build/$(TARGET)/sparrow3d diff --git a/ToDo b/ToDo index 412772f..7dc7ba8 100644 --- a/ToDo +++ b/ToDo @@ -1,4 +1,3 @@ 1 bessere AI -2 Was, wenn er einfach abhaut? Abstürzt? http://pastebin.com/P0q6QE86 diff --git a/data/keyboard320.png b/data/keyboard320.png new file mode 100644 index 0000000..fa7387c Binary files /dev/null and b/data/keyboard320.png differ diff --git a/data/keyboardShift320.png b/data/keyboardShift320.png new file mode 100644 index 0000000..159b27a Binary files /dev/null and b/data/keyboardShift320.png differ diff --git a/hase.c b/hase.c index 6d30edb..d10df1c 100644 --- a/hase.c +++ b/hase.c @@ -639,7 +639,7 @@ int hase(void ( *resize )( Uint16 w, Uint16 h ),pGame game,pPlayer me_list) int result = spLoop(draw,calc,10,resize,NULL); stop_thread(); - if (result) + if (result == 2) { int i; for (i = 0; i < player_count; i ++) diff --git a/lobby.c b/lobby.c index b1e77dc..dc8e943 100644 --- a/lobby.c +++ b/lobby.c @@ -26,6 +26,8 @@ void resize( Uint16 w, Uint16 h ) spFontAddButton( font, 'w', SP_BUTTON_UP_NAME, 65535, spGetRGB(127,127,127) ); // w == up button spFontAddButton( font, 's', SP_BUTTON_DOWN_NAME, 65535, spGetRGB(127,127,127) ); // s == down button spFontMulWidth(font,spFloatToFixed(0.9f)); + + spSetVirtualKeyboard(SP_VIRTUAL_KEYBOARD_IF_NEEDED,0,h-w*48/320,w,w*48/320,spLoadSurface("./data/keyboard320.png"),spLoadSurface("./data/keyboardShift320.png")); } int main(int argc, char **argv) diff --git a/lobbyGame.c b/lobbyGame.c index 6918d50..b984596 100644 --- a/lobbyGame.c +++ b/lobbyGame.c @@ -43,9 +43,9 @@ void lg_draw(void) //Informations int w = screen->w-8-l_w; spFontDrawMiddle(screen->w-2-w/2, 1*lg_font->maxheight, 0, "Game Info", lg_font ); - sprintf(buffer,"Sec. per turn: %i",lg_game->seconds_per_turn); + sprintf(buffer,"Seconds per turn: %i",lg_game->seconds_per_turn); spFontDraw(screen->w-w, 2*lg_font->maxheight, 0, buffer, lg_font ); - sprintf(buffer,"Max. players: %i",lg_game->max_player); + sprintf(buffer,"Maximum players: %i",lg_game->max_player); spFontDraw(screen->w-w, 3*lg_font->maxheight, 0, buffer, lg_font ); spFontDraw(screen->w-w, 4*lg_font->maxheight, 0, "Players:", lg_font ); //player block @@ -54,7 +54,11 @@ void lg_draw(void) if (lg_block) spFontDrawTextBlock(middle,screen->w-w-4, 5*lg_font->maxheight-1, 0,lg_block,h,0,lg_font); //Instructions on the right - spFontDrawMiddle(screen->w-2-w/2, h+5*lg_font->maxheight, 0, "[w]Add pl. [s]Rem. pl.", lg_font ); + #ifdef PANDORA + spFontDrawMiddle(screen->w-2-w/2, h+5*lg_font->maxheight, 0, "[w]Add player [s]Remove player", lg_font ); + #else + spFontDrawMiddle(screen->w-2-w/2, h+5*lg_font->maxheight, 0, "[w]Add player [s]Remove pl.", lg_font ); + #endif if (lg_game->admin_pw == 0) { spFontDrawMiddle(screen->w-2-w/2, h+6*lg_font->maxheight, 0, "The game master will", lg_font ); @@ -62,11 +66,14 @@ void lg_draw(void) } else { - spFontDrawMiddle(screen->w-2-w/2, h+6*lg_font->maxheight, 0, "[d]New level [a]Start", lg_font ); - spFontDrawMiddle(screen->w-2-w/2, h+7*lg_font->maxheight, 0, "[q]Add AI [e]Rem. all AI", lg_font ); + spFontDrawMiddle(screen->w-2-w/2, h+6*lg_font->maxheight, 0, "[q]Add AI [e]Remove all AIs", lg_font ); + spFontDrawMiddle(screen->w-2-w/2, h+7*lg_font->maxheight, 0, "[a]Start game [d]New level", lg_font ); } //Chat spRectangle(screen->w/2, l_w+(4+CHAT_LINES)*lg_font->maxheight/2+4, 0,screen->w-4,CHAT_LINES*lg_font->maxheight,LL_FG); + if (lg_game->local) + spFontDrawMiddle(screen->w/2, l_w+(3+CHAT_LINES)*lg_font->maxheight/2+4, 0,"No chat in local game",lg_font); + else if (lg_chat_block) spFontDrawTextBlock(left,4, l_w+2*lg_font->maxheight+4, 0,lg_chat_block,CHAT_LINES*lg_font->maxheight,lg_scroll,lg_font); //Footline @@ -77,6 +84,9 @@ void lg_draw(void) } else { + if (lg_game->local) + spFontDraw( 2, screen->h-lg_font->maxheight, 0, "[B]Leave and close game", lg_font ); + else if (lg_game->admin_pw == 0) spFontDraw( 2, screen->h-lg_font->maxheight, 0, "[R]Chat [B]Leave game", lg_font ); else @@ -221,7 +231,7 @@ int lg_calc(Uint32 steps) if (lg_chat_block->line_count > CHAT_LINES) lg_scroll = SP_ONE; } - if (spGetInput()->button[SP_BUTTON_START]) + if (!lg_game->local && spGetInput()->button[SP_BUTTON_START]) { spGetInput()->button[SP_BUTTON_START] = 0; char m[256] = ""; @@ -345,7 +355,8 @@ int lg_calc(Uint32 steps) spGetInput()->button[SP_BUTTON_RIGHT] = 0; create_level_string(lg_game->level_string,1536,1536,3,3,3); spDeleteSurface(lg_level); - lg_level = create_level(lg_game->level_string,spGetWindowSurface()->h-3*lg_font->maxheight,spGetWindowSurface()->h-3*lg_font->maxheight,LL_BG); + int l_w = spGetWindowSurface()->h-(4+CHAT_LINES)*lg_font->maxheight; + lg_level = create_level(lg_game->level_string,l_w,l_w,LL_BG); sprintf(lg_level_string,"%s",lg_game->level_string); set_level(lg_game,lg_level_string); } @@ -409,7 +420,7 @@ int lg_reload() } if (lg_block) spDeleteTextBlock(lg_block); - int l_w = spGetWindowSurface()->h-7*lg_font->maxheight; + int l_w = spGetWindowSurface()->h-(4+CHAT_LINES)*lg_font->maxheight; lg_block = spCreateTextBlock(temp,spGetWindowSurface()->w-8-l_w,lg_font); if (lg_level == NULL || strcmp(lg_level_string,lg_game->level_string)) { @@ -451,9 +462,11 @@ void start_lobby_game(spFontPointer font, void ( *resize )( Uint16 w, Uint16 h ) lg_chat_block = NULL; lg_last_chat = NULL; lg_chat_text[0] = 0; - start_chat_listener(lg_player); + if (!lg_game->local) + start_chat_listener(lg_player); int res = spLoop(lg_draw,lg_calc,10,resize,NULL); - stop_chat_listener(lg_player); + if (!lg_game->local) + stop_chat_listener(lg_player); if (lg_block) spDeleteTextBlock(lg_block); if (res == -1) diff --git a/message.c b/message.c index 4e380d9..a266cf3 100644 --- a/message.c +++ b/message.c @@ -19,6 +19,10 @@ void message_draw(void) spSetAlphaPattern4x4(196,0); spRectangle(screen->w/2,screen->h/2,0,screen->w,screen->h,LL_BG); spDeactivatePattern(); + + if (spIsKeyboardPolled() && spGetVirtualKeyboardState() == SP_VIRTUAL_KEYBOARD_ALWAYS) + spBlitSurface(screen->w/2,screen->h-spGetVirtualKeyboard()->h/2,0,spGetVirtualKeyboard()); + char buffer[256]; if (mg_button_count < 0) { @@ -27,6 +31,10 @@ void message_draw(void) spRectangleBorder(screen->w/2,screen->h/2,0,screen->w/2+2*meow,screen->h/2+2*meow,meow,meow,LL_FG); spFontDrawMiddle( screen->w/2, 6*screen->h/23, 0, "Create game", mg_font ); sprintf(buffer,"Name: %s",mg_name); + int x = (screen->w+spFontWidth(buffer,mg_font))/2; + if (mg_sel == 1 && mg_pos == 0 && (SDL_GetTicks() >> 9) & 1) + spLine(x,8*screen->h/23-0*mg_font->maxheight/2, 0, + x,8*screen->h/23+2*mg_font->maxheight/2, 0,65535); spFontDrawMiddle( screen->w/2, 8*screen->h/23, 0, buffer, mg_font ); sprintf(buffer,"Maximum players: %i",*mg_players); spFontDrawMiddle( screen->w/2,10*screen->h/23, 0, buffer, mg_font ); @@ -67,7 +75,10 @@ void message_draw(void) } } else - spFontDrawMiddle( screen->w/2,16*screen->h/23, 0, "[a]Select [w]Create [d]Cancel", mg_font ); + if (*mg_online == -1 && mg_pos == 3) + spFontDrawMiddle( screen->w/2,16*screen->h/23, 0, "[w]Create [d]Cancel", mg_font ); + else + spFontDrawMiddle( screen->w/2,16*screen->h/23, 0, "[a]Select [w]Create [d]Cancel", mg_font ); spFlip(); } else @@ -114,7 +125,7 @@ int message_calc(Uint32 steps) spGetInput()->button[SP_BUTTON_UP] = 0; return 1; } - if (spGetInput()->button[SP_BUTTON_LEFT]) + if (spGetInput()->button[SP_BUTTON_LEFT] && (*mg_online != -1 || mg_pos != 3)) { spGetInput()->button[SP_BUTTON_LEFT] = 0; mg_sel = 1-mg_sel; diff --git a/trace.c b/trace.c index 616691c..239f32f 100644 --- a/trace.c +++ b/trace.c @@ -1,5 +1,5 @@ -#define TRACE_LENGTH 20 -#define TRACE_STEP 100 +#define TRACE_LENGTH 10 +#define TRACE_STEP 150 #define TRACE_UPDATE 5 int trace_count = TRACE_UPDATE-1; typedef struct sTrace