Overview
Comment: | Implement the solution replay |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3edc879c324f49d885daf45a63a6caf3 |
User & Date: | user on 2021-01-09 00:56:28 |
Other Links: | manifest | tags |
Context
2021-01-09
| ||
01:32 | Fix the logic for sending CREATED and DESTROYED messages check-in: 00378e2e14 user: user tags: trunk | |
00:56 | Implement the solution replay check-in: 3edc879c32 user: user tags: trunk | |
2021-01-08
| ||
09:14 | Implement defining the CollisionLayers value for a class. check-in: 34870ce7e8 user: user tags: trunk | |
Changes
Modified game.c from [537835c926] to [a95ee4649a].
︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | + + | #include "heromesh.h" #include "quarks.h" #include "cursorshapes.h" #include "names.h" Uint8*replay_list; Uint16 replay_size,replay_count,replay_pos,replay_mark; Uint8 solution_replay=255; static volatile Uint8 timerflag; static int exam_scroll; static Uint8*inputs; static int inputs_size,inputs_count; static Uint8 side_mode=255; static void setup_game(void) { const char*v; optionquery[1]=Q_showInventory; v=xrm_get_resource(resourcedb,optionquery,optionquery,2)?:""; side_mode=boolxrm(v,1); solution_replay=0; } static void redraw_game(void) { char buf[32]; SDL_Rect r; int x,y; r.x=r.y=0; |
︙ | |||
104 105 106 107 108 109 110 | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | - + | draw_picture(0,y*picture_size+52,classes[inventory[y].class]->images[inventory[y].image]&0x7FFF); } } else { // Move list snprintf(buf,8,"%5d",replay_pos); draw_text(8,52,buf,0xF0,0xF9); snprintf(buf,8,"%5d",replay_count); |
︙ | |||
192 193 194 195 196 197 198 | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - - - - - - - - + - | } SDL_LockSurface(screen); draw_text(0,40,buf,0xF0,0xF1); SDL_UnlockSurface(screen); SDL_Flip(screen); } |
︙ | |||
484 485 486 487 488 489 490 491 492 493 494 495 496 497 | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | + + + + | modal_draw_popup(s); sqlite3_free(s); } static int game_command(int prev,int cmd,int number,int argc,sqlite3_stmt*args,void*aux) { switch(cmd) { case '\' ': // Play a move if(solution_replay) { screen_message("You cannot play your own moves during the solution replay"); return -3; } if(inputs_count>=inputs_size) { inputs=realloc(inputs,inputs_size+=32); if(!inputs) fatal("Allocation failed\n"); } inputs[inputs_count++]=number; return 0; case '+ ': replay: // Replay |
︙ | |||
540 541 542 543 544 545 546 547 548 549 550 551 552 553 | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | + + + + + | return prev; case '^d': // Describe object describe_at(number-65); return prev; case '^o': // List objects list_objects_at(number-65); return prev; case '^s': // Toggle solution replay solution_replay^=1; replay_count=0; if(replay_count) begin_level(level_id); else load_replay(); return 1; case 'go': // Select level begin_level(number); return 1; default: return prev; } } |
︙ | |||
658 659 660 661 662 663 664 | 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | - + | } redraw_game(); timerflag=0; // ensure we have not missed a timer event break; } } quit: |
︙ |
Modified heromesh.h from [c906f5298c] to [f7c90cf74d].
︙ | |||
254 255 256 257 258 259 260 261 262 263 264 265 266 267 | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | + | const char*execute_turn(int key); const char*init_level(void); // == game == extern Uint8*replay_list; extern Uint16 replay_size,replay_count,replay_pos,replay_mark; extern Uint8 solution_replay; void run_game(void); void locate_me(int x,int y); // == edit == void run_editor(void); |
︙ |