Overview
Comment: | Add Misc/Dir editing |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
94aad6dd1bb42d73404e2d8de3cca5eb |
User & Date: | user on 2021-02-13 04:46:51 |
Other Links: | manifest | tags |
Context
2021-02-14
| ||
05:08 | Correct a mistake in the OBJECTS virtual table, and allow the class name to be used with the CVALUE function. check-in: a352027216 user: user tags: trunk | |
2021-02-13
| ||
04:46 | Add Misc/Dir editing check-in: 94aad6dd1b user: user tags: trunk | |
2021-02-11
| ||
23:59 | Add the "pick" instruction check-in: 23f422335e user: user tags: trunk | |
Changes
Modified bindings.doc from [482a34c08c] to [49d6e34851].
︙ | ︙ | |||
101 102 103 104 105 106 107 108 109 110 111 112 113 114 | '^a' <location> Add an object with the current MRU values to that location, if there is not already another object of the same class there. '^c' Display the class selection menu. '^u' <location> Add an object with the current MRU values to that location, even if there is already another object of the same class at that location. 'mR' <number> Select a relative MRU. Negative numbers move up the list, and positive numbers move down the list. | > > > > > | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | '^a' <location> Add an object with the current MRU values to that location, if there is not already another object of the same class there. '^c' Display the class selection menu. '^e' Edit the currently selected MRU values. (You can only edit the direction and the Misc values (1 to 3), not the class and image; to edit the class and image, use the class selection menu.) '^u' <location> Add an object with the current MRU values to that location, even if there is already another object of the same class at that location. 'mR' <number> Select a relative MRU. Negative numbers move up the list, and positive numbers move down the list. |
︙ | ︙ |
Modified default.heromeshrc from [5c68efeaef] to [0717a6e544].
︙ | ︙ | |||
136 137 138 139 140 141 142 143 144 145 146 147 148 149 | ?.editKey.8: select 'mr',7; ?.editKey.9: select 'mr',8; ?.editKey.up: select 'mR',-1; ?.editKey.down: select 'mR',+1; ?.editKey.ctrl.P: ^P ?.editKey.ctrl.Q: ^Q ?.editKey.space: ^c ?.editClick.left: ^a ?.editClick.alt.left: ^u ?.editClick.right: delete from objects where x=$X and y=$Y and up is null; ! Global key bindings ?.?.kp_minus: select 'go',-(level()-1); ?.?.kp_plus: select 'go',-(level()+1); | > | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | ?.editKey.8: select 'mr',7; ?.editKey.9: select 'mr',8; ?.editKey.up: select 'mR',-1; ?.editKey.down: select 'mR',+1; ?.editKey.ctrl.P: ^P ?.editKey.ctrl.Q: ^Q ?.editKey.space: ^c ?.editKey.return: ^e ?.editClick.left: ^a ?.editClick.alt.left: ^u ?.editClick.right: delete from objects where x=$X and y=$Y and up is null; ! Global key bindings ?.?.kp_minus: select 'go',-(level()-1); ?.?.kp_plus: select 'go',-(level()+1); |
︙ | ︙ |
Modified edit.c from [f72f24e675] to [077a253bca].
︙ | ︙ | |||
391 392 393 394 395 396 397 398 399 400 401 402 403 404 | goto redraw; case SDL_QUIT: exit(0); break; } } } static void add_object_at(int x,int y,MRU*m,int d) { Uint32 n,u; Class*c; if(x<1 || x>pfwidth || y<1 || y>pfheight || !m || !m->class) return; c=classes[m->class]; if(!c) return; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | goto redraw; case SDL_QUIT: exit(0); break; } } } static Value ask_value(const char*s) { int i; s=screen_prompt(s); if(!s || !*s) return UVALUE(0,4); if(*s=='-' || *s=='+' || (*s>='0' && *s<='9')) { if(*s=='0' && s[1]=='x') return NVALUE(strtol(s+2,0,16)&0xFFFF); if(*s=='0' && s[1]=='o') return NVALUE(strtol(s+2,0,8)&0xFFFF); return NVALUE(strtol(s,0,10)&0xFFFF); } else if(*s=='$') { for(i=1;i<0x4000;i++) { if(classes[i] && !(classes[i]->cflags&CF_NOCLASS2) && !strcmp(s+1,classes[i]->name)) return CVALUE(i); } screen_message("Undefined class"); } else if(*s=='#') { for(i=0;i<0x4000;i++) { if(messages[i] && !strcmp(s+1,messages[i])) return MVALUE(i+256); } screen_message("Undefined message"); } else if(*s>='A' && *s<='Z') { for(i=0;i<N_MESSAGES;i++) { if(!strcmp(s,standard_message_names[i])) return MVALUE(i); } screen_message("Undefined message"); } else if(*s=='\'') { for(i=0;i<256;i++) { if(heromesh_key_names[i] && !strcmp(s+1,heromesh_key_names[i])) return NVALUE(i); } screen_message("Invalid key"); } else { screen_message("Syntax error"); } return UVALUE(0,4); } static void mru_edit(MRU*m) { SDL_Event ev; SDL_Rect r; char buf[256]; int i,j; Value v; if(!m->class) return; redraw: set_cursor(XC_arrow); r.x=r.y=0; r.w=screen->w; r.h=screen->h; SDL_FillRect(screen,&r,0xF0); SDL_LockSurface(screen); draw_text(0,0,"Class:",0xF0,0xF7); draw_text(64,0,"$",0xF0,0xFB); draw_text(72,0,classes[m->class]->name,0xF0,0xFB); draw_text(0,8,"Image:",0xF0,0xF7); snprintf(buf,255,"%d",m->img); draw_text(64,8,buf,0xF0,0xFE); draw_text(0,24,"Dir:",0xF0,0xF7); snprintf(buf,255,"%2.2s","E NEN NWW SWS SE"+(m->dir&7)*2); draw_text(64,24,buf,0xF0,0xFF); for(i=32;i<56;i+=8) { switch(i) { case 32: v=m->misc1; draw_text(0,32,"Misc1:",0xF0,0xF7); break; case 40: v=m->misc2; draw_text(0,40,"Misc2:",0xF0,0xF7); break; case 48: v=m->misc3; draw_text(0,48,"Misc3:",0xF0,0xF7); break; } switch(v.t) { case TY_NUMBER: snprintf(buf,255,"%u",(int)v.u); draw_text(64,i,buf,0xF0,0xFE); break; case TY_CLASS: draw_text(64,i,"$",0xF0,0xFB); draw_text(72,i,classes[v.u]->name,0xF0,0xFB); break; case TY_MESSAGE: snprintf(buf,255,"%s%s",v.u<256?"":"#",v.u<256?standard_message_names[v.u]:messages[v.u-256]); draw_text(64,i,buf,0xF0,0xFD); break; case TY_LEVELSTRING: snprintf(buf,255,"String %u",(int)v.u); draw_text(200,i,buf,0xF0,0xF9); break; } } draw_text(0,64,"Str:",0xF0,0xF7); snprintf(buf,255,"%d",nlevelstrings); draw_text(64,64,buf,0xF0,0xF7); SDL_UnlockSurface(screen); SDL_Flip(screen); while(SDL_WaitEvent(&ev)) switch(ev.type) { case SDL_KEYDOWN: switch(ev.key.keysym.sym) { case SDLK_RETURN: case SDLK_KP_ENTER: case SDLK_ESCAPE: return; case SDLK_1: v=ask_value("Misc1:"); if(v.t<4) m->misc1=v; break; case SDLK_2: v=ask_value("Misc2:"); if(v.t<4) m->misc2=v; break; case SDLK_3: v=ask_value("Misc3:"); if(v.t<4) m->misc3=v; break; case SDLK_KP1: m->dir=5; break; case SDLK_KP2: m->dir=6; break; case SDLK_KP3: m->dir=7; break; case SDLK_KP4: m->dir=4; break; case SDLK_KP6: m->dir=0; break; case SDLK_KP7: m->dir=3; break; case SDLK_KP8: m->dir=2; break; case SDLK_KP9: m->dir=1; break; case SDLK_KP_PLUS: m->dir=(m->dir+1)&7; break; case SDLK_KP_MINUS: m->dir=(m->dir-1)&7; break; } goto redraw; case SDL_VIDEOEXPOSE: goto redraw; case SDL_QUIT: exit(0); break; } } static void add_object_at(int x,int y,MRU*m,int d) { Uint32 n,u; Class*c; if(x<1 || x>pfwidth || y<1 || y>pfheight || !m || !m->class) return; c=classes[m->class]; if(!c) return; |
︙ | ︙ | |||
430 431 432 433 434 435 436 437 438 439 440 441 442 443 | switch(cmd) { case '^a': // Add object (no duplicates) if(prev) return prev; add_object_at(number&63?:64,number/64?:64,mru+curmru,1); return 0; case '^c': // Select class/image class_image_select(); return 0; case '^u': // Add object (allow duplicates) if(prev) return prev; add_object_at(number&63?:64,number/64?:64,mru+curmru,0); return 0; case '^P': // Play return -2; | > > > | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | switch(cmd) { case '^a': // Add object (no duplicates) if(prev) return prev; add_object_at(number&63?:64,number/64?:64,mru+curmru,1); return 0; case '^c': // Select class/image class_image_select(); return 0; case '^e': // Edit Misc/Dir of MRU slot mru_edit(mru+curmru); return 0; case '^u': // Add object (allow duplicates) if(prev) return prev; add_object_at(number&63?:64,number/64?:64,mru+curmru,0); return 0; case '^P': // Play return -2; |
︙ | ︙ | |||
478 479 480 481 482 483 484 485 486 487 488 489 490 491 | break; case SDL_MOUSEBUTTONDOWN: if(ev.button.x<left_margin) { if(ev.button.y<56) break; i=(ev.button.y-56)/picture_size; if(i>=0 && i<MRUCOUNT) { curmru=i; redraw_editor(); } break; } else { i=exec_key_binding(&ev,1,(ev.button.x-left_margin)/picture_size+1,ev.button.y/picture_size+1,editor_command,0); goto command; } | > | 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 | break; case SDL_MOUSEBUTTONDOWN: if(ev.button.x<left_margin) { if(ev.button.y<56) break; i=(ev.button.y-56)/picture_size; if(i>=0 && i<MRUCOUNT) { curmru=i; if(ev.button.button==3) mru_edit(mru+i); redraw_editor(); } break; } else { i=exec_key_binding(&ev,1,(ev.button.x-left_margin)/picture_size+1,ev.button.y/picture_size+1,editor_command,0); goto command; } |
︙ | ︙ |