Overview
| Comment: | A few minor corrections, including displaying width/height of level in editor and allowing loading levels by index. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
01830be55a81229a6c94cde6de4da0fd |
| User & Date: | user on 2018-10-26 06:47:14.035 |
| Other Links: | manifest | tags |
Context
|
2018-10-26
| ||
| 08:12 | Implement scrollbars check-in: 633696a6f5 user: user tags: trunk | |
| 06:47 | A few minor corrections, including displaying width/height of level in editor and allowing loading levels by index. check-in: 01830be55a user: user tags: trunk | |
|
2018-10-23
| ||
| 03:31 | Add implementation of loading level index check-in: 17b9aedf92 user: user tags: trunk | |
Changes
Modified bindings.c
from [7677516cfd]
to [21ad796e4d].
| ︙ | |||
199 200 201 202 203 204 205 | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | - + |
if(!name) return 0;
sqlite3_bind_text(cmd->stmt,i,name,-1,SQLITE_TRANSIENT);
}
}
}
while((i=sqlite3_step(cmd->stmt))==SQLITE_ROW) {
if(i=sqlite3_data_count(cmd->stmt)) {
|
| ︙ |
Modified edit.c
from [e979aee854]
to [ce143bd0c0].
| ︙ | |||
52 53 54 55 56 57 58 59 60 61 62 | 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 85 86 87 | + + + - + - + |
snprintf(buf,32,"%5d",level_version);
draw_text(0,16,"V",0xF0,0xF7);
draw_text(16,16,buf,0xF0,0xFF);
snprintf(buf,32,"%5d",level_code);
draw_text(0,24,"C",0xF0,0xF7);
draw_text(16,24,buf,0xF0,0xFF);
}
snprintf(buf,8,"%2dx%2d",pfwidth,pfheight);
draw_text(8,32,buf,0xF0,0xFD);
draw_text(24,32,"x",0xF0,0xF5);
x=x>=left_margin?(x-left_margin)/picture_size+1:0;
y=y/picture_size+1;
if(x>0 && y>0 && x<=pfwidth && y<=pfheight) snprintf(buf,8,"(%2d,%2d)",x,y);
else strcpy(buf," ");
|
| ︙ | |||
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | + |
break;
case SDL_MOUSEMOTION:
set_cursor(ev.motion.x<left_margin?XC_arrow:XC_tcross);
show_mouse_xy(&ev);
break;
case SDL_MOUSEBUTTONDOWN:
if(ev.button.x<left_margin) break;
// fallthrough
case SDL_KEYDOWN:
i=exec_key_binding(&ev,1,0,0,editor_command,0);
if(i==-1) exit(0);
if(i==-2) {
main_options['e']=0;
return;
}
redraw_editor();
break;
}
}
}
|
Modified main.c
from [d47c90633f]
to [fed1a85264].
| ︙ | |||
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | + + + + + |
const char*load_level(int lvl) {
// Load level by ID. Returns null pointer if successful, or an error message if it failed.
long sz=0;
unsigned char*buf=lvl>=0?read_lump(FIL_LEVEL,lvl,&sz,0):0;
unsigned char*p=buf;
unsigned char*end=buf+sz;
int i,n,x,y,z;
Uint16 lo=0;
Uint32 o;
Uint32 mru[2];
if(lvl<0 && level_index && -lvl<=level_nindex) {
lo=-lvl;
lvl=level_index[~lvl];
}
if(lvl<0) return "Invalid level ID";
if(!buf) return "Cannot find level";
free(level_title);
level_title=0;
annihilate();
generation_number=TY_MAXTYPE+1;
level_version=p[0]|(p[1]<<8);
|
| ︙ | |||
306 307 308 309 310 311 312 | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | - - + + |
}
}
}
// skip level strings for now
if(p>end) goto bad1;
free(buf);
level_id=lvl;
|
| ︙ |