Replace cmode with more flexible render options, TODO: Saving and render options UI
This commit is contained in:
parent
1b984200f3
commit
0f4c0915d9
@ -219,9 +219,9 @@ char font_data[] = {
|
||||
0x0A, 0xE0, 0x2F, 0xC0, 0x01, 0x0D, 0x06, 0x40, 0x32, 0x00, 0x30, 0x03, 0x00, 0x33, 0x00, 0x30, 0x06, 0x40, 0xC2, 0x01, 0x0D, 0xE0, 0x2F, 0x00, 0x00, 0x00,
|
||||
0x0A, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x23, 0x80, 0x32, 0x0A, 0x0D, 0xC3, 0xD1, 0x10, 0x1C, 0x0D, 0xC0, 0x81, 0x02, 0x0A, 0xE0, 0x2F, 0x00, 0x54, 0x00,
|
||||
0x0A, 0x00, 0x00, 0x00, 0xFC, 0x03, 0xB0, 0xE0, 0x00, 0x03, 0x0C, 0x30, 0xC0, 0x00, 0x0B, 0x0E, 0xC0, 0x3F, 0x00, 0xAC, 0x03, 0xC0, 0x3A, 0x00, 0xAC, 0x03,
|
||||
0x06, 0x74, 0xC0, 0x0C, 0xDC, 0xC0, 0x0C, 0xDC, 0xC0, 0x0C, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07,
|
||||
0x06, 0x74, 0xC0, 0x0C, 0xDC, 0xC0, 0x0C, 0xDC, 0xC0, 0x0C, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07,
|
||||
0x06, 0x74, 0xC0, 0x0C, 0xDC, 0xC0, 0x0C, 0xDC, 0xC0, 0x0C, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07,
|
||||
0x05, 0x6F, 0xBC, 0xF1, 0xC6, 0x1B, 0x6F, 0xBC, 0xF1, 0xC6, 0x1B, 0x6F, 0x00, 0x00,
|
||||
0x08, 0xE4, 0x6F, 0xE4, 0x6F, 0xE4, 0x6F, 0xE4, 0x6F, 0xE4, 0x6F, 0xE4, 0x6F, 0xE4, 0x6F, 0xE4, 0x6F, 0xE4, 0x6F, 0x00, 0x00,
|
||||
0x09, 0x00, 0xE4, 0x03, 0x90, 0x0F, 0x40, 0x3E, 0x00, 0xF9, 0x00, 0xE4, 0x03, 0x90, 0x0F, 0x40, 0x3E, 0x00, 0xF9, 0x00, 0xE4, 0x03, 0x00, 0x00,
|
||||
0x06, 0x74, 0xC0, 0x0C, 0xDC, 0xC0, 0x0C, 0xDC, 0xC0, 0x0C, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07,
|
||||
0x06, 0x74, 0xC0, 0x0C, 0xDC, 0xC0, 0x0C, 0xDC, 0xC0, 0x0C, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07,
|
||||
0x06, 0x74, 0xC0, 0x0C, 0xDC, 0xC0, 0x0C, 0xDC, 0xC0, 0x0C, 0x99, 0x31, 0x30, 0x89, 0x41, 0x07,
|
||||
@ -288,11 +288,11 @@ short font_ptrs[] = {
|
||||
0x0CA8, 0x0CC2, 0x0CDC, 0x0CF6, 0x0D10, 0x0D2A, 0x0D44, 0x0D5E,
|
||||
0x0D78, 0x0D92, 0x0DAC, 0x0DC6, 0x0DE0, 0x0DFA, 0x0E14, 0x0E2E,
|
||||
0x0E46, 0x0E60, 0x0E7A, 0x0E94, 0x0EAE, 0x0EC8, 0x0EE2, 0x0EFC,
|
||||
0x0F16, 0x0F26, 0x0F36, 0x0F46, 0x0F56, 0x0F66, 0x0F76, 0x0F86,
|
||||
0x0F96, 0x0FA6, 0x0FB6, 0x0FC6, 0x0FD6, 0x0FE6, 0x0FF6, 0x1006,
|
||||
0x1016, 0x1026, 0x1036, 0x1046, 0x1056, 0x1066, 0x1076, 0x1086,
|
||||
0x1096, 0x10A6, 0x10B6, 0x10C6, 0x10D6, 0x10E6, 0x10F6, 0x1106,
|
||||
0x1116, 0x1126, 0x1136, 0x1146, 0x1156, 0x1166, 0x1176, 0x1186,
|
||||
0x0F16, 0x0F24, 0x0F39, 0x0F51, 0x0F61, 0x0F71, 0x0F81, 0x0F91,
|
||||
0x0FA1, 0x0FB1, 0x0FC1, 0x0FD1, 0x0FE1, 0x0FF1, 0x1001, 0x1011,
|
||||
0x1021, 0x1031, 0x1041, 0x1051, 0x1061, 0x1071, 0x1081, 0x1091,
|
||||
0x10A1, 0x10B1, 0x10C1, 0x10D1, 0x10E1, 0x10F1, 0x1101, 0x1111,
|
||||
0x1121, 0x1131, 0x1141, 0x1151, 0x1161, 0x1171, 0x1181, 0x1191,
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
@ -45,7 +45,12 @@
|
||||
|
||||
extern int emp_decor;
|
||||
|
||||
extern unsigned cmode;
|
||||
extern unsigned int *render_modes;
|
||||
extern unsigned int render_mode;
|
||||
extern unsigned int colour_mode;
|
||||
extern unsigned int *display_modes;
|
||||
extern unsigned int display_mode;
|
||||
|
||||
extern SDL_Surface *sdl_scrn;
|
||||
extern int sdl_scale;
|
||||
|
||||
@ -120,6 +125,8 @@ void draw_menu(pixel *vid_buf, int i, int hover);
|
||||
|
||||
void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a);
|
||||
|
||||
int addchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a);
|
||||
|
||||
int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a);
|
||||
|
||||
int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a);
|
||||
|
@ -328,6 +328,8 @@ int report_ui(pixel *vid_buf, char *save_id);
|
||||
|
||||
char *console_ui(pixel *vid_buf, char error[255],char console_more);
|
||||
|
||||
void render_ui(pixel *vid_buf);
|
||||
|
||||
void simulation_ui(pixel *vid_buf);
|
||||
|
||||
unsigned int decorations_ui(pixel *vid_buf, int *bsx, int *bsy, unsigned int savedColor);
|
||||
|
@ -1,29 +1,50 @@
|
||||
#ifndef PGRAPHICS_H
|
||||
#define PGRAPHICS_H
|
||||
|
||||
#define PMODE 0x00000FFF
|
||||
#define PMODE_NONE 0x00000000
|
||||
#define PMODE_FLAT 0x00000001
|
||||
#define PMODE_BLOB 0x00000002
|
||||
#define PMODE_BLUR 0x00000004
|
||||
#define PMODE_GLOW 0x00000008
|
||||
#define PMODE_SPARK 0x00000010
|
||||
#define PMODE_FLARE 0x00000020
|
||||
#define PMODE_LFLARE 0x00000040
|
||||
#define PMODE_ADD 0x00000080
|
||||
#define PMODE_BLEND 0x00000100
|
||||
|
||||
#define PMODE 0x00000FFF
|
||||
#define PMODE_NONE 0x00000000
|
||||
#define PMODE_FLAT 0x00000001
|
||||
#define PMODE_BLOB 0x00000002
|
||||
#define PMODE_BLUR 0x00000004
|
||||
#define PMODE_GLOW 0x00000008
|
||||
#define PMODE_SPARK 0x00000010
|
||||
#define PMODE_FLARE 0x00000020
|
||||
#define PMODE_LFLARE 0x00000040
|
||||
#define PMODE_ADD 0x00000080
|
||||
#define PMODE_BLEND 0x00000100
|
||||
#define PSPEC_STICKMAN 0x00000200
|
||||
|
||||
#define NO_DECO 0x00001000
|
||||
#define DECO_FIRE 0x00002000
|
||||
#define OPTIONS 0x0000F000
|
||||
#define NO_DECO 0x00001000
|
||||
#define DECO_FIRE 0x00002000
|
||||
|
||||
#define FIREMODE 0x00FF0000
|
||||
#define FIRE_ADD 0x00010000
|
||||
#define FIRE_BLEND 0x00020000
|
||||
#define FIREMODE 0x00FF0000
|
||||
#define FIRE_ADD 0x00010000
|
||||
#define FIRE_BLEND 0x00020000
|
||||
|
||||
#define EFFECT 0xFF000000
|
||||
#define EFFECT_GRAVIN 0x01000000
|
||||
#define EFFECT_GRAVOUT 0x02000000
|
||||
|
||||
#define RENDER_EFFE OPTIONS | PSPEC_STICKMAN | EFFECT
|
||||
#define RENDER_FIRE OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_ADD | PMODE_BLEND | FIREMODE
|
||||
#define RENDER_GLOW OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_GLOW | PMODE_SPARK | PMODE_FLARE | PMODE_LFLARE | PMODE_ADD | PMODE_BLEND
|
||||
#define RENDER_BLUR OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_BLUR | PMODE_ADD | PMODE_BLEND
|
||||
#define RENDER_BASC OPTIONS | PSPEC_STICKMAN | PMODE_FLAT | PMODE_ADD | PMODE_BLEND
|
||||
#define RENDER_NONE OPTIONS | PSPEC_STICKMAN | PMODE_FLAT
|
||||
|
||||
#define COLOUR_HEAT 0x00000001
|
||||
#define COLOUR_LIFE 0x00000002
|
||||
|
||||
#define COLOUR_DEFAULT 0x00000000
|
||||
|
||||
#define DISPLAY_AIRC 0x00000001
|
||||
#define DISPLAY_AIRP 0x00000002
|
||||
#define DISPLAY_AIRV 0x00000004
|
||||
#define DISPLAY_AIRH 0x00000008
|
||||
#define DISPLAY_AIR 0x0000000F
|
||||
#define DISPLAY_WARP 0x00000010
|
||||
#define DISPLAY_PERS 0x00000020
|
||||
#define DISPLAY_EFFE 0x00000020
|
||||
|
||||
#endif
|
||||
|
260
src/graphics.c
260
src/graphics.c
@ -28,7 +28,13 @@
|
||||
#include <misc.h>
|
||||
#include "hmap.h"
|
||||
|
||||
unsigned cmode = CM_FIRE;
|
||||
//unsigned cmode = CM_FIRE;
|
||||
unsigned int *render_modes;
|
||||
unsigned int render_mode;
|
||||
unsigned int colour_mode;
|
||||
unsigned int *display_modes;
|
||||
unsigned int display_mode;
|
||||
|
||||
SDL_Surface *sdl_scrn;
|
||||
int sdl_scale = 1;
|
||||
|
||||
@ -60,6 +66,32 @@ int plasma_data_points = 5;
|
||||
pixel plasma_data_colours[] = {PIXPACK(0xAFFFFF), PIXPACK(0xAFFFFF), PIXPACK(0x301060), PIXPACK(0x301040), PIXPACK(0x000000)};
|
||||
float plasma_data_pos[] = {1.0f, 0.9f, 0.5f, 0.25, 0.0f};
|
||||
|
||||
void init_display_modes()
|
||||
{
|
||||
int i;
|
||||
display_modes = calloc(sizeof(unsigned int), 1);
|
||||
render_modes = calloc(sizeof(unsigned int), 2);
|
||||
|
||||
display_modes[0] = 0;
|
||||
render_modes[0] = RENDER_FIRE;
|
||||
render_modes[1] = 0;
|
||||
|
||||
display_mode = 0;
|
||||
i = 0;
|
||||
while(display_modes[i])
|
||||
{
|
||||
display_mode |= display_modes[i];
|
||||
i++;
|
||||
}
|
||||
render_mode = 0;
|
||||
i = 0;
|
||||
while(render_modes[i])
|
||||
{
|
||||
render_mode |= render_modes[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
char * generate_gradient(pixel * colours, float * points, int pointcount, int size)
|
||||
{
|
||||
int cp, i, j;
|
||||
@ -848,6 +880,32 @@ inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a)
|
||||
return x + w;
|
||||
}
|
||||
|
||||
#if defined(WIN32) && !defined(__GNUC__)
|
||||
_inline int addchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a)
|
||||
#else
|
||||
inline int addchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a)
|
||||
#endif
|
||||
{
|
||||
int i, j, w, bn = 0, ba = 0;
|
||||
char *rp = font_data + font_ptrs[c];
|
||||
w = *(rp++);
|
||||
for (j=0; j<FONT_H; j++)
|
||||
for (i=0; i<w; i++)
|
||||
{
|
||||
if (!bn)
|
||||
{
|
||||
ba = *(rp++);
|
||||
bn = 8;
|
||||
}
|
||||
{
|
||||
addpixel(vid, x+i, y+j, r, g, b, ((ba&3)*a)/3);
|
||||
}
|
||||
ba >>= 2;
|
||||
bn -= 2;
|
||||
}
|
||||
return x + w;
|
||||
}
|
||||
|
||||
int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a)
|
||||
{
|
||||
int sx = x;
|
||||
@ -1237,25 +1295,23 @@ void draw_air(pixel *vid)
|
||||
#ifndef OGLR
|
||||
int x, y, i, j;
|
||||
pixel c;
|
||||
if (cmode == CM_PERS)//this should never happen anyway
|
||||
return;
|
||||
for (y=0; y<YRES/CELL; y++)
|
||||
for (x=0; x<XRES/CELL; x++)
|
||||
{
|
||||
if (cmode == CM_PRESS)
|
||||
if (display_mode & DISPLAY_AIRP)
|
||||
{
|
||||
if (pv[y][x] > 0.0f)
|
||||
c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0);//positive pressure is red!
|
||||
else
|
||||
c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f));//negative pressure is blue!
|
||||
}
|
||||
else if (cmode == CM_VEL)
|
||||
else if (display_mode & DISPLAY_AIRV)
|
||||
{
|
||||
c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f),//vx adds red
|
||||
clamp_flt(pv[y][x], 0.0f, 8.0f),//pressure adds green
|
||||
clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f));//vy adds blue
|
||||
}
|
||||
else if (cmode == CM_HEAT && aheat_enable)
|
||||
else if (display_mode & DISPLAY_AIRH)
|
||||
{
|
||||
float ttemp = hv[y][x]+(-MIN_TEMP);
|
||||
int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/1024) ) *3, 0.0f, (1024.0f*3)-3);
|
||||
@ -1264,7 +1320,7 @@ void draw_air(pixel *vid)
|
||||
// clamp_flt(hv[y][x], 0.0f, 1600.0f),//heat adds green
|
||||
// clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f));//vy adds blue
|
||||
}
|
||||
else if (cmode == CM_CRACK)
|
||||
else if (display_mode & DISPLAY_AIRC)
|
||||
{
|
||||
int r;
|
||||
int g;
|
||||
@ -1302,15 +1358,15 @@ void draw_air(pixel *vid)
|
||||
}
|
||||
#else
|
||||
GLuint airProg;
|
||||
if(cmode == CM_CRACK)
|
||||
if(display_mode & DISPLAY_AIRC)
|
||||
{
|
||||
airProg = airProg_Cracker;
|
||||
}
|
||||
else if(cmode == CM_VEL)
|
||||
else if(display_mode & DISPLAY_AIRV)
|
||||
{
|
||||
airProg = airProg_Velocity;
|
||||
}
|
||||
else if(cmode == CM_PRESS)
|
||||
else if(display_mode & DISPLAY_AIRP)
|
||||
{
|
||||
airProg = airProg_Pressure;
|
||||
}
|
||||
@ -1447,7 +1503,7 @@ void draw_line(pixel *vid, int x1, int y1, int x2, int y2, int r, int g, int b,
|
||||
void addpixel(pixel *vid, int x, int y, int r, int g, int b, int a)
|
||||
{
|
||||
pixel t;
|
||||
if (x<0 || y<0 || x>=XRES || y>=YRES)
|
||||
if (x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE)
|
||||
return;
|
||||
t = vid[y*(XRES+BARSIZE)+x];
|
||||
r = (a*r + 255*PIXR(t)) >> 8;
|
||||
@ -1592,7 +1648,7 @@ void draw_other(pixel *vid) // EMP effect
|
||||
if (emp_decor>0 && !sys_pause) emp_decor-=emp_decor/25+2;
|
||||
if (emp_decor>40) emp_decor=40;
|
||||
if (emp_decor<0) emp_decor = 0;
|
||||
if (cmode==CM_NOTHING) // no in nothing mode
|
||||
if (!(display_mode & display_mode == DISPLAY_EFFE)) // no in nothing mode
|
||||
return;
|
||||
if (emp_decor>0)
|
||||
{
|
||||
@ -1653,7 +1709,6 @@ GLfloat lineC[(((YRES*XRES)*2)*6)];
|
||||
#endif
|
||||
void render_parts(pixel *vid)
|
||||
{
|
||||
//TODO: Replace cmode with a set of flags
|
||||
int deca, decr, decg, decb, cola, colr, colg, colb, firea, firer, fireg, fireb, pixel_mode, q, i, t, nx, ny, x, y, caddress;
|
||||
float gradv, flicker, fnx, fny;
|
||||
#ifdef OGLR
|
||||
@ -1709,7 +1764,7 @@ void render_parts(pixel *vid)
|
||||
decg = (parts[i].dcolour>>8)&0xFF;
|
||||
decb = (parts[i].dcolour)&0xFF;
|
||||
|
||||
if(cmode == CM_NOTHING)
|
||||
/*if(display_mode == RENDER_NONE)
|
||||
{
|
||||
if(decorations_enable)
|
||||
{
|
||||
@ -1729,7 +1784,7 @@ void render_parts(pixel *vid)
|
||||
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(colr,colg,colb);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
else*/
|
||||
{
|
||||
if (graphicscache[t].isready)
|
||||
{
|
||||
@ -1786,18 +1841,39 @@ void render_parts(pixel *vid)
|
||||
colg += sin(gradv*caddress*4.55 +3.14) * 34;
|
||||
colb += sin(gradv*caddress*2.22 +3.14) * 64;
|
||||
}
|
||||
|
||||
if(pixel_mode & FIRE_ADD && !(render_mode & FIRE_ADD))
|
||||
pixel_mode |= PMODE_GLOW;
|
||||
if(pixel_mode & FIRE_BLEND && !(render_mode & FIRE_BLEND))
|
||||
pixel_mode |= PMODE_BLUR;
|
||||
|
||||
pixel_mode &= render_mode;
|
||||
|
||||
//Alter colour based on display mode
|
||||
switch(cmode)
|
||||
if(display_mode & COLOUR_HEAT)
|
||||
{
|
||||
case CM_HEAT:
|
||||
caddress = restrict_flt((int)( restrict_flt((float)(parts[i].temp+(-MIN_TEMP)), 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/1024) ) *3, 0.0f, (1024.0f*3)-3);
|
||||
firea = 255;
|
||||
firer = colr = (unsigned char)color_data[caddress];
|
||||
fireg = colg = (unsigned char)color_data[caddress+1];
|
||||
fireb = colb = (unsigned char)color_data[caddress+2];
|
||||
cola = 255;
|
||||
if(pixel_mode & (FIRE_ADD | FIRE_BLEND | PMODE_GLOW)) pixel_mode = (pixel_mode & ~(FIRE_ADD|FIRE_BLEND|PMODE_GLOW)) | PMODE_BLUR | PMODE_FLAT;
|
||||
break;
|
||||
if(pixel_mode & (FIREMODE | PMODE_GLOW)) pixel_mode = (pixel_mode & ~(FIREMODE|PMODE_GLOW)) | PMODE_BLUR;
|
||||
}
|
||||
else if(display_mode & COLOUR_LIFE)
|
||||
{
|
||||
gradv = 0.4f;
|
||||
if (!(parts[i].life<5))
|
||||
q = sqrt(parts[i].life);
|
||||
else
|
||||
q = parts[i].life;
|
||||
colr = colg = colb = sin(gradv*q) * 100 + 128;
|
||||
cola = 255;
|
||||
if(pixel_mode & (FIREMODE | PMODE_GLOW)) pixel_mode = (pixel_mode & ~(FIREMODE|PMODE_GLOW)) | PMODE_BLUR;
|
||||
}
|
||||
|
||||
/*switch(cmode)
|
||||
{
|
||||
case CM_LIFE:
|
||||
gradv = 0.4f;
|
||||
if (!(parts[i].life<5))
|
||||
@ -1826,21 +1902,24 @@ void render_parts(pixel *vid)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
//Apply decoration colour
|
||||
if(!(pixel_mode & NO_DECO) && cmode != CM_HEAT && decorations_enable)
|
||||
if(!(display_mode & COLOUR_HEAT|COLOUR_LIFE))
|
||||
{
|
||||
colr = (deca*decr + (255-deca)*colr) >> 8;
|
||||
colg = (deca*decg + (255-deca)*colg) >> 8;
|
||||
colb = (deca*decb + (255-deca)*colb) >> 8;
|
||||
}
|
||||
|
||||
if(pixel_mode & DECO_FIRE && decorations_enable)
|
||||
{
|
||||
firer = (deca*decr + (255-deca)*firer) >> 8;
|
||||
fireg = (deca*decg + (255-deca)*fireg) >> 8;
|
||||
fireb = (deca*decb + (255-deca)*fireb) >> 8;
|
||||
if(!(pixel_mode & NO_DECO) && decorations_enable)
|
||||
{
|
||||
colr = (deca*decr + (255-deca)*colr) >> 8;
|
||||
colg = (deca*decg + (255-deca)*colg) >> 8;
|
||||
colb = (deca*decb + (255-deca)*colb) >> 8;
|
||||
}
|
||||
|
||||
if(pixel_mode & DECO_FIRE && decorations_enable)
|
||||
{
|
||||
firer = (deca*decr + (255-deca)*firer) >> 8;
|
||||
fireg = (deca*decg + (255-deca)*fireg) >> 8;
|
||||
fireb = (deca*decb + (255-deca)*fireb) >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef OGLR
|
||||
@ -1861,7 +1940,6 @@ void render_parts(pixel *vid)
|
||||
char buff[20]; //Buffer for HP
|
||||
int s;
|
||||
int legr, legg, legb;
|
||||
pixel pc;
|
||||
playerst *cplayer;
|
||||
if(t==PT_STKM)
|
||||
cplayer = &player;
|
||||
@ -1914,8 +1992,18 @@ void render_parts(pixel *vid)
|
||||
drawtext(vid, mousex-8-2*(parts[i].life<100)-2*(parts[i].life<10), mousey-12, buff, 255, 255, 255, 255);
|
||||
}
|
||||
|
||||
if (cplayer->elem<PT_NUM) pc = ptypes[cplayer->elem].pcolors;
|
||||
else pc = PIXPACK(0x8080FF);
|
||||
if (cplayer->elem<PT_NUM)
|
||||
{
|
||||
colr = PIXR(ptypes[cplayer->elem].pcolors);
|
||||
colg = PIXG(ptypes[cplayer->elem].pcolors);
|
||||
colb = PIXB(ptypes[cplayer->elem].pcolors);
|
||||
}
|
||||
else
|
||||
{
|
||||
colr = 0x80;
|
||||
colg = 0x80;
|
||||
colb = 0xFF;
|
||||
}
|
||||
s = XRES+BARSIZE;
|
||||
|
||||
if (t==PT_STKM2)
|
||||
@ -1931,10 +2019,8 @@ void render_parts(pixel *vid)
|
||||
legb = 255;
|
||||
}
|
||||
|
||||
if (cmode == CM_HEAT)
|
||||
if (colour_mode)
|
||||
{
|
||||
pc = PIXRGB(colr, colg, colb);
|
||||
|
||||
legr = colr;
|
||||
legg = colg;
|
||||
legb = colb;
|
||||
@ -1943,17 +2029,17 @@ void render_parts(pixel *vid)
|
||||
//head
|
||||
if(t==PT_FIGH)
|
||||
{
|
||||
draw_line(vid , nx, ny+2, nx+2, ny, PIXR(pc), PIXG(pc), PIXB(pc), s);
|
||||
draw_line(vid , nx+2, ny, nx, ny-2, PIXR(pc), PIXG(pc), PIXB(pc), s);
|
||||
draw_line(vid , nx, ny-2, nx-2, ny, PIXR(pc), PIXG(pc), PIXB(pc), s);
|
||||
draw_line(vid , nx-2, ny, nx, ny+2, PIXR(pc), PIXG(pc), PIXB(pc), s);
|
||||
draw_line(vid , nx, ny+2, nx+2, ny, colr, colg, colb, s);
|
||||
draw_line(vid , nx+2, ny, nx, ny-2, colr, colg, colb, s);
|
||||
draw_line(vid , nx, ny-2, nx-2, ny, colr, colg, colb, s);
|
||||
draw_line(vid , nx-2, ny, nx, ny+2, colr, colg, colb, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_line(vid , nx-2, ny+2, nx+2, ny+2, PIXR(pc), PIXG(pc), PIXB(pc), s);
|
||||
draw_line(vid , nx-2, ny-2, nx+2, ny-2, PIXR(pc), PIXG(pc), PIXB(pc), s);
|
||||
draw_line(vid , nx-2, ny-2, nx-2, ny+2, PIXR(pc), PIXG(pc), PIXB(pc), s);
|
||||
draw_line(vid , nx+2, ny-2, nx+2, ny+2, PIXR(pc), PIXG(pc), PIXB(pc), s);
|
||||
draw_line(vid , nx-2, ny+2, nx+2, ny+2, colr, colg, colb, s);
|
||||
draw_line(vid , nx-2, ny-2, nx+2, ny-2, colr, colg, colb, s);
|
||||
draw_line(vid , nx-2, ny-2, nx-2, ny+2, colr, colg, colb, s);
|
||||
draw_line(vid , nx+2, ny-2, nx+2, ny+2, colr, colg, colb, s);
|
||||
}
|
||||
//legs
|
||||
draw_line(vid , nx, ny+3, cplayer->legs[0], cplayer->legs[1], legr, legg, legb, s);
|
||||
@ -2532,7 +2618,7 @@ void render_parts(pixel *vid)
|
||||
void draw_parts_fbo()
|
||||
{
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
if(cmode==CM_FANCY)
|
||||
if(display_mode & DISPLAY_WARP)
|
||||
{
|
||||
float xres = XRES, yres = YRES;
|
||||
glUseProgram(lensProg);
|
||||
@ -2569,7 +2655,7 @@ void draw_parts_fbo()
|
||||
glVertex3f(XRES*sdl_scale, MENUSIZE*sdl_scale, 1.0);
|
||||
glEnd();
|
||||
|
||||
if(cmode==CM_FANCY)
|
||||
if(display_mode & DISPLAY_WARP)
|
||||
{
|
||||
glUseProgram(0);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
@ -2672,86 +2758,6 @@ void draw_walls(pixel *vid)
|
||||
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x242424);
|
||||
}
|
||||
}
|
||||
|
||||
if (cmode==CM_BLOB)
|
||||
{
|
||||
// when in blob view, draw some blobs...
|
||||
if (wtypes[wt].drawstyle==1)
|
||||
{
|
||||
for (j=0; j<CELL; j+=2)
|
||||
for (i=(j>>1)&1; i<CELL; i+=2)
|
||||
drawblob(vid, (x*CELL+i), (y*CELL+j), PIXR(pc), PIXG(pc), PIXB(pc));
|
||||
}
|
||||
else if (wtypes[wt].drawstyle==2)
|
||||
{
|
||||
for (j=0; j<CELL; j+=2)
|
||||
for (i=0; i<CELL; i+=2)
|
||||
drawblob(vid, (x*CELL+i), (y*CELL+j), PIXR(pc), PIXG(pc), PIXB(pc));
|
||||
}
|
||||
else if (wtypes[wt].drawstyle==3)
|
||||
{
|
||||
for (j=0; j<CELL; j++)
|
||||
for (i=0; i<CELL; i++)
|
||||
drawblob(vid, (x*CELL+i), (y*CELL+j), PIXR(pc), PIXG(pc), PIXB(pc));
|
||||
}
|
||||
else if (wtypes[wt].drawstyle==4)
|
||||
{
|
||||
for (j=0; j<CELL; j++)
|
||||
for (i=0; i<CELL; i++)
|
||||
if(i == j)
|
||||
drawblob(vid, (x*CELL+i), (y*CELL+j), PIXR(pc), PIXG(pc), PIXB(pc));
|
||||
else if (i == j+1 || (i == 0 && j == CELL-1))
|
||||
drawblob(vid, (x*CELL+i), (y*CELL+j), PIXR(gc), PIXG(gc), PIXB(gc));
|
||||
else
|
||||
drawblob(vid, (x*CELL+i), (y*CELL+j), 0x20, 0x20, 0x20);
|
||||
}
|
||||
if (bmap[y][x]==WL_EWALL)
|
||||
{
|
||||
if (emap[y][x])
|
||||
{
|
||||
for (j=0; j<CELL; j++)
|
||||
for (i=0; i<CELL; i++)
|
||||
if (i&j&1)
|
||||
drawblob(vid, (x*CELL+i), (y*CELL+j), 0x80, 0x80, 0x80);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j=0; j<CELL; j++)
|
||||
for (i=0; i<CELL; i++)
|
||||
if (!(i&j&1))
|
||||
drawblob(vid, (x*CELL+i), (y*CELL+j), 0x80, 0x80, 0x80);
|
||||
}
|
||||
}
|
||||
else if (bmap[y][x]==WL_WALLELEC)
|
||||
{
|
||||
for (j=0; j<CELL; j++)
|
||||
for (i=0; i<CELL; i++)
|
||||
{
|
||||
if (!((y*CELL+j)%2) && !((x*CELL+i)%2))
|
||||
drawblob(vid, (x*CELL+i), (y*CELL+j), PIXR(pc), PIXG(pc), PIXB(pc));
|
||||
else
|
||||
drawblob(vid, (x*CELL+i), (y*CELL+j), 0x80, 0x80, 0x80);
|
||||
}
|
||||
}
|
||||
else if (bmap[y][x]==WL_EHOLE)
|
||||
{
|
||||
if (emap[y][x])
|
||||
{
|
||||
for (j=0; j<CELL; j++)
|
||||
for (i=0; i<CELL; i++)
|
||||
drawblob(vid, (x*CELL+i), (y*CELL+j), 0x24, 0x24, 0x24);
|
||||
for (j=0; j<CELL; j+=2)
|
||||
for (i=0; i<CELL; i+=2)
|
||||
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x000000);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j=0; j<CELL; j+=2)
|
||||
for (i=0; i<CELL; i+=2)
|
||||
drawblob(vid, (x*CELL+i), (y*CELL+j), 0x24, 0x24, 0x24);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wtypes[wt].eglow && emap[y][x])
|
||||
{
|
||||
|
121
src/interface.c
121
src/interface.c
@ -804,58 +804,15 @@ void draw_svf_ui(pixel *vid_buf, int alternate)// all the buttons at the bottom
|
||||
}
|
||||
|
||||
//The simulation options button, used to be the heat sim button
|
||||
/*if (!legacy_enable)
|
||||
{
|
||||
fillrect(vid_buf, XRES-160+BARSIZE, YRES+(MENUSIZE-17), 16, 16, 255, 255, 255, 255);
|
||||
drawtext(vid_buf, XRES-154+BARSIZE, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255);
|
||||
drawtext(vid_buf, XRES-154+BARSIZE, YRES+(MENUSIZE-13), "\xBD", 0, 0, 0, 255);
|
||||
}
|
||||
else*/
|
||||
{
|
||||
drawtext(vid_buf, XRES-156+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xCF", 255, 255, 255, 255);
|
||||
drawrect(vid_buf, XRES-159+BARSIZE/*494*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255);
|
||||
}
|
||||
|
||||
//the view mode button
|
||||
switch (cmode)
|
||||
{
|
||||
case CM_VEL:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255);
|
||||
break;
|
||||
case CM_PRESS:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255);
|
||||
break;
|
||||
case CM_PERS:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255);
|
||||
break;
|
||||
case CM_FIRE:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9B", 255, 0, 0, 255);
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9C", 255, 255, 64, 255);
|
||||
break;
|
||||
case CM_BLOB:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255);
|
||||
break;
|
||||
case CM_HEAT:
|
||||
drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBE", 255, 0, 0, 255);
|
||||
drawtext(vid_buf, XRES-27+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBD", 255, 255, 255, 255);
|
||||
break;
|
||||
case CM_FANCY:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255);
|
||||
break;
|
||||
case CM_NOTHING:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255);
|
||||
break;
|
||||
case CM_CRACK:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD4", 255, 55, 55, 255);
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD5", 55, 255, 55, 255);
|
||||
break;
|
||||
case CM_GRAD:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD3", 255, 50, 255, 255);
|
||||
break;
|
||||
case CM_LIFE:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 255, 50, 255, 255);
|
||||
break;
|
||||
}
|
||||
addchar(vid_buf, XRES-29+BARSIZE, YRES+(MENUSIZE-13), 0xD8, 255, 0, 0, 255);
|
||||
addchar(vid_buf, XRES-29+BARSIZE, YRES+(MENUSIZE-13), 0xD9, 0, 255, 0, 255);
|
||||
addchar(vid_buf, XRES-29+BARSIZE, YRES+(MENUSIZE-13), 0xDA, 0, 0, 255, 255);
|
||||
drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255);
|
||||
|
||||
// special icons for admin/mods
|
||||
@ -2705,74 +2662,6 @@ int sdl_poll(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void set_cmode(int cm) // sets to given view mode
|
||||
{
|
||||
cmode = cm;
|
||||
itc = 51;
|
||||
if (cmode==CM_BLOB)
|
||||
{
|
||||
memset(fire_r, 0, sizeof(fire_r));
|
||||
memset(fire_g, 0, sizeof(fire_g));
|
||||
memset(fire_b, 0, sizeof(fire_b));
|
||||
strcpy(itc_msg, "Blob Display");
|
||||
}
|
||||
else if (cmode==CM_HEAT)
|
||||
{
|
||||
strcpy(itc_msg, "Heat Display");
|
||||
}
|
||||
else if (cmode==CM_FANCY)
|
||||
{
|
||||
memset(fire_r, 0, sizeof(fire_r));
|
||||
memset(fire_g, 0, sizeof(fire_g));
|
||||
memset(fire_b, 0, sizeof(fire_b));
|
||||
strcpy(itc_msg, "Fancy Display");
|
||||
}
|
||||
else if (cmode==CM_FIRE)
|
||||
{
|
||||
memset(fire_r, 0, sizeof(fire_r));
|
||||
memset(fire_g, 0, sizeof(fire_g));
|
||||
memset(fire_b, 0, sizeof(fire_b));
|
||||
strcpy(itc_msg, "Fire Display");
|
||||
}
|
||||
else if (cmode==CM_PERS)
|
||||
{
|
||||
memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||
strcpy(itc_msg, "Persistent Display");
|
||||
}
|
||||
else if (cmode==CM_PRESS)
|
||||
{
|
||||
strcpy(itc_msg, "Pressure Display");
|
||||
}
|
||||
else if (cmode==CM_NOTHING)
|
||||
{
|
||||
strcpy(itc_msg, "Nothing Display");
|
||||
}
|
||||
else if (cmode==CM_CRACK)
|
||||
{
|
||||
strcpy(itc_msg, "Alternate Velocity Display");
|
||||
}
|
||||
else if (cmode==CM_GRAD)
|
||||
{
|
||||
strcpy(itc_msg, "Heat Gradient Display");
|
||||
}
|
||||
else if (cmode==CM_LIFE)
|
||||
{
|
||||
if (DEBUG_MODE) //can only get to Life view in debug mode
|
||||
{
|
||||
strcpy(itc_msg, "Life Display");
|
||||
}
|
||||
else
|
||||
{
|
||||
set_cmode(CM_CRACK);
|
||||
}
|
||||
}
|
||||
else //if no special text given, it will display this.
|
||||
{
|
||||
strcpy(itc_msg, "Velocity Display");
|
||||
}
|
||||
save_presets(0);
|
||||
}
|
||||
|
||||
char *download_ui(pixel *vid_buf, char *uri, int *len)
|
||||
{
|
||||
int dstate = 0;
|
||||
@ -6154,6 +6043,10 @@ openfin:
|
||||
return;
|
||||
}
|
||||
|
||||
void render_ui(pixel * vid_buf)
|
||||
{
|
||||
}
|
||||
|
||||
void simulation_ui(pixel * vid_buf)
|
||||
{
|
||||
int xsize = 300;
|
||||
|
@ -1104,10 +1104,7 @@ int luatpt_heat(lua_State* l)
|
||||
}
|
||||
int luatpt_cmode_set(lua_State* l)
|
||||
{
|
||||
int aheatstate;
|
||||
aheatstate = luaL_optint(l, 1, CM_FIRE);
|
||||
cmode = aheatstate;
|
||||
return 0;
|
||||
return luaL_error(l, "Not implemented");
|
||||
}
|
||||
int luatpt_setfire(lua_State* l)
|
||||
{
|
||||
|
41
src/main.c
41
src/main.c
@ -47,6 +47,7 @@
|
||||
#include <font.h>
|
||||
#include <powder.h>
|
||||
#include <graphics.h>
|
||||
#include <powdergraphics.h>
|
||||
#include <version.h>
|
||||
#include <http.h>
|
||||
#include <md5.h>
|
||||
@ -1521,7 +1522,9 @@ int main(int argc, char *argv[])
|
||||
char ppmfilename[256], ptifilename[256], ptismallfilename[256];
|
||||
FILE *f;
|
||||
|
||||
cmode = CM_FIRE;
|
||||
colour_mode = COLOUR_DEFAULT;
|
||||
init_display_modes();
|
||||
|
||||
sys_pause = 1;
|
||||
parts = calloc(sizeof(particle), NPART);
|
||||
for (i=0; i<NPART-1; i++)
|
||||
@ -1669,6 +1672,9 @@ int main(int argc, char *argv[])
|
||||
cb_parts = calloc(sizeof(particle), NPART);
|
||||
init_can_move();
|
||||
clear_sim();
|
||||
|
||||
colour_mode = COLOUR_DEFAULT;
|
||||
init_display_modes();
|
||||
|
||||
//fbi_img = render_packed_rgb(fbi, FBI_W, FBI_H, FBI_CMP);
|
||||
|
||||
@ -1803,7 +1809,7 @@ int main(int argc, char *argv[])
|
||||
#ifdef OGLR
|
||||
part_vbuf = vid_buf;
|
||||
#else
|
||||
if(ngrav_enable && cmode==CM_FANCY)
|
||||
if(ngrav_enable && display_mode & DISPLAY_WARP)
|
||||
{
|
||||
part_vbuf = part_vbuf_store;
|
||||
memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||
@ -1819,7 +1825,7 @@ int main(int argc, char *argv[])
|
||||
gravwl_timeout--;
|
||||
}
|
||||
#ifdef OGLR
|
||||
if (cmode==CM_PERS)//save background for persistent, then clear
|
||||
if (display_mode & DISPLAY_PERS)//save background for persistent, then clear
|
||||
{
|
||||
clearScreen(0.01f);
|
||||
memset(part_vbuf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||
@ -1828,17 +1834,17 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
clearScreen(1.0f);
|
||||
memset(part_vbuf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||
if (cmode==CM_VEL || cmode==CM_PRESS || cmode==CM_CRACK || (cmode==CM_HEAT && aheat_enable))//air only gets drawn in these modes
|
||||
if (display_mode & DISPLAY_AIR)//air only gets drawn in these modes
|
||||
{
|
||||
draw_air(part_vbuf);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (cmode==CM_VEL || cmode==CM_PRESS || cmode==CM_CRACK || (cmode==CM_HEAT && aheat_enable))//air only gets drawn in these modes
|
||||
if (display_mode & DISPLAY_AIR)//air only gets drawn in these modes
|
||||
{
|
||||
draw_air(part_vbuf);
|
||||
}
|
||||
else if (cmode==CM_PERS)//save background for persistent, then clear
|
||||
else if (display_mode & DISPLAY_PERS)//save background for persistent, then clear
|
||||
{
|
||||
memcpy(part_vbuf, pers_bg, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||
memset(part_vbuf+((XRES+BARSIZE)*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-((XRES+BARSIZE)*YRES*PIXELSIZE));
|
||||
@ -1962,7 +1968,7 @@ int main(int argc, char *argv[])
|
||||
sys_pause = 1;
|
||||
}
|
||||
|
||||
if (cmode==CM_PERS)
|
||||
if (display_mode & DISPLAY_PERS)
|
||||
{
|
||||
if (!fire_fc)//fire_fc has nothing to do with fire... it is a counter for diminishing persistent view every 3 frames
|
||||
{
|
||||
@ -1976,14 +1982,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
#ifndef OGLR
|
||||
if (cmode==CM_FIRE||cmode==CM_BLOB||cmode==CM_FANCY)
|
||||
if (render_mode & FIREMODE)
|
||||
render_fire(part_vbuf);
|
||||
#endif
|
||||
|
||||
render_signs(part_vbuf);
|
||||
|
||||
#ifndef OGLR
|
||||
if(ngrav_enable && cmode==CM_FANCY)
|
||||
if(ngrav_enable && display_mode & DISPLAY_WARP)
|
||||
render_gravlensing(part_vbuf, vid_buf);
|
||||
#endif
|
||||
|
||||
@ -2202,7 +2208,8 @@ int main(int argc, char *argv[])
|
||||
it = 50;
|
||||
save_mode = 1;
|
||||
}
|
||||
if (sdl_key=='1')
|
||||
//TODO: Superseded by new display mode switching, need some keyboard shortcuts
|
||||
/*if (sdl_key=='1')
|
||||
{
|
||||
set_cmode(CM_VEL);
|
||||
}
|
||||
@ -2245,7 +2252,7 @@ int main(int argc, char *argv[])
|
||||
if (sdl_key=='1'&& (sdl_mod & (KMOD_SHIFT)) && DEBUG_MODE)
|
||||
{
|
||||
set_cmode(CM_LIFE);
|
||||
}
|
||||
}*/
|
||||
if (sdl_key==SDLK_TAB)
|
||||
{
|
||||
CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ;
|
||||
@ -2550,12 +2557,13 @@ int main(int argc, char *argv[])
|
||||
save_mode = 1;
|
||||
copy_mode = 1;
|
||||
}
|
||||
else if (sdl_key=='c')
|
||||
//TODO: Superseded by new display mode switching, need some keyboard shortcuts
|
||||
/*else if (sdl_key=='c')
|
||||
{
|
||||
set_cmode((cmode+1) % CM_COUNT);
|
||||
if (it > 50)
|
||||
it = 50;
|
||||
}
|
||||
}*/
|
||||
if (sdl_key=='z'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) // Undo
|
||||
{
|
||||
int cbx, cby, cbi;
|
||||
@ -3154,7 +3162,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq)
|
||||
{
|
||||
if (b & SDL_BUTTON_LMASK) {
|
||||
render_ui(vid_buf);
|
||||
/*if (b & SDL_BUTTON_LMASK) {
|
||||
set_cmode((cmode+1) % CM_COUNT);
|
||||
}
|
||||
if (b & SDL_BUTTON_RMASK) {
|
||||
@ -3163,7 +3172,7 @@ int main(int argc, char *argv[])
|
||||
} else {
|
||||
set_cmode((cmode+(CM_COUNT-1)) % CM_COUNT);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
if (x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq)
|
||||
sys_pause = !sys_pause;
|
||||
@ -3668,6 +3677,8 @@ int main(int argc, char *argv[])
|
||||
player2.elem = PT_DUST;
|
||||
}
|
||||
}
|
||||
save_presets(0);
|
||||
|
||||
SDL_CloseAudio();
|
||||
http_done();
|
||||
#ifdef GRAVFFT
|
||||
|
@ -159,7 +159,7 @@ void save_presets(int do_update)
|
||||
|
||||
//General settings
|
||||
cJSON_AddStringToObject(root, "proxy", http_proxy_string);
|
||||
cJSON_AddNumberToObject(root, "cmode", cmode);
|
||||
cJSON_AddNumberToObject(root, "colour_mode", colour_mode);
|
||||
cJSON_AddNumberToObject(root, "scale", sdl_scale);
|
||||
|
||||
outputdata = cJSON_Print(root);
|
||||
@ -265,7 +265,8 @@ void load_presets(void)
|
||||
|
||||
//Read general settings
|
||||
if((tmpobj = cJSON_GetObjectItem(root, "proxy")) && tmpobj->type == cJSON_String) strncpy(http_proxy_string, tmpobj->valuestring, 255); else http_proxy_string[0] = 0;
|
||||
if(tmpobj = cJSON_GetObjectItem(root, "cmode")) cmode = tmpobj->valueint;
|
||||
//TODO: Translate old cmode value into new *_mode values
|
||||
if(tmpobj = cJSON_GetObjectItem(root, "colour_mode")) colour_mode = tmpobj->valueint;
|
||||
if(tmpobj = cJSON_GetObjectItem(root, "scale")) sdl_scale = tmpobj->valueint;
|
||||
|
||||
cJSON_Delete(root);
|
||||
@ -317,7 +318,8 @@ void load_presets(void)
|
||||
sdl_scale = (tmp == 2) ? 2 : 1;
|
||||
if (fread(&tmp, 1, 1, f) != 1)
|
||||
goto fail;
|
||||
cmode = tmp%CM_COUNT;
|
||||
//TODO: Translate old cmode value into new *_mode values
|
||||
//cmode = tmp%CM_COUNT;
|
||||
if (fread(&tmp, 1, 1, f) != 1)
|
||||
goto fail;
|
||||
svf_admin = tmp;
|
||||
|
Loading…
Reference in New Issue
Block a user