Cracker64 merge

This commit is contained in:
Simon 2010-12-05 15:49:48 +00:00
parent 6ecc177c8f
commit 40ab51d79f
11 changed files with 2599 additions and 471 deletions

View File

@ -56,6 +56,12 @@ extern unsigned char ZSIZE;
#define STAMP_Y 4
#define STAMP_MAX 120
#define NGOL 13
#define CIRCLE_BRUSH 0
#define SQUARE_BRUSH 1
#define BRUSH_NUM 2
#ifdef PIX16
typedef unsigned short pixel;
#else
@ -80,6 +86,15 @@ extern int amd;
extern int FPSB;
int NUM_PARTS;
int GRAV;
int GRAV_R;
int GRAV_G;
int GRAV_B;
int GRAV_R2;
int GRAV_G2;
int GRAV_B2;
extern int legacy_enable;
extern int sys_pause;
@ -103,6 +118,24 @@ struct stamp
};
typedef struct stamp stamp;
int MSIGN;
int CGOL;
int ISGOL;
int ISLOVE;
int ISLOLZ;
int ISGRAV;
int ISWIRE;
int GSPEED;
int love[XRES/9][YRES/9];
int lolz[XRES/9][YRES/9];
int gol[XRES][YRES];
int gol2[XRES][YRES][NGOL];
int SEC;
int SEC2;
int REPLACE_MODE;
int CURRENT_BRUSH;
int GRID_MODE;
int VINE_MODE;
extern sign signs[MAXSIGNS];
extern stamp stamps[STAMP_MAX];
extern int stamp_count;

View File

@ -137,7 +137,7 @@ pixel *prerender_save(void *save, int size, int *width, int *height);
int render_thumb(void *thumb, int size, int bzip2, pixel *vid_buf, int px, int py, int scl);
void render_cursor(pixel *vid, int x, int y, int t, int r);
void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry);
void sdl_open(void);

View File

@ -8,6 +8,7 @@ struct menu_section
char *icon;
const char *name;
int itemcount;
int doshow;
};
typedef struct menu_section menu_section;
@ -50,19 +51,23 @@ static menu_wall mwalls[] =
#define SC_GAS 3
#define SC_LIQUID 4
#define SC_NUCLEAR 7
#define SC_TOTAL 9
#define SC_LIFE 9
#define SC_CRACKER 10
#define SC_TOTAL 10
static menu_section msections[] =
{
{"\xC1", "Walls", 0},
{"\xC2", "Electronics", 0},
{"\xC3", "Explosives", 0},
{"\xC5", "Gasses", 0},
{"\xC4", "Liquids", 0},
{"\xD0", "Powders", 0},
{"\xD1", "Solids", 0},
{"\xC6", "Radioactive", 0},
{"\xCC", "Special", 0},
{"\xC1", "Walls", 0, 1},
{"\xC2", "Electronics", 0, 1},
{"\xC3", "Explosives", 0, 1},
{"\xC5", "Gasses", 0, 1},
{"\xC4", "Liquids", 0, 1},
{"\xD0", "Powders", 0, 1},
{"\xD1", "Solids", 0, 1},
{"\xC6", "Radioactive", 0, 1},
{"\xCC", "Special", 0, 1},
{"\xC8", "Life", 0, 1},
{"\xC8", "Cracker", 0, 0},
};
struct ui_edit
@ -100,6 +105,7 @@ struct ui_checkbox
};
typedef struct ui_checkbox ui_checkbox;
int SLALT;
extern SDLMod sdl_mod;
extern int sdl_key, sdl_wheel, sdl_caps, sdl_ascii, sdl_zoom_trig;
extern char *shift_0;

View File

@ -69,4 +69,4 @@ void *file_load(char *fn, int *size);
int cpu_check(void);
#endif
#endif

View File

@ -5,7 +5,10 @@
#include "defines.h"
#include "interface.h"
#define CM_COUNT 7
#define CM_COUNT 10
#define CM_GRAD 9
#define CM_CRACK 8
#define CM_NOTHING 7
#define CM_FANCY 6
#define CM_HEAT 5
#define CM_BLOB 4
@ -14,29 +17,35 @@
#define CM_PRESS 1
#define CM_VEL 0
#define UI_WALLSTART 37
#define UI_WALLSTART 222
#define UI_ACTUALSTART 122
#define UI_WALLCOUNT 19
#define SPC_AIR 136
#define SPC_HEAT 137
#define SPC_COOL 138
#define SPC_VACUUM 139
#define WL_WALLELEC 122
#define WL_EWALL 123
#define WL_DETECT 124
#define WL_STREAM 125
#define WL_SIGN 126
#define WL_FAN 127
#define WL_FANHELPER 255
#define WL_ALLOWLIQUID 128
#define WL_DESTROYALL 129
#define WL_ERASE 130
#define WL_WALL 131
#define WL_ALLOWAIR 132
#define WL_ALLOWSOLID 133
#define WL_ALLOWALLELEC 134
#define WL_EHOLE 135
#define SPC_AIR 236
#define SPC_HEAT 237
#define SPC_COOL 238
#define SPC_VACUUM 239
#define WL_ALLOWGAS 140
#define WL_WALLELEC 22
#define WL_EWALL 23
#define WL_DETECT 24
#define WL_STREAM 25
#define WL_SIGN 26
#define WL_FAN 27
#define WL_ALLOWLIQUID 28
#define WL_DESTROYALL 29
#define WL_ERASE 30
#define WL_WALL 31
#define WL_ALLOWAIR 32
#define WL_ALLOWSOLID 33
#define WL_ALLOWALLELEC 34
#define WL_EHOLE 35
#define WL_ALLOWGAS 40
#define PT_NONE 0
#define PT_DUST 1
@ -116,7 +125,55 @@
#define PT_HSWC 75
#define PT_IRON 76
#define PT_MORT 77
#define PT_NUM 78
#define PT_GOL 78
#define PT_HLIF 79
#define PT_ASIM 80
#define PT_2x2 81
#define PT_DANI 82
#define PT_AMOE 83
#define PT_MOVE 84
#define PT_PGOL 85
#define PT_DMOE 86
#define PT_34 87
#define PT_LLIF 88
#define PT_STAN 89
#define PT_CRAC 90
#define PT_RIME 91
#define PT_FOG 92
#define PT_BCLN 93
#define PT_LOVE 94
#define PT_DEUT 95
#define PT_WARP 96
#define PT_PUMP 97
#define PT_FWRK 98
#define PT_PIPE 99
#define PT_FRZZ 100
#define PT_FRZW 101
#define PT_GRAV 102
#define PT_A_A 103
#define PT_A_AG 104
#define PT_A_AS 105
#define PT_INST 106
#define PT_ISOZ 107
#define PT_ISZS 108
#define PT_PRTI 109
#define PT_PRTO 110
#define PT_PSTE 111
#define PT_PSTS 112
#define PT_ANAR 113
#define PT_VINE 114
#define PT_INVIS 115
#define PT_EQUALVEL 116//all particles equal their velocities
#define PT_INST2 117
#define PT_INST3 118
#define PT_SHLD1 119
#define PT_SHLD2 120
#define PT_SHLD3 121
#define PT_SHLD4 122
#define PT_LOLZ 123
#define PT_WIFI 124
#define PT_FILT 125
#define PT_NUM 126
#define R_TEMP 22
#define MAX_TEMP 9999
@ -129,7 +186,7 @@
#define ST_LIQUID 2
#define ST_GAS 3
/*
TODO: We should start to implement these. (Almost done)
TODO: We should start to implement these.
*/
#define TYPE_PART 0x0001 //1 Powders
#define TYPE_LIQUID 0x0002 //2 Liquids
@ -231,7 +288,7 @@ static const part_type ptypes[PT_NUM] =
{"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything.", TYPE_LIQUID},
{"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles.", TYPE_SOLID},
{"WTRV", PIXPACK(0xA0A0FF), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, -0.1f, 0.75f, 0.0003f * CFDS, 0, 0, 0, 0, 4, 1, 1, SC_GAS, R_TEMP+100.0f+273.15f, 48, "Steam, heats up air, produced from hot water.", TYPE_GAS},
{"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 25, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone.", TYPE_PART},
{"CNCT", PIXPACK(0xC0C0C0), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 55, SC_POWDERS, R_TEMP+0.0f +273.15f, 100, "Concrete, stronger than stone.", TYPE_PART},
{"DSTW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP-2.0f +273.15f, 23, "Distilled water, does not conduct electricity.", TYPE_LIQUID|PROP_NEUTPENETRATE},
{"SALT", PIXPACK(0xFFFFFF), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 75, SC_POWDERS, R_TEMP+0.0f +273.15f, 110, "Salt, dissolves in water.", TYPE_PART},
{"SLTW", PIXPACK(0x4050F0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 35, SC_LIQUID, R_TEMP+0.0f +273.15f, 75, "Saltwater, conducts electricity, difficult to freeze.", TYPE_LIQUID|PROP_CONDUCTS|PROP_NEUTPENETRATE},
@ -252,7 +309,7 @@ static const part_type ptypes[PT_NUM] =
{"LRBD", PIXPACK(0xAAAAAA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 1000, 1, 0, 2, 1, 45, SC_EXPLOSIVE, R_TEMP+45.0f+273.15f, 170, "Liquid Rubidium.", TYPE_LIQUID|PROP_CONDUCTS},
{"NTCT", PIXPACK(0x505040), 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, "Semi-conductor. Only conducts electricity when hot (More than 100C)", TYPE_SOLID},
{"SAND", PIXPACK(0xFFD090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Sand, Heavy particles. Meltable.", TYPE_PART},
{"GLAS", PIXPACK(0x404040), 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_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure", TYPE_SOLID | PROP_NEUTPASS},
{"GLAS", PIXPACK(0x404040), 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_SOLIDS, R_TEMP+0.0f +273.15f, 150, "Solid. Meltable. Shatters under pressure", TYPE_SOLID | PROP_NEUTPASS},
{"PTCT", PIXPACK(0x405050), 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, "Semi-conductor. Only conducts electricity when cold (Less than 120C)", TYPE_SOLID},
{"BGLA", PIXPACK(0x606060), 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 Glass, Heavy particles. Meltable. Bagels.", TYPE_PART},
{"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, SC_ELEC, 9000.0f +273.15f, 251, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", TYPE_ENERGY},
@ -285,7 +342,56 @@ static const part_type ptypes[PT_NUM] =
{"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", TYPE_SOLID},
{"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, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR", TYPE_SOLID},
{"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, 0, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Steam Train.", TYPE_PART},
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description
{"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! (23/3)", TYPE_SOLID},
{"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! (like GOL 23/36)", TYPE_SOLID},
{"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! (4567/345)", TYPE_SOLID},
{"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! (125/36)", TYPE_SOLID},
{"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! (34678/3678)", TYPE_SOLID},
{"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! (1358/357)", TYPE_SOLID},
{"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(245/368)", TYPE_SOLID},
{"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! (238/357)", TYPE_SOLID},
{"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! (5678/35678)", TYPE_SOLID},
{"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! (34/34)", TYPE_SOLID},
{"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! (5/345)", TYPE_SOLID},
{"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! (235678/3678)", TYPE_SOLID},
{"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.",TYPE_SOLID},
{"RIME", PIXPACK(0xCCCCCC), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 100, SC_CRACKER, 243.15f, 100, "Not quite Ice",TYPE_SOLID},
{"FOG", PIXPACK(0xAAAAAA), 0.8f, 0.00f * CFDS, 0.4f, 0.70f, -0.1f, 0.0f, 0.99f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_CRACKER, 243.15f, 100, "Not quite Steam",TYPE_GAS},
{"BCLN", PIXPACK(0xFFD040), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Breakable Clone.", TYPE_SOLID},
{"LOVE", PIXPACK(0xFF30FF), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.0f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 373.0f, 40, "Love...", TYPE_SOLID},
{"DEUT", PIXPACK(0x00153F), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 31, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 251, "Deuterium oxide. Volume changes with temp, radioactive with neutrons.", TYPE_LIQUID|PROP_NEUTPENETRATE},
{"WARP", PIXPACK(0x000000), 0.8f, 0.00f * CFDS, 0.9f, 0.70f, -0.1f, 0.0f, 3.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_NUCLEAR, R_TEMP +273.15f, 100, "Displaces other elements.",TYPE_GAS},
{"PUMP", PIXPACK(0x10103B), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_ELEC, 273.15f, 0, "Changes pressure to its temp when activated. (use HEAT/COOL).", TYPE_SOLID},
{"FWRK", PIXPACK(0x666666), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 97, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 100, "First fireworks made, activated by heat/neutrons."},
{"PIPE", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SOLIDS, 273.15f, 0, "Moves elements around, read FAQ on website for help.", TYPE_SOLID},
{"FRZZ", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 0, 50, SC_CRACKER, 90.0f, 46, "FREEZE", TYPE_PART},
{"FRZW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 0, 30, SC_CRACKER, 120.0f, 29, "FREEZE WATER", TYPE_LIQUID},
{"GRAV", PIXPACK(0xFFE0A0), 0.7f, 0.00f * CFDS, 1.00f, 1.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Changes colour based on velocity.", TYPE_PART},
{"@_@", PIXPACK(0x00FF77), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP+0.0f +273.15f, 29, "@_@, contradicts the normal state changes.", TYPE_LIQUID},
{"@_@G", PIXPACK(0x00FFBB), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 2.75f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 1, SC_CRACKER, R_TEMP-200.0f+273.15f, 42, "@_@ gas", TYPE_GAS},
{"@_@S", PIXPACK(0x00E455), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_CRACKER, R_TEMP+300.0f+273.15f, 251, "@_@ solid", TYPE_SOLID},
{"INST", PIXPACK(0x404039), 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, "Instantly conducts, like walls, is now also a battery, PSCN to charge, NSCN to take.", TYPE_SOLID|PROP_CONDUCTS},
{"ISOZ", PIXPACK(0xAA30D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 24, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 29, "Radioactive liquid", TYPE_LIQUID|PROP_NEUTPENETRATE},
{"ISZS", PIXPACK(0x662089), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0007f* CFDS, 0, 0, 0, 1, 1, 1, 100, SC_NUCLEAR, 140.00f, 251, "Solid form of ISOZ, slowly decays.", TYPE_SOLID},
{"PRTI", PIXPACK(0xEB5917), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 40, "Portal IN. Things go in here", TYPE_SOLID},
{"PRTO", PIXPACK(0x0020EB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 40, "Portal OUT. Things come out here", TYPE_SOLID},
{"PSTE", PIXPACK(0xAA99AA), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 31, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Colloid, Hardens under pressure", TYPE_LIQUID},
{"PSTS", PIXPACK(0x776677), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 20, 0, 100, SC_CRACKER, R_TEMP-2.0f +273.15f, 29, "Solid form of PSTE, temporary", TYPE_SOLID},
{"ANAR", PIXPACK(0xFFFFEE), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.1f, 0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Behaves opposite gravity", TYPE_PART},
{"VINE", PIXPACK(0x079A00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Vine, grows", TYPE_SOLID},
{"INVS", PIXPACK(0x00CCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Invisible to everything while under pressure.", TYPE_SOLID},
{"EQVE", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 85, SC_CRACKER, R_TEMP+0.0f +273.15f, 70, "Shared velocity test", TYPE_PART},
{"INST", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "helper for INST", 0},
{"INST", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "helper for INST", 0},
{"SHLD", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "Shield, spark it to grow", 0},
{"SHD2", PIXPACK(0x777777), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 0, "Shield lvl 2", 0},
{"SHD3", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 0, "Shield lvl 3", 0},
{"SHD4", PIXPACK(0x212121), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 0, "Shield lvl 4", 0},
{"LOLZ", PIXPACK(0x569212), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.0f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 373.0f, 40, "Lolz", TYPE_SOLID},
{"WIFI", PIXPACK(0x40A060), 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, 0, "Wireless transmitter, color coded.", TYPE_SOLID},
{"FILT", PIXPACK(0x000056), 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_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Filter for photons, changes the color.", TYPE_SOLID},
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description
};
static part_state pstates[PT_NUM] =
@ -314,7 +420,7 @@ static part_state pstates[PT_NUM] =
/* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f},
/* ACID */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* VOID */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WTRV */ {ST_GAS, PT_ICEI, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f},
/* WTRV */ {ST_GAS, PT_RIME, 273.0f, PT_DSTW, 371.0f, PT_NONE, 373.0f, PT_NONE, 0.0f},
/* CNCT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1123.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* DSTW */ {ST_LIQUID, PT_ICEI, 273.15f, PT_NONE, 0.0f, PT_WTRV, 373.0f, PT_NONE, 0.0f},
/* SALT */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1173.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
@ -368,8 +474,100 @@ static part_state pstates[PT_NUM] =
/* PCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* HSWC */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* IRON */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1687.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* MORT */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* MORT */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* Crac */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 2730.0f},
/* RIME */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 273.15f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FOG */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* BCLN */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* LOVE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WTF */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WARP */ {ST_GAS , PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PUMP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FWRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FWRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FRZZ */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FRZW */ {ST_LIQUID, PT_ICEI, 53.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* GRAV */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* @_@ */ {ST_LIQUID, PT_A_AG, 100.0f, PT_NONE, 0.0f, PT_A_AS, 400.0f, PT_NONE, 0.0f},
/* @_@g */ {ST_GAS , PT_A_AG, 100.0f, PT_A_A , 273.0f, PT_A_AS, 400.0f, PT_NONE, 0.0f},
/* @_@s */ {ST_SOLID, PT_A_AG, 100.0f, PT_A_A , 273.0f, PT_A_AS, 400.0f, PT_NONE, 0.0f},
/* INST */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* ISOZ */ {ST_LIQUID, PT_ISZS, 160.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* ISZS */ {ST_SOLID, PT_NONE, 0.0f, PT_ISOZ, 300.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PRTI */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PRTO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PSTE */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PSTS */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* ANAR */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* VINE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f},
/* INVS */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* EQVE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* INST2*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* INST3*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD1*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD2*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD3*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD4*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* LOlZ */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WIFI */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FILT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
};
static int grule[NGOL][9] =
{
// 0,1,2,3,4,5,6,7,8 live=1 spawn=2 spawn&live=3
{0,0,0,0,0,0,0,0,0},//blank
{0,0,1,3,0,0,0,0,0},//GOL
{0,0,1,3,0,0,2,0,0},//HLIF
{0,0,0,2,3,3,1,1,0},//ASIM
{0,1,1,2,0,1,2,0,0},//2x2
{0,0,0,3,1,0,3,3,3},//DANI
{0,1,0,3,0,3,0,2,1},//AMOE
{0,0,1,2,1,1,2,0,2},//MOVE
{0,0,1,3,0,2,0,2,1},//PGOL
{0,0,0,2,0,3,3,3,3},//DMOE
{0,0,0,3,3,0,0,0,0},//34
{0,0,0,2,2,3,0,0,0},//LLIF
{0,0,1,3,0,1,3,3,3},//STAN
};
static int loverule[9][9] =
{
{0,0,1,1,0,0,0,0,0},
{0,1,0,0,1,1,0,0,0},
{1,0,0,0,0,0,1,0,0},
{1,0,0,0,0,0,0,1,0},
{0,1,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,1,0},
{1,0,0,0,0,0,1,0,0},
{0,1,0,0,1,1,0,0,0},
{0,0,1,1,0,0,0,0,0},
};
static int lolzrule[9][9] =
{
{0,0,0,0,0,0,0,0,0},
{1,0,0,0,0,0,1,0,0},
{1,0,0,0,0,0,1,0,0},
{1,0,0,1,1,0,0,1,0},
{1,0,1,0,0,1,0,1,0},
{1,0,1,0,0,1,0,1,0},
{0,1,0,1,1,0,0,1,0},
{0,1,0,0,0,0,0,1,0},
{0,1,0,0,0,0,0,1,0},
};
int portal[8][8];
int wireless[25];
extern int isplayer;
extern float player[27];
@ -419,9 +617,9 @@ extern inline int is_wire_off(int x, int y);
void set_emap(int x, int y);
#if defined(WIN32) && !defined(__GNUC__)
_inline int parts_avg(int ci, int ni);
_inline int parts_avg(int ci, int ni, int t);
#else
int parts_avg(int ci, int ni);
int parts_avg(int ci, int ni, int t);
#endif
int nearest_part(int ci, int t);
@ -436,8 +634,8 @@ void create_box(int x1, int y1, int x2, int y2, int c);
int flood_parts(int x, int y, int c, int cm, int bm);
int create_parts(int x, int y, int r, int c);
int create_parts(int x, int y, int rx, int ry, int c);
void create_line(int x1, int y1, int x2, int y2, int r, int c);
void create_line(int x1, int y1, int x2, int y2, int rx, int ry, int c);
#endif

View File

@ -54,15 +54,15 @@ void update_air(void)
vy[y][x] *= VLOSS;
vx[y][x] += dx*TSTEPV;
vy[y][x] += dy*TSTEPV;
if(bmap[y][x]==1 || bmap[y][x+1]==1 ||
bmap[y][x]==8 || bmap[y][x+1]==8 ||
(bmap[y][x]==7 && !emap[y][x]) ||
(bmap[y][x+1]==7 && !emap[y][x+1]))
if(bmap[y][x]==WL_WALL || bmap[y][x+1]==WL_WALL ||
bmap[y][x]==WL_WALLELEC || bmap[y][x+1]==WL_WALLELEC ||
(bmap[y][x]==WL_EWALL && !emap[y][x]) ||
(bmap[y][x+1]==WL_EWALL && !emap[y][x+1]))
vx[y][x] = 0;
if(bmap[y][x]==1 || bmap[y+1][x]==1 ||
bmap[y][x]==8 || bmap[y+1][x]==8 ||
(bmap[y][x]==7 && !emap[y][x]) ||
(bmap[y+1][x]==7 && !emap[y+1][x]))
if(bmap[y][x]==WL_WALL || bmap[y+1][x]==WL_WALL ||
bmap[y][x]==WL_WALLELEC || bmap[y+1][x]==WL_WALLELEC ||
(bmap[y][x]==WL_EWALL && !emap[y][x]) ||
(bmap[y+1][x]==WL_EWALL && !emap[y+1][x]))
vy[y][x] = 0;
}
@ -76,9 +76,9 @@ void update_air(void)
for(i=-1; i<2; i++)
if(y+j>0 && y+j<YRES/CELL-1 &&
x+i>0 && x+i<XRES/CELL-1 &&
bmap[y+j][x+i]!=1 &&
bmap[y+j][x+i]!=8 &&
(bmap[y+j][x+i]!=7 || emap[y+j][x+i]))
bmap[y+j][x+i]!=WL_WALL &&
bmap[y+j][x+i]!=WL_WALLELEC &&
(bmap[y+j][x+i]!=WL_EWALL || emap[y+j][x+i]))
{
f = kernel[i+1+(j+1)*3];
dx += vx[y+j][x+i]*f;
@ -118,13 +118,12 @@ void update_air(void)
dy += VADV*tx*ty*vy[j+1][i+1];
}
if(bmap[y][x] == 4)
if(bmap[y][x] == WL_FAN)
{
dx += fvx[y][x];
dy += fvy[y][x];
}
//Pressure Caps, remove for lulz
if(dp > 256.0f) dp = 256.0f;
if(dp < -256.0f) dp = -256.0f;
if(dx > 256.0f) dx = 256.0f;

View File

@ -21,7 +21,7 @@
#include <misc.h>
unsigned cmode = 3;
unsigned cmode = CM_FIRE;
SDL_Surface *sdl_scrn;
int sdl_scale = 1;
@ -447,7 +447,7 @@ void draw_tool(pixel *vid_buf, int b, int sl, int sr, unsigned pc, unsigned iswa
int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
{
int i, j, c;
if(b>=121)
if(b>=UI_WALLSTART)
{
b = b-100;
//x = (2+32*((b-22)/1));
@ -470,7 +470,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 23:
case WL_EWALL:
for(j=1; j<15; j++)
{
for(i=1; i<6+j; i++)
@ -489,7 +489,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 24:
case WL_DETECT:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<27; i+=2)
@ -498,7 +498,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 25:
case WL_STREAM:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -512,7 +512,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
drawpixel(vid_buf, x+i, y+8+(int)(3.9f*cos(i*0.3f)), 255, 255, 255, 255);
}
break;
case 26:
case WL_SIGN:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -523,7 +523,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
drawtext(vid_buf, x+9, y+3, "\xA1", 32, 64, 128, 255);
drawtext(vid_buf, x+9, y+3, "\xA0", 255, 255, 255, 255);
break;
case 27:
case WL_FAN:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<27; i+=2)
@ -532,7 +532,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 28:
case WL_ALLOWLIQUID:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -544,7 +544,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 29:
case WL_DESTROYALL:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<27; i+=2)
@ -553,7 +553,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 30:
case WL_ERASE:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<13; i+=2)
@ -569,7 +569,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 32:
case WL_ALLOWAIR:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<27; i+=2)
@ -578,7 +578,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 33:
case WL_ALLOWSOLID:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<27; i+=2)
@ -587,7 +587,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 34:
case WL_ALLOWALLELEC:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -599,7 +599,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
break;
case 36:
case SPC_AIR-100:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -618,7 +618,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
drawtext(vid_buf, x+14-textwidth("AIR")/2, y+4, "AIR", c, c, c, 255);
break;
case 37:
case SPC_HEAT-100:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -637,7 +637,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
drawtext(vid_buf, x+14-textwidth("HEAT")/2, y+4, "HEAT", c, c, c, 255);
break;
case 38:
case SPC_COOL-100:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -656,7 +656,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
drawtext(vid_buf, x+14-textwidth("COOL")/2, y+4, "COOL", c, c, c, 255);
break;
case 39:
case SPC_VACUUM-100:
for(j=1; j<15; j++)
{
for(i=1; i<27; i++)
@ -675,7 +675,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
drawtext(vid_buf, x+14-textwidth("VAC")/2, y+4, "VAC", c, c, c, 255);
break;
case 40:
case WL_ALLOWGAS:
for(j=1; j<15; j+=2)
{
for(i=1+(1&(j>>1)); i<27; i+=2)
@ -693,7 +693,7 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
}
}
}
if(b==30)
if(b==WL_ERASE)
{
for(j=4; j<12; j++)
{
@ -745,7 +745,10 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc)
void draw_menu(pixel *vid_buf, int i, int hover)
{
drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255);
if(i==SEC&&SEC!=0)
drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 0, 255, 255, 255);
else
drawrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255);
if(hover==i)
{
fillrect(vid_buf, (XRES+BARSIZE)-16, (i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16), 14, 14, 255, 255, 255, 255);
@ -1107,23 +1110,56 @@ void draw_air(pixel *vid)
int x, y, i, j;
pixel c;
if(cmode == 2)
if(cmode == CM_PERS)
return;
for(y=0; y<YRES/CELL; y++)
for(x=0; x<XRES/CELL; x++)
{
if(cmode)
if(cmode == CM_PRESS)
{
if(pv[y][x] > 0.0f)
c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0);
else
c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f));
}
else
else if(cmode == CM_VEL)
{
c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f),
clamp_flt(pv[y][x], 0.0f, 8.0f),
clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f));
}
else if(cmode == CM_CRACK)
{
int r;
int g;
int b;
r = clamp_flt(fabsf(vx[y][x]), 0.0f, 24.0f) + clamp_flt(fabsf(vy[y][x]), 0.0f, 20.0f);
g = clamp_flt(fabsf(vx[y][x]), 0.0f, 20.0f) + clamp_flt(fabsf(vy[y][x]), 0.0f, 24.0f);
b = clamp_flt(fabsf(vx[y][x]), 0.0f, 24.0f) + clamp_flt(fabsf(vy[y][x]), 0.0f, 20.0f);
if(pv[y][x] > 0.0f)
{
r += clamp_flt(pv[y][x], 0.0f, 16.0f);
if(r>255)
r=255;
if(g>255)
g=255;
if(b>255)
b=255;
c = PIXRGB(r, g, b);
}
else
{
b += clamp_flt(-pv[y][x], 0.0f, 16.0f);
if(r>255)
r=255;
if(g>255)
g=255;
if(b>255)
b=255;
c = PIXRGB(r, g, b);
}
}
for(j=0; j<CELL; j++)
for(i=0; i<CELL; i++)
vid[(x*CELL+i) + (y*CELL+j)*(XRES+BARSIZE)] = c;
@ -1268,9 +1304,20 @@ void draw_parts(pixel *vid)
int cr, cg, cb;
float fr, fg, fb;
float pt = R_TEMP;
if(GRID_MODE)
{
for(ny=0;ny<YRES;ny++)
for(nx=0;nx<XRES;nx++)
{
if(ny%(4*GRID_MODE)==0)
blendpixel(vid, nx, ny, 100, 100, 100, 80);
if(nx%(4*GRID_MODE)==0)
blendpixel(vid, nx, ny, 100, 100, 100, 80);
}
}
for(i = 0; i<NPART; i++) {
#ifdef OpenGL
if(cmode == 6) //If fire mode
if(cmode == CM_FANCY) //If fancy mode
{
if(t==PT_MWAX)
@ -1328,7 +1375,6 @@ void draw_parts(pixel *vid)
nx = (int)(parts[i].x+0.5f);
ny = (int)(parts[i].y+0.5f);
if(cmode!=CM_HEAT)
{
if(t==PT_STKM) //Just draw head here
@ -1356,7 +1402,37 @@ void draw_parts(pixel *vid)
isplayer = 1; //It's a secret. Tssss...
}
if(t==PT_MWAX&&cmode == 6)
if(cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP)//nothing display but show needed color changes
{
cr = PIXR(ptypes[t].pcolors);
cg = PIXG(ptypes[t].pcolors);
cb = PIXB(ptypes[t].pcolors);
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
if(cmode==CM_GRAD)
{
float frequency = 0.05;
int q = parts[i].temp;
cr = sin(frequency*q) * 16 + PIXR(ptypes[t].pcolors);
cg = sin(frequency*q) * 16 + PIXG(ptypes[t].pcolors);
cb = sin(frequency*q) * 16 + PIXB(ptypes[t].pcolors);
if(cr>=255)
cr = 255;
if(cg>=255)
cg = 255;
if(cb>=255)
cb = 255;
if(cr<=0)
cr = 0;
if(cg<=0)
cg = 0;
if(cb<=0)
cb = 0;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
else if(t==PT_MWAX&&cmode == CM_FANCY)
{
for(x=-1; x<=1; x++)
{
@ -1372,6 +1448,189 @@ void draw_parts(pixel *vid)
}
}
else if(t==PT_CRAC)
{
cr = PIXR(ptypes[t].pcolors) - parts[i].life*15;
cg = PIXG(ptypes[t].pcolors) - parts[i].life*15;
cb = PIXB(ptypes[t].pcolors) - parts[i].life*15;
if(cr<=50)
cr = 50;
if(cg<=50)
cg = 50;
if(cb<=20)
cb = 20;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
else if(t==PT_DEUT)
{
if(parts[i].life>=700&&(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY))
{
x = nx/CELL;
y = ny/CELL;
cr = 20;
cg = 20;
cb = 20;
cg += fire_g[y][x];
if(cg > 255) cg = 255;
fire_g[y][x] = cg;
cb += fire_b[y][x];
if(cb > 255) cb = 255;
fire_b[y][x] = cb;
cr += fire_r[y][x];
if(cr > 255) cr = 255;
fire_r[y][x] = cr;
}
else
{
cr = PIXR(ptypes[t].pcolors) + parts[i].life*1;
cg = PIXG(ptypes[t].pcolors) + parts[i].life*2;
cb = PIXB(ptypes[t].pcolors) + parts[i].life*4;
if(cr>=255)
cr = 255;
if(cg>=255)
cg = 255;
if(cb>=255)
cb = 255;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
}
else if(t==PT_DUST && parts[i].life >= 1)
{
x = nx;
y = ny;
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(parts[i].tmp,parts[i].ctype,parts[i].flags);
cg = parts[i].tmp/4;
cb = parts[i].ctype/4;
cr = parts[i].flags/4;
x = nx/CELL;
y = ny/CELL;
cg += fire_g[y][x];
if(cg > 255) cg = 255;
fire_g[y][x] = cg;
cb += fire_b[y][x];
if(cb > 255) cb = 255;
fire_b[y][x] = cb;
cr += fire_r[y][x];
if(cr > 255) cr = 255;
fire_r[y][x] = cr;
}
else
blendpixel(vid,x,y,parts[i].tmp,parts[i].ctype,parts[i].flags,255);
}
else if(t==PT_GRAV)
{
cr = 20;
cg = 20;
cb = 20;
if(parts[i].vx>0)
{
cr += (parts[i].vx)*GRAV_R;
cg += (parts[i].vx)*GRAV_G;
cb += (parts[i].vx)*GRAV_B;
}
if(parts[i].vy>0)
{
cr += (parts[i].vy)*GRAV_G;
cg += (parts[i].vy)*GRAV_B;
cb += (parts[i].vy)*GRAV_R;
}
if(parts[i].vx<0)
{
cr -= (parts[i].vx)*GRAV_B;
cg -= (parts[i].vx)*GRAV_R;
cb -= (parts[i].vx)*GRAV_G;
}
if(parts[i].vy<0)
{
cr -= (parts[i].vy)*GRAV_R2;
cg -= (parts[i].vy)*GRAV_G2;
cb -= (parts[i].vy)*GRAV_B2;
}
if(cr>255)
cr=255;
if(cg>255)
cg=255;
if(cb>255)
cb=255;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
else if(t==PT_WIFI)
{
float frequency = 0.25;
int q = parts[i].tmp;
cr = sin(frequency*q + 0) * 127 + 128;
cg = sin(frequency*q + 2) * 127 + 128;
cb = sin(frequency*q + 4) * 127 + 128;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
else if(t==PT_PIPE)
{
if(parts[i].ctype==2)
{
cr = 50;
cg = 1;
cb = 1;
}
else if(parts[i].ctype==3)
{
cr = 1;
cg = 50;
cb = 1;
}
else if(parts[i].ctype==4)
{
cr = 1;
cg = 1;
cb = 50;
}
else if(parts[i].temp<272.15&&parts[i].ctype!=1)
{
if(parts[i].temp>173.25&&parts[i].temp<273.15)
{
cr = 50;
cg = 1;
cb = 1;
}
if(parts[i].temp>73.25&&parts[i].temp<=173.15)
{
cr = 1;
cg = 50;
cb = 1;
}
if(parts[i].temp>=0&&parts[i].temp<=73.15)
{
cr = 1;
cg = 1;
cb = 50;
}
}
else
{
cr = PIXR(ptypes[t].pcolors);
cg = PIXG(ptypes[t].pcolors);
cb = PIXB(ptypes[t].pcolors);
}
if(parts[i].tmp)
{
cr = PIXR(ptypes[parts[i].tmp].pcolors);
cg = PIXG(ptypes[parts[i].tmp].pcolors);
cb = PIXB(ptypes[parts[i].tmp].pcolors);
}
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
else if(t==PT_INVIS && (pv[ny/CELL][nx/CELL]>4.0f ||pv[ny/CELL][nx/CELL]<-4.0f))
blendpixel(vid, nx, ny, 15, 0, 150, 100);
else if(t==PT_ACID)
{
if(parts[i].life>255) parts[i].life = 255;
@ -1381,7 +1640,7 @@ void draw_parts(pixel *vid)
cr = PIXR(ptypes[t].pcolors)/s;
cg = PIXG(ptypes[t].pcolors)/s;
cb = PIXB(ptypes[t].pcolors)/s;
if(cmode==6) {
if(cmode==CM_FANCY) {
for(x=-1; x<=1; x++)
{
for(y=-1; y<=1; y++)
@ -1396,7 +1655,7 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
if(cmode==4)
if(cmode==CM_BLOB)
{
blendpixel(vid, nx+1, ny, cr, cg, cb, 223);
blendpixel(vid, nx-1, ny, cr, cg, cb, 223);
@ -1409,7 +1668,7 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112);
}
}
else if(t==PT_OIL&&cmode == 6)
else if(t==PT_OIL&&cmode == CM_FANCY)
{
for(x=-1; x<=1; x++)
{
@ -1424,7 +1683,7 @@ void draw_parts(pixel *vid)
}
else if(t==PT_NEUT)
{
if(cmode == 3||cmode==4 || cmode==6)
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors;
cg = 8;
@ -1453,7 +1712,7 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32);
blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32);
}
} else if(t==PT_PLUT&&cmode == 6)
} else if(t==PT_PLUT&&cmode == CM_FANCY)
{
int tempx;
int tempy;
@ -1473,7 +1732,7 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5);
}
}
} else if(t==PT_URAN&&cmode == 6)
} else if(t==PT_URAN&&cmode == CM_FANCY)
{
int tempx;
int tempy;
@ -1493,7 +1752,7 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5);
}
}
} else if(t==PT_SLTW&&cmode == 6)
} else if(t==PT_SLTW&&cmode == CM_FANCY)
{
for(x=-1; x<=1; x++)
{
@ -1506,9 +1765,33 @@ void draw_parts(pixel *vid)
}
}
}
else if(t==PT_FILT)
{
int temp_bin = (int)((parts[i].temp-273.0f)*0.025f);
if(temp_bin < 0) temp_bin = 0;
if(temp_bin > 25) temp_bin = 25;
parts[i].ctype = 0x1F << temp_bin;
cg = 0;
cb = 0;
cr = 0;
for(x=0; x<12; x++) {
cr += (parts[i].ctype >> (x+18)) & 1;
cb += (parts[i].ctype >> x) & 1;
}
for(x=0; x<14; x++)
cg += (parts[i].ctype >> (x+9)) & 1;
x = 624/(cr+cg+cb+1);
cr *= x;
cg *= x;
cb *= x;
cr = cr>255?255:cr;
cg = cg>255?255:cg;
cb = cb>255?255:cb;
blendpixel(vid, nx, ny, cr, cg, cb, 127);
}
else if(t==PT_PHOT)
{
if(cmode == 3||cmode==4 || cmode==6)
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
cg = 0;
cb = 0;
@ -1575,7 +1858,7 @@ void draw_parts(pixel *vid)
y = ny;
blendpixel(vid,x,y,17,217,24,255);
}
else if(t==PT_LNTG&&cmode == 6)
else if(t==PT_LNTG&&cmode == CM_FANCY)
{
for(x=-1; x<=1; x++)
{
@ -1590,7 +1873,7 @@ void draw_parts(pixel *vid)
}
else if(t==PT_SMKE)
{
if(cmode == 3||cmode==4 || cmode==6)
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
x = nx/CELL;
y = ny/CELL;
@ -1623,7 +1906,7 @@ void draw_parts(pixel *vid)
}
}
}
else if(t==PT_WATR&&cmode == 6)
else if(t==PT_WATR&&cmode == CM_FANCY)
{
for(x=-1; x<=1; x++)
{
@ -1636,7 +1919,7 @@ void draw_parts(pixel *vid)
}
}
} else if(t==PT_DSTW&&cmode == 6)
} else if(t==PT_DSTW&&cmode == CM_FANCY)
{
for(x=-1; x<=1; x++)
{
@ -1649,7 +1932,7 @@ void draw_parts(pixel *vid)
}
}
}
else if(t==PT_NITR&&cmode == 6)
else if(t==PT_NITR&&cmode == CM_FANCY)
{
for(x=-1; x<=1; x++)
{
@ -1663,7 +1946,7 @@ void draw_parts(pixel *vid)
}
}
else if(t==PT_LRBD&&cmode == 6)
else if(t==PT_LRBD&&cmode == CM_FANCY)
{
for(x=-1; x<=1; x++)
{
@ -1678,7 +1961,7 @@ void draw_parts(pixel *vid)
}
else if(t==PT_NBLE&&cmode == 6)
else if(t==PT_NBLE&&cmode == CM_FANCY)
{
for(x=-1; x<=1; x++)
{
@ -1694,7 +1977,7 @@ void draw_parts(pixel *vid)
}
}
else if(t==PT_GAS&&cmode == 6)
else if(t==PT_GAS&&cmode == CM_FANCY)
{
for(x=-1; x<=1; x++)
{
@ -1712,7 +1995,7 @@ void draw_parts(pixel *vid)
}
else if(t==PT_WTRV)
{
if(cmode == 3||cmode==4 || cmode==6)
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
x = nx/CELL;
y = ny/CELL;
@ -1747,7 +2030,7 @@ void draw_parts(pixel *vid)
}
else if(t==PT_THDR)
{
if(cmode == 3||cmode==4 || cmode==6)
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors;
cg = 16;
@ -1792,7 +2075,7 @@ void draw_parts(pixel *vid)
fr = 2 * pv[ny/CELL][nx/CELL];
}
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(0x44 + fr*8, 0, 255), (int)restrict_flt(0x88 + fg*8, 0, 255), (int)restrict_flt(0x44 + fb*8, 0, 255));
if(cmode == 3||cmode==4 || cmode==6)
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
x = nx/CELL;
y = ny/CELL;
@ -1806,7 +2089,7 @@ void draw_parts(pixel *vid)
if(fr > 255) fr = 255;
fire_r[y][x] = fr;
}
if(cmode == 4) {
if(cmode == CM_BLOB) {
uint8 R = (int)restrict_flt(0x44 + fr*8, 0, 255);
uint8 G = (int)restrict_flt(0x88 + fg*8, 0, 255);
uint8 B = (int)restrict_flt(0x44 + fb*8, 0, 255);
@ -1826,7 +2109,7 @@ void draw_parts(pixel *vid)
{
uint8 GR = 0x50+(parts[i].life*10);
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, GR);
if(cmode == 4) {
if(cmode == CM_BLOB) {
blendpixel(vid, nx+1, ny, GR, GR, GR, 223);
blendpixel(vid, nx-1, ny, GR, GR, GR, 223);
blendpixel(vid, nx, ny+1, GR, GR, GR, 223);
@ -1842,7 +2125,7 @@ void draw_parts(pixel *vid)
{
uint8 GR = 0x3B+(parts[i].life*19);
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, GR, 10);
if(cmode == 4) {
if(cmode == CM_BLOB) {
blendpixel(vid, nx+1, ny, GR, GR, 10, 223);
blendpixel(vid, nx-1, ny, GR, GR, 10, 223);
blendpixel(vid, nx, ny+1, GR, GR, 10, 223);
@ -1858,7 +2141,7 @@ void draw_parts(pixel *vid)
{
uint8 GR = 0x3B+(parts[i].life*19);
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(GR, 10, 10);
if(cmode == 4) {
if(cmode == CM_BLOB) {
blendpixel(vid, nx+1, ny, GR, 10, 10, 223);
blendpixel(vid, nx-1, ny, GR, 10, 10, 223);
blendpixel(vid, nx, ny+1, GR, 10, 10, 223);
@ -1870,6 +2153,22 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx-1, ny+1, GR, 10, 10, 112);
}
}
else if(t==PT_PUMP)
{
uint8 GR = 0x3B+(parts[i].life*19);
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(10, 10, GR);
if(cmode == CM_BLOB) {
blendpixel(vid, nx+1, ny, 10, 10, GR, 223);
blendpixel(vid, nx-1, ny, 10, 10, GR, 223);
blendpixel(vid, nx, ny+1, 10, 10, GR, 223);
blendpixel(vid, nx, ny-1, 10, 10, GR, 223);
blendpixel(vid, nx+1, ny-1, 10, 10, GR, 112);
blendpixel(vid, nx-1, ny-1, 10, 10, GR, 112);
blendpixel(vid, nx+1, ny+1, 10, 10, GR, 112);
blendpixel(vid, nx-1, ny+1, 10, 10, GR, 112);
}
}
else if(t==PT_PLSM)
{
float ttemp = (float)parts[i].life;
@ -1877,7 +2176,7 @@ void draw_parts(pixel *vid)
uint8 R = plasma_data[caddress];
uint8 G = plasma_data[caddress+1];
uint8 B = plasma_data[caddress+2];
if(cmode == 3||cmode==4 || cmode==6)
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
cr = R/8;
cg = G/8;
@ -1916,7 +2215,7 @@ void draw_parts(pixel *vid)
uint8 R = hflm_data[caddress];
uint8 G = hflm_data[caddress+1];
uint8 B = hflm_data[caddress+2];
if(cmode == 3||cmode==4 || cmode==6)
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
cr = R/8;
cg = G/8;
@ -1955,7 +2254,7 @@ void draw_parts(pixel *vid)
uint8 R = firw_data[caddress];
uint8 G = firw_data[caddress+1];
uint8 B = firw_data[caddress+2];
if(cmode == 3||cmode==4 || cmode==6)
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
cr = R/2;
cg = G/2;
@ -1995,7 +2294,7 @@ void draw_parts(pixel *vid)
uint8 R = flm_data[caddress];
uint8 G = flm_data[caddress+1];
uint8 B = flm_data[caddress+2];
if(cmode == 3||cmode==4 || cmode==6)
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
cr = R/8;
cg = G/8;
@ -2083,7 +2382,7 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx-1, ny, cr, cg, cb, 64);
blendpixel(vid, nx, ny+1, cr, cg, cb, 64);
blendpixel(vid, nx, ny-1, cr, cg, cb, 64);
if(cmode == 3||cmode==4 || cmode==6)
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
cr /= 32;
cg /= 32;
@ -2104,7 +2403,7 @@ void draw_parts(pixel *vid)
else if(t==PT_LAVA || t==PT_SPRK)
{
vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors;
if(cmode == 3 || cmode==4 || cmode==6)
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
{
if(t == PT_LAVA)
{
@ -2173,7 +2472,7 @@ void draw_parts(pixel *vid)
//blendpixel(vid, nx+1, ny, R, G, B, 255);
}
}
if(cmode == 4&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_HFLM&&t!=PT_NONE&&t!=PT_ACID&&t!=PT_LCRY&&t!=PT_GLOW&&t!=PT_SWCH&&t!=PT_SMKE&&t!=PT_WTRV&&!(t==PT_FIRW&&parts[i].tmp==3))
if(cmode == CM_BLOB&&t!=PT_FIRE&&t!=PT_PLSM&&t!=PT_HFLM&&t!=PT_NONE&&t!=PT_ACID&&t!=PT_LCRY&&t!=PT_GLOW&&t!=PT_SWCH&&t!=PT_SMKE&&t!=PT_WTRV&&!(t==PT_FIRW&&parts[i].tmp==3))
{
if(t==PT_PHOT) {
cg = 0;
@ -2223,7 +2522,7 @@ void draw_parts(pixel *vid)
void render_signs(pixel *vid_buf)
{
int i, j, x, y, w, h, dx, dy;
int i, j, x, y, w, h, dx, dy,mx,my,b=1,bq;
char buff[30]; //Buffer
for(i=0; i<MAXSIGNS; i++)
if(signs[i].text[0])
@ -2238,7 +2537,6 @@ void render_signs(pixel *vid_buf)
sprintf(buff, "Pressure: %3.2f", pv[signs[i].y/CELL][signs[i].x/CELL]); //...pressure
drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255);
}
if(strcmp(signs[i].text, "{t}")==0)
{
if((pmap[signs[i].y][signs[i].x]>>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)<NPART)
@ -2251,6 +2549,7 @@ void render_signs(pixel *vid_buf)
//Usual text
if(strcmp(signs[i].text, "{p}") && strcmp(signs[i].text, "{t}"))
drawtext(vid_buf, x+3, y+3, signs[i].text, 255, 255, 255, 255);
x = signs[i].x;
y = signs[i].y;
dx = 1 - signs[i].ju;
@ -2261,6 +2560,15 @@ void render_signs(pixel *vid_buf)
x+=dx;
y+=dy;
}
if(MSIGN==i)
{
bq = b;
b = SDL_GetMouseState(&mx, &my);
mx /= sdl_scale;
my /= sdl_scale;
signs[i].x = mx;
signs[i].y = my;
}
}
}
@ -2630,17 +2938,33 @@ corrupt:
return 1;
}
void render_cursor(pixel *vid, int x, int y, int t, int r)
void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry)
{
int i,j,c;
int i,j,c;
if(t<PT_NUM||t==SPC_AIR||t==SPC_HEAT||t==SPC_COOL||t==SPC_VACUUM)
{
if(r<=0)
if(rx<=0)
xor_pixel(x, y, vid);
else
for(j=0; j<=r; j++)
for(i=0; i<=r; i++)
if(i*i+j*j<=r*r && ((i+1)*(i+1)+j*j>r*r || i*i+(j+1)*(j+1)>r*r))
else if(ry<=0)
xor_pixel(x, y, vid);
if(rx+ry<=0)
xor_pixel(x, y, vid);
else if(CURRENT_BRUSH==SQUARE_BRUSH)
{
for(j=0; j<=ry; j++)
for(i=0; i<=rx; i++)
if(i*j<=ry*rx && ((i+1)>rx || (j+1)>ry))
{
xor_pixel(x+i, y+j, vid);
xor_pixel(x-i, y-j, vid);
if(i&&j)xor_pixel(x+i, y-j, vid);
if(i&&j)xor_pixel(x-i, y+j, vid);
}
}
else if(CURRENT_BRUSH==CIRCLE_BRUSH)
for(j=0; j<=ry; j++)
for(i=0; i<=rx; i++)
if((pow(i,2))/(pow(rx,2))+(pow(j,2))/(pow(ry,2))<=1 && ((pow(i+1,2))/(pow(rx,2))+(pow(j,2))/(pow(ry,2))>1 || (pow(i,2))/(pow(rx,2))+(pow(j+1,2))/(pow(ry,2))>1))
{
xor_pixel(x+i, y+j, vid);
if(j) xor_pixel(x+i, y-j, vid);
@ -2651,7 +2975,7 @@ void render_cursor(pixel *vid, int x, int y, int t, int r)
else
{
int tc;
c = (r/CELL) * CELL;
c = (rx/CELL) * CELL;
x = (x/CELL) * CELL;
y = (y/CELL) * CELL;

View File

@ -101,11 +101,16 @@ void add_sign_ui(pixel *vid_buf, int mx, int my)
int i, w, h, x, y, nm=0, ju;
int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq;
ui_edit ed;
// check if it is an existing sign
for(i=0; i<MAXSIGNS; i++)
if(signs[i].text[0])
{
if(i == MSIGN)
{
MSIGN = -1;
return;
}
get_sign_pos(i, &x, &y, &w, &h);
if(mx>=x && mx<=x+w && my>=y && my<=y+h)
break;
@ -120,7 +125,6 @@ void add_sign_ui(pixel *vid_buf, int mx, int my)
}
if(i >= MAXSIGNS)
return;
if(nm)
{
signs[i].x = mx;
@ -166,12 +170,18 @@ void add_sign_ui(pixel *vid_buf, int mx, int my)
draw_icon(vid_buf, x0+68, y0+42, 0x9E, ju == 1);
draw_icon(vid_buf, x0+86, y0+42, 0x9F, ju == 2);
if(!nm)
{
drawtext(vid_buf, x0+138, y0+45, "\x86", 160, 48, 32, 255);
drawtext(vid_buf, x0+138, y0+45, "\x85", 255, 255, 255, 255);
drawtext(vid_buf, x0+152, y0+46, "Delete", 255, 255, 255, 255);
drawrect(vid_buf, x0+134, y0+42, 50, 15, 255, 255, 255, 255);
drawrect(vid_buf,x0+104,y0+42,26,15,255,255,255,255);
drawtext(vid_buf, x0+110, y0+48, "Mv.", 255, 255, 255, 255);
}
drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255);
@ -188,6 +198,11 @@ void add_sign_ui(pixel *vid_buf, int mx, int my)
if(b && !bq && mx>=x0+86 && mx<=x0+103 && my>=y0+42 && my<=y0+59)
ju = 2;
if(!nm && b && !bq && mx>=x0+104 && mx<=x0+130 && my>=y0+42 && my<=y0+59)
{
MSIGN = i;
break;
}
if(b && !bq && mx>=x0+9 && mx<x0+23 && my>=y0+22 && my<y0+36)
break;
if(b && !bq && mx>=x0 && mx<x0+192 && my>=y0+64 && my<=y0+80)
@ -513,28 +528,37 @@ void draw_svf_ui(pixel *vid_buf)
switch(cmode)
{
case 0:
case CM_VEL:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x98", 128, 160, 255, 255);
break;
case 1:
case CM_PRESS:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x99", 255, 212, 32, 255);
break;
case 2:
case CM_PERS:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x9A", 212, 212, 212, 255);
break;
case 3:
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 4:
case CM_BLOB:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xBF", 55, 255, 55, 255);
break;
case 5:
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 6:
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), "\x00", 100, 150, 255, 255);
break;
case CM_GRAD:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255);
break;
}
drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255);
@ -1460,32 +1484,42 @@ void menu_ui(pixel *vid_buf, int i, int *sl, int *sr)
void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx, int my)
{
int h,x,y,n=0,height,width,sy,rows=0;
SEC = SEC2;
mx /= sdl_scale;
my /= sdl_scale;
rows = ceil((float)msections[i].itemcount/16.0f);
height = (ceil((float)msections[i].itemcount/16.0f)*18);
width = restrict_flt(msections[i].itemcount*31, 0, 16*31);
h = -1;
x = XRES-BARSIZE-26;
x = XRES-BARSIZE-18;
y = YRES+1;
sy = y;
if(i==SC_WALL)
{
for(n = 122; n<122+UI_WALLCOUNT; n++)
for(n = UI_WALLSTART; n<UI_WALLSTART+UI_WALLCOUNT; n++)
{
if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM)
{
if(x-26<=20)
if(x-18<=20)
{
x = XRES-BARSIZE-26;
x = XRES-BARSIZE-18;
y += 19;
}
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5;
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-UI_WALLSTART].colour)+5;
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
{
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
h = n;
}
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT)))
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
h = n;
}
else if(n==SLALT)
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
}
else if(n==*sl)
{
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
@ -1499,21 +1533,30 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
}
else if(i==SC_SPECIAL)
{
for(n = 122; n<122+UI_WALLCOUNT; n++)
for(n = UI_WALLSTART; n<UI_WALLSTART+UI_WALLCOUNT; n++)
{
if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM)
{
if(x-26<=20)
if(x-18<=20)
{
x = XRES-BARSIZE-26;
x = XRES-BARSIZE-18;
y += 19;
}
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-122].colour)+5;
x -= draw_tool_xy(vid_buf, x, y, n, mwalls[n-UI_WALLSTART].colour)+5;
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15)
{
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
h = n;
}
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT)))
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
h = n;
}
else if(n==SLALT)
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
}
else if(n==*sl)
{
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
@ -1528,9 +1571,9 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{
if(ptypes[n].menusection==i&&ptypes[n].menu==1)
{
if(x-26<=20)
if(x-18<=20)
{
x = XRES-BARSIZE-26;
x = XRES-BARSIZE-18;
y += 19;
}
x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5;
@ -1539,6 +1582,15 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
h = n;
}
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT)))
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
h = n;
}
else if(n==SLALT)
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
}
else if(n==*sl)
{
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
@ -1556,9 +1608,9 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{
if(ptypes[n].menusection==i&&ptypes[n].menu==1)
{
if(x-26<=20)
if(x-18<=20)
{
x = XRES-BARSIZE-26;
x = XRES-BARSIZE-18;
y += 19;
}
x -= draw_tool_xy(vid_buf, x, y, n, ptypes[n].pcolors)+5;
@ -1567,6 +1619,15 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
h = n;
}
if(!bq && mx>=x+32 && mx<x+58 && my>=y && my< y+15&&(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT)))
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
h = n;
}
else if(n==SLALT)
{
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
}
else if(n==*sl)
{
drawrect(vid_buf, x+30, y-1, 29, 17, 255, 0, 0, 255);
@ -1578,27 +1639,64 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
}
}
}
if(!bq&&mx>=sdl_scale*((XRES+BARSIZE)-16) && mx<sdl_scale*(XRES+BARSIZE-1) &&my>= sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)) && my<sdl_scale*((i*16)+YRES+MENUSIZE-16-(SC_TOTAL*16)+15))
{
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
if(i>=0&&i<SC_TOTAL)
SEC = i;
}
if(h==-1)
{
drawtext(vid_buf, XRES-textwidth((char *)msections[i].name)-BARSIZE, sy-10, (char *)msections[i].name, 255, 255, 255, 255);
}
else if(i==SC_WALL||(i==SC_SPECIAL&&h>=122))
else if(i==SC_WALL||(i==SC_SPECIAL&&h>=UI_WALLSTART))
{
drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-122].descs)-BARSIZE, sy-10, (char *)mwalls[h-122].descs, 255, 255, 255, 255);
drawtext(vid_buf, XRES-textwidth((char *)mwalls[h-UI_WALLSTART].descs)-BARSIZE, sy-10, (char *)mwalls[h-UI_WALLSTART].descs, 255, 255, 255, 255);
}
else
{
drawtext(vid_buf, XRES-textwidth((char *)ptypes[h].descs)-BARSIZE, sy-10, (char *)ptypes[h].descs, 255, 255, 255, 255);
}
if(b==1&&h==-1)
{
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT) && SEC>=0)
{
SLALT = -1;
SEC2 = SEC;
}
}
if(b==1&&h!=-1)
{
*sl = h;
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
{
SLALT = h;
SEC2 = -1;
}
else{
*sl = h;
}
}
if(b==4&&h==-1)
{
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT) && SEC>=0)
{
SLALT = -1;
SEC2 = SEC;
}
}
if(b==4&&h!=-1)
{
*sr = h;
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
{
SLALT = h;
SEC2 = -1;
}
else{
*sr = h;
}
}
}
@ -1685,38 +1783,44 @@ void set_cmode(int cm)
{
cmode = cm;
itc = 51;
if(cmode==4)
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==5)
else if(cmode==CM_HEAT)
{
strcpy(itc_msg, "Heat Display");
}
else if(cmode==6)
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==3)
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==2)
else if(cmode==CM_PERS)
{
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);
strcpy(itc_msg, "Persistent Display");
}
else if(cmode==1)
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
strcpy(itc_msg, "Velocity Display");
}
@ -2542,7 +2646,6 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
drawrect(vid_buf, 50, 50, (XRES/2)+1, (YRES/2)+1, 255, 255, 255, 155);
drawrect(vid_buf, 50+(XRES/2)+1, 50, XRES+BARSIZE-100-((XRES/2)+1), YRES+MENUSIZE-100, 155, 155, 155, 255);
drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128);
//Also, The Game.
ed.x = 57+(XRES/2)+1;
ed.y = YRES+MENUSIZE-118;

View File

@ -6,6 +6,7 @@
* Copyright (c) 2010 Skresanov Savely
* Copyright (c) 2010 Bryan Hoyle
* Copyright (c) 2010 Nathan Cousins
* Copyright (c) 2010 cracker64
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,6 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -28,6 +30,7 @@
#include <SDL/SDL.h>
#include <bzlib.h>
#include <time.h>
#ifdef WIN32
#include <direct.h>
#else
@ -49,7 +52,7 @@
#include <icon.h>
static const char *it_msg =
"\brThe Powder Toy\n"
"\brThe Powder Toy - http://powdertoy.co.uk/\n"
"\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n"
"\n"
"\bgControl+C/V/X are Copy, Paste and cut respectively.\n"
@ -66,18 +69,16 @@ static const char *it_msg =
"'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n"
"'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 7 will do the same\n"
"Use the mouse scroll wheel to change the tool size for particles.\n"
"'Q' will quit the application.\n"
"The spacebar can be used to pause physics.\n"
"'P' will take a screenshot and save it into the current directory.\n"
"\n"
"\brhttp://powdertoy.co.uk/\n"
"\bgCopyright (c) 2008-10 Stanislaw K Skowronek (\brhttp://powder.unaligned.org\bg, \bbirc.unaligned.org #wtf\bg)\n"
"\bgCopyright (c) 2010 Simon Robertshaw (\brhttp://powdertoy.co.uk\bg, \bbirc.freenode.net #powder\bg)\n"
"\bgCopyright (c) 2010 Skresanov Savely (Stickman)\n"
"\bgCopyright (c) 2010 cracker64\n"
"\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n"
"\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n"
"\n"
"\bgSpecial thanks to Brian Ledbetter for maintaining ports.\n"
"\bgTo use online features such as saving, you need to register at: \brhttp://powdertoy.co.uk/Register.html"
;
@ -99,6 +100,9 @@ int legacy_enable = 0; //Used to disable new features such as heat, will be set
int death = 0, framerender = 0;
int amd = 1;
int FPSB = 0;
int MSIGN =-1;
//int CGOL = 0;
//int GSPEED = 1;//causes my .exe to crash..
sign signs[MAXSIGNS];
@ -245,7 +249,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
d[p++] = bmap[y][x];
for(y=by0; y<by0+bh; y++)
for(x=bx0; x<bx0+bw; x++)
if(bmap[y][x]==4)
if(bmap[y][x]==WL_FAN)
{
i = (int)(fvx[y][x]*64.0f+127.5f);
if(i<0) i=0;
@ -254,7 +258,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
}
for(y=by0; y<by0+bh; y++)
for(x=bx0; x<bx0+bw; x++)
if(bmap[y][x]==4)
if(bmap[y][x]==WL_FAN)
{
i = (int)(fvy[y][x]*64.0f+127.5f);
if(i<0) i=0;
@ -325,7 +329,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
for(j=0; j<w*h; j++)
{
i = m[j];
if(i && (parts[i-1].type==PT_CLNE || parts[i-1].type==PT_PCLN || parts[i-1].type==PT_SPRK || parts[i-1].type==PT_LAVA))
if(i && (parts[i-1].type==PT_CLNE || parts[i-1].type==PT_PCLN || parts[i-1].type==PT_SPRK || parts[i-1].type==PT_LAVA || parts[i-1].type==PT_PIPE))
d[p++] = parts[i-1].ctype;
}
@ -481,7 +485,36 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
for(x=bx0; x<bx0+bw; x++)
{
if(d[p])
{
bmap[y][x] = d[p];
if(bmap[y][x]==1)
bmap[y][x]=WL_WALL;
if(bmap[y][x]==2)
bmap[y][x]=WL_DESTROYALL;
if(bmap[y][x]==3)
bmap[y][x]=WL_ALLOWLIQUID;
if(bmap[y][x]==4)
bmap[y][x]=WL_FAN;
if(bmap[y][x]==5)
bmap[y][x]=WL_STREAM;
if(bmap[y][x]==6)
bmap[y][x]=WL_DETECT;
if(bmap[y][x]==7)
bmap[y][x]=WL_EWALL;
if(bmap[y][x]==8)
bmap[y][x]=WL_WALLELEC;
if(bmap[y][x]==9)
bmap[y][x]=WL_ALLOWAIR;
if(bmap[y][x]==10)
bmap[y][x]=WL_ALLOWSOLID;
if(bmap[y][x]==11)
bmap[y][x]=WL_ALLOWALLELEC;
if(bmap[y][x]==12)
bmap[y][x]=WL_EHOLE;
if(bmap[y][x]==13)
bmap[y][x]=WL_ALLOWGAS;
}
p++;
}
for(y=by0; y<by0+bh; y++)
@ -514,6 +547,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
//TODO: Possibly some server side translation
j = PT_DUST;//goto corrupt;
}
gol[x][y]=0;
if(j)// && !(isplayer == 1 && j==PT_STKM))
{
if(pmap[y][x])
@ -529,6 +563,10 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
else if(i < nf)
{
parts[fp[i]].type = j;
if(j == PT_COAL)
parts[fp[i]].tmp = 50;
if(j == PT_FUSE)
parts[fp[i]].tmp = 50;
if(j == PT_PHOT)
parts[fp[i]].ctype = 0x3fffffff;
parts[fp[i]].x = (float)x;
@ -654,7 +692,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{
i = m[j];
ty = d[pty+j];
if(i && (ty==PT_CLNE || (ty==PT_PCLN && ver>=43) || (ty==PT_SPRK && ver>=21) || (ty==PT_LAVA && ver>=34)))
if(i && (ty==PT_CLNE || (ty==PT_PCLN && ver>=43) || (ty==PT_SPRK && ver>=21) || (ty==PT_LAVA && ver>=34) || (ty==PT_PIPE && ver>=43)))
{
if(p >= size)
goto corrupt;
@ -1003,7 +1041,7 @@ int main(int argc, char *argv[])
int vs = 0;
#endif
int x, y, b = 0, sl=1, sr=0, su=0, c, lb = 0, lx = 0, ly = 0, lm = 0;//, tx, ty;
int da = 0, db = 0, it = 2047, mx, my, bs = 2;
int da = 0, db = 0, it = 2047, mx, my, bsx = 2, bsy = 2;
float nfvx, nfvy;
int load_mode=0, load_w=0, load_h=0, load_x=0, load_y=0, load_size=0;
void *load_data=NULL;
@ -1118,7 +1156,7 @@ int main(int argc, char *argv[])
{
for(i=1; i<XRES/CELL; i++)
{
if(bmap[j][i]==1 || bmap[j][i]==8 || (bmap[j][i]==7 && !emap[j][i]))
if(bmap[j][i]==WL_WALL || bmap[j][i]==WL_WALLELEC || (bmap[j][i]==WL_EWALL && !emap[j][i]))
{
vx[j][i] = 0.0f;
vx[j][i-1] = 0.0f;
@ -1135,11 +1173,11 @@ int main(int argc, char *argv[])
#ifdef OpenGL
ClearScreen();
#else
if(cmode==0 || cmode==1)
if(cmode==CM_VEL || cmode==CM_PRESS || cmode==CM_CRACK)
{
draw_air(vid_buf);
}
else if(cmode==2)
else if(cmode==CM_PERS)
{
memcpy(vid_buf, fire_bg, XRES*YRES*PIXELSIZE);
memset(vid_buf+(XRES*YRES), 0, ((XRES+BARSIZE)*YRES*PIXELSIZE)-(XRES*YRES*PIXELSIZE));
@ -1152,7 +1190,7 @@ int main(int argc, char *argv[])
update_particles(vid_buf);
draw_parts(vid_buf);
if(cmode==2)
if(cmode==CM_PERS)
{
if(!fire_fc)
{
@ -1164,7 +1202,7 @@ int main(int argc, char *argv[])
}
fire_fc = (fire_fc+1) % 3;
}
if(cmode==3||cmode==4||cmode==6)
if(cmode==CM_FIRE||cmode==CM_BLOB||cmode==CM_FANCY)
render_fire(vid_buf);
render_signs(vid_buf);
@ -1252,76 +1290,134 @@ int main(int argc, char *argv[])
}
if(sdl_key=='1')
{
set_cmode(0);
set_cmode(CM_VEL);
}
if(sdl_key=='2')
{
set_cmode(1);
set_cmode(CM_PRESS);
}
if(sdl_key=='3')
{
set_cmode(2);
set_cmode(CM_PERS);
}
if(sdl_key=='4')
{
set_cmode(3);
set_cmode(CM_FIRE);
}
if(sdl_key=='5')
{
set_cmode(4);
set_cmode(CM_BLOB);
}
if(sdl_key=='6')
{
set_cmode(5);
set_cmode(CM_HEAT);
}
if(sdl_key=='7')
{
set_cmode(6);
set_cmode(CM_FANCY);
}
if(sdl_key=='8')
{
set_cmode(CM_NOTHING);
}
if(sdl_key=='9')
{
set_cmode(CM_CRACK);
}
if(sdl_key=='0')
{
set_cmode(CM_GRAD);
}
if(sdl_key==SDLK_TAB)
{
CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ;
}
if(sdl_key==SDLK_LEFTBRACKET) {
if(sdl_zoom_trig==1)
{
ZSIZE -= 1;
if(ZSIZE>32)
ZSIZE = 32;
if(ZSIZE>60)
ZSIZE = 60;
if(ZSIZE<2)
ZSIZE = 2;
ZFACTOR = 256/ZSIZE;
}
else
{
if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))
bs -= 1;
if(sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
{
bsx -= 1;
bsy -= 1;
}
else if(sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL)))
{
bsx -= 1;
}
else if(sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT)))
{
bsy -= 1;
}
else
bs -= ceil((bs/5)+0.5f);
if(bs>1224)
bs = 1224;
if(bs<0)
bs = 0;
{
bsx -= ceil((bsx/5)+0.5f);
bsy -= ceil((bsy/5)+0.5f);
}
if(bsx>1180)
bsx = 1180;
if(bsy>1180)
bsy = 1180;
if(bsx<0)
bsx = 0;
if(bsy<0)
bsy = 0;
}
}
if(sdl_key==SDLK_RIGHTBRACKET) {
if(sdl_zoom_trig==1)
{
ZSIZE += 1;
if(ZSIZE>32)
ZSIZE = 32;
if(ZSIZE>60)
ZSIZE = 60;
if(ZSIZE<2)
ZSIZE = 2;
ZFACTOR = 256/ZSIZE;
}
else
{
if(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))
bs += 1;
if(sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
{
bsx += 1;
bsy += 1;
}
else if(sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL)))
{
bsx += 1;
}
else if(sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT)))
{
bsy += 1;
}
else
bs += ceil((bs/5)+0.5f);
if(bs>1224)
bs = 1224;
if(bs<0)
bs = 0;
{
bsx += ceil((bsx/5)+0.5f);
bsy += ceil((bsy/5)+0.5f);
}
if(bsx>1180)
bsx = 1180;
if(bsy>1180)
bsy = 1180;
if(bsx<0)
bsx = 0;
if(bsy<0)
bsy = 0;
}
}
if(sdl_key==SDLK_INSERT)
REPLACE_MODE = !REPLACE_MODE;
if(sdl_key=='g')
GRID_MODE = (GRID_MODE+1)%10;
if(sdl_key=='t')
VINE_MODE = !VINE_MODE;
if(sdl_key==SDLK_SPACE)
sys_pause = !sys_pause;
if(sdl_key=='h')
@ -1357,7 +1453,7 @@ int main(int argc, char *argv[])
}
else if(sdl_key=='c')
{
set_cmode((cmode+1) % 7);
set_cmode((cmode+1) % CM_COUNT);
if(it > 50)
it = 50;
}
@ -1394,8 +1490,8 @@ int main(int argc, char *argv[])
if(sdl_zoom_trig==1)
{
ZSIZE += sdl_wheel;
if(ZSIZE>32)
ZSIZE = 32;
if(ZSIZE>60)
ZSIZE = 60;
if(ZSIZE<2)
ZSIZE = 2;
ZFACTOR = 256/ZSIZE;
@ -1403,11 +1499,27 @@ int main(int argc, char *argv[])
}
else
{
bs += sdl_wheel;
if(bs>1224)
bs = 1224;
if(bs<0)
bs = 0;
if(!(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
{
bsx += sdl_wheel;
bsy += sdl_wheel;
}
else if(sdl_mod & (KMOD_SHIFT) && !(sdl_mod & (KMOD_CTRL)))
{
bsx += sdl_wheel;
}
else if(sdl_mod & (KMOD_CTRL) && !(sdl_mod & (KMOD_SHIFT)))
{
bsy += sdl_wheel;
}
if(bsx>1180)
bsx = 1180;
if(bsx<0)
bsx = 0;
if(bsy>1180)
bsy = 1180;
if(bsy<0)
bsy = 0;
sdl_wheel = 0;
/*if(su >= PT_NUM) {
if(sl < PT_NUM)
@ -1794,9 +1906,9 @@ int main(int argc, char *argv[])
if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq)
{
if(b & SDL_BUTTON_LMASK)
set_cmode((cmode+1) % 7);
set_cmode((cmode+1) % CM_COUNT);
if(b & SDL_BUTTON_RMASK)
set_cmode((cmode+6) % 7);
set_cmode((cmode+(CM_COUNT-1)) % CM_COUNT);
save_presets(0);
}
if(x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq)
@ -1808,7 +1920,7 @@ int main(int argc, char *argv[])
{
c = (b&1) ? sl : sr;
su = c;
if(c==126)
if(c==WL_SIGN+100)
{
if(!bq)
add_sign_ui(vid_buf, x, y);
@ -1818,18 +1930,18 @@ int main(int argc, char *argv[])
if(lm == 1)
{
xor_line(lx, ly, x, y, vid_buf);
if(c==127 && lx>=0 && ly>=0 && lx<XRES && ly<YRES && bmap[ly/CELL][lx/CELL]==4)
if(c==WL_FAN+100 && lx>=0 && ly>=0 && lx<XRES && ly<YRES && bmap[ly/CELL][lx/CELL]==WL_FAN)
{
nfvx = (x-lx)*0.005f;
nfvy = (y-ly)*0.005f;
flood_parts(lx, ly, 255, -1, 4);
flood_parts(lx, ly, WL_FANHELPER, -1, WL_FAN);
for(j=0; j<YRES/CELL; j++)
for(i=0; i<XRES/CELL; i++)
if(bmap[j][i] == 255)
if(bmap[j][i] == WL_FANHELPER)
{
fvx[j][i] = nfvx;
fvy[j][i] = nfvy;
bmap[j][i] = 4;
bmap[j][i] = WL_FAN;
}
}
}
@ -1842,14 +1954,14 @@ int main(int argc, char *argv[])
}
else
{
create_line(lx, ly, x, y, bs, c);
create_line(lx, ly, x, y, bsx, bsy, c);
lx = x;
ly = y;
}
}
else
{
if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT)) && !(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
if((sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT)) && !(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL|KMOD_LALT)))
{
lx = x;
ly = y;
@ -1863,16 +1975,18 @@ int main(int argc, char *argv[])
lb = b;
lm = 2;
}
else if((sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) && (sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT)))
else if((sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) && (sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT)) && !(sdl_mod & (KMOD_LALT)))
{
if(c!=125&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM)
if(sdl_mod & (KMOD_CAPS))
c = 0;
if(c!=WL_STREAM&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE)
flood_parts(x, y, c, -1, -1);
lx = x;
ly = y;
lb = 0;
lm = 0;
}
else if((sdl_mod & (KMOD_LALT||KMOD_RALT)) || b==SDL_BUTTON_MIDDLE)
else if(((sdl_mod & (KMOD_LALT|KMOD_RALT)) && !(sdl_mod & (KMOD_SHIFT))) || b==SDL_BUTTON_MIDDLE)
{
if(y>0 && y<sdl_scale*YRES && x>0 && x<sdl_scale*XRES)
{
@ -1914,7 +2028,7 @@ int main(int argc, char *argv[])
cb_emap[cby][cbx] = emap[cby][cbx];
}
create_parts(x, y, bs, c);
create_parts(x, y, bsx, bsy, c);
lx = x;
ly = y;
lb = b;
@ -1933,8 +2047,8 @@ int main(int argc, char *argv[])
su = c;
if(lm == 1)
{
if(c!=127 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=4)
create_line(lx, ly, x, y, bs, c);
if(c!=WL_FAN+100 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=WL_FAN)
create_line(lx, ly, x, y, bsx, bsy, c);
}
else
create_box(lx, ly, x, y, c);
@ -1958,7 +2072,7 @@ int main(int argc, char *argv[])
if(zoom_en!=1 && !load_mode && !save_mode)
{
render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bs);
render_cursor(vid_buf, mx/sdl_scale, my/sdl_scale, su, bsx, bsy);
mousex = mx/sdl_scale;
mousey = my/sdl_scale;
}
@ -2071,16 +2185,23 @@ int main(int argc, char *argv[])
}
if(currentTime-pastFPS>=1000)
{
#ifdef BETA
sprintf(uitext, "Version %d (Beta %d) FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS);
//printf("%s\n", uitext);
#else
sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPS);
#endif
FPSB = FPS;
FPS = 0;
pastFPS = currentTime;
}
#ifdef BETA
sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS);
#else
sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPSB);
#endif
if(REPLACE_MODE)
strappend(uitext, " [REPLACE MODE]");
if(sdl_mod&(KMOD_CAPS))
strappend(uitext, " [CAP LOCKS]");
if(GRID_MODE)
sprintf(uitext, "%s [GRID: %d]", uitext, GRID_MODE);
if(sdl_zoom_trig||zoom_en)
{
if(zoom_x<XRES/2)

View File

@ -280,4 +280,4 @@ int cpu_check(void)
#endif
#endif
return 0;
}
}

File diff suppressed because it is too large Load Diff