update with latest
This commit is contained in:
parent
30d86813fc
commit
e882dfecf9
@ -8,9 +8,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SAVE_VERSION 46
|
#define SAVE_VERSION 46
|
||||||
#define MINOR_VERSION 0
|
#define MINOR_VERSION 1
|
||||||
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
|
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
|
||||||
//#define BETA
|
#define BETA
|
||||||
|
|
||||||
#define SERVER "powdertoy.co.uk"
|
#define SERVER "powdertoy.co.uk"
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ int GRAV_G2;
|
|||||||
int GRAV_B2;
|
int GRAV_B2;
|
||||||
|
|
||||||
extern int legacy_enable;
|
extern int legacy_enable;
|
||||||
|
extern int sound_enable;
|
||||||
extern int kiosk_enable;
|
extern int kiosk_enable;
|
||||||
|
|
||||||
extern int sys_pause;
|
extern int sys_pause;
|
||||||
|
@ -441,22 +441,22 @@ static const part_type ptypes[PT_NUM] =
|
|||||||
{"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!", ST_SOLID, TYPE_PART, &update_FIRW},
|
{"FIRW", PIXPACK(0xFFA040), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, -0.99f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 55, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 70, "Fireworks!", ST_SOLID, TYPE_PART, &update_FIRW},
|
||||||
{"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity.", ST_SOLID, TYPE_SOLID, &update_FUSE},
|
{"FUSE", PIXPACK(0x0A5706), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.0f, 0.0f * CFDS, 0, 0, 0, 0, 20, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 200, "Solid. Burns slowly. Ignites at somewhat high temperatures and electricity.", ST_SOLID, TYPE_SOLID, &update_FUSE},
|
||||||
{"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE.", ST_SOLID, TYPE_PART, &update_FSEP},
|
{"FSEP", PIXPACK(0x63AD5F), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 70, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Fuse Powder. See FUSE.", ST_SOLID, TYPE_PART, &update_FSEP},
|
||||||
{"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles", ST_NONE, TYPE_PART, NULL}, //Maybe TYPE_ENERGY?
|
{"AMTR", PIXPACK(0x808080), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.00f, 0.10f, 1.00f, 0.0000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 70, "Anti-Matter, Destroys a majority of particles", ST_NONE, TYPE_PART, &update_AMTR}, //Maybe TYPE_ENERGY?
|
||||||
{"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL", ST_SOLID, TYPE_PART, &update_BCOL},
|
{"BCOL", PIXPACK(0x333333), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Coal. Heavy particles. See COAL", ST_SOLID, TYPE_PART, &update_BCOL},
|
||||||
{"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When activated, duplicates any particles it touches.", ST_NONE, TYPE_SOLID, &update_PCLN},
|
{"PCLN", PIXPACK(0x3B3B10), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Solid. When activated, duplicates any particles it touches.", ST_NONE, TYPE_SOLID, &update_PCLN},
|
||||||
{"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated", ST_NONE, TYPE_SOLID, &update_HSWC},
|
{"HSWC", PIXPACK(0x3B1010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Heat switch. Conducts Heat only when activated", ST_NONE, TYPE_SOLID, &update_HSWC},
|
||||||
{"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrolysis of WATR", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS, &update_IRON},
|
{"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 100, SC_CRACKER2, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrolysis of WATR", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS, &update_IRON},
|
||||||
{"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_CRACKER2, R_TEMP+4.0f +273.15f, 60, "Steam Train.", ST_NONE, TYPE_PART, &update_MORT},
|
{"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_CRACKER2, R_TEMP+4.0f +273.15f, 60, "Steam Train.", ST_NONE, TYPE_PART, &update_MORT},
|
||||||
{"GOL ", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Game Of Life! B3/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"GOL", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Game Of Life! B3/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"HLIF", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "High Life! B36/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"HLIF", PIXPACK(0xFF0000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "High Life! B36/S23", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"ASIM", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Assimilation! B345/S4567", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"ASIM", PIXPACK(0x0000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Assimilation! B345/S4567", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"2x2 ", PIXPACK(0xFFFF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "2x2! B36/S125", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"2x2", PIXPACK(0xFFFF00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "2x2! B36/S125", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"DANI", PIXPACK(0x00FFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Day and Night! B3678/S34678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"DANI", PIXPACK(0x00FFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Day and Night! B3678/S34678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"AMOE", PIXPACK(0xFF00FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Amoeba! B357/S1358", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"AMOE", PIXPACK(0xFF00FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Amoeba! B357/S1358", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"MOVE", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "'Move' particles! Does not move things.. it is a life type B368/S245", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"MOVE", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "'Move' particles! Does not move things.. it is a life type B368/S245", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"PGOL", PIXPACK(0xE05010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Pseudo Life! B357/S238", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"PGOL", PIXPACK(0xE05010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Pseudo Life! B357/S238", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"DMOE", PIXPACK(0x500000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Diamoeba! B35678/S5678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"DMOE", PIXPACK(0x500000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Diamoeba! B35678/S5678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"34 ", PIXPACK(0x500050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "34! B34/S34)", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"34", PIXPACK(0x500050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "34! B34/S34)", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"LLIF", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Long Life! B345/S5", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"LLIF", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Long Life! B345/S5", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"STAN", PIXPACK(0x5000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Stains! B3678/S235678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
{"STAN", PIXPACK(0x5000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Stains! B3678/S235678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
|
||||||
{"SPNG", PIXPACK(0xFFBE30), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 1, 30, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "A sponge, absorbs water.", ST_SOLID, TYPE_SOLID, &update_SPNG},
|
{"SPNG", PIXPACK(0xFFBE30), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 1, 30, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "A sponge, absorbs water.", ST_SOLID, TYPE_SOLID, &update_SPNG},
|
||||||
@ -767,10 +767,11 @@ static int lolzrule[9][9] =
|
|||||||
{0,1,0,0,0,0,0,1,0},
|
{0,1,0,0,0,0,0,1,0},
|
||||||
{0,1,0,0,0,0,0,1,0},
|
{0,1,0,0,0,0,0,1,0},
|
||||||
};
|
};
|
||||||
int portal[(int)(MAX_TEMP-73.15f)/100+2][8][80];
|
#define CHANNELS ((int)(MAX_TEMP-73.15f)/100+2)
|
||||||
float portaltemp[(int)(MAX_TEMP-73.15f)/100+2][8][80];
|
int portal[CHANNELS][8][80];
|
||||||
int portalctype[(int)(MAX_TEMP-73.15f)/100+2][8][80];
|
float portaltemp[CHANNELS][8][80];
|
||||||
int wireless[(int)(MAX_TEMP-73.15f)/100+2][2];
|
int portalctype[CHANNELS][8][80];
|
||||||
|
int wireless[CHANNELS][2];
|
||||||
|
|
||||||
extern int isplayer;
|
extern int isplayer;
|
||||||
extern float player[27];
|
extern float player[27];
|
||||||
@ -778,6 +779,7 @@ extern float player[27];
|
|||||||
extern float player2[27];
|
extern float player2[27];
|
||||||
|
|
||||||
extern int gravityMode;
|
extern int gravityMode;
|
||||||
|
extern int airMode;
|
||||||
|
|
||||||
extern particle *parts;
|
extern particle *parts;
|
||||||
extern particle *cb_parts;
|
extern particle *cb_parts;
|
||||||
|
26
src/air.c
26
src/air.c
@ -33,6 +33,9 @@ void update_air(void)
|
|||||||
{
|
{
|
||||||
int x, y, i, j;
|
int x, y, i, j;
|
||||||
float dp, dx, dy, f, tx, ty;
|
float dp, dx, dy, f, tx, ty;
|
||||||
|
|
||||||
|
if (airMode != 4) {
|
||||||
|
|
||||||
for (i=0; i<YRES/CELL; i++)
|
for (i=0; i<YRES/CELL; i++)
|
||||||
{
|
{
|
||||||
pv[i][0] = pv[i][0]*0.8f;
|
pv[i][0] = pv[i][0]*0.8f;
|
||||||
@ -177,6 +180,28 @@ void update_air(void)
|
|||||||
if (dy > 256.0f) dy = 256.0f;
|
if (dy > 256.0f) dy = 256.0f;
|
||||||
if (dy < -256.0f) dy = -256.0f;
|
if (dy < -256.0f) dy = -256.0f;
|
||||||
|
|
||||||
|
|
||||||
|
switch (airMode)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case 0: //Default
|
||||||
|
break;
|
||||||
|
case 1: //0 Pressure
|
||||||
|
dp = 0.0f;
|
||||||
|
break;
|
||||||
|
case 2: //0 Velocity
|
||||||
|
dx = 0.0f;
|
||||||
|
dy = 0.0f;
|
||||||
|
break;
|
||||||
|
case 3: //0 Air
|
||||||
|
dx = 0.0f;
|
||||||
|
dy = 0.0f;
|
||||||
|
dp = 0.0f;
|
||||||
|
break;
|
||||||
|
case 4: //No Update
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ovx[y][x] = dx;
|
ovx[y][x] = dx;
|
||||||
ovy[y][x] = dy;
|
ovy[y][x] = dy;
|
||||||
opv[y][x] = dp;
|
opv[y][x] = dp;
|
||||||
@ -185,3 +210,4 @@ void update_air(void)
|
|||||||
memcpy(vy, ovy, sizeof(vy));
|
memcpy(vy, ovy, sizeof(vy));
|
||||||
memcpy(pv, opv, sizeof(pv));
|
memcpy(pv, opv, sizeof(pv));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -4,6 +4,8 @@ int update_PRTI(UPDATE_FUNC_ARGS) {
|
|||||||
int r, nnx, rx, ry;
|
int r, nnx, rx, ry;
|
||||||
int count =0;
|
int count =0;
|
||||||
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
|
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
|
||||||
|
if (parts[i].tmp>=CHANNELS) parts[i].tmp = CHANNELS-1;
|
||||||
|
else if (parts[i].tmp<0) parts[i].tmp = 0;
|
||||||
for (rx=-1; rx<2; rx++)
|
for (rx=-1; rx<2; rx++)
|
||||||
for (ry=-1; ry<2; ry++)
|
for (ry=-1; ry<2; ry++)
|
||||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||||
|
@ -4,6 +4,8 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
|
|||||||
int r, nnx, rx, ry, np;
|
int r, nnx, rx, ry, np;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
|
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
|
||||||
|
if (parts[i].tmp>=CHANNELS) parts[i].tmp = CHANNELS-1;
|
||||||
|
else if (parts[i].tmp<0) parts[i].tmp = 0;
|
||||||
for (rx=-1; rx<2; rx++)
|
for (rx=-1; rx<2; rx++)
|
||||||
for (ry=-1; ry<2; ry++)
|
for (ry=-1; ry<2; ry++)
|
||||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
int update_WIFI(UPDATE_FUNC_ARGS) {
|
int update_WIFI(UPDATE_FUNC_ARGS) {
|
||||||
int r, rx, ry;
|
int r, rx, ry;
|
||||||
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
|
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
|
||||||
|
if (parts[i].tmp>=CHANNELS) parts[i].tmp = CHANNELS-1;
|
||||||
|
else if (parts[i].tmp<0) parts[i].tmp = 0;
|
||||||
for (rx=-1; rx<2; rx++)
|
for (rx=-1; rx<2; rx++)
|
||||||
for (ry=-1; ry<2; ry++)
|
for (ry=-1; ry<2; ry++)
|
||||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||||
|
@ -855,7 +855,20 @@ int drawtextwrap(pixel *vid, int x, int y, int w, const char *s, int r, int g, i
|
|||||||
int rh = 12;
|
int rh = 12;
|
||||||
int rw = 0;
|
int rw = 0;
|
||||||
int cw = x;
|
int cw = x;
|
||||||
for (; *s; s++)
|
int wordlen;
|
||||||
|
int charspace;
|
||||||
|
while (*s)
|
||||||
|
{
|
||||||
|
wordlen = strcspn(s," .,!?\n");
|
||||||
|
charspace = textwidthx(s, w-(x-cw));
|
||||||
|
if (charspace<wordlen && wordlen && w-(x-cw)<w/3)
|
||||||
|
{
|
||||||
|
x = sx;
|
||||||
|
rw = 0;
|
||||||
|
y+=FONT_H+2;
|
||||||
|
rh+=FONT_H+2;
|
||||||
|
}
|
||||||
|
for (; *s && --wordlen>=-1; s++)
|
||||||
{
|
{
|
||||||
if (*s == '\n')
|
if (*s == '\n')
|
||||||
{
|
{
|
||||||
@ -891,7 +904,9 @@ int drawtextwrap(pixel *vid, int x, int y, int w, const char *s, int r, int g, i
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (x-cw>=w) {
|
|
||||||
|
if (x-cw>=w)
|
||||||
|
{
|
||||||
x = sx;
|
x = sx;
|
||||||
rw = 0;
|
rw = 0;
|
||||||
y+=FONT_H+2;
|
y+=FONT_H+2;
|
||||||
@ -900,6 +915,7 @@ int drawtextwrap(pixel *vid, int x, int y, int w, const char *s, int r, int g, i
|
|||||||
x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a);
|
x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return rh;
|
return rh;
|
||||||
}
|
}
|
||||||
@ -1009,19 +1025,30 @@ void textnpos(char *s, int n, int w, int *cx, int *cy)
|
|||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
//TODO: Implement Textnheight for wrapped text
|
int wordlen, charspace;
|
||||||
for (; *s; s++)
|
while (*s&&n)
|
||||||
|
{
|
||||||
|
wordlen = strcspn(s," .,!?\n");
|
||||||
|
charspace = textwidthx(s, w-x);
|
||||||
|
if (charspace<wordlen && wordlen && w-x<w/3)
|
||||||
|
{
|
||||||
|
x = 0;
|
||||||
|
y += FONT_H+2;
|
||||||
|
}
|
||||||
|
for (; *s && --wordlen>=-1; s++)
|
||||||
{
|
{
|
||||||
if (!n) {
|
if (!n) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
x += font_data[font_ptrs[(int)(*(unsigned char *)s)]];
|
x += font_data[font_ptrs[(int)(*(unsigned char *)s)]];
|
||||||
if (x>=w) {
|
if (x>=w)
|
||||||
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
y += FONT_H+2;
|
y += FONT_H+2;
|
||||||
}
|
}
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
*cx = x-1;
|
*cx = x-1;
|
||||||
*cy = y;
|
*cy = y;
|
||||||
}
|
}
|
||||||
@ -1041,12 +1068,21 @@ int textwidthx(char *s, int w)
|
|||||||
}
|
}
|
||||||
int textposxy(char *s, int width, int w, int h)
|
int textposxy(char *s, int width, int w, int h)
|
||||||
{
|
{
|
||||||
int x=0,y=0,n=0,cw;
|
int x=0,y=0,n=0,cw, wordlen, charspace;
|
||||||
for (; *s; s++)
|
while (*s)
|
||||||
|
{
|
||||||
|
wordlen = strcspn(s," .,!?\n");
|
||||||
|
charspace = textwidthx(s, width-x);
|
||||||
|
if (charspace<wordlen && wordlen && width-x<width/3)
|
||||||
|
{
|
||||||
|
x = 0;
|
||||||
|
y += FONT_H+2;
|
||||||
|
}
|
||||||
|
for (; *s && --wordlen>=-1; s++)
|
||||||
{
|
{
|
||||||
cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]];
|
cw = font_data[font_ptrs[(int)(*(unsigned char *)s)]];
|
||||||
if (x+(cw/2) >= w && y+6 >= h)
|
if ((x+(cw/2) >= w && y+6 >= h)||(y+6 >= h+FONT_H+2))
|
||||||
break;
|
return n++;
|
||||||
x += cw;
|
x += cw;
|
||||||
if (x>=width) {
|
if (x>=width) {
|
||||||
x = 0;
|
x = 0;
|
||||||
@ -1054,6 +1090,7 @@ int textposxy(char *s, int width, int w, int h)
|
|||||||
}
|
}
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1483,7 +1520,9 @@ void draw_parts(pixel *vid)
|
|||||||
t!=PT_HFLM && t!=PT_SPRK && t!=PT_FIRW &&
|
t!=PT_HFLM && t!=PT_SPRK && t!=PT_FIRW &&
|
||||||
t!=PT_DUST && t!=PT_FIRW && t!=PT_FWRK &&
|
t!=PT_DUST && t!=PT_FIRW && t!=PT_FWRK &&
|
||||||
t!=PT_NEUT && t!=PT_LAVA && t!=PT_BOMB &&
|
t!=PT_NEUT && t!=PT_LAVA && t!=PT_BOMB &&
|
||||||
t!=PT_PHOT && t!=PT_THDR && t!=PT_SMKE)
|
t!=PT_PHOT && t!=PT_THDR && t!=PT_SMKE &&
|
||||||
|
t!=PT_LCRY && t!=PT_SWCH && t!=PT_PCLN &&
|
||||||
|
t!=PT_PUMP && t!=PT_HSWC && t!=PT_FILT)
|
||||||
{
|
{
|
||||||
if (ptypes[parts[i].type].properties&TYPE_LIQUID)
|
if (ptypes[parts[i].type].properties&TYPE_LIQUID)
|
||||||
{
|
{
|
||||||
|
@ -867,14 +867,14 @@ void login_ui(pixel *vid_buf)
|
|||||||
if (res && !strncmp(res, "OK ", 3))
|
if (res && !strncmp(res, "OK ", 3))
|
||||||
{
|
{
|
||||||
char *s_id,*u_e,*nres;
|
char *s_id,*u_e,*nres;
|
||||||
printf("\n{%s}\n", res);
|
printf("{%s}\n", res);
|
||||||
s_id = strchr(res+3, ' ');
|
s_id = strchr(res+3, ' ');
|
||||||
if (!s_id)
|
if (!s_id)
|
||||||
goto fail;
|
goto fail;
|
||||||
*(s_id++) = 0;
|
*(s_id++) = 0;
|
||||||
|
|
||||||
u_e = strchr(s_id, ' ');
|
u_e = strchr(s_id, ' ');
|
||||||
if (!u_e){
|
if (!u_e) {
|
||||||
u_e = malloc(1);
|
u_e = malloc(1);
|
||||||
memset(u_e, 0, 1);
|
memset(u_e, 0, 1);
|
||||||
}
|
}
|
||||||
@ -885,7 +885,7 @@ void login_ui(pixel *vid_buf)
|
|||||||
strcpy(svf_session_id, s_id);
|
strcpy(svf_session_id, s_id);
|
||||||
nres = mystrdup(u_e);
|
nres = mystrdup(u_e);
|
||||||
|
|
||||||
printf("\n{%s} {%s} {%s}\n", svf_user_id, svf_session_id, nres);
|
printf("{%s} {%s} {%s}\n", svf_user_id, svf_session_id, nres);
|
||||||
|
|
||||||
if (!strncmp(nres, "ADMIN", 5))
|
if (!strncmp(nres, "ADMIN", 5))
|
||||||
{
|
{
|
||||||
@ -3957,19 +3957,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
|
|||||||
|
|
||||||
int console_parse_type(char *txt, int *element, char *err)
|
int console_parse_type(char *txt, int *element, char *err)
|
||||||
{
|
{
|
||||||
int i = atoi(txt);
|
int i = -1;
|
||||||
char num[4];
|
|
||||||
if (i>=0 && i<PT_NUM)
|
|
||||||
{
|
|
||||||
sprintf(num,"%d",i);
|
|
||||||
if (strcmp(txt,num)==0)
|
|
||||||
{
|
|
||||||
*element = i;
|
|
||||||
strcpy(err,"");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i = -1;
|
|
||||||
// alternative names for some elements
|
// alternative names for some elements
|
||||||
if (strcasecmp(txt,"C4")==0) i = PT_PLEX;
|
if (strcasecmp(txt,"C4")==0) i = PT_PLEX;
|
||||||
else if (strcasecmp(txt,"C5")==0) i = PT_C5;
|
else if (strcasecmp(txt,"C5")==0) i = PT_C5;
|
||||||
@ -3995,13 +3983,7 @@ int console_parse_coords(char *txt, int *x, int *y, char *err)
|
|||||||
{
|
{
|
||||||
// TODO: use regex?
|
// TODO: use regex?
|
||||||
int nx = -1, ny = -1;
|
int nx = -1, ny = -1;
|
||||||
sscanf(txt,"%d,%d",&nx,&ny);
|
if (sscanf(txt,"%d,%d",&nx,&ny)!=2 || nx<0 || nx>=XRES || ny<0 || ny>=YRES)
|
||||||
if (nx<0 && nx>=XRES)
|
|
||||||
{
|
|
||||||
strcpy(err,"Invalid coordinates");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (ny<0 && ny>=YRES)
|
|
||||||
{
|
{
|
||||||
strcpy(err,"Invalid coordinates");
|
strcpy(err,"Invalid coordinates");
|
||||||
return 0;
|
return 0;
|
||||||
@ -4012,9 +3994,10 @@ int console_parse_coords(char *txt, int *x, int *y, char *err)
|
|||||||
}
|
}
|
||||||
int console_parse_partref(char *txt, int *which, char *err)
|
int console_parse_partref(char *txt, int *which, char *err)
|
||||||
{
|
{
|
||||||
|
strcpy(err,"");
|
||||||
// TODO: use regex?
|
// TODO: use regex?
|
||||||
int i = -1, nx, ny;
|
int i = -1, nx, ny;
|
||||||
if (console_parse_coords(txt, &nx, &ny, err))
|
if (strchr(txt,',') && console_parse_coords(txt, &nx, &ny, err))
|
||||||
{
|
{
|
||||||
i = pmap[ny][nx];
|
i = pmap[ny][nx];
|
||||||
if (!i || (i>>8)>=NPART)
|
if (!i || (i>>8)>=NPART)
|
||||||
@ -4025,7 +4008,6 @@ int console_parse_partref(char *txt, int *which, char *err)
|
|||||||
else if (txt)
|
else if (txt)
|
||||||
{
|
{
|
||||||
char *num = (char*)malloc(strlen(txt)+3);
|
char *num = (char*)malloc(strlen(txt)+3);
|
||||||
strcpy(err,""); // suppress error message from failed coordinate parsing
|
|
||||||
i = atoi(txt);
|
i = atoi(txt);
|
||||||
sprintf(num,"%d",i);
|
sprintf(num,"%d",i);
|
||||||
if (!txt || strcmp(txt,num)!=0)
|
if (!txt || strcmp(txt,num)!=0)
|
||||||
@ -4038,6 +4020,6 @@ int console_parse_partref(char *txt, int *which, char *err)
|
|||||||
strcpy(err,"");
|
strcpy(err,"");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
strcpy(err,"Particle does not exist");
|
if (strcmp(err,"")==0) strcpy(err,"Particle does not exist");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
146
src/main.c
146
src/main.c
@ -82,6 +82,8 @@ void play_sound(char *file)
|
|||||||
Uint32 dlen;
|
Uint32 dlen;
|
||||||
SDL_AudioCVT cvt;
|
SDL_AudioCVT cvt;
|
||||||
|
|
||||||
|
if (!sound_enable) return;
|
||||||
|
|
||||||
/* Look for an empty (or finished) sound slot */
|
/* Look for an empty (or finished) sound slot */
|
||||||
for ( index=0; index<NUM_SOUNDS; ++index ) {
|
for ( index=0; index<NUM_SOUNDS; ++index ) {
|
||||||
if ( sounds[index].dpos == sounds[index].dlen ) {
|
if ( sounds[index].dpos == sounds[index].dlen ) {
|
||||||
@ -167,6 +169,7 @@ int FPSB = 0;
|
|||||||
int MSIGN =-1;
|
int MSIGN =-1;
|
||||||
//int CGOL = 0;
|
//int CGOL = 0;
|
||||||
//int GSPEED = 1;//causes my .exe to crash..
|
//int GSPEED = 1;//causes my .exe to crash..
|
||||||
|
int sound_enable;
|
||||||
|
|
||||||
sign signs[MAXSIGNS];
|
sign signs[MAXSIGNS];
|
||||||
|
|
||||||
@ -543,7 +546,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
|
|||||||
if (replace)
|
if (replace)
|
||||||
{
|
{
|
||||||
gravityMode = 1;
|
gravityMode = 1;
|
||||||
|
airMode = 1;
|
||||||
memset(bmap, 0, sizeof(bmap));
|
memset(bmap, 0, sizeof(bmap));
|
||||||
memset(emap, 0, sizeof(emap));
|
memset(emap, 0, sizeof(emap));
|
||||||
memset(signs, 0, sizeof(signs));
|
memset(signs, 0, sizeof(signs));
|
||||||
@ -1181,9 +1184,10 @@ int main(int argc, char *argv[])
|
|||||||
pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
|
pixel *vid_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
|
||||||
pixel *pers_bg=calloc((XRES+BARSIZE)*YRES, PIXELSIZE);
|
pixel *pers_bg=calloc((XRES+BARSIZE)*YRES, PIXELSIZE);
|
||||||
void *http_ver_check;
|
void *http_ver_check;
|
||||||
char *ver_data=NULL, *tmp;
|
void *http_session_check = NULL;
|
||||||
|
char *ver_data=NULL, *check_data=NULL, *tmp;
|
||||||
char console_error[255] = "";
|
char console_error[255] = "";
|
||||||
int i, j, bq, fire_fc=0, do_check=0, old_version=0, http_ret=0, major, minor, old_ver_len;
|
int i, j, bq, fire_fc=0, do_check=0, do_s_check=0, old_version=0, http_ret=0,http_s_ret=0, major, minor, old_ver_len;
|
||||||
#ifdef INTERNAL
|
#ifdef INTERNAL
|
||||||
int vs = 0;
|
int vs = 0;
|
||||||
#endif
|
#endif
|
||||||
@ -1208,9 +1212,12 @@ int main(int argc, char *argv[])
|
|||||||
if ( SDL_OpenAudio(&fmt, NULL) < 0 )
|
if ( SDL_OpenAudio(&fmt, NULL) < 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
|
fprintf(stderr, "Unable to open audio: %s\n", SDL_GetError());
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sound_enable = 1;
|
||||||
SDL_PauseAudio(0);
|
SDL_PauseAudio(0);
|
||||||
|
}
|
||||||
#ifdef MT
|
#ifdef MT
|
||||||
numCores = core_count();
|
numCores = core_count();
|
||||||
#endif
|
#endif
|
||||||
@ -1285,6 +1292,10 @@ int main(int argc, char *argv[])
|
|||||||
#else
|
#else
|
||||||
http_ver_check = http_async_req_start(NULL, "http://" SERVER "/Update.api?Action=CheckVersion", NULL, 0, 0);
|
http_ver_check = http_async_req_start(NULL, "http://" SERVER "/Update.api?Action=CheckVersion", NULL, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
if(svf_login){
|
||||||
|
http_session_check = http_async_req_start(NULL, "http://" SERVER "/Login.api?Action=CheckSession", NULL, 0, 0);
|
||||||
|
http_auth_headers(http_session_check, svf_user_id, NULL, svf_session_id);
|
||||||
|
}
|
||||||
|
|
||||||
while (!sdl_poll())
|
while (!sdl_poll())
|
||||||
{
|
{
|
||||||
@ -1367,6 +1378,74 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
do_check = (do_check+1) & 15;
|
do_check = (do_check+1) & 15;
|
||||||
}
|
}
|
||||||
|
if(http_session_check)
|
||||||
|
{
|
||||||
|
if(!do_s_check && http_async_req_status(http_session_check))
|
||||||
|
{
|
||||||
|
check_data = http_async_req_stop(http_session_check, &http_s_ret, NULL);
|
||||||
|
if(http_ret==200 && check_data)
|
||||||
|
{
|
||||||
|
printf("{%s}\n", check_data);
|
||||||
|
if(!strncmp(check_data, "EXPIRED", 7))
|
||||||
|
{
|
||||||
|
//Session expired
|
||||||
|
strcpy(svf_user, "");
|
||||||
|
strcpy(svf_pass, "");
|
||||||
|
strcpy(svf_user_id, "");
|
||||||
|
strcpy(svf_session_id, "");
|
||||||
|
svf_login = 0;
|
||||||
|
svf_own = 0;
|
||||||
|
svf_admin = 0;
|
||||||
|
svf_mod = 0;
|
||||||
|
}
|
||||||
|
else if(!strncmp(check_data, "BANNED", 6))
|
||||||
|
{
|
||||||
|
//User banned
|
||||||
|
strcpy(svf_user, "");
|
||||||
|
strcpy(svf_pass, "");
|
||||||
|
strcpy(svf_user_id, "");
|
||||||
|
strcpy(svf_session_id, "");
|
||||||
|
svf_login = 0;
|
||||||
|
svf_own = 0;
|
||||||
|
svf_admin = 0;
|
||||||
|
svf_mod = 0;
|
||||||
|
}
|
||||||
|
else if(!strncmp(check_data, "OK", 2))
|
||||||
|
{
|
||||||
|
//Session valid
|
||||||
|
if(strlen(check_data)>2){
|
||||||
|
//User is elevated
|
||||||
|
if (!strncmp(check_data+3, "ADMIN", 5))
|
||||||
|
{
|
||||||
|
svf_admin = 1;
|
||||||
|
svf_mod = 0;
|
||||||
|
}
|
||||||
|
else if (!strncmp(check_data+3, "MOD", 3))
|
||||||
|
{
|
||||||
|
svf_admin = 0;
|
||||||
|
svf_mod = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
save_presets(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//No idea, but log the user out anyway
|
||||||
|
strcpy(svf_user, "");
|
||||||
|
strcpy(svf_pass, "");
|
||||||
|
strcpy(svf_user_id, "");
|
||||||
|
strcpy(svf_session_id, "");
|
||||||
|
svf_login = 0;
|
||||||
|
svf_own = 0;
|
||||||
|
svf_admin = 0;
|
||||||
|
svf_mod = 0;
|
||||||
|
}
|
||||||
|
free(check_data);
|
||||||
|
}
|
||||||
|
http_session_check = NULL;
|
||||||
|
}
|
||||||
|
do_s_check = (do_s_check+1) & 15;
|
||||||
|
}
|
||||||
|
|
||||||
if (sdl_key=='q' || sdl_key==SDLK_ESCAPE)
|
if (sdl_key=='q' || sdl_key==SDLK_ESCAPE)
|
||||||
{
|
{
|
||||||
@ -1563,7 +1642,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT)))
|
if ((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT)))
|
||||||
active_menu = 12;
|
active_menu = 11;
|
||||||
if (sdl_key==SDLK_INSERT)// || sdl_key==SDLK_BACKQUOTE)
|
if (sdl_key==SDLK_INSERT)// || sdl_key==SDLK_BACKQUOTE)
|
||||||
REPLACE_MODE = !REPLACE_MODE;
|
REPLACE_MODE = !REPLACE_MODE;
|
||||||
if (sdl_key==SDLK_BACKQUOTE)
|
if (sdl_key==SDLK_BACKQUOTE)
|
||||||
@ -1624,6 +1703,33 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sdl_key=='y')
|
||||||
|
{
|
||||||
|
++airMode;
|
||||||
|
itc = 52;
|
||||||
|
switch (airMode)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
airMode = 0;
|
||||||
|
case 0:
|
||||||
|
strcpy(itc_msg, "Air: On");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
strcpy(itc_msg, "Air: Pressure Off");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
strcpy(itc_msg, "Air: Velocity Off");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
strcpy(itc_msg, "Air: Off");
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
strcpy(itc_msg, "Air: No Update");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (sdl_key=='t')
|
if (sdl_key=='t')
|
||||||
VINE_MODE = !VINE_MODE;
|
VINE_MODE = !VINE_MODE;
|
||||||
if (sdl_key==SDLK_SPACE)
|
if (sdl_key==SDLK_SPACE)
|
||||||
@ -1841,7 +1947,6 @@ int main(int argc, char *argv[])
|
|||||||
if (tctype>=PT_NUM)
|
if (tctype>=PT_NUM)
|
||||||
tctype = 0;
|
tctype = 0;
|
||||||
sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d, #%d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life ,cr>>8);
|
sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d, #%d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life ,cr>>8);
|
||||||
sprintf(coordtext, "X:%d Y:%d", x/sdl_scale, y/sdl_scale);
|
|
||||||
//sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
|
//sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
|
||||||
} else {
|
} else {
|
||||||
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f);
|
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f);
|
||||||
@ -1850,10 +1955,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (DEBUG_MODE)
|
|
||||||
sprintf(coordtext, "X:%d Y:%d", x/sdl_scale, y/sdl_scale);
|
|
||||||
sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]);
|
sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]);
|
||||||
}
|
}
|
||||||
|
if (DEBUG_MODE)
|
||||||
|
sprintf(coordtext, "X:%d Y:%d", x/sdl_scale, y/sdl_scale);
|
||||||
}
|
}
|
||||||
mx = x;
|
mx = x;
|
||||||
my = y;
|
my = y;
|
||||||
@ -2173,6 +2278,7 @@ int main(int argc, char *argv[])
|
|||||||
svf_tags[0] = 0;
|
svf_tags[0] = 0;
|
||||||
svf_description[0] = 0;
|
svf_description[0] = 0;
|
||||||
gravityMode = 1;
|
gravityMode = 1;
|
||||||
|
airMode = 0;
|
||||||
death = death2 = 0;
|
death = death2 = 0;
|
||||||
isplayer2 = 0;
|
isplayer2 = 0;
|
||||||
isplayer = 0;
|
isplayer = 0;
|
||||||
@ -2626,19 +2732,18 @@ int main(int argc, char *argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int process_command(pixel *vid_buf,char *console,char *console_error) {
|
int process_command(pixel *vid_buf,char *console,char *console_error) {
|
||||||
|
int y,x,nx,ny,i,j,k,m;
|
||||||
int x,y,nx,ny,i,j,k,m;
|
int do_next = 1;
|
||||||
int do_next = 1;
|
char xcoord[10];
|
||||||
char xcoord[10];
|
char ycoord[10];
|
||||||
char ycoord[10];
|
char console2[15];
|
||||||
char console2[15];
|
char console3[15];
|
||||||
char console3[15];
|
char console4[15];
|
||||||
char console4[15];
|
char console5[15];
|
||||||
char console5[15];
|
|
||||||
//sprintf(console_error, "%s", console);
|
//sprintf(console_error, "%s", console);
|
||||||
if(console && strcmp(console, "")!=0 && strncmp(console, " ", 1)!=0)
|
if(console && strcmp(console, "")!=0 && strncmp(console, " ", 1)!=0)
|
||||||
{
|
{
|
||||||
sscanf(console,"%s %s %s %s", console2, console3, console4, console5);//why didn't i know about this function?!
|
sscanf(console,"%14s %14s %14s %14s", console2, console3, console4, console5);//why didn't i know about this function?!
|
||||||
if(strcmp(console2, "quit")==0)
|
if(strcmp(console2, "quit")==0)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -2679,7 +2784,7 @@ char console5[15];
|
|||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
sscanf(tokens,"x%d,y%d",&x,&y);
|
sscanf(tokens,"x%d,y%d",&x,&y);
|
||||||
sscanf(tokens,"%s,%s",xcoord,ycoord);
|
sscanf(tokens,"%9s,%9s",xcoord,ycoord);
|
||||||
x += nx;
|
x += nx;
|
||||||
y += ny;
|
y += ny;
|
||||||
sprintf(xcoord,"%d",x);
|
sprintf(xcoord,"%d",x);
|
||||||
@ -2726,7 +2831,8 @@ char console5[15];
|
|||||||
}
|
}
|
||||||
else if(strcmp(console2, "sound")==0 && console3)
|
else if(strcmp(console2, "sound")==0 && console3)
|
||||||
{
|
{
|
||||||
play_sound(console3);
|
if (sound_enable) play_sound(console3);
|
||||||
|
else strcpy(console_error, "Audio device not available - cannot play sounds");
|
||||||
}
|
}
|
||||||
else if(strcmp(console2, "load")==0 && console3)
|
else if(strcmp(console2, "load")==0 && console3)
|
||||||
{
|
{
|
||||||
|
15
src/misc.c
15
src/misc.c
@ -92,7 +92,7 @@ void strlist_free(struct strlist **list)
|
|||||||
void save_presets(int do_update)
|
void save_presets(int do_update)
|
||||||
{
|
{
|
||||||
FILE *f=fopen("powder.def", "wb");
|
FILE *f=fopen("powder.def", "wb");
|
||||||
unsigned char sig[4] = {0x50, 0x44, 0x65, 0x66};
|
unsigned char sig[4] = {0x50, 0x44, 0x65, 0x67};
|
||||||
unsigned char tmp = sdl_scale;
|
unsigned char tmp = sdl_scale;
|
||||||
if (!f)
|
if (!f)
|
||||||
return;
|
return;
|
||||||
@ -136,7 +136,7 @@ void load_presets(void)
|
|||||||
if (!f)
|
if (!f)
|
||||||
return;
|
return;
|
||||||
fread(sig, 1, 4, f);
|
fread(sig, 1, 4, f);
|
||||||
if (sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65 || sig[3]!=0x66)
|
if (sig[0]!=0x50 || sig[1]!=0x44 || sig[2]!=0x65)
|
||||||
{
|
{
|
||||||
if (sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F)
|
if (sig[0]==0x4D && sig[1]==0x6F && sig[2]==0x46 && sig[3]==0x6F)
|
||||||
{
|
{
|
||||||
@ -158,15 +158,20 @@ void load_presets(void)
|
|||||||
remove("powder.def");
|
remove("powder.def");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(sig[3]==0x66){
|
||||||
|
if (load_string(f, svf_user, 63))
|
||||||
|
goto fail;
|
||||||
|
if (load_string(f, svf_pass, 63))
|
||||||
|
goto fail;
|
||||||
|
} else {
|
||||||
if (load_string(f, svf_user, 63))
|
if (load_string(f, svf_user, 63))
|
||||||
goto fail;
|
goto fail;
|
||||||
//if (load_string(f, svf_pass, 63))
|
|
||||||
//goto fail;
|
|
||||||
if (load_string(f, svf_user_id, 63))
|
if (load_string(f, svf_user_id, 63))
|
||||||
goto fail;
|
goto fail;
|
||||||
if (load_string(f, svf_session_id, 63))
|
if (load_string(f, svf_session_id, 63))
|
||||||
goto fail;
|
goto fail;
|
||||||
svf_login = !!svf_user[0];
|
}
|
||||||
|
svf_login = !!svf_session_id[0];
|
||||||
if (fread(&tmp, 1, 1, f) != 1)
|
if (fread(&tmp, 1, 1, f) != 1)
|
||||||
goto fail;
|
goto fail;
|
||||||
sdl_scale = (tmp == 2) ? 2 : 1;
|
sdl_scale = (tmp == 2) ? 2 : 1;
|
||||||
|
39
src/powder.c
39
src/powder.c
@ -13,6 +13,8 @@ particle *parts;
|
|||||||
particle *cb_parts;
|
particle *cb_parts;
|
||||||
|
|
||||||
int gravityMode = 1; // starts enabled in "vertical" mode...
|
int gravityMode = 1; // starts enabled in "vertical" mode...
|
||||||
|
int airMode = 0;
|
||||||
|
|
||||||
|
|
||||||
unsigned char bmap[YRES/CELL][XRES/CELL];
|
unsigned char bmap[YRES/CELL][XRES/CELL];
|
||||||
unsigned char emap[YRES/CELL][XRES/CELL];
|
unsigned char emap[YRES/CELL][XRES/CELL];
|
||||||
@ -253,11 +255,9 @@ int try_move(int i, int x, int y, int nx, int ny)
|
|||||||
|
|
||||||
parts[e].x += x-nx;
|
parts[e].x += x-nx;
|
||||||
parts[e].y += y-ny;
|
parts[e].y += y-ny;
|
||||||
|
pmap[(int)(parts[e].y+0.5f)][(int)(parts[e].x+0.5f)] = (e<<8)|parts[e].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmap[ny][nx] = (i<<8)|parts[i].type;
|
|
||||||
pmap[y][x] = r;
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,7 +415,6 @@ void kill_part(int i)
|
|||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (parts[i].type != PT_PHOT) {
|
|
||||||
x = (int)(parts[i].x+0.5f);
|
x = (int)(parts[i].x+0.5f);
|
||||||
y = (int)(parts[i].y+0.5f);
|
y = (int)(parts[i].y+0.5f);
|
||||||
if (parts[i].type == PT_STKM)
|
if (parts[i].type == PT_STKM)
|
||||||
@ -442,7 +441,6 @@ void kill_part(int i)
|
|||||||
else if ((photons[y][x]>>8)==i)
|
else if ((photons[y][x]>>8)==i)
|
||||||
photons[y][x] = 0;
|
photons[y][x] = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
parts[i].type = PT_NONE;
|
parts[i].type = PT_NONE;
|
||||||
parts[i].life = pfree;
|
parts[i].life = pfree;
|
||||||
@ -458,10 +456,18 @@ inline void part_change_type(int i, int x, int y, int t)
|
|||||||
if (x<0 || y<0 || x>=XRES || y>=YRES || i>=NPART)
|
if (x<0 || y<0 || x>=XRES || y>=YRES || i>=NPART)
|
||||||
return -1;
|
return -1;
|
||||||
parts[i].type = t;
|
parts[i].type = t;
|
||||||
if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT)// && t!=PT_NEUT)
|
if (t==PT_PHOT)// || t==PT_NEUT)
|
||||||
pmap[y][x] = t|(i<<8);
|
{
|
||||||
else if ((pmap[y][x]>>8)==i)
|
photons[y][x] = t|(i<<8);
|
||||||
|
if ((pmap[y][x]>>8)==i)
|
||||||
pmap[y][x] = 0;
|
pmap[y][x] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pmap[y][x] = t|(i<<8);
|
||||||
|
if ((photons[y][x]>>8)==i)
|
||||||
|
photons[y][x] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(__GNUC__)
|
#if defined(WIN32) && !defined(__GNUC__)
|
||||||
@ -500,6 +506,8 @@ inline int create_n_parts(int n, int x, int y, float vx, float vy, int t)
|
|||||||
parts[i].tmp = 0;
|
parts[i].tmp = 0;
|
||||||
if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT && !pmap[y][x])// && t!=PT_NEUT)
|
if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT && !pmap[y][x])// && t!=PT_NEUT)
|
||||||
pmap[y][x] = t|(i<<8);
|
pmap[y][x] = t|(i<<8);
|
||||||
|
else if (t==PT_PHOT && !photons[y][x])
|
||||||
|
photons[y][x] = t|(i<<8);
|
||||||
|
|
||||||
pv[y/CELL][x/CELL] += 6.0f * CFDS;
|
pv[y/CELL][x/CELL] += 6.0f * CFDS;
|
||||||
}
|
}
|
||||||
@ -1341,15 +1349,13 @@ void update_particles_i(pixel *vid, int start, int inc)
|
|||||||
if(parts[r>>8].tmp==grule[golnum][9]-1)
|
if(parts[r>>8].tmp==grule[golnum][9]-1)
|
||||||
parts[r>>8].tmp --;
|
parts[r>>8].tmp --;
|
||||||
}
|
}
|
||||||
if(parts[r>>8].tmp<=0)
|
if (r && parts[r>>8].tmp<=0)
|
||||||
parts[r>>8].type = PT_NONE;//using kill_part makes it not work
|
parts[r>>8].type = PT_NONE;//using kill_part makes it not work
|
||||||
}
|
}
|
||||||
gol2[nx][ny][0] = 0;
|
|
||||||
for ( z = 1; z<=NGOL; z++)
|
|
||||||
gol2[nx][ny][z] = 0;
|
|
||||||
}
|
}
|
||||||
if (createdsomething)
|
if (createdsomething)
|
||||||
GENERATION ++;
|
GENERATION ++;
|
||||||
|
memset(gol2, 0, sizeof(gol2));
|
||||||
}
|
}
|
||||||
if (ISWIRE==1)
|
if (ISWIRE==1)
|
||||||
{
|
{
|
||||||
@ -2030,11 +2036,20 @@ killed:
|
|||||||
}
|
}
|
||||||
nx = (int)(parts[i].x+0.5f);
|
nx = (int)(parts[i].x+0.5f);
|
||||||
ny = (int)(parts[i].y+0.5f);
|
ny = (int)(parts[i].y+0.5f);
|
||||||
|
if (ny!=y || nx!=x)
|
||||||
|
{
|
||||||
|
if ((pmap[y][x]>>8)==i) pmap[y][x] = 0;
|
||||||
|
else if (t==PT_PHOT&&(photons[y][x]>>8)==i) photons[y][x] = 0;
|
||||||
if (nx<CELL || nx>=XRES-CELL || ny<CELL || ny>=YRES-CELL)
|
if (nx<CELL || nx>=XRES-CELL || ny<CELL || ny>=YRES-CELL)
|
||||||
{
|
{
|
||||||
kill_part(i);
|
kill_part(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (t==PT_PHOT)
|
||||||
|
photons[ny][nx] = t|(i<<8);
|
||||||
|
else
|
||||||
|
pmap[ny][nx] = t|(i<<8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (framerender) {
|
if (framerender) {
|
||||||
framerender = 0;
|
framerender = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user