13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <string.h>
#include "sqlite3.h"
#include "smallxrm.h"
#include "heromesh.h"
#include "quarks.h"
#include "cursorshapes.h"
typedef struct {
Uint16 class;
Uint8 img,dir;
Value misc1,misc2,misc3;
} MRU;
#define MRUCOUNT 32
|
>
>
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include <string.h>
#include "sqlite3.h"
#include "smallxrm.h"
#include "heromesh.h"
#include "quarks.h"
#include "cursorshapes.h"
EditorRect editrect;
typedef struct {
Uint16 class;
Uint8 img,dir;
Value misc1,misc2,misc3;
} MRU;
#define MRUCOUNT 32
|
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
draw_text(0,40,buf,0xF0,0xF3);
for(x=0;x<MRUCOUNT;x++) {
y=picture_size*x+56;
if(y+picture_size>screen->h) break;
if(x==curmru) draw_text(0,y,">",0xF0,0xFE);
if(mru[x].misc1.u|mru[x].misc1.t|mru[x].misc2.u|mru[x].misc2.t|mru[x].misc3.u|mru[x].misc3.t) draw_text(picture_size+16,y,"*",0xF0,0xFB);
}
SDL_UnlockSurface(screen);
r.w=r.h=picture_size;
r.x=8;
for(x=0;x<MRUCOUNT;x++) {
y=picture_size*x+56;
if(y+picture_size>screen->h) break;
if(mru[x].class) {
|
>
|
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
draw_text(0,40,buf,0xF0,0xF3);
for(x=0;x<MRUCOUNT;x++) {
y=picture_size*x+56;
if(y+picture_size>screen->h) break;
if(x==curmru) draw_text(0,y,">",0xF0,0xFE);
if(mru[x].misc1.u|mru[x].misc1.t|mru[x].misc2.u|mru[x].misc2.t|mru[x].misc3.u|mru[x].misc3.t) draw_text(picture_size+16,y,"*",0xF0,0xFB);
}
if(editrect.x0 && editrect.x1) draw_selection_rectangle();
SDL_UnlockSurface(screen);
r.w=r.h=picture_size;
r.x=8;
for(x=0;x<MRUCOUNT;x++) {
y=picture_size*x+56;
if(y+picture_size>screen->h) break;
if(mru[x].class) {
|
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
|
return -1;
case '^S': // Save level
save_level();
return 1;
case '^T': // Level title
edit_string(&level_title);
return 0;
case 'am': // Add MRU
if(argc<7) return prev;
for(x=1;x<7;x++) if(sqlite3_column_type(args,x)==SQLITE_NULL) return prev;
x=sqlite3_column_int(args,1)&0x3FFF;
if(!x) return prev;
y=sqlite3_column_int(args,2)&0xFF;
add_mru(x,y);
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
|
return -1;
case '^S': // Save level
save_level();
return 1;
case '^T': // Level title
edit_string(&level_title);
return 0;
case '^Z': // Cancel rectangle
editrect.x0=editrect.y0=editrect.x1=editrect.y1=0;
return prev;
case '^<': // First corner
if((number&63?:64)>pfwidth || (number/64?:64)>pfheight) return prev;
editrect.x0=number&63?:64;
editrect.y0=number/64?:64;
goto setrect;
case '^>': // Second corner
if((number&63?:64)>pfwidth || (number/64?:64)>pfheight) return prev;
editrect.x1=number&63?:64;
editrect.y1=number/64?:64;
setrect:
if(!editrect.x1) editrect.x1=editrect.x0;
if(!editrect.y1) editrect.y1=editrect.y0;
if(editrect.x0>editrect.x1) x=editrect.x0,editrect.x0=editrect.x1,editrect.x1=x;
if(editrect.y0>editrect.y1) y=editrect.y0,editrect.y0=editrect.y1,editrect.y1=y;
return prev;
case 'am': // Add MRU
if(argc<7) return prev;
for(x=1;x<7;x++) if(sqlite3_column_type(args,x)==SQLITE_NULL) return prev;
x=sqlite3_column_int(args,1)&0x3FFF;
if(!x) return prev;
y=sqlite3_column_int(args,2)&0xFF;
add_mru(x,y);
|
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
|
number+=curmru;
// fall through
case 'mr': // Select MRU absolute
if(number>=0 && number<MRUCOUNT) curmru=number;
return 0;
case 're': // Resize and clear
if(argc<3) return 0;
x=sqlite3_column_int(args,1);
y=sqlite3_column_int(args,2);
if(x<1 || y<1 || x>64 || y>64) return 0;
level_changed=1;
annihilate();
pfwidth=x;
pfheight=y;
|
>
|
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
|
number+=curmru;
// fall through
case 'mr': // Select MRU absolute
if(number>=0 && number<MRUCOUNT) curmru=number;
return 0;
case 're': // Resize and clear
if(argc<3) return 0;
editrect.x0=editrect.y0=editrect.x1=editrect.y1=0;
x=sqlite3_column_int(args,1);
y=sqlite3_column_int(args,2);
if(x<1 || y<1 || x>64 || y>64) return 0;
level_changed=1;
annihilate();
pfwidth=x;
pfheight=y;
|