From 0ee10557cce8cdd51153aba56a67108047737978 Mon Sep 17 00:00:00 2001 From: Eugenio Favalli Date: Fri, 26 Nov 2004 17:52:41 +0000 Subject: Auto detect keyboard WIN32 --- src/game.cpp | 14 +- src/graphic/2xsai.h | 3 - src/graphic/graphic.cpp | 407 +++++++++++++++++++++++++++++++++++++++++++----- src/log.cpp | 2 + 4 files changed, 380 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/game.cpp b/src/game.cpp index a1fb7a54..37f0a000 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -96,7 +96,7 @@ void game() { status("INIT"); do_init(); init_graphic(); - while(state!=EXIT) { + while(state!=EXIT) { status("INPUT"); do_input(); status("GRAPHIC"); @@ -106,7 +106,7 @@ void game() { status("FLUSH"); flush(); - rest(1); // This one should work only in Win32 + //rest(1); // This one should work only in Win32 } exit_graphic(); @@ -164,7 +164,7 @@ void do_input() { int x = get_x(player_node->coordinates); int y = get_y(player_node->coordinates); - if(key[KEY_UP]) { + if(key[KEY_8_PAD]) { if(get_walk(x, y-1)!=0) { walk(x, y-1, NORTH); walk_status = 1; @@ -174,7 +174,7 @@ void do_input() { player_node->tick_time = tick_time; set_coordinates(player_node->coordinates, x, y-1, NORTH); } else set_coordinates(player_node->coordinates, x, y, NORTH); - } else if(key[KEY_DOWN]) { + } else if(key[KEY_2_PAD]) { if(get_walk(x, y+1)!=0) { walk(x, y+1, SOUTH); walk_status = 1; @@ -184,7 +184,7 @@ void do_input() { player_node->tick_time = tick_time; set_coordinates(player_node->coordinates, x, y+1, SOUTH); } else set_coordinates(player_node->coordinates, x, y, SOUTH); - } else if(key[KEY_LEFT]) { + } else if(key[KEY_4_PAD]) { if(get_walk(x-1, y)!=0) { walk(x-1, y, WEST); walk_status = 1; @@ -194,7 +194,7 @@ void do_input() { player_node->tick_time = tick_time; set_coordinates(player_node->coordinates, x-1, y, WEST); } else set_coordinates(player_node->coordinates, x, y, WEST); - } else if(key[KEY_RIGHT]) { + } else if(key[KEY_6_PAD]) { if(get_walk(x+1, y)!=0) { walk(x+1, y, EAST); walk_status = 1; @@ -347,9 +347,11 @@ void do_parse() { if((i+1)%10==0)fprintf(file, "\n"); } fclose(file);*/ +#ifdef DEBUG FILE *file = fopen("./docs/packet.list", "ab"); fprintf(file, "%x\n", RFIFOW(0)); fclose(file); +#endif // Parse packet based on their id switch(id) { diff --git a/src/graphic/2xsai.h b/src/graphic/2xsai.h index 7a9128bf..35068ba8 100644 --- a/src/graphic/2xsai.h +++ b/src/graphic/2xsai.h @@ -7,9 +7,6 @@ #include #include -//#include - - #define uint32 unsigned long #define uint16 unsigned short diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index d3abd21f..673f0d41 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -33,11 +33,14 @@ #pragma warning (disable:4312) #endif +BITMAP *vbuffer, *vpage[2], *vtileset, *temp, *vnpcset, *vplayerset, *vmonsterset; +int page_num = 0; + BITMAP *buffer, *double_buffer, *chat_background; DATAFILE *tileset; -//extern char* itemCurrenyQ; + char itemCurrenyQ[10] = "0"; -char page_num; +//char page_num; int map_x, map_y, camera_x, camera_y; DIALOG_PLAYER *chat_player, *npc_player, *skill_player, *buy_sell_player, *buy_player, *sell_player, *stats_player, *skill_list_player, *npc_list_player; char speech[255] = ""; @@ -173,10 +176,23 @@ int get_y_offset(NODE *node) { return offset; } +BITMAP *load_graphic_file(char *filename) { + BITMAP *temp = load_bitmap(filename, NULL); + if(!temp)error(filename); + BITMAP *vbmp = create_video_bitmap(temp->w, temp->h); + if(!vbmp) { + warning("Not enough video memory"); + vbmp = create_bitmap(temp->w, temp->h); + if(!vbmp)error("Not enough memory"); + } + blit(temp, vbmp, 0, 0, 0, 0, temp->w, temp->h); + destroy_bitmap(temp); + return vbmp; +} + void init_graphic() { tileset = load_datafile("./data/graphic/desert.dat"); if(!tileset)error("Unable to load tileset datafile"); - //if(!(gfx_capabilities & GFX_HW_VRAM_BLIT))allegro_message("Not supporting HW accelerated blit"); buffer = create_bitmap(SCREEN_W/2, SCREEN_H/2); double_buffer = create_bitmap(SCREEN_W, SCREEN_H); @@ -196,9 +212,30 @@ void init_graphic() { sell_player = init_dialog(sell_dialog, -1); skill_list_player = init_dialog(skill_list_dialog, -1); npc_list_player = init_dialog(npc_list_dialog, -1); - gui_bitmap = double_buffer; + //gui_bitmap = vpage[page_num]; alfont_text_mode(-1); inventory.create(100, 100); + + if(gfx_capabilities & GFX_HW_VRAM_BLIT) { + vpage[0] = create_video_bitmap(SCREEN_W, SCREEN_H); + vpage[1] = create_video_bitmap(SCREEN_W, SCREEN_H); + } else { + vpage[0] = create_bitmap(SCREEN_W, SCREEN_H); + vpage[1] = create_bitmap(SCREEN_W, SCREEN_H); + } + vbuffer = create_video_bitmap(SCREEN_W/2, SCREEN_H/2); + if(!vbuffer) { + warning("Not enough video memory [BUFFER]"); + vbuffer = create_bitmap(SCREEN_W/2, SCREEN_W/2); + if(!vbuffer)error("Not enough memory [BUFFER]"); + } + vtileset = load_graphic_file("./data/graphic/tileset.bmp"); + vnpcset = load_graphic_file("./data/graphic/npcset.bmp"); + vplayerset = load_graphic_file("./data/graphic/playerset.bmp"); + vmonsterset = load_graphic_file("./data/graphic/monsterset.bmp"); + + gui_bitmap = vpage[page_num]; + } void do_graphic(void) { @@ -213,22 +250,314 @@ void do_graphic(void) { int offset_y = map_y & 15; sort(); + + frame++; + acquire_bitmap(vbuffer); + + for(int j=0;j<20;j++) + for(int i=0;i<26;i++) { + //if(get_tile(i+camera_x, j+camera_y, 0) < 600) + blit(vtileset, vbuffer, get_tile_x(i+camera_x, j+camera_y, 0)*16, get_tile_y(i+camera_x, j+camera_y, 0)*16, i*16-offset_x, j*16-offset_y, 16, 16); + if(get_tile(i+camera_x, j+camera_y, 1) > 0 /*&& get_tile(i+camera_x, j+camera_y, 1)<600*/) + masked_blit(vtileset, vbuffer, get_tile_x(i+camera_x, j+camera_y, 1)*16, get_tile_y(i+camera_x, j+camera_y, 1)*16, i*16-offset_x, j*16-offset_y, 16, 16); + } + + NODE *node = get_head(); + while(node) { + if((node->job>=100)&&(node->job<=110)) { // Draw a NPC + masked_blit(vnpcset, vbuffer, (get_direction(node->coordinates)/2+4*(node->job-100))*25, 0, (get_x(node->coordinates)-camera_x)*16-4-offset_x, (get_y(node->coordinates)-camera_y)*16-24-offset_y, 25, 40); + } else if(node->job<10) { // Draw a player + node->text_x = (get_x(node->coordinates)-camera_x)*16 -34+get_x_offset(node)-offset_x; + node->text_y = (get_y(node->coordinates)-camera_y)*16 -36+get_y_offset(node)-offset_y; + if(node->action==SIT)node->frame = 0; + if(node->action==ATTACK) { + masked_blit(vplayerset, vbuffer, 80*(get_direction(node->coordinates)/2), 60*(node->frame+node->action+4*node->weapon), node->text_x, node->text_y, 80, 60); + draw_rle_sprite(vbuffer, (RLE_SPRITE *)weaponset[16*node->weapon+4*node->frame+get_direction(node->coordinates)/2].dat, node->text_x, node->text_y); + masked_blit(hairset, vbuffer, 20*(node->hair_color-1), 20*(get_direction(node->coordinates)/2+4*(node->hair_style-1)), node->text_x+31+hairtable[node->action+node->frame+4*node->weapon][get_direction(node->coordinates)/2][0], node->text_y+15+hairtable[node->action+node->frame+4*node->weapon][get_direction(node->coordinates)/2][1], 20, 20); + } else { + masked_blit(vplayerset, vbuffer, 80*(get_direction(node->coordinates)/2), 60*(node->frame+node->action), node->text_x, node->text_y, 80, 60); + masked_blit(hairset, vbuffer, 20*(node->hair_color-1), 20*(get_direction(node->coordinates)/2+4*(node->hair_style-1)), node->text_x+31+hairtable[node->action+node->frame][get_direction(node->coordinates)/2][0], node->text_y+15+hairtable[node->action+node->frame][get_direction(node->coordinates)/2][1], 20, 20); + } + if(node->emotion!=0) { + draw_sprite(vbuffer, (BITMAP *)emotions[node->emotion-1].dat, (get_x(node->coordinates)-camera_x)*16-5+get_x_offset(node)-offset_x, (get_y(node->coordinates)-camera_y)*16-45+get_y_offset(node)-offset_y); + node->emotion_time--; + if(node->emotion_time==0) + node->emotion = 0; + } + if(node->action!=STAND && node->action!=SIT) { + node->frame = (get_elapsed_time(node->tick_time)*4)/(node->speed); + if(node->frame>=4) { + node->frame = 0; + node->action = STAND; + if(node->id==player_node->id) + walk_status = 0; + } + } + + } else if(node->job==45) { // Draw a warp + //rectfill(buffer, (get_x(node->coordinates)-map_x)*16-player_x-get_x_offset(node->frame, get_direction(node->coordinates)), (get_y(node->coordinates)-map_y)*16-player_y-get_y_offset(node->frame, get_direction(node->coordinates)), (get_x(node->coordinates)-map_x)*16-player_x-get_x_offset(node->frame, get_direction(node->coordinates))+16, (get_y(node->coordinates)-map_y)*16-player_y-get_y_offset(node->frame, get_direction(node->coordinates))+16, makecol(0,0,255)); + } else { // Draw a monster + //node->speed = 10000; + if(node->frame>=4) { + //alert("","","","","",0,0); + node->frame = 3; + } + + + node->text_x = (get_x(node->coordinates)-camera_x)*16-22+get_x_offset(node)-offset_x; + node->text_y = (get_y(node->coordinates)-camera_y)*16-25+get_y_offset(node)-offset_y; + + int r_x = node->text_x-get_x_offset(node); + int r_y = node->text_y-get_y_offset(node); + + //rectfill(buffer, node->text_x+22, node->text_y+25, node->text_x+16+22, node->text_y+16+25, makecol(0,0,255)); + + //if(node->action==MONSTER_DEAD)node->frame = 0; + if(node->action==MONSTER_DEAD) + masked_blit(vmonsterset, vbuffer, (get_direction(node->coordinates)/2)*60+240*(node->job-1002), 60*MONSTER_DEAD, node->text_x, node->text_y, 60, 60); + else + masked_blit(vmonsterset, vbuffer, (get_direction(node->coordinates)/2)*60+240*(node->job-1002), 60*(node->frame+node->action), node->text_x, node->text_y, 60, 60); + + //alfont_textprintf(buffer, gui_font, node->text_x, node->text_y, MAKECOL_WHITE, "%i", node->id); + + if(node->action!=STAND) { + node->frame = (get_elapsed_time(node->tick_time)*4)/(node->speed); + if(node->frame>=4) { + if(node->action!=MONSTER_DEAD && node->path) { + if(node->path->next) { + PATH_NODE *old = node->path; + node->path = node->path->next; + direction = 0; + //if(node->path->next) { + if(node->path->x>old->x && node->path->y>old->y)direction = SE; + else if(node->path->xx && node->path->y>old->y)direction = SW; + else if(node->path->x>old->x && node->path->yy)direction = NE; + else if(node->path->xx && node->path->yy)direction = NW; + else if(node->path->x>old->x)direction = EAST; + else if(node->path->xx)direction = WEST; + else if(node->path->y>old->y)direction = SOUTH; + else if(node->path->yy)direction = NORTH; + //} + + set_coordinates(node->coordinates, node->path->x, node->path->y, direction); + + //node->tick_time = tick_time; + + + } else { + node->action = STAND; + } + if(node->action!=MONSTER_DEAD)node->frame = 0; + node->tick_time = tick_time; + //node->frame = 0; + } + } + } + } + if(node->action==MONSTER_DEAD && node->frame>=20) { + NODE *temp = node; + node = node->next; + remove_node(temp->id); + } else node = node->next; + + + // nodes are ordered so if the next node y is > then the + // last drawed for fringe layer, draw the missing lines + } + for(int j=0;j<20;j++) - for(int i=0;i<26;i++) { - if( /* get_tile(i+camera_x, j+camera_y, 0) >= 0 && */ get_tile(i+camera_x, j+camera_y, 0) < 600) - draw_rle_sprite(buffer, (RLE_SPRITE *)tileset[get_tile(i+camera_x, j+camera_y, 0)].dat, i*16-offset_x, j*16-offset_y); - if( get_tile(i+camera_x, j+camera_y, 1) > 0 && get_tile(i+camera_x, j+camera_y, 1)<600) - draw_rle_sprite(buffer, (RLE_SPRITE *)tileset[get_tile(i+camera_x, j+camera_y, 1)].dat, i*16-offset_x, j*16-offset_y); + for(int i=0;i<26;i++) + if(get_tile(i+camera_x, j+camera_y, 2)>0 && get_tile(i+camera_x, j+camera_y, 2)<600) + masked_blit(vtileset, vbuffer, get_tile_x(i+camera_x, j+camera_y, 2)*16, get_tile_y(i+camera_x, j+camera_y, 2)*16, i*16-offset_x, j*16-offset_y, 16, 16); + release_bitmap(vbuffer); + + acquire_bitmap(vpage[page_num]); + if(stretch_mode==0) + stretch_blit(vbuffer, vpage[page_num], 0, 0, 400, 300, 0, 0, 800, 600); + else if(stretch_mode==1) + Super2xSaI(vbuffer, vpage[page_num], 0, 0, 0, 0, 400, 300); + else if(stretch_mode==2) + SuperEagle(vbuffer, vpage[page_num], 0, 0, 0, 0, 400, 300); + textprintf_ex(vpage[page_num], font, 0, 0, makecol(255,255,255), -1, "[%i fps]", fps); + + // Draw player speech + node = get_head(); + while(node) { + if(node->speech!=NULL) { + if(node->speech_color==makecol(255,255,255)) + alfont_textprintf_aa(vpage[page_num], gui_font, node->text_x*2+90-alfont_text_length(gui_font, node->speech)/2, node->text_y*2, node->speech_color, "%s", node->speech); + else + alfont_textprintf_aa(vpage[page_num], gui_font, node->text_x*2+60-alfont_text_length(gui_font, node->speech)/2, node->text_y*2, node->speech_color, "%s", node->speech); + + node->speech_time--; + if(node->speech_time==0) { + free(node->speech); + node->speech = NULL; + } + } + node = node->next; + } + + inventory.draw(vpage[page_num]); + + set_trans_blender(0, 0, 0, 110); + draw_trans_sprite(vpage[page_num], chat_background, 0, SCREEN_H-125); + + chatlog.chat_draw(vpage[page_num], 8, gui_font); + gui_update(chat_player); + + switch(show_npc_dialog) { + case 1: + dialog_message(npc_dialog, MSG_DRAW, 0, 0); + if(!(show_npc_dialog = gui_update(npc_player))) { + strcpy(npc_text, ""); + WFIFOW(0) = net_w_value(0x00b9); + //alert("","","","","",0,0); + WFIFOL(2) = net_l_value(current_npc); + WFIFOSET(6); + } + break; + case 2: + dialog_message(buy_sell_dialog, MSG_DRAW, 0, 0); + if(!gui_update(buy_sell_player)) { + show_npc_dialog = shutdown_dialog(buy_sell_player); + if(show_npc_dialog==1 || show_npc_dialog==2) { + WFIFOW(0) = net_w_value(0x00c5); + WFIFOL(2) = net_l_value(current_npc); + WFIFOB(6) = net_b_value(show_npc_dialog-1); + WFIFOSET(7); + } + show_npc_dialog = 0; + buy_sell_player = init_dialog(buy_sell_dialog, -1); + } + break; + case 3: + char money[20]; + sprintf(money, "%i gp", char_info->gp); + buy_dialog[4].dp = &money; + buy_dialog[5].d1 = (int)(char_info->gp/get_item_price(buy_dialog[3].d1)); + if(buy_dialog[5].d2>buy_dialog[5].d1) + //alfont_textprintf(double_buffer, gui_font, 0, 10, MAKECOL_WHITE, "%i", buy_dialog[5].d1); + dialog_message(buy_dialog, MSG_DRAW, 0, 0); + if(!gui_update(buy_player)) { + show_npc_dialog = shutdown_dialog(buy_player); + buy_dialog[5].d1 = 0; + if(show_npc_dialog==1) { + WFIFOW(0) = net_w_value(0x00c8); + WFIFOW(2) = net_w_value(8); + WFIFOW(4) = net_w_value(buy_dialog[5].d2); + WFIFOW(6) = net_w_value(get_item_id(buy_dialog[3].d1)); + WFIFOSET(8); + } + show_npc_dialog = 0; + buy_player = init_dialog(buy_dialog, -1); + close_shop(); + }break; + case 4: + //alert("","","","","",0,0); + //char ds[20]; + sell_dialog[3].d1 = get_item_quantity(sell_dialog[4].d1); + //sprintf(ds, "%i", sell_dialog[3].d1); + //ok(ds,""); + + alfont_textprintf(double_buffer, gui_font, 0, 10, MAKECOL_WHITE, "%i", sell_dialog[3].d1); + dialog_message(sell_dialog, MSG_DRAW, 0, 0); + if(!gui_update(sell_player)) { + show_npc_dialog = shutdown_dialog(sell_player); + sell_dialog[3].d1 = 0; + if(show_npc_dialog==1) { + WFIFOW(0) = net_w_value(0x00c9); + WFIFOW(2) = net_w_value(8); + WFIFOW(4) = net_w_value(get_item_index(sell_dialog[4].d1)); + WFIFOW(6) = net_w_value(sell_dialog[3].d2); + WFIFOSET(8); + } + show_npc_dialog = 0; + sell_dialog[3].d2 = 0; + sprintf((char *)sell_dialog[5].dp, "%i", 0); + sell_player = init_dialog(sell_dialog, -1); + close_shop(); + } + break; + case 5: + dialog_message(npc_list_dialog, MSG_DRAW, 0, 0); + if(!gui_update(npc_list_player)) { + show_npc_dialog = shutdown_dialog(npc_list_player); + if(show_npc_dialog==1) { + WFIFOW(0) = net_w_value(0x00b8); + WFIFOL(2) = net_l_value(current_npc); + WFIFOB(6) = net_b_value(npc_list_dialog[3].d1+1); + WFIFOSET(7); + } + show_npc_dialog = 0; + npc_list_player = init_dialog(npc_list_dialog, -1); + remove_all_items(); + } + break; + } + + if(show_skill_dialog) { + update_skill_dialog(); + if(gui_update(skill_player)==0)show_skill_dialog = false; + } + + if(show_skill_dialog) { + update_skill_dialog(); + if(gui_update(skill_player)==0)show_skill_dialog = false; + } + + if(show_skill_list_dialog) { + + if(gui_update(skill_list_player)==0) { + int ret = shutdown_dialog(skill_list_player); + if(ret==1) { + if(char_info->skill_point>0) { + WFIFOW(0) = net_w_value(0x0112); + WFIFOW(2) = net_w_value(get_skill_id(skill_list_dialog[3].d1)); + WFIFOSET(4); + } + } else if(ret==2) { + show_skill_list_dialog = false; + } + skill_list_player = init_dialog(skill_list_dialog, -1); } + } - NODE *node = get_head(); + // character status display + update_stats_dialog(); + gui_update(stats_player); + + + + draw_sprite(vpage[page_num], mouse_sprite, mouse_x, mouse_y); + release_bitmap(vpage[page_num]); + show_video_bitmap(vpage[page_num]); + //blit(vpage[page_num], screen, 0, 0, 0, 0, 800, 600); + page_num = 1-page_num; + gui_bitmap = vpage[page_num]; + + + + + /*acquire_bitmap(vbuffer); + + for(int j=0;j<20;j++) + for(int i=0;i<26;i++) { + if( /* get_tile(i+camera_x, j+camera_y, 0) >= 0 && */ // get_tile(i+camera_x, j+camera_y, 0) < 600) + //draw_rle_sprite(buffer, (RLE_SPRITE *)tileset[get_tile(i+camera_x, j+camera_y, 0)].dat, i*16-offset_x, j*16-offset_y); + // blit(vtileset, vbuffer, get_tile_x(i+camera_x, j+camera_y, 0)*16, get_tile_y(i+camera_x, j+camera_y, 0)*16, i*16-offset_x, j*16-offset_y, 16, 16); + //if(get_tile(i+camera_x, j+camera_y, 1) > 0 && get_tile(i+camera_x, j+camera_y, 1)<600) + //draw_rle_sprite(buffer, (RLE_SPRITE *)tileset[get_tile(i+camera_x, j+camera_y, 1)].dat, i*16-offset_x, j*16-offset_y); + //masked_blit(vtileset, vbuffer, get_tile_x(i+camera_x, j+camera_y, 1)*16, get_tile_y(i+camera_x, j+camera_y, 1)*16, i*16-offset_x, j*16-offset_y, 16, 16); + //} + + /*NODE *node = get_head(); NODE *old_node = NULL; while(node) { if((node->job>=100)&&(node->job<=110)) { // Draw a NPC masked_blit((BITMAP *)graphic[NPCSET_BMP].dat, buffer, (get_direction(node->coordinates)/2+4*(node->job-100))*25, 0, (get_x(node->coordinates)-camera_x)*16-4-offset_x, (get_y(node->coordinates)-camera_y)*16-24-offset_y, 25, 40); - //alfont_textprintf(buffer, gui_font, (get_x(node->coordinates)-camera_x)*16-4-offset_x, (get_y(node->coordinates)-camera_y)*16-24-offset_y, MAKECOL_WHITE, "%i %i", get_x(node->coordinates), get_y(node->coordinates)); } else if(node->job<10) { // Draw a player node->text_x = (get_x(node->coordinates)-camera_x)*16-34+get_x_offset(node)-offset_x; node->text_y = (get_y(node->coordinates)-camera_y)*16-36+get_y_offset(node)-offset_y; @@ -255,12 +584,7 @@ void do_graphic(void) { node->frame = (get_elapsed_time(node->tick_time)*4)/(node->speed); if(node->frame>=4) { node->frame = 0; - /*if(node->action==WALK) - if(walk_status==1) { - set_coordinates(player_node->coordinates, src_x, src_y, direction); - walk_status = 0; - } */ - node->action = STAND; + node->action = STAND; // node->tick_time; if(node->id==player_node->id) walk_status = 0; @@ -278,7 +602,6 @@ void do_graphic(void) { node->frame = 3; } - //set_coordinates(node->coordinates, get_x(node->coordinates), get_y(node->coordinates), direction);*/ node->text_x = (get_x(node->coordinates)-camera_x)*16-22+get_x_offset(node)-offset_x; node->text_y = (get_y(node->coordinates)-camera_y)*16-25+get_y_offset(node)-offset_y; @@ -319,8 +642,7 @@ void do_graphic(void) { //node->tick_time = tick_time; - /*if(old!=NULL) - free(old);*/ + } else { node->action = STAND; } @@ -338,29 +660,38 @@ void do_graphic(void) { node = node->next; remove_node(temp->id); } else node = node->next; - /*if(old_node->action==MONSTER_DEAD && old_node->frame>=4) - remove_node(old_node->id);*/ + // nodes are ordered so if the next node y is > then the // last drawed for fringe layer, draw the missing lines - } + }*/ // complete drawing fringe layer - for(int j=0;j<20;j++) + /*for(int j=0;j<20;j++) for(int i=0;i<26;i++) { - if(get_tile(i+camera_x, j+camera_y, 2)>0 && get_tile(i+camera_x, j+camera_y, 2)<600)draw_rle_sprite(buffer, (RLE_SPRITE *)tileset[get_tile(i+camera_x, j+camera_y, 2)].dat, i*16-offset_x, j*16-offset_y); + if(get_tile(i+camera_x, j+camera_y, 2)>0 && get_tile(i+camera_x, j+camera_y, 2)<600)//draw_rle_sprite(buffer, (RLE_SPRITE *)tileset[get_tile(i+camera_x, j+camera_y, 2)].dat, i*16-offset_x, j*16-offset_y); + masked_blit(vtileset, vbuffer, get_tile_x(i+camera_x, j+camera_y, 2)*16, get_tile_y(i+camera_x, j+camera_y, 2)*16, i*16-offset_x, j*16-offset_y, 16, 16); } + + textprintf(vbuffer, font, 0, 0, MAKECOL_WHITE, "FPS: %i",fps); + + release_bitmap(vbuffer); + + acquire_bitmap(vpage[page_num]); + + if(stretch_mode==0) - stretch_blit(buffer, double_buffer, 0, 0, 400, 300, 0, 0, 800, 600); + //stretch_blit(buffer, double_buffer, 0, 0, 400, 300, 0, 0, 800, 600); + stretch_blit(vbuffer, vpage[page_num], 0, 0, 400, 300, 0, 0, 800, 600); else if(stretch_mode==1) Super2xSaI(buffer, double_buffer, 0, 0, 0, 0, 400, 300); else if(stretch_mode==2) SuperEagle(buffer, double_buffer, 0, 0, 0, 0, 400, 300); // Draw player speech - node = get_head(); + /*node = get_head(); while(node) { if(node->speech!=NULL) { if(node->speech_color==makecol(255,255,255)) @@ -438,10 +769,7 @@ void do_graphic(void) { sell_dialog[3].d1 = get_item_quantity(sell_dialog[4].d1); //sprintf(ds, "%i", sell_dialog[3].d1); //ok(ds,""); - /*if(sell_dialog[3].d2>sell_dialog[3].d1) { - sell_dialog[3].d2 = sell_dialog[3].d1; - sprintf((char *)sell_dialog[5].dp, "%i %i", sell_dialog[3].d1, sell_dialog[3].d2); - }*/ + alfont_textprintf(double_buffer, gui_font, 0, 10, MAKECOL_WHITE, "%i", sell_dialog[3].d1); dialog_message(sell_dialog, MSG_DRAW, 0, 0); if(!gui_update(sell_player)) { @@ -484,8 +812,7 @@ void do_graphic(void) { } if(show_skill_list_dialog) { - /*if(char_info->skill_point>0)skill_list_dialog[1].flags = 0; - else skill_list_dialog[1].flags |= D_DISABLED;*/ + if(gui_update(skill_list_player)==0) { int ret = shutdown_dialog(skill_list_player); if(ret==1) { @@ -503,15 +830,21 @@ void do_graphic(void) { // character status display update_stats_dialog(); - gui_update(stats_player); + gui_update(stats_player);*/ - alfont_textprintf(double_buffer, gui_font, 0, 0, MAKECOL_WHITE, "FPS:%i %i %i %i %i %i %i", fps, get_x(player_node->coordinates), get_y(player_node->coordinates),src_x,src_y,server_tick,player_node->weapon); + //alfont_textprintf(vpage[0], gui_font, 0, 0, MAKECOL_WHITE, "FPS:%i %i %i %i %i %i %i", fps, get_x(player_node->coordinates), get_y(player_node->coordinates),src_x,src_y,server_tick,player_node->weapon); + //textprintf(vpage[0], font, 0, 0, MAKECOL_WHITE, "FPS:"); //alfont_textprintf(double_buffer, gui_font, 0, 20, MAKECOL_WHITE, "%i", show_npc_dialog); + /*release_bitmap(vpage[page_num]); + + show_video_bitmap(vpage[page_num]); + page_num = 1-page_num; + //return; - blit(double_buffer, screen, 0, 0, 0, 0, 800, 600); + //blit(double_buffer, screen, 0, 0, 0, 0, 800, 600); - frame++; + frame++;*/ } void exit_graphic() { diff --git a/src/log.cpp b/src/log.cpp index 641e87ef..7b96fce4 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -185,5 +185,7 @@ void warning(const char *warning_text) { } void status(const char *status_text) { +#ifdef DEBUG log("Status", "last_function", status_text); +#endif } -- cgit v1.2.3-70-g09d2