From b7f768e4b3453a0a5b90efc6a53d05528b689aed Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Mon, 31 Jan 2011 00:12:47 -0500 Subject: [PATCH 1/2] Moved console commands into own function. Added running script files so console commands can be run instantly. Added create command. element names work, from jacksonmj. --- includes/interface.h | 2 + src/interface.c | 19 ++ src/main.c | 569 ++++++++++++++++++++++++------------------- 3 files changed, 336 insertions(+), 254 deletions(-) diff --git a/includes/interface.h b/includes/interface.h index de1c95509..870e917e1 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -228,5 +228,7 @@ int report_ui(pixel *vid_buf, char *save_id); char *console_ui(pixel *vid_buf, char error[255]); +int console_get_type(char *element); + #endif diff --git a/src/interface.c b/src/interface.c index 8ec97fb46..65f340c1f 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3898,6 +3898,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show if(ci==-1) { strcpy(ed.str, ""); + ed.cursor = strlen(ed.str); } else { @@ -3916,6 +3917,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show { ci = -1; strcpy(ed.str, ""); + ed.cursor = strlen(ed.str); } } } @@ -3925,3 +3927,20 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show } +int console_get_type(char *element) +{ + int i; + char num[4]; + i = atoi(element); + sprintf(num,"%d",i); + if (i>=0 && i YRES || nx > XRES) + sprintf(console_error, "Invalid Coordinates", console2); + else + create_part(-1,nx,ny,j); + } + else if(strcmp(console2, "reset")==0 && console3) + { + if(strcmp(console3, "pressure")==0) + { + for (nx = 0; nx Date: Mon, 31 Jan 2011 00:49:50 -0500 Subject: [PATCH 2/2] stupid git, didn't take description change --- src/interface.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/interface.c b/src/interface.c index 65f340c1f..1d1c258b0 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3840,12 +3840,15 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show clearrect(vid_buf, 0, 0, XRES+BARSIZE, 220);//anyway to make it transparent? draw_line(vid_buf, 1, 219, XRES, 219, 228, 228, 228, XRES+BARSIZE); - drawtext(vid_buf, 15, 15, "Welcome to The Powder Toy console v.1 (by cracker64)\n" - "Current commands are quit, set, reset, load\n" + drawtext(vid_buf, 100, 15, "Welcome to The Powder Toy console v.2 (by cracker64)\n" + "Current commands are quit, set, reset, load, create, file\n" "You can set type, temp, ctype, life, x, y, vx, vy using this format ('set life particle# 9001')\n" - "You can also use 'all' instead of a particle number to do it to everything\n" + "You can also use 'all' instead of a particle number to do it to everything.\n" + "You can now use particle names (ex. set type all deut)\n" "Reset works with pressure, velocity, sparks, temp (ex. 'reset pressure')\n" - "To load a save use load saveID (ex. load 1337)" + "To load a save use load saveID (ex. load 1337)\n" + "Create particles with 'create deut x y' where x and y are the coords\n" + "Run scripts from file 'file filename'" ,255, 187, 187, 255); cc = 0;