Mercurial > hg > openttd
comparison console.c @ 135:5f7d4f435388 draft
(svn r136) -Feature/Fix: Console Rev #2 and WKC_BACKQUOTE this patch adds new features to the ingame console and inserts a new keymanagement for windows pcs... (sign_de)
author | darkvater <darkvater@openttd.org> |
---|---|
date | Tue, 24 Aug 2004 22:41:42 +0000 |
parents | dcb4023d7cf5 |
children | b1efd00ffd88 |
comparison
equal
deleted
inserted
replaced
134:5d29a891e888 | 135:5f7d4f435388 |
---|---|
20 static byte _iconsole_color_default = 1; | 20 static byte _iconsole_color_default = 1; |
21 static byte _iconsole_color_error = 3; | 21 static byte _iconsole_color_error = 3; |
22 static byte _iconsole_color_debug = 5; | 22 static byte _iconsole_color_debug = 5; |
23 static byte _iconsole_color_commands = 2; | 23 static byte _iconsole_color_commands = 2; |
24 static Window *_iconsole_win = NULL; | 24 static Window *_iconsole_win = NULL; |
25 static byte _iconsole_scroll; | |
25 | 26 |
26 // ** console cursor ** // | 27 // ** console cursor ** // |
27 static bool _icursor_state; | 28 static bool _icursor_state; |
28 static byte _icursor_rate; | 29 static byte _icursor_rate; |
29 static byte _icursor_counter; | 30 static byte _icursor_counter; |
44 | 45 |
45 static _iconsole_cmd * _iconsole_cmds; // list of registred commands | 46 static _iconsole_cmd * _iconsole_cmds; // list of registred commands |
46 static _iconsole_var * _iconsole_vars; // list of registred vars | 47 static _iconsole_var * _iconsole_vars; // list of registred vars |
47 | 48 |
48 // ** console std lib ** // | 49 // ** console std lib ** // |
49 static byte _stdlib_developer=0; | 50 static byte _stdlib_developer=1; |
50 static void IConsoleStdLibRegister(); | 51 static void IConsoleStdLibRegister(); |
51 static byte * _stdlib_temp_string; | |
52 static byte * _stdlib_temp_pointer; | |
53 static uint32 _stdlib_temp_uint32; | |
54 static bool _stdlib_temp_bool; | |
55 | 52 |
56 /* *************** */ | 53 /* *************** */ |
57 /* end of header */ | 54 /* end of header */ |
58 /* *************** */ | 55 /* *************** */ |
59 | 56 |
70 switch(e->event) { | 67 switch(e->event) { |
71 | 68 |
72 case WE_PAINT: | 69 case WE_PAINT: |
73 GfxFillRect(w->left,w->top,w->width,w->height-1,0); | 70 GfxFillRect(w->left,w->top,w->width,w->height-1,0); |
74 { | 71 { |
75 int i=79; | 72 int i=_iconsole_scroll; |
76 int max=(w->height/12)-1; | 73 int max=(w->height/12)-1; |
77 while ((i>79-max) && (_iconsole_buffer[i]!=NULL)) { | 74 while ((i>_iconsole_scroll-max) && (_iconsole_buffer[i]!=NULL)) { |
78 DoDrawString(_iconsole_buffer[i],5,w->height-((81-i)*12),_iconsole_cbuffer[i]); | 75 DoDrawString(_iconsole_buffer[i],5,w->height-(((_iconsole_scroll+2)-i)*12),_iconsole_cbuffer[i]); |
79 i--; | 76 i--; |
80 } | 77 } |
81 DoDrawString((char *)&_iconsole_cmdline,5,w->height-12,_iconsole_color_commands); | 78 DoDrawString("]",5,w->height-12,_iconsole_color_commands); |
79 DoDrawString((char *)&_iconsole_cmdline,10,w->height-12,_iconsole_color_commands); | |
82 } | 80 } |
83 break; | 81 break; |
84 | 82 |
85 case WE_TICK: | 83 case WE_TICK: |
86 | 84 |
95 int posx; | 93 int posx; |
96 int posy; | 94 int posy; |
97 int color; | 95 int color; |
98 _cur_dpi=&_screen; | 96 _cur_dpi=&_screen; |
99 if (_icursor_state) color=14; else color=0; | 97 if (_icursor_state) color=14; else color=0; |
100 posx=5+GetStringWidth((char *)&_iconsole_cmdline); | 98 posx=10+GetStringWidth((char *)&_iconsole_cmdline); |
101 posy=w->height-3; | 99 posy=w->height-3; |
102 GfxFillRect(posx,posy,posx+5,posy+1,color); | 100 GfxFillRect(posx,posy,posx+5,posy+1,color); |
103 _video_driver->make_dirty(posx,posy,5,1); | 101 _video_driver->make_dirty(posx,posy,5,1); |
104 } | 102 } |
105 _icursor_counter=0; | 103 _icursor_counter=0; |
106 } | 104 } |
107 break; | 105 break; |
108 | 106 |
109 case WE_KEYPRESS: | 107 case WE_KEYPRESS: |
110 e->keypress.cont=false; | 108 e->keypress.cont=false; |
109 if (e->keypress.keycode == WKC_PAGEUP) | |
110 { | |
111 if ((_iconsole_scroll - ((w->height/12)-1))<0) { | |
112 _iconsole_scroll = 0; | |
113 } else { | |
114 _iconsole_scroll -= (w->height/12)-1; | |
115 } | |
116 SetWindowDirty(w); | |
117 } else | |
118 if (e->keypress.keycode == WKC_PAGEDOWN) | |
119 { | |
120 if ((_iconsole_scroll + ((w->height/12)-1))>79) { | |
121 _iconsole_scroll = 79; | |
122 } else { | |
123 _iconsole_scroll += (w->height/12)-1; | |
124 } | |
125 SetWindowDirty(w); | |
126 } else | |
127 if (e->keypress.keycode == WKC_UP) | |
128 { | |
129 if ((_iconsole_scroll - 1)<0) { | |
130 _iconsole_scroll = 0; | |
131 } else { | |
132 _iconsole_scroll -= 1; | |
133 } | |
134 SetWindowDirty(w); | |
135 } else | |
136 if (e->keypress.keycode == WKC_DOWN) | |
137 { | |
138 if ((_iconsole_scroll + 1)>79) { | |
139 _iconsole_scroll = 79; | |
140 } else { | |
141 _iconsole_scroll += 1; | |
142 } | |
143 SetWindowDirty(w); | |
144 } else | |
111 if (e->keypress.keycode == WKC_BACKQUOTE) | 145 if (e->keypress.keycode == WKC_BACKQUOTE) |
112 { | 146 { |
113 IConsoleSwitch(); | 147 IConsoleSwitch(); |
114 } else | 148 } else |
115 if (e->keypress.keycode == WKC_RETURN) | 149 if (e->keypress.keycode == WKC_RETURN) |
124 _iconsole_cmdline[_iconsole_cmdpos]=0; | 158 _iconsole_cmdline[_iconsole_cmdpos]=0; |
125 SetWindowDirty(w); | 159 SetWindowDirty(w); |
126 } else | 160 } else |
127 if (IS_INT_INSIDE((e->keypress.ascii), 32, 256)) | 161 if (IS_INT_INSIDE((e->keypress.ascii), 32, 256)) |
128 { | 162 { |
163 _iconsole_scroll=79; | |
129 _iconsole_cmdline[_iconsole_cmdpos]=e->keypress.ascii; | 164 _iconsole_cmdline[_iconsole_cmdpos]=e->keypress.ascii; |
130 if (_iconsole_cmdpos!=255) _iconsole_cmdpos++; | 165 if (_iconsole_cmdpos!=255) _iconsole_cmdpos++; |
131 SetWindowDirty(w); | 166 SetWindowDirty(w); |
132 e->keypress.keycode=0; | |
133 } else e->keypress.cont=true; | 167 } else e->keypress.cont=true; |
134 break; | 168 break; |
135 | 169 |
136 } | 170 } |
137 } | 171 } |
138 | 172 |
139 void IConsoleInit() | 173 void IConsoleInit() |
140 { | 174 { |
141 int i; | 175 int i; |
176 #if defined(WITH_REV) | |
177 extern char _openttd_revision[]; | |
178 #endif | |
179 _iconsole_scroll=79; | |
142 _iconsole_inited=true; | 180 _iconsole_inited=true; |
143 _iconsole_mode=ICONSOLE_CLOSED; | 181 _iconsole_mode=ICONSOLE_CLOSED; |
144 _iconsole_win=NULL; | 182 _iconsole_win=NULL; |
145 _icursor_state=false; | 183 _icursor_state=false; |
146 _icursor_rate=5; | 184 _icursor_rate=5; |
147 _icursor_counter=0; | 185 _icursor_counter=0; |
148 for (i=0;i<80;i++) _iconsole_buffer[i]=NULL; | 186 for (i=0;i<80;i++) _iconsole_buffer[i]=NULL; |
149 IConsoleStdLibRegister(); | 187 IConsoleStdLibRegister(); |
150 IConsolePrint(12,"OpenTTD Game Console Build #"); | 188 #if defined(WITH_REV) |
189 IConsolePrintF(13,"OpenTTD Game Console %s",_openttd_revision); | |
190 #else | |
191 IConsolePrint(13,"OpenTTD Game Console"); | |
192 #endif | |
151 IConsolePrint(12,"---------------------------------"); | 193 IConsolePrint(12,"---------------------------------"); |
194 IConsolePrint(12,"use \"help\" for more info"); | |
195 IConsolePrint(12,""); | |
152 IConsoleClearCommand(); | 196 IConsoleClearCommand(); |
153 } | 197 } |
154 | 198 |
155 void IConsoleClear() | 199 void IConsoleClear() |
156 { | 200 { |
278 while (item->_next != NULL) { item = item->_next; }; | 322 while (item->_next != NULL) { item = item->_next; }; |
279 item->_next = item_new; | 323 item->_next = item_new; |
280 } | 324 } |
281 } | 325 } |
282 | 326 |
283 static void* IConsoleCmdGetAddr(byte * name) { | 327 void* IConsoleCmdGetAddr(byte * name) { |
284 _iconsole_cmd * item; | 328 _iconsole_cmd * item; |
285 | 329 |
286 item = _iconsole_cmds; | 330 item = _iconsole_cmds; |
287 while (item != NULL) { | 331 while (item != NULL) { |
288 if (strcmp(item->name,name)==0) return item->addr; | 332 if (strcmp(item->name,name)==0) return item->addr; |
307 | 351 |
308 item_new->_next = NULL; | 352 item_new->_next = NULL; |
309 item_new->addr = addr; | 353 item_new->addr = addr; |
310 item_new->name = _new; | 354 item_new->name = _new; |
311 item_new->type = type; | 355 item_new->type = type; |
356 item_new->_malloc = false; | |
312 | 357 |
313 item = _iconsole_vars; | 358 item = _iconsole_vars; |
314 if (item == NULL) { | 359 if (item == NULL) { |
315 _iconsole_vars = item_new; | 360 _iconsole_vars = item_new; |
316 } else { | 361 } else { |
317 while (item->_next != NULL) { item = item->_next; }; | 362 while (item->_next != NULL) { item = item->_next; }; |
318 item->_next = item_new; | 363 item->_next = item_new; |
319 } | 364 } |
320 } | 365 } |
321 | 366 |
367 void IConsoleVarInsert(_iconsole_var * var, byte * name) { | |
368 byte * _new; | |
369 _iconsole_var * item; | |
370 _iconsole_var * item_new; | |
371 int i; | |
372 | |
373 item_new = var; | |
374 | |
375 // dont allow to build variable rings | |
376 if (item_new->_next != NULL) return; | |
377 | |
378 i=strlen((char *)name)+1; | |
379 _new=malloc(i+1); | |
380 memset(_new,0,i+1); | |
381 _new[0]='*'; | |
382 memcpy(_new+1,name,i); | |
383 | |
384 item_new->name = _new; | |
385 | |
386 item = _iconsole_vars; | |
387 if (item == NULL) { | |
388 _iconsole_vars = item_new; | |
389 } else { | |
390 while (item->_next != NULL) { item = item->_next; }; | |
391 item->_next = item_new; | |
392 } | |
393 } | |
394 | |
395 | |
322 _iconsole_var * IConsoleVarGet(byte * name) { | 396 _iconsole_var * IConsoleVarGet(byte * name) { |
323 _iconsole_var * item; | 397 _iconsole_var * item; |
324 | 398 |
325 item = _iconsole_vars; | 399 item = _iconsole_vars; |
326 while (item != NULL) { | 400 while (item != NULL) { |
328 item = item->_next; | 402 item = item->_next; |
329 } | 403 } |
330 return NULL; | 404 return NULL; |
331 } | 405 } |
332 | 406 |
333 static void IConsoleVarStringSet(_iconsole_var * var, byte * string) { | 407 _iconsole_var * IConsoleVarAlloc(byte type) { |
408 _iconsole_var * item; | |
409 item=malloc(sizeof(_iconsole_var)); | |
410 item->_next = NULL; | |
411 item->name = ""; | |
412 item->type = type; | |
413 switch (item->type) { | |
414 case ICONSOLE_VAR_BOOLEAN: | |
415 { | |
416 item->addr=malloc(sizeof(bool)); | |
417 memset(item->addr,0,sizeof(bool)); | |
418 item->_malloc=true; | |
419 } | |
420 break; | |
421 case ICONSOLE_VAR_BYTE: | |
422 { | |
423 item->addr=malloc(sizeof(byte)); | |
424 memset(item->addr,0,sizeof(byte)); | |
425 item->_malloc=true; | |
426 } | |
427 break; | |
428 case ICONSOLE_VAR_UINT16: | |
429 { | |
430 item->addr=malloc(sizeof(unsigned short)); | |
431 memset(item->addr,0,sizeof(unsigned short)); | |
432 item->_malloc=true; | |
433 } | |
434 break; | |
435 case ICONSOLE_VAR_UINT32: | |
436 { | |
437 item->addr=malloc(sizeof(unsigned int)); | |
438 memset(item->addr,0,sizeof(unsigned int)); | |
439 item->_malloc=true; | |
440 } | |
441 break; | |
442 case ICONSOLE_VAR_INT16: | |
443 { | |
444 item->addr=malloc(sizeof(signed short)); | |
445 memset(item->addr,0,sizeof(signed short)); | |
446 item->_malloc=true; | |
447 } | |
448 break; | |
449 case ICONSOLE_VAR_INT32: | |
450 { | |
451 item->addr=malloc(sizeof(signed int)); | |
452 memset(item->addr,0,sizeof(signed int)); | |
453 item->_malloc=true; | |
454 } | |
455 break; | |
456 default: | |
457 item->addr = NULL; | |
458 item->_malloc = false; | |
459 break; | |
460 } | |
461 return item; | |
462 } | |
463 | |
464 | |
465 void IConsoleVarFree(_iconsole_var * var) { | |
466 if (var ->_malloc) { | |
467 free(var ->addr); | |
468 } | |
469 free(var); | |
470 } | |
471 | |
472 void IConsoleVarSetString(_iconsole_var * var, byte * string) { | |
334 int l; | 473 int l; |
335 | 474 |
336 if (strlen((byte *) var->addr)!=0) { | 475 if (var->_malloc) { |
337 free(var->addr); | 476 free(var->addr); |
338 } | 477 } |
478 | |
339 l=strlen((char *) string); | 479 l=strlen((char *) string); |
340 var->addr=malloc(l+1); | 480 var->addr=malloc(l+1); |
481 var->_malloc=true; | |
341 memset(var->addr,0,l); | 482 memset(var->addr,0,l); |
342 memcpy((void *) var->addr,(void *) string, l); | 483 memcpy((void *) var->addr,(void *) string, l); |
343 ((byte *)var->addr)[l]=0; | 484 ((byte *)var->addr)[l]=0; |
344 } | 485 } |
345 | 486 |
487 void IConsoleVarSetValue(_iconsole_var * var, int value) { | |
488 switch (var->type) { | |
489 case ICONSOLE_VAR_BOOLEAN: | |
490 { | |
491 (*(bool *)var->addr)=(value!=0); | |
492 } | |
493 break; | |
494 case ICONSOLE_VAR_BYTE: | |
495 { | |
496 (*(byte *)var->addr)=value; | |
497 } | |
498 break; | |
499 case ICONSOLE_VAR_UINT16: | |
500 { | |
501 (*(unsigned short *)var->addr)=value; | |
502 } | |
503 break; | |
504 case ICONSOLE_VAR_UINT32: | |
505 { | |
506 (*(unsigned int *)var->addr)=value; | |
507 } | |
508 break; | |
509 case ICONSOLE_VAR_INT16: | |
510 { | |
511 (*(signed short *)var->addr)=value; | |
512 } | |
513 break; | |
514 case ICONSOLE_VAR_INT32: | |
515 { | |
516 (*(signed int *)var->addr)=value; | |
517 } | |
518 break; | |
519 default: | |
520 break; | |
521 } | |
522 } | |
523 | |
524 void IConsoleVarDump(_iconsole_var * var, byte * dump_desc) { | |
525 | |
526 byte var_b; // TYPE BYTE | |
527 unsigned short var_ui16; // TYPE UINT16 | |
528 unsigned int var_ui32; // TYPE UINT32 | |
529 signed short var_i16; // TYPE INT16 | |
530 signed int var_i32; // TYPE INT32 | |
531 byte * var_s; // TYPE STRING | |
532 | |
533 if (dump_desc==NULL) dump_desc = var->name; | |
534 | |
535 switch (var->type) { | |
536 case ICONSOLE_VAR_BOOLEAN: | |
537 { | |
538 if (*(bool *)var->addr) { | |
539 IConsolePrintF(_iconsole_color_default, "%s = true",dump_desc); | |
540 } else { | |
541 IConsolePrintF(_iconsole_color_default, "%s = false",dump_desc); | |
542 } | |
543 } | |
544 break; | |
545 case ICONSOLE_VAR_BYTE: | |
546 { | |
547 var_b=*(byte *)var->addr; | |
548 IConsolePrintF(_iconsole_color_default, "%s = %i",dump_desc,var_b); | |
549 } | |
550 break; | |
551 case ICONSOLE_VAR_UINT16: | |
552 { | |
553 var_ui16=*(unsigned short *)var->addr; | |
554 IConsolePrintF(_iconsole_color_default, "%s = %i",dump_desc,var_ui16); | |
555 } | |
556 break; | |
557 case ICONSOLE_VAR_UINT32: | |
558 { | |
559 var_ui32=*(unsigned int *)var->addr; | |
560 IConsolePrintF(_iconsole_color_default, "%s = %i",dump_desc,var_ui32); | |
561 } | |
562 break; | |
563 case ICONSOLE_VAR_INT16: | |
564 { | |
565 var_i16=*(signed short *)var->addr; | |
566 IConsolePrintF(_iconsole_color_default, "%s = %i",dump_desc,var_i16); | |
567 } | |
568 break; | |
569 case ICONSOLE_VAR_INT32: | |
570 { | |
571 var_i32=*(signed int *)var->addr; | |
572 IConsolePrintF(_iconsole_color_default, "%s = %i",dump_desc,var_i32); | |
573 } | |
574 break; | |
575 case ICONSOLE_VAR_STRING: | |
576 { | |
577 var_s=(byte *)var->addr; | |
578 IConsolePrintF(_iconsole_color_default, "%s = %s",dump_desc,var_s); | |
579 } | |
580 break; | |
581 case ICONSOLE_VAR_UNKNOWN: | |
582 case ICONSOLE_VAR_POINTER: | |
583 { | |
584 var_i32=(signed int)((byte *)var->addr); | |
585 IConsolePrintF(_iconsole_color_default, "%s = @%i",dump_desc,var_i32); | |
586 } | |
587 break; | |
588 } | |
589 | |
590 } | |
591 | |
346 void IConsoleCmdExec(byte * cmdstr) { | 592 void IConsoleCmdExec(byte * cmdstr) { |
347 void (*function)(byte argc, byte* argv[], byte argt[]); | 593 _iconsole_var * (*function)(byte argc, byte* argv[], byte argt[]); |
348 byte * tokens[20]; | 594 byte * tokens[20]; |
349 byte tokentypes[20]; | 595 byte tokentypes[20]; |
350 byte * tokenstream; | 596 byte * tokenstream; |
351 byte * tokenstream_s; | 597 byte * tokenstream_s; |
352 byte execution_mode; | 598 byte execution_mode; |
353 _iconsole_var * var = NULL; | 599 _iconsole_var * var = NULL; |
354 | 600 _iconsole_var * result = NULL; |
355 byte var_b; // TYPE BYTE | |
356 unsigned short var_ui16; // TYPE UINT16 | |
357 unsigned int var_ui32; // TYPE UINT32 | |
358 signed short var_i16; // TYPE INT16 | |
359 signed int var_i32; // TYPE INT32 | |
360 byte * var_s; // TYPE STRING | |
361 | 601 |
362 bool longtoken; | 602 bool longtoken; |
363 bool valid_token; | 603 bool valid_token; |
364 bool skip_lt_change; | 604 bool skip_lt_change; |
365 | 605 |
435 | 675 |
436 //** interpreting **// | 676 //** interpreting **// |
437 | 677 |
438 for (i=0; i<c; i++) { | 678 for (i=0; i<c; i++) { |
439 if (i>0) if (strlen((char *) tokens[i])>0) { | 679 if (i>0) if (strlen((char *) tokens[i])>0) { |
680 tokentypes[i]=ICONSOLE_VAR_UNKNOWN; | |
440 if (tokens[i][0]=='*') { | 681 if (tokens[i][0]=='*') { |
441 var = IConsoleVarGet(tokens[i]); | 682 var = IConsoleVarGet(tokens[i]); |
442 if (var!=NULL) { | 683 if (var!=NULL) { |
443 tokens[i]=(byte *)var->addr; | 684 tokens[i]=(byte *)var->addr; |
444 tokentypes[i]=var->type; | 685 tokentypes[i]=var->type; |
445 } | 686 } |
446 } else { | |
447 tokentypes[i]=ICONSOLE_VAR_STRING; | |
448 } | 687 } |
449 } | 688 } |
450 } | 689 } |
451 | 690 |
452 execution_mode=0; | 691 execution_mode=0; |
456 execution_mode=1; // this is a command | 695 execution_mode=1; // this is a command |
457 } else { | 696 } else { |
458 var = IConsoleVarGet(tokens[0]); | 697 var = IConsoleVarGet(tokens[0]); |
459 if (var != NULL) { | 698 if (var != NULL) { |
460 execution_mode=2; // this is a variable | 699 execution_mode=2; // this is a variable |
700 if (c>2) if (strcmp(tokens[1],"<<")==0) { | |
701 // this is command to variable mode [normal] | |
702 function = IConsoleCmdGetAddr(tokens[2]); | |
703 if (function != NULL) { | |
704 execution_mode=3; | |
705 } | |
706 } | |
461 } | 707 } |
462 } | 708 } |
463 | 709 |
464 //** executing **// | 710 //** executing **// |
465 | 711 |
471 } | 717 } |
472 break; | 718 break; |
473 case 1: | 719 case 1: |
474 { | 720 { |
475 // execution with command syntax | 721 // execution with command syntax |
476 function(c,tokens,tokentypes); | 722 result = function(c,tokens,tokentypes); |
723 if (result!=NULL) { | |
724 IConsoleVarDump(result,"result"); | |
725 IConsoleVarFree(result); | |
726 } | |
477 } | 727 } |
478 break; | 728 break; |
479 case 2: | 729 case 2: |
480 { | 730 { |
481 // execution with variable syntax | 731 // execution with variable syntax |
484 switch (var->type) { | 734 switch (var->type) { |
485 case ICONSOLE_VAR_BOOLEAN: | 735 case ICONSOLE_VAR_BOOLEAN: |
486 { | 736 { |
487 if (strcmp(tokens[1],"=")==0) { | 737 if (strcmp(tokens[1],"=")==0) { |
488 if (c==3) { | 738 if (c==3) { |
489 *(bool *)var->addr=(atoi((char *) tokens[2])==1); | 739 *(bool *)var->addr=(atoi((char *) tokens[2])!=0); |
490 c=1; | 740 IConsoleVarDump(var,NULL); |
491 } else { | 741 } else { |
492 *(bool *)var->addr=false; | 742 *(bool *)var->addr=false; |
493 c=1; | 743 IConsoleVarDump(var,NULL); |
494 } | 744 } |
495 } | 745 } |
496 else if (strcmp(tokens[1],"++")==0) { | 746 else if (strcmp(tokens[1],"++")==0) { |
497 *(bool *)var->addr=!*(bool *)var->addr; | 747 *(bool *)var->addr=!*(bool *)var->addr; |
498 c=1; | 748 IConsoleVarDump(var,NULL); |
499 } | 749 } |
500 else if (strcmp(tokens[1],"--")==0) { | 750 else if (strcmp(tokens[1],"--")==0) { |
501 *(bool *)var->addr=!*(bool *)var->addr; | 751 *(bool *)var->addr=!*(bool *)var->addr; |
502 c=1; | 752 IConsoleVarDump(var,NULL); |
503 } | 753 } |
504 else { IConsoleError("operation not supported"); } | 754 else { IConsoleError("operation not supported"); } |
505 } | 755 } |
506 break; | 756 break; |
507 case ICONSOLE_VAR_BYTE: | 757 case ICONSOLE_VAR_BYTE: |
508 { | 758 { |
509 if (strcmp(tokens[1],"=")==0) { | 759 if (strcmp(tokens[1],"=")==0) { |
510 if (c==3) { | 760 if (c==3) { |
511 *(byte *)var->addr=atoi((char *) tokens[2]); | 761 *(byte *)var->addr=atoi((char *) tokens[2]); |
512 c=1; | 762 IConsoleVarDump(var,NULL); |
513 } else { | 763 } else { |
514 *(byte *)var->addr=0; | 764 *(byte *)var->addr=0; |
515 c=1; | 765 IConsoleVarDump(var,NULL); |
516 } | 766 } |
517 } | 767 } |
518 else if (strcmp(tokens[1],"++")==0) { | 768 else if (strcmp(tokens[1],"++")==0) { |
519 (*(byte *)var->addr)++; | 769 (*(byte *)var->addr)++; |
520 c=1; | 770 IConsoleVarDump(var,NULL); |
521 } | 771 } |
522 else if (strcmp(tokens[1],"--")==0) { | 772 else if (strcmp(tokens[1],"--")==0) { |
523 (*(byte *)var->addr)--; | 773 (*(byte *)var->addr)--; |
524 c=1; | 774 IConsoleVarDump(var,NULL); |
525 } | 775 } |
526 else { IConsoleError("operation not supported"); } | 776 else { IConsoleError("operation not supported"); } |
527 } | 777 } |
528 break; | 778 break; |
529 case ICONSOLE_VAR_UINT16: | 779 case ICONSOLE_VAR_UINT16: |
530 { | 780 { |
531 if (strcmp(tokens[1],"=")==0) { | 781 if (strcmp(tokens[1],"=")==0) { |
532 if (c==3) { | 782 if (c==3) { |
533 *(unsigned short *)var->addr=atoi((char *) tokens[2]); | 783 *(unsigned short *)var->addr=atoi((char *) tokens[2]); |
534 c=1; | 784 IConsoleVarDump(var,NULL); |
535 } else { | 785 } else { |
536 *(unsigned short *)var->addr=0; | 786 *(unsigned short *)var->addr=0; |
537 c=1; | 787 IConsoleVarDump(var,NULL); |
538 } | 788 } |
539 } | 789 } |
540 else if (strcmp(tokens[1],"++")==0) { | 790 else if (strcmp(tokens[1],"++")==0) { |
541 (*(unsigned short *)var->addr)++; | 791 (*(unsigned short *)var->addr)++; |
542 c=1; | 792 IConsoleVarDump(var,NULL); |
543 } | 793 } |
544 else if (strcmp(tokens[1],"--")==0) { | 794 else if (strcmp(tokens[1],"--")==0) { |
545 (*(unsigned short *)var->addr)--; | 795 (*(unsigned short *)var->addr)--; |
546 c=1; | 796 IConsoleVarDump(var,NULL); |
547 } | 797 } |
548 else { IConsoleError("operation not supported"); } | 798 else { IConsoleError("operation not supported"); } |
549 } | 799 } |
550 break; | 800 break; |
551 case ICONSOLE_VAR_UINT32: | 801 case ICONSOLE_VAR_UINT32: |
552 { | 802 { |
553 if (strcmp(tokens[1],"=")==0) { | 803 if (strcmp(tokens[1],"=")==0) { |
554 if (c==3) { | 804 if (c==3) { |
555 *(unsigned int *)var->addr=atoi((char *) tokens[2]); | 805 *(unsigned int *)var->addr=atoi((char *) tokens[2]); |
556 c=1; | 806 IConsoleVarDump(var,NULL); |
557 } else { | 807 } else { |
558 *(unsigned int *)var->addr=0; | 808 *(unsigned int *)var->addr=0; |
559 c=1; | 809 IConsoleVarDump(var,NULL); |
560 } | 810 } |
561 } | 811 } |
562 else if (strcmp(tokens[1],"++")==0) { | 812 else if (strcmp(tokens[1],"++")==0) { |
563 (*(unsigned int *)var->addr)++; | 813 (*(unsigned int *)var->addr)++; |
564 c=1; | 814 IConsoleVarDump(var,NULL); |
565 } | 815 } |
566 else if (strcmp(tokens[1],"--")==0) { | 816 else if (strcmp(tokens[1],"--")==0) { |
567 (*(unsigned int *)var->addr)--; | 817 (*(unsigned int *)var->addr)--; |
568 c=1; | 818 IConsoleVarDump(var,NULL); |
569 } | 819 } |
570 else { IConsoleError("operation not supported"); } | 820 else { IConsoleError("operation not supported"); } |
571 } | 821 } |
572 break; | 822 break; |
573 case ICONSOLE_VAR_INT16: | 823 case ICONSOLE_VAR_INT16: |
574 { | 824 { |
575 if (strcmp(tokens[1],"=")==0) { | 825 if (strcmp(tokens[1],"=")==0) { |
576 if (c==3) { | 826 if (c==3) { |
577 *(signed short *)var->addr=atoi((char *) tokens[2]); | 827 *(signed short *)var->addr=atoi((char *) tokens[2]); |
578 c=1; | 828 IConsoleVarDump(var,NULL); |
579 } else { | 829 } else { |
580 *(signed short *)var->addr=0; | 830 *(signed short *)var->addr=0; |
581 c=1; | 831 IConsoleVarDump(var,NULL); |
582 } | 832 } |
583 } | 833 } |
584 else if (strcmp(tokens[1],"++")==0) { | 834 else if (strcmp(tokens[1],"++")==0) { |
585 (*(signed short *)var->addr)++; | 835 (*(signed short *)var->addr)++; |
586 c=1; | 836 IConsoleVarDump(var,NULL); |
587 } | 837 } |
588 else if (strcmp(tokens[1],"--")==0) { | 838 else if (strcmp(tokens[1],"--")==0) { |
589 (*(signed short *)var->addr)--; | 839 (*(signed short *)var->addr)--; |
590 c=1; | 840 IConsoleVarDump(var,NULL); |
591 } | 841 } |
592 else { IConsoleError("operation not supported"); } | 842 else { IConsoleError("operation not supported"); } |
593 } | 843 } |
594 break; | 844 break; |
595 case ICONSOLE_VAR_INT32: | 845 case ICONSOLE_VAR_INT32: |
596 { | 846 { |
597 if (strcmp(tokens[1],"=")==0) { | 847 if (strcmp(tokens[1],"=")==0) { |
598 if (c==3) { | 848 if (c==3) { |
599 *(signed int *)var->addr=atoi((char *) tokens[2]); | 849 *(signed int *)var->addr=atoi((char *) tokens[2]); |
600 c=1; | 850 IConsoleVarDump(var,NULL); |
601 } else { | 851 } else { |
602 *(signed int *)var->addr=0; | 852 *(signed int *)var->addr=0; |
603 c=1; | 853 IConsoleVarDump(var,NULL); |
604 } | 854 } |
605 } | 855 } |
606 else if (strcmp(tokens[1],"++")==0) { | 856 else if (strcmp(tokens[1],"++")==0) { |
607 (*(signed int *)var->addr)++; | 857 (*(signed int *)var->addr)++; |
608 c=1; | 858 IConsoleVarDump(var,NULL); |
609 } | 859 } |
610 else if (strcmp(tokens[1],"--")==0) { | 860 else if (strcmp(tokens[1],"--")==0) { |
611 (*(signed int *)var->addr)--; | 861 (*(signed int *)var->addr)--; |
612 c=1; | 862 IConsoleVarDump(var,NULL); |
613 } | 863 } |
614 else { IConsoleError("operation not supported"); } | 864 else { IConsoleError("operation not supported"); } |
615 } | 865 } |
616 break; | 866 break; |
617 case ICONSOLE_VAR_STRING: | 867 case ICONSOLE_VAR_STRING: |
618 { | 868 { |
619 if (strcmp(tokens[1],"=")==0) { | 869 if (strcmp(tokens[1],"=")==0) { |
620 if (c==3) { | 870 if (c==3) { |
621 IConsoleVarStringSet(var, tokens[2]); | 871 IConsoleVarSetString(var, tokens[2]); |
622 c=1; | 872 IConsoleVarDump(var,NULL); |
623 } else { | 873 } else { |
624 IConsoleVarStringSet(var, ""); | 874 IConsoleVarSetString(var, ""); |
625 c=1; | 875 IConsoleVarDump(var,NULL); |
626 } | 876 } |
627 } | 877 } |
628 else { IConsoleError("operation not supported"); } | 878 else { IConsoleError("operation not supported"); } |
629 } | 879 } |
630 break; | 880 break; |
631 case ICONSOLE_VAR_POINTER: | 881 case ICONSOLE_VAR_POINTER: |
632 { | 882 { |
633 if (strcmp(tokens[1],"=")==0) { | 883 if (strcmp(tokens[1],"=")==0) { |
634 if (c==3) { | 884 if (c==3) { |
635 var->addr = tokens[2]; | 885 if (tokentypes[2]==ICONSOLE_VAR_UNKNOWN) { |
636 c=1; | 886 var->addr = (void *)atoi(tokens[2]); |
887 } else { | |
888 var->addr = (void *)tokens[2]; | |
889 } | |
890 IConsoleVarDump(var,NULL); | |
637 } else { | 891 } else { |
638 var->addr = NULL; | 892 var->addr = NULL; |
639 c=1; | 893 IConsoleVarDump(var,NULL); |
640 } | 894 } |
641 } | 895 } |
642 else if (strcmp(tokens[1],"++")==0) { | 896 else if (strcmp(tokens[1],"++")==0) { |
643 var->addr = ((char *)var->addr)+1; | 897 var->addr = ((char *)var->addr)+1; |
644 c=1; | 898 IConsoleVarDump(var,NULL); |
645 } | 899 } |
646 else if (strcmp(tokens[1],"--")==0) { | 900 else if (strcmp(tokens[1],"--")==0) { |
647 var->addr = ((char *)var->addr)-1;; | 901 var->addr = ((char *)var->addr)-1;; |
648 c=1; | 902 IConsoleVarDump(var,NULL); |
649 } | 903 } |
650 else { IConsoleError("operation not supported"); } | 904 else { IConsoleError("operation not supported"); } |
651 } | 905 } |
652 break; | 906 break; |
653 } | 907 } |
654 } | 908 } |
655 if (c==1) { | 909 if (c==1) { |
656 // ** variable output ** // | 910 // ** variable output ** // |
657 switch (var->type) { | 911 IConsoleVarDump(var,NULL); |
658 case ICONSOLE_VAR_BOOLEAN: | 912 } |
659 { | 913 } |
660 if (*(bool *)var->addr) { | 914 break; |
661 IConsolePrintF(_iconsole_color_default, "%s = true",var->name); | 915 case 3: |
662 } else { | 916 { |
663 IConsolePrintF(_iconsole_color_default, "%s = false",var->name); | 917 // execute command with result |
664 } | 918 { |
665 } | 919 int i; |
666 break; | 920 int diff; |
667 case ICONSOLE_VAR_BYTE: | 921 void * temp; |
668 { | 922 byte temp2; |
669 var_b=*(byte *)var->addr; | 923 |
670 IConsolePrintF(_iconsole_color_default, "%s = %i",var->name,var_b); | 924 for (diff=0; diff<2; diff++) { |
671 } | 925 temp=tokens[0]; |
672 break; | 926 temp2=tokentypes[0]; |
673 case ICONSOLE_VAR_UINT16: | 927 for (i=1; i<20; i++) { |
674 { | 928 tokens[i-1]=tokens[i]; |
675 var_ui16=*(unsigned short *)var->addr; | 929 tokentypes[i-1]=tokentypes[i]; |
676 IConsolePrintF(_iconsole_color_default, "%s = %i",var->name,var_ui16); | 930 } |
677 } | 931 tokens[19]=temp; |
678 break; | 932 tokentypes[19]=temp2; |
679 case ICONSOLE_VAR_UINT32: | 933 } |
680 { | 934 } |
681 var_ui32=*(unsigned int *)var->addr; | 935 |
682 IConsolePrintF(_iconsole_color_default, "%s = %i",var->name,var_ui32); | 936 result = function(c,tokens,tokentypes); |
683 } | 937 if (result!=NULL) { |
684 break; | 938 if (result ->type != var -> type) { |
685 case ICONSOLE_VAR_INT16: | 939 IConsoleError("variable type missmatch"); |
686 { | 940 } else { |
687 var_i16=*(signed short *)var->addr; | 941 switch (result->type) { |
688 IConsolePrintF(_iconsole_color_default, "%s = %i",var->name,var_i16); | 942 case ICONSOLE_VAR_BOOLEAN: |
689 } | 943 { |
690 break; | 944 (*(bool *)var->addr)=(*(bool *)result->addr); |
691 case ICONSOLE_VAR_INT32: | 945 IConsoleVarDump(var,NULL); |
692 { | 946 } |
693 var_i32=*(signed int *)var->addr; | 947 break; |
694 IConsolePrintF(_iconsole_color_default, "%s = %i",var->name,var_i32); | 948 case ICONSOLE_VAR_BYTE: |
695 } | 949 { |
696 break; | 950 (*(byte *)var->addr)=(*(byte *)result->addr); |
697 case ICONSOLE_VAR_STRING: | 951 IConsoleVarDump(var,NULL); |
698 { | 952 } |
699 var_s=(byte *)var->addr; | 953 break; |
700 IConsolePrintF(_iconsole_color_default, "%s = %s",var->name,var_s); | 954 case ICONSOLE_VAR_UINT16: |
701 } | 955 { |
702 break; | 956 (*(unsigned short *)var->addr)=(*(unsigned short *)result->addr); |
703 case ICONSOLE_VAR_UNKNOWN: | 957 IConsoleVarDump(var,NULL); |
704 case ICONSOLE_VAR_VARPTR: | 958 } |
705 case ICONSOLE_VAR_POINTER: | 959 break; |
706 { | 960 case ICONSOLE_VAR_UINT32: |
707 var_i32=(signed int)((byte *)var->addr); | 961 { |
708 IConsolePrintF(_iconsole_color_default, "%s = @%i",var->name,var_i32); | 962 (*(unsigned int *)var->addr)=(*(unsigned int *)result->addr); |
709 } | 963 IConsoleVarDump(var,NULL); |
710 break; | 964 } |
711 } | 965 break; |
712 } | 966 case ICONSOLE_VAR_INT16: |
967 { | |
968 (*(signed short *)var->addr)=(*(signed short *)result->addr); | |
969 IConsoleVarDump(var,NULL); | |
970 } | |
971 break; | |
972 case ICONSOLE_VAR_INT32: | |
973 { | |
974 (*(signed int *)var->addr)=(*(signed int *)result->addr); | |
975 IConsoleVarDump(var,NULL); | |
976 } | |
977 break; | |
978 case ICONSOLE_VAR_POINTER: | |
979 { | |
980 var->addr=result->addr; | |
981 IConsoleVarDump(var,NULL); | |
982 } | |
983 break; | |
984 default: | |
985 { | |
986 IConsoleError("variable type missmatch"); | |
987 } | |
988 break; | |
989 } | |
990 } | |
991 } | |
992 | |
713 } | 993 } |
714 break; | 994 break; |
715 default: | 995 default: |
716 { | 996 { |
717 // execution mode invalid | 997 // execution mode invalid |
728 /* **************************** */ | 1008 /* **************************** */ |
729 /* default console commands */ | 1009 /* default console commands */ |
730 /* **************************** */ | 1010 /* **************************** */ |
731 | 1011 |
732 | 1012 |
733 static void IConsoleStdLibEcho(byte argc, byte * argv[], byte argt[]) { | 1013 static _iconsole_var * IConsoleStdLibEcho(byte argc, byte* argv[], byte argt[]) { |
734 if (argc<2) return; | 1014 if (argc<2) return NULL; |
735 IConsolePrint(_iconsole_color_default, argv[1]); | 1015 IConsolePrint(_iconsole_color_default, argv[1]); |
736 } | 1016 return NULL; |
737 | 1017 } |
738 static void IConsoleStdLibEchoC(byte argc, byte * argv[], byte argt[]) { | 1018 |
739 if (argc<3) return; | 1019 static _iconsole_var * IConsoleStdLibEchoC(byte argc, byte* argv[], byte argt[]) { |
1020 if (argc<3) return NULL; | |
740 IConsolePrint(atoi(argv[1]), argv[2]); | 1021 IConsolePrint(atoi(argv[1]), argv[2]); |
741 } | 1022 return NULL; |
742 | 1023 } |
743 static void IConsoleStdLibPrintF(byte argc, byte * argv[], byte argt[]) { | 1024 |
744 if (argc<3) return; | 1025 static _iconsole_var * IConsoleStdLibPrintF(byte argc, byte* argv[], byte argt[]) { |
1026 if (argc<3) return NULL; | |
745 IConsolePrintF(_iconsole_color_default, argv[1] ,argv[2],argv[3],argv[4],argv[5],argv[6],argv[7],argv[8],argv[9],argv[10],argv[11],argv[12],argv[13],argv[14],argv[15],argv[16],argv[17],argv[18],argv[19]); | 1027 IConsolePrintF(_iconsole_color_default, argv[1] ,argv[2],argv[3],argv[4],argv[5],argv[6],argv[7],argv[8],argv[9],argv[10],argv[11],argv[12],argv[13],argv[14],argv[15],argv[16],argv[17],argv[18],argv[19]); |
746 } | 1028 return NULL; |
747 | 1029 } |
748 static void IConsoleStdLibPrintFC(byte argc, byte * argv[], byte argt[]) { | 1030 |
749 if (argc<3) return; | 1031 static _iconsole_var * IConsoleStdLibPrintFC(byte argc, byte* argv[], byte argt[]) { |
1032 if (argc<3) return NULL; | |
750 IConsolePrintF(atoi(argv[1]), argv[2] ,argv[3],argv[4],argv[5],argv[6],argv[7],argv[8],argv[9],argv[10],argv[11],argv[12],argv[13],argv[14],argv[15],argv[16],argv[17],argv[18],argv[19]); | 1033 IConsolePrintF(atoi(argv[1]), argv[2] ,argv[3],argv[4],argv[5],argv[6],argv[7],argv[8],argv[9],argv[10],argv[11],argv[12],argv[13],argv[14],argv[15],argv[16],argv[17],argv[18],argv[19]); |
751 } | 1034 return NULL; |
752 | 1035 } |
753 static void IConsoleStdLibScreenShot(byte argc, byte * argv[], byte argt[]) { | 1036 |
1037 static _iconsole_var * IConsoleStdLibScreenShot(byte argc, byte* argv[], byte argt[]) { | |
754 | 1038 |
755 if (argc<2) { | 1039 if (argc<2) { |
756 _make_screenshot=1; | 1040 _make_screenshot=1; |
757 } else { | 1041 } else { |
758 if (strcmp(argv[1],"big")==0) { | 1042 if (strcmp(argv[1],"big")==0) { |
759 _make_screenshot=2; | 1043 _make_screenshot=2; |
760 } | 1044 } |
761 } | 1045 } |
762 } | 1046 |
763 | 1047 return NULL; |
764 static void IConsoleStdLibDebugLevel(byte argc, byte * argv[], byte argt[]) { | 1048 } |
765 if (argc<2) return; | 1049 |
1050 static _iconsole_var * IConsoleStdLibDebugLevel(byte argc, byte* argv[], byte argt[]) { | |
1051 if (argc<2) return NULL; | |
766 SetDebugString(argv[1]); | 1052 SetDebugString(argv[1]); |
767 } | 1053 return NULL; |
768 | 1054 } |
769 static void IConsoleStdLibExit(byte argc, byte * argv[], byte argt[]) { | 1055 |
1056 static _iconsole_var * IConsoleStdLibExit(byte argc, byte* argv[], byte argt[]) { | |
770 _exit_game = true; | 1057 _exit_game = true; |
771 } | 1058 return NULL; |
772 | 1059 } |
773 static void IConsoleStdLibListCommands(byte argc, byte * argv[], byte argt[]) { | 1060 |
1061 static _iconsole_var * IConsoleStdLibHelp(byte argc, byte* argv[], byte argt[]) { | |
1062 IConsolePrint(1 ,""); | |
1063 IConsolePrint(13 ," -- console help -- "); | |
1064 IConsolePrint(1 ," variables: [command to list them: list_vars]"); | |
1065 IConsolePrint(1 ," *temp_string = \"my little \""); | |
1066 IConsolePrint(1 ,""); | |
1067 IConsolePrint(1 ," commands: [command to list them: list_cmds]"); | |
1068 IConsolePrint(1 ," [command] [\"string argument with spaces\"] [argument 2] ..."); | |
1069 IConsolePrint(1 ," printf \"%s world\" *temp_string"); | |
1070 IConsolePrint(1 ,""); | |
1071 IConsolePrint(1 ," command returning a value into an variable:"); | |
1072 IConsolePrint(1 ," *temp_uint16 << random"); | |
1073 IConsolePrint(1 ,""); | |
1074 return NULL; | |
1075 } | |
1076 | |
1077 static _iconsole_var * IConsoleStdLibRandom(byte argc, byte* argv[], byte argt[]) { | |
1078 _iconsole_var * result; | |
1079 result = IConsoleVarAlloc(ICONSOLE_VAR_UINT16); | |
1080 IConsoleVarSetValue(result,rand()); | |
1081 return result; | |
1082 } | |
1083 | |
1084 static _iconsole_var * IConsoleStdLibListCommands(byte argc, byte* argv[], byte argt[]) { | |
774 _iconsole_cmd * item; | 1085 _iconsole_cmd * item; |
775 int l = 0; | 1086 int l = 0; |
776 | 1087 |
777 if (argv[1]!=NULL) l = strlen((char *) argv[1]); | 1088 if (argv[1]!=NULL) l = strlen((char *) argv[1]); |
778 | 1089 |
788 IConsolePrintF(_iconsole_color_default,"%s",item->name); | 1099 IConsolePrintF(_iconsole_color_default,"%s",item->name); |
789 | 1100 |
790 } | 1101 } |
791 item = item->_next; | 1102 item = item->_next; |
792 } | 1103 } |
793 } | 1104 |
794 | 1105 return NULL; |
795 static void IConsoleStdLibListVariables(byte argc, byte * argv[], byte argt[]) { | 1106 } |
1107 | |
1108 static _iconsole_var * IConsoleStdLibListVariables(byte argc, byte* argv[], byte argt[]) { | |
796 _iconsole_var * item; | 1109 _iconsole_var * item; |
797 int l = 0; | 1110 int l = 0; |
798 | 1111 |
799 if (argv[1]!=NULL) l = strlen((char *) argv[1]); | 1112 if (argv[1]!=NULL) l = strlen((char *) argv[1]); |
800 | 1113 |
810 IConsolePrintF(_iconsole_color_default,"%s",item->name); | 1123 IConsolePrintF(_iconsole_color_default,"%s",item->name); |
811 | 1124 |
812 } | 1125 } |
813 item = item->_next; | 1126 item = item->_next; |
814 } | 1127 } |
1128 | |
1129 return NULL; | |
1130 } | |
1131 | |
1132 static _iconsole_var * IConsoleStdLibListDumpVariables(byte argc, byte* argv[], byte argt[]) { | |
1133 _iconsole_var * item; | |
1134 int l = 0; | |
1135 | |
1136 if (argv[1]!=NULL) l = strlen((char *) argv[1]); | |
1137 | |
1138 item = _iconsole_vars; | |
1139 while (item != NULL) { | |
1140 if (argv[1]!=NULL) { | |
1141 | |
1142 if (memcmp((void *) item->name, (void *) argv[1],l)==0) | |
1143 IConsoleVarDump(item,NULL); | |
1144 | |
1145 } else { | |
1146 | |
1147 IConsoleVarDump(item,NULL); | |
1148 | |
1149 } | |
1150 item = item->_next; | |
1151 } | |
1152 | |
1153 return NULL; | |
815 } | 1154 } |
816 | 1155 |
817 static void IConsoleStdLibRegister() { | 1156 static void IConsoleStdLibRegister() { |
1157 IConsoleCmdRegister("debug_level",IConsoleStdLibDebugLevel); | |
818 IConsoleCmdRegister("echo",IConsoleStdLibEcho); | 1158 IConsoleCmdRegister("echo",IConsoleStdLibEcho); |
819 IConsoleCmdRegister("echoc",IConsoleStdLibEchoC); | 1159 IConsoleCmdRegister("echoc",IConsoleStdLibEchoC); |
1160 IConsoleCmdRegister("exit",IConsoleStdLibExit); | |
1161 IConsoleCmdRegister("help",IConsoleStdLibHelp); | |
820 IConsoleCmdRegister("printf",IConsoleStdLibPrintF); | 1162 IConsoleCmdRegister("printf",IConsoleStdLibPrintF); |
821 IConsoleCmdRegister("printfc",IConsoleStdLibPrintFC); | 1163 IConsoleCmdRegister("printfc",IConsoleStdLibPrintFC); |
1164 IConsoleCmdRegister("quit",IConsoleStdLibExit); | |
1165 IConsoleCmdRegister("random",IConsoleStdLibRandom); | |
822 IConsoleCmdRegister("list_cmds",IConsoleStdLibListCommands); | 1166 IConsoleCmdRegister("list_cmds",IConsoleStdLibListCommands); |
823 IConsoleCmdRegister("list_vars",IConsoleStdLibListVariables); | 1167 IConsoleCmdRegister("list_vars",IConsoleStdLibListVariables); |
1168 IConsoleCmdRegister("dump_vars",IConsoleStdLibListDumpVariables); | |
824 IConsoleCmdRegister("screenshot",IConsoleStdLibScreenShot); | 1169 IConsoleCmdRegister("screenshot",IConsoleStdLibScreenShot); |
825 IConsoleCmdRegister("debug_level",IConsoleStdLibDebugLevel); | 1170 IConsoleVarRegister("cursor_rate",(void *) &_icursor_rate,ICONSOLE_VAR_BYTE); |
826 IConsoleCmdRegister("exit",IConsoleStdLibExit); | |
827 IConsoleVarRegister("developer",(void *) &_stdlib_developer,ICONSOLE_VAR_BYTE); | 1171 IConsoleVarRegister("developer",(void *) &_stdlib_developer,ICONSOLE_VAR_BYTE); |
828 IConsoleVarRegister("cursor_rate",(void *) &_icursor_rate,ICONSOLE_VAR_BYTE); | 1172 #if defined(_DEBUG) |
829 IConsoleVarRegister("temp_string",(void *) &_stdlib_temp_string,ICONSOLE_VAR_STRING); | 1173 { |
830 IConsoleVarRegister("temp_pointer",(void *) &_stdlib_temp_pointer,ICONSOLE_VAR_POINTER); | 1174 _iconsole_var * var; |
831 IConsoleVarRegister("temp_uint32",(void *) &_stdlib_temp_uint32,ICONSOLE_VAR_UINT32); | 1175 var = IConsoleVarAlloc(ICONSOLE_VAR_BOOLEAN); |
832 IConsoleVarRegister("temp_bool",(void *) &_stdlib_temp_bool,ICONSOLE_VAR_BOOLEAN); | 1176 IConsoleVarInsert(var,"temp_bool"); |
833 } | 1177 |
834 | 1178 var = IConsoleVarAlloc(ICONSOLE_VAR_INT16); |
835 | 1179 IConsoleVarInsert(var,"temp_int16"); |
1180 var = IConsoleVarAlloc(ICONSOLE_VAR_INT32); | |
1181 IConsoleVarInsert(var,"temp_int32"); | |
1182 | |
1183 var = IConsoleVarAlloc(ICONSOLE_VAR_POINTER); | |
1184 IConsoleVarInsert(var,"temp_pointer"); | |
1185 | |
1186 var = IConsoleVarAlloc(ICONSOLE_VAR_UINT16); | |
1187 IConsoleVarInsert(var,"temp_uint16"); | |
1188 var = IConsoleVarAlloc(ICONSOLE_VAR_UINT32); | |
1189 IConsoleVarInsert(var,"temp_uint32"); | |
1190 | |
1191 | |
1192 var = IConsoleVarAlloc(ICONSOLE_VAR_STRING); | |
1193 IConsoleVarInsert(var,"temp_string"); | |
1194 } | |
1195 #endif | |
1196 } | |
1197 | |
1198 |