Index: bindings.doc ================================================================== --- bindings.doc +++ bindings.doc @@ -96,13 +96,21 @@ will receive the move list (in the same format as above) on stdin. === Editor commands === +'^a' + 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' + 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' Select a relative MRU. Negative numbers move up the list, and positive numbers move down the list. 'mr' Index: edit.c ================================================================== --- edit.c +++ edit.c @@ -393,16 +393,46 @@ exit(0); break; } } } + +static void add_object_at(int x,int y,MRU*m,int d) { + Uint32 n; + if(x<1 || x>pfwidth || y<1 || y>pfheight || !m || !m->class) return; + if(d) { + n=playfield[y*64+x-65]; + while(n!=VOIDLINK) { + if(objects[n]->class==m->class) return; + n=objects[n]->up; + } + } + n=objalloc(m->class); + if(n==VOIDLINK) return; + objects[n]->x=x; + objects[n]->y=y; + objects[n]->image=m->img; + objects[n]->dir=m->dir; + objects[n]->misc1=m->misc1; + objects[n]->misc2=m->misc2; + objects[n]->misc3=m->misc3; + pflink(n); +} static int editor_command(int prev,int cmd,int number,int argc,sqlite3_stmt*args,void*aux) { 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; case '^Q': // Quit return -1; case 'go': // Select level Index: game.c ================================================================== --- game.c +++ game.c @@ -719,11 +719,11 @@ case SDL_MOUSEBUTTONDOWN: if(ev.button.xh-68)/32-4; if(i<0) game_command(0,'- ',-i,0,0,0); else if(i>0) game_command(0,'+ ',i,0,0,0); goto replay;