Overview
Comment: | Add OF_BIZARRO flag, change OF_TRACEIN/OF_TRACEOUT to CF_TRACEIN/CF_TRACEOUT, fix a bug in update logic for CLASSES vtab |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
966114bc2f331afa43a3ee9884e2f535 |
User & Date: | user on 2018-08-24 15:12:54 |
Other Links: | manifest | tags |
Context
2018-09-10
| ||
01:16 | Implement INSERT/UPDATE/DELETE for OBJECTS virtual table (untested) check-in: ec1c70d3d1 user: user tags: trunk | |
2018-08-24
| ||
15:12 | Add OF_BIZARRO flag, change OF_TRACEIN/OF_TRACEOUT to CF_TRACEIN/CF_TRACEOUT, fix a bug in update logic for CLASSES vtab check-in: 966114bc2f user: user tags: trunk | |
2018-08-19
| ||
21:53 | Implement loading level titles (and level version and level code) check-in: 69c81d7254 user: user tags: trunk | |
Changes
Modified exec.c from [f13cb4246e] to [b18753cc8b].
︙ | ︙ | |||
68 69 70 71 72 73 74 | // Allocates a new object of the given class; links into the event list but not into the playfield. // All fields are initialized by the class or to zero. // Does not send any messages or otherwise notify anyone that it has been created. // Returns VOIDLINK if object cannot be created. Uint32 n; Class*cl=classes[c]; Object*o=calloc(1,sizeof(Object)+cl->uservars*sizeof(Value)); | | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | // Allocates a new object of the given class; links into the event list but not into the playfield. // All fields are initialized by the class or to zero. // Does not send any messages or otherwise notify anyone that it has been created. // Returns VOIDLINK if object cannot be created. Uint32 n; Class*cl=classes[c]; Object*o=calloc(1,sizeof(Object)+cl->uservars*sizeof(Value)); if(!c || !cl || cl->cflags&(CF_GROUP|CF_NOCLASS2)) goto bad; if(!o) fatal("Allocation failed\n"); o->class=c; o->generation=generation_number; #define C(x) o->x=cl->x; C(height) C(weight) C(climb) C(density) C(volume) C(strength) C(arrivals) C(departures) C(temperature) C(shape) C(shovable) C(oflags) C(sharp[0]) C(sharp[1]) C(sharp[2]) C(sharp[3]) |
︙ | ︙ |
Modified function.c from [b08b25d50c] to [b0c90043b3].
︙ | ︙ | |||
465 466 467 468 469 470 471 | case 4: // INPUT sqlite3_result_int(cxt,classes[cur->rowid]->cflags&CF_INPUT?1:0); break; case 5: // QUIZ sqlite3_result_int(cxt,classes[cur->rowid]->cflags&CF_QUIZ?1:0); break; case 6: // TRACEIN | | | | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | case 4: // INPUT sqlite3_result_int(cxt,classes[cur->rowid]->cflags&CF_INPUT?1:0); break; case 5: // QUIZ sqlite3_result_int(cxt,classes[cur->rowid]->cflags&CF_QUIZ?1:0); break; case 6: // TRACEIN sqlite3_result_int(cxt,classes[cur->rowid]->cflags&CF_TRACEIN?1:0); break; case 7: // TRACEOUT sqlite3_result_int(cxt,classes[cur->rowid]->cflags&CF_TRACEOUT?1:0); break; case 8: // GROUP if(sqlite3_vtab_nochange(cxt)) return SQLITE_OK; if(classes[cur->rowid]->cflags&CF_GROUP) { char*s=sqlite3_mprintf(" "); if(!s) return SQLITE_NOMEM; for(n=0;classes[cur->rowid]->codes[n];n++) { |
︙ | ︙ | |||
497 498 499 500 501 502 503 | static int vt1_classes_filter(sqlite3_vtab_cursor*pcur,int idxNum,const char*idxStr,int argc,sqlite3_value**argv) { Cursor*cur=(void*)pcur; cur->eof=0; if(argc) { cur->rowid=sqlite3_value_int64(*argv); cur->unique=1; | | | | | | | | | | | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | static int vt1_classes_filter(sqlite3_vtab_cursor*pcur,int idxNum,const char*idxStr,int argc,sqlite3_value**argv) { Cursor*cur=(void*)pcur; cur->eof=0; if(argc) { cur->rowid=sqlite3_value_int64(*argv); cur->unique=1; if(cur->rowid<=0 || cur->rowid>=0x4000 || !classes[cur->rowid] || (classes[cur->rowid]->cflags&CF_NOCLASS2)) cur->eof=1; } else { cur->unique=0; cur->rowid=1; while(cur->rowid<0x4000 && (!classes[cur->rowid] || (classes[cur->rowid]->cflags&CF_NOCLASS2))) ++cur->rowid; if(cur->rowid>=0x4000) cur->eof=1; } return SQLITE_OK; } static int vt1_classes_next(sqlite3_vtab_cursor*pcur) { Cursor*cur=(void*)pcur; if(cur->unique) { cur->eof=1; } else { ++cur->rowid; while(cur->rowid<0x4000 && (!classes[cur->rowid] || (classes[cur->rowid]->cflags&CF_NOCLASS2))) ++cur->rowid; if(cur->rowid>=0x4000) cur->eof=1; } return SQLITE_OK; } static int vt1_classes_update(sqlite3_vtab*vt,int argc,sqlite3_value**argv,sqlite3_int64*rowid) { sqlite3_int64 id; int v[3]; if(argc<2 || sqlite3_value_type(*argv)!=SQLITE_INTEGER) return SQLITE_CONSTRAINT_VTAB; id=sqlite3_value_int64(*argv); if(id!=sqlite3_value_int64(argv[1])) return SQLITE_CONSTRAINT_VTAB; if(id<=0 || id>=0x4000 || !classes[id]) return SQLITE_INTERNAL; v[0]=sqlite3_value_int(argv[7]); v[1]=sqlite3_value_int(argv[8]); v[2]=sqlite3_value_int(argv[9]); if((v[0]|v[1]|v[2])&~1) return SQLITE_CONSTRAINT_CHECK; if(v[0]) classes[id]->cflags|=CF_QUIZ; else classes[id]->cflags&=~CF_QUIZ; classes[id]->cflags&=~(CF_TRACEIN|CF_TRACEOUT); classes[id]->cflags|=(v[1]?CF_TRACEIN:0)|(v[2]?CF_TRACEOUT:0); return SQLITE_OK; } Module(vt_classes, .xColumn=vt1_classes_column, .xFilter=vt1_classes_filter, .xNext=vt1_classes_next, |
︙ | ︙ |
Modified heromesh.h from [2c25e1e23b] to [f8558aace9].
︙ | ︙ | |||
29 30 31 32 33 34 35 | #define NVALUE(x) SVALUE(x,TY_NUMBER) #define CVALUE(x) UVALUE(x,TY_CLASS) #define MVALUE(x) UVALUE(x,TY_MESSAGE) #define ZVALUE(x) UVALUE(x,TY_STRING) #define OVALUE(x) UVALUE(x,objects[x]->generation) #define ValueTo64(v) (((sqlite3_int64)((v).u))|(((sqlite3_int64)((v).t))<<32)) | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #define NVALUE(x) SVALUE(x,TY_NUMBER) #define CVALUE(x) UVALUE(x,TY_CLASS) #define MVALUE(x) UVALUE(x,TY_MESSAGE) #define ZVALUE(x) UVALUE(x,TY_STRING) #define OVALUE(x) UVALUE(x,objects[x]->generation) #define ValueTo64(v) (((sqlite3_int64)((v).u))|(((sqlite3_int64)((v).t))<<32)) #define N_MESSAGES 24 extern const char*const standard_message_names[]; extern const char*const standard_sound_names[]; extern const char*const heromesh_key_names[256]; extern sqlite3*userdb; extern xrm_db*resourcedb; extern const char*basefilename; |
︙ | ︙ | |||
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | // == class == #define CF_PLAYER 0x01 #define CF_INPUT 0x02 #define CF_COMPATIBLE 0x04 #define CF_QUIZ 0x08 #define CF_GROUP 0x10 // this is a group of classes; you can't create an object of this class #define CF_NOCLASS1 0x40 // if only the name has been loaded so far, from the .class file #define CF_NOCLASS2 0x80 // if only the name has been loaded so far, from the CLASS.DEF lump #define OF_INVISIBLE 0x0001 #define OF_VISUALONLY 0x0002 #define OF_STEALTHY 0x0004 #define OF_BUSY 0x0008 #define OF_USERSTATE 0x0010 #define OF_USERSIGNAL 0x0020 #define OF_MOVED 0x0040 #define OF_DONE 0x0080 #define OF_KEYCLEARED 0x0100 #define OF_DESTROYED 0x0200 | > > < | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | // == class == #define CF_PLAYER 0x01 #define CF_INPUT 0x02 #define CF_COMPATIBLE 0x04 #define CF_QUIZ 0x08 #define CF_GROUP 0x10 // this is a group of classes; you can't create an object of this class #define CF_TRACEIN 0x20 #define CF_TRACEOUT 0x40 // same as CF_NOCLASS1 (no problem since CF_NOCLASS1 not used after class loading) #define CF_NOCLASS1 0x40 // if only the name has been loaded so far, from the .class file #define CF_NOCLASS2 0x80 // if only the name has been loaded so far, from the CLASS.DEF lump #define OF_INVISIBLE 0x0001 #define OF_VISUALONLY 0x0002 #define OF_STEALTHY 0x0004 #define OF_BUSY 0x0008 #define OF_USERSTATE 0x0010 #define OF_USERSIGNAL 0x0020 #define OF_MOVED 0x0040 #define OF_DONE 0x0080 #define OF_KEYCLEARED 0x0100 #define OF_DESTROYED 0x0200 #define OF_BIZARRO 0x0400 typedef struct { const char*name; const char*edithelp; // not present if CF_GROUP const char*gamehelp; // not present if CF_GROUP Uint16*codes; // if this is CF_GROUP, then instead a zero-terminated list of classes Uint16*messages; // use 0xFFFF if no such message block; not present if CF_GROUP |
︙ | ︙ |
Modified names.h from [9957cbf76e] to [6e0057f4c8].
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #define MSG_DESTROYED 16 #define MSG_CREATED 17 #define MSG_POSTINIT 18 #define MSG_END_TURN 19 #define MSG_CLEANUP 20 #define MSG_COLLIDING 21 #define MSG_COLLIDE 22 const char*const standard_message_names[]={ "INIT", "CREATE", "DESTROY", "BEGIN_TURN", "ARRIVED", "DEPARTED", | > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #define MSG_DESTROYED 16 #define MSG_CREATED 17 #define MSG_POSTINIT 18 #define MSG_END_TURN 19 #define MSG_CLEANUP 20 #define MSG_COLLIDING 21 #define MSG_COLLIDE 22 #define MSG_BIZARRO_SWAP 23 const char*const standard_message_names[]={ "INIT", "CREATE", "DESTROY", "BEGIN_TURN", "ARRIVED", "DEPARTED", |
︙ | ︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | "DESTROYED", "CREATED", "POSTINIT", "END_TURN", "CLEANUP", "COLLIDING", "COLLIDE", }; #define SND_SPLASH 0 #define SND_POUR 1 #define SND_DOOR 2 #define SND_GLASS 3 #define SND_BANG 4 #define SND_UNHH 5 | > | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | "DESTROYED", "CREATED", "POSTINIT", "END_TURN", "CLEANUP", "COLLIDING", "COLLIDE", "BIZARRO_SWAP", }; #define SND_SPLASH 0 #define SND_POUR 1 #define SND_DOOR 2 #define SND_GLASS 3 #define SND_BANG 4 #define SND_UNHH 5 |
︙ | ︙ |
Modified names.js from [42af4f0845] to [1f5387d203].
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 17 = CREATED 18 = POSTINIT 19 = END_TURN // New 20 = CLEANUP 21 = COLLIDING 22 = COLLIDE `.split("\n").map(x=>/^ *([0-9]+) = ([^ ]*) *$/.exec(x)).filter(x=>x); const standard_sound_names=[]; ` SPLASH POUR DOOR GLASS | > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 17 = CREATED 18 = POSTINIT 19 = END_TURN // New 20 = CLEANUP 21 = COLLIDING 22 = COLLIDE 23 = BIZARRO_SWAP `.split("\n").map(x=>/^ *([0-9]+) = ([^ ]*) *$/.exec(x)).filter(x=>x); const standard_sound_names=[]; ` SPLASH POUR DOOR GLASS |
︙ | ︙ |