Overview
Comment: | Types, bug fixes, and test mode |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3df78ec087d196b27c71c781e45e8988 |
User & Date: | user on 2018-04-08 23:31:47 |
Other Links: | manifest | tags |
Context
2018-04-09
| ||
04:15 | Faster key bindings, and testing for key bindings check-in: c8eb0a9e48 user: user tags: trunk | |
2018-04-08
| ||
23:31 | Types, bug fixes, and test mode check-in: 3df78ec087 user: user tags: trunk | |
2018-04-06
| ||
21:00 | Add init_screen() and starting the type defintions for classes, and fix the picture loader to work with zoomed pictures check-in: 88e748ef6d user: user tags: trunk | |
Changes
Modified heromesh.h from [89443417d7] to [0f695d01fc].
1 2 3 4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | - + + + + + + + + + + + + + + + + + + + + + + + + - + - + + - - - - - + + + + + - - - + + + | /* This file is part of Free Hero Mesh and is public domain. */ |
Modified main.c from [6d5db62424] to [9c681f49a8].
︙ | |||
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | + + + + - - - | #define MOD_META 8 #define MOD_NUMLOCK 14 typedef struct { UserCommand m[16]; } KeyBinding; static const char schema[]= "BEGIN;" "PRAGMA APPLICATION_ID(1296388936);" "PRAGMA RECURSIVE_TRIGGERS(1);" "CREATE TABLE IF NOT EXISTS `USERCACHEINDEX`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT, `TIME` INT);" "CREATE TEMPORARY TABLE `PICTURES`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT, `OFFSET` INT);" "COMMIT;" ; sqlite3*userdb; xrm_db*resourcedb; const char*basefilename; xrm_quark optionquery[16]; Uint32 generation_number; static const char*globalclassname; static SDL_Cursor*cursor[77]; static FILE*levelfp; static FILE*solutionfp; static FILE*hamarc_fp; static long hamarc_pos; static char main_options[128]; static KeyBinding*editor_bindings[SDLK_LAST]; static KeyBinding*game_bindings[SDLK_LAST]; static KeyBinding*editor_mouse_bindings[4]; static KeyBinding*game_mouse_bindings[4]; |
︙ | |||
129 130 131 132 133 134 135 | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | - + | } if(sqlite3_exec(userdb,schema,0,0,&s)) fatal("Failed to initialize database schema (%s)\n",s?:"unknown error"); optionquery[1]=Q_sqlInit; v=xrm_get_resource(resourcedb,optionquery,optionquery,2); if(v && sqlite3_exec(userdb,v,0,0,&s)) fatal("Failed to execute user-defined SQL statements (%s)\n",s?:"unknown error"); } |
︙ | |||
274 275 276 277 278 279 280 281 282 | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + - - + + + + + + | optionquery[2]=Q_ctrl; SetMouseBinding(SDL_BUTTON_RIGHT,4,MOD_CTRL); optionquery[2]=Q_alt; SetMouseBinding(SDL_BUTTON_RIGHT,4,MOD_ALT); optionquery[2]=Q_meta; SetMouseBinding(SDL_BUTTON_RIGHT,4,MOD_META); } static int test_sql_callback(void*usr,int argc,char**argv,char**name) { int i; if(argc) printf("%s",*argv); for(i=1;i<argc;i++) printf("|%s",argv[i]); putchar('\n'); return 0; } static void test_mode(void) { Uint32 n=0; SDL_Event ev; char buf[32]; set_cursor(XC_tcross); SDL_LockSurface(screen); draw_text(0,0,"Hello, World!",0xF0,0xFF); SDL_UnlockSurface(screen); SDL_Flip(screen); while(SDL_WaitEvent(&ev)) switch(ev.type) { case SDL_KEYDOWN: switch(ev.key.keysym.sym) { case SDLK_BACKSPACE: n/=10; snprintf(buf,30,"%u",n); SDL_WM_SetCaption(buf,buf); break; case SDLK_SPACE: n=0; SDL_WM_SetCaption("0","0"); break; case SDLK_0 ... SDLK_9: n=10*n+ev.key.keysym.sym-SDLK_0; snprintf(buf,30,"%u",n); SDL_WM_SetCaption(buf,buf); break; case SDLK_c: SDL_FillRect(screen,0,n); SDL_Flip(screen); break; case SDLK_p: sqlite3_exec(userdb,"SELECT * FROM `PICTURES`;",test_sql_callback,0,0); break; case SDLK_q: exit(0); break; } break; case SDL_MOUSEBUTTONDOWN: draw_picture(ev.button.x,ev.button.y,n); SDL_Flip(screen); break; case SDL_QUIT: exit(0); break; } fatal("An error occurred waiting for events.\n"); } int main(int argc,char**argv) { int optind=1; while(argc>optind && argv[optind][0]=='-') { int i; const char*s=argv[optind++]; if(s[1]=='-' && !s[2]) break; for(i=1;s[i];i++) main_options[s[i]&127]=1; } |
Modified picture.c from [a53d3b6194] to [2526d2ec5f].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | - - | #include <string.h> #include "sqlite3.h" #include "smallxrm.h" #include "pcfont.h" #include "quarks.h" #include "heromesh.h" |
︙ | |||
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | + + | int xx,yy; const unsigned char*f; if(x+8*len>screen->w) len=(screen->w-x)>>3; if(len<=0 || y+8>screen->h) return; pix+=y*pitch+x; while(*t) { f=fontdata+(*t<<3); p=pix; for(yy=0;yy<8;yy++) { for(xx=0;xx<8;xx++) p[xx]=(*f<<xx)&128?fg:bg; p+=pitch; ++f; } t++; if(!--len) return; pix+=8; } } static Uint16 decide_picture_size(int nwantsize,const Uint8*wantsize,const Uint16*havesize) { int i,j; if(!nwantsize) fatal("Unable to determine what picture size is wanted\n"); for(i=0;i<nwantsize;i++) if(havesize[j=wantsize[i]]) return j; |
︙ | |||
245 246 247 248 249 250 251 | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | - + | } nam[i]=0; if(i>4 && !memcmp(".IMG",nam+i-4,4)) { j=1; if(n++==32768) fatal("Too many pictures\n"); sqlite3_reset(st); sqlite3_bind_int(st,1,n); |
︙ | |||
319 320 321 322 323 324 325 | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | + + + + + + + - + + | case 'p': i|=SDL_HWPALETTE; break; case 'r': i|=SDL_RESIZABLE; break; case 'y': i|=SDL_ASYNCBLIT; break; } if(!(i&SDL_HWSURFACE)) i|=SDL_SWSURFACE; screen=SDL_SetVideoMode(w,h,8,i); if(!screen) fatal("Failed to initialize screen mode: %s\n",SDL_GetError()); optionquery[1]=Q_keyRepeat; if(v=xrm_get_resource(resourcedb,optionquery,optionquery,2)) { w=strtol(v,(void*)&v,10); h=strtol(v,0,10); SDL_EnableKeyRepeat(w,h); } else { SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,SDL_DEFAULT_REPEAT_INTERVAL); |
Modified quarks from [58f69cd9fa] to [d5aac816d7].
︙ | |||
200 201 202 203 204 205 206 207 | 200 201 202 203 204 205 206 207 208 209 210 | + + + | ! SQL settings sqlInit sqlExtensions sqlMemStatus sqlSmallAllocations sqlCoveringIndexScan sqlPowerSafe ! Miscellaneous level |
Modified quarks.h from [6487272797] to [16698ee816].
︙ | |||
167 168 169 170 171 172 173 174 175 176 177 178 179 180 | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | + | #define Q_solutionTimestamp 168 #define Q_sqlInit 169 #define Q_sqlExtensions 170 #define Q_sqlMemStatus 171 #define Q_sqlSmallAllocations 172 #define Q_sqlCoveringIndexScan 173 #define Q_sqlPowerSafe 174 #define Q_level 175 static const char*const global_quarks[]={ "screenWidth", "screenHeight", "palette", "popupColors", "imageSize", "altImage", |
︙ | |||
341 342 343 344 345 346 347 348 349 350 351 352 353 354 | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | + | "solutionTimestamp", "sqlInit", "sqlExtensions", "sqlMemStatus", "sqlSmallAllocations", "sqlCoveringIndexScan", "sqlPowerSafe", "level", 0}; #ifdef HEROMESH_MAIN static const SDLKey quark_to_key[Q_undo+1-Q_backspace]={ SDLK_BACKSPACE, SDLK_TAB, SDLK_CLEAR, SDLK_RETURN, |
︙ |