nice
This commit is contained in:
parent
cb6597f9e1
commit
14b4dfef87
2
Makefile
2
Makefile
@ -2,7 +2,7 @@ SOURCES := src/*.c
|
||||
|
||||
CFLAGS := -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/
|
||||
OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations
|
||||
LFLAGS := -B static -lSDL -lm -lbz2
|
||||
LFLAGS := -lSDL -lm -lbz2
|
||||
MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3
|
||||
MFLAGS_SSE2 := -march=native-DX86 -DX86_SSE2 -msse2
|
||||
MFLAGS_SSE := -march=native -DX86 -DX86_SSE
|
||||
|
4
includes/font.h
Executable file → Normal file
4
includes/font.h
Executable file → Normal file
File diff suppressed because one or more lines are too long
@ -8,7 +8,7 @@ struct menu_section
|
||||
char *icon;
|
||||
const char *name;
|
||||
int itemcount;
|
||||
int doshow;
|
||||
int doshow;
|
||||
};
|
||||
typedef struct menu_section menu_section;
|
||||
|
||||
|
@ -240,7 +240,7 @@ struct part_type
|
||||
unsigned char hconduct;
|
||||
const char *descs;
|
||||
const unsigned short properties;
|
||||
int (*update_func) (int);
|
||||
int (*update_func) (int);
|
||||
};
|
||||
typedef struct part_type part_type;
|
||||
|
||||
@ -366,7 +366,7 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"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, 1, 100, SC_CRACKER2, 373.0f, 40, "Love...", TYPE_SOLID, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, 1, 1, 97, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 100, "First fireworks made, activated by heat/neutrons.", TYPE_PART, NULL},
|
||||
{"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, NULL},
|
||||
{"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, 1, 50, SC_CRACKER2, 90.0f, 46, "FREEZE", TYPE_PART, NULL},
|
||||
@ -374,15 +374,15 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"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, NULL},
|
||||
{"BIZR", 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, "Bizarre... contradicts the normal state changes.", TYPE_LIQUID, NULL},
|
||||
{"BIZG", 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, 1, 1, SC_CRACKER2, R_TEMP-200.0f+273.15f, 42, "Bizarre gas", TYPE_GAS, NULL},
|
||||
{"BIZS", 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, 1, 100, SC_CRACKER2, R_TEMP+300.0f+273.15f, 251, "Bizarre solid", TYPE_SOLID, NULL},
|
||||
{"BIZS", 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, 1, 100, SC_CRACKER2, R_TEMP+300.0f+273.15f, 251, "Bizarre solid", TYPE_SOLID, NULL},
|
||||
{"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_CRACKER2, 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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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, NULL},
|
||||
{"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 | PROP_NEUTPASS, NULL},
|
||||
{"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, 0, 85, SC_CRACKER2, R_TEMP+0.0f +273.15f, 70, "Shared velocity test", TYPE_PART, NULL},
|
||||
@ -397,8 +397,8 @@ static const part_type ptypes[PT_NUM] =
|
||||
{"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, NULL},
|
||||
{"ARAY", PIXPACK(0xFFBB00), 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, "Ray Emmitter. Rays create points when they collide", TYPE_SOLID, NULL},
|
||||
{"BRAY", PIXPACK(0xFFFFFF), 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_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", TYPE_SOLID, NULL},
|
||||
{"STK2", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0, NULL},
|
||||
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
|
||||
{"STK2", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0, NULL},
|
||||
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
|
||||
};
|
||||
|
||||
static part_state pstates[PT_NUM] =
|
||||
@ -510,9 +510,9 @@ static part_state pstates[PT_NUM] =
|
||||
/* BIZR */ {ST_LIQUID, PT_BIZRG, 100.0f, PT_NONE, 0.0f, PT_BIZRS, 400.0f, PT_NONE, 0.0f},
|
||||
/* BIZRG*/ {ST_GAS , PT_BIZRG, 100.0f, PT_BIZR , 273.0f, PT_BIZRS, 400.0f, PT_NONE, 0.0f},
|
||||
/* BIZRS*/ {ST_SOLID, PT_BIZRG, 100.0f, PT_BIZR , 273.0f, PT_BIZRS, 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},
|
||||
/* 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},
|
||||
@ -535,46 +535,46 @@ static part_state pstates[PT_NUM] =
|
||||
/* STKM2*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f},
|
||||
|
||||
};
|
||||
static int grule[NGOL][9] =
|
||||
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
|
||||
{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},
|
||||
{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},
|
||||
{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[MAX_TEMP/100][8][8];
|
||||
float portaltemp[MAX_TEMP/100][8][8];
|
||||
|
790
src/graphics.c
790
src/graphics.c
@ -745,10 +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)
|
||||
{
|
||||
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(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);
|
||||
@ -1008,22 +1008,22 @@ int textnwidth(char *s, int n)
|
||||
void textnpos(char *s, int n, int w, int *cx, int *cy)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
//TODO: Implement Textnheight for wrapped text
|
||||
for(; *s; s++)
|
||||
int y = 0;
|
||||
//TODO: Implement Textnheight for wrapped text
|
||||
for(; *s; s++)
|
||||
{
|
||||
if(!n){
|
||||
if(!n) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
x += font_data[font_ptrs[(int)(*(unsigned char *)s)]];
|
||||
if(x>=w) {
|
||||
x = 0;
|
||||
y += FONT_H+2;
|
||||
}
|
||||
if(x>=w) {
|
||||
x = 0;
|
||||
y += FONT_H+2;
|
||||
}
|
||||
n--;
|
||||
}
|
||||
*cx = x-1;
|
||||
*cy = y;
|
||||
*cy = y;
|
||||
}
|
||||
|
||||
int textwidthx(char *s, int w)
|
||||
@ -1048,10 +1048,10 @@ int textposxy(char *s, int width, int w, int h)
|
||||
if(x+(cw/2) >= w && y+6 >= h)
|
||||
break;
|
||||
x += cw;
|
||||
if(x>=width) {
|
||||
x = 0;
|
||||
y += FONT_H+2;
|
||||
}
|
||||
if(x>=width) {
|
||||
x = 0;
|
||||
y += FONT_H+2;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
@ -1124,42 +1124,42 @@ void draw_air(pixel *vid)
|
||||
c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f));
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
@ -1305,16 +1305,16 @@ void draw_parts(pixel *vid)
|
||||
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(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 == CM_FANCY) //If fancy mode
|
||||
@ -1402,7 +1402,7 @@ void draw_parts(pixel *vid)
|
||||
|
||||
isplayer = 1; //It's a secret. Tssss...
|
||||
}
|
||||
else if(t==PT_STKM2) //Just draw head here
|
||||
else if(t==PT_STKM2) //Just draw head here
|
||||
{
|
||||
char buff[10]; //Buffer for HP
|
||||
|
||||
@ -1427,82 +1427,82 @@ void draw_parts(pixel *vid)
|
||||
|
||||
isplayer2 = 1; //It's a secret. Tssss...
|
||||
}
|
||||
if(cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_FILT && t!=PT_HSWC && t!=PT_PCLN && t!=PT_DEUT && t!=PT_WIFI)//nothing display but show needed color changes
|
||||
{
|
||||
if(t==PT_PHOT)
|
||||
{
|
||||
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, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
cr = PIXR(ptypes[t].pcolors);
|
||||
cg = PIXG(ptypes[t].pcolors);
|
||||
cb = PIXB(ptypes[t].pcolors);
|
||||
blendpixel(vid, nx, ny, cr, cg, cb, 255);
|
||||
}
|
||||
}
|
||||
else if(cmode==CM_GRAD)//forgot to put else, broke nothing view
|
||||
{
|
||||
if((t==PT_METL||t==PT_BRMT||t==PT_BMTL)&&parts[i].temp>473&&parts[i].temp<1370)
|
||||
{
|
||||
float frequency = 0.00146;
|
||||
int q = parts[i].temp-473;
|
||||
cr = sin(frequency*q) * 226 + PIXR(ptypes[t].pcolors);
|
||||
cg = sin(frequency*q*4.55 +3.14) * 34 + PIXG(ptypes[t].pcolors);
|
||||
cb = sin(frequency*q*2.22 +3.14) * 64 + 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
|
||||
{
|
||||
float frequency = 0.05;
|
||||
int q = parts[i].temp-40;
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
if(cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_FILT && t!=PT_HSWC && t!=PT_PCLN && t!=PT_DEUT && t!=PT_WIFI)//nothing display but show needed color changes
|
||||
{
|
||||
if(t==PT_PHOT)
|
||||
{
|
||||
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, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
cr = PIXR(ptypes[t].pcolors);
|
||||
cg = PIXG(ptypes[t].pcolors);
|
||||
cb = PIXB(ptypes[t].pcolors);
|
||||
blendpixel(vid, nx, ny, cr, cg, cb, 255);
|
||||
}
|
||||
}
|
||||
else if(cmode==CM_GRAD)//forgot to put else, broke nothing view
|
||||
{
|
||||
if((t==PT_METL||t==PT_BRMT||t==PT_BMTL)&&parts[i].temp>473&&parts[i].temp<1370)
|
||||
{
|
||||
float frequency = 0.00146;
|
||||
int q = parts[i].temp-473;
|
||||
cr = sin(frequency*q) * 226 + PIXR(ptypes[t].pcolors);
|
||||
cg = sin(frequency*q*4.55 +3.14) * 34 + PIXG(ptypes[t].pcolors);
|
||||
cb = sin(frequency*q*2.22 +3.14) * 64 + 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
|
||||
{
|
||||
float frequency = 0.05;
|
||||
int q = parts[i].temp-40;
|
||||
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++)
|
||||
@ -1519,30 +1519,30 @@ void draw_parts(pixel *vid)
|
||||
}
|
||||
|
||||
}
|
||||
else if(t==PT_SPNG)
|
||||
{
|
||||
else if(t==PT_SPNG)
|
||||
{
|
||||
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);
|
||||
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;
|
||||
}
|
||||
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;
|
||||
cr = 20;
|
||||
cg = 20;
|
||||
cb = 20;
|
||||
cg += fire_g[y][x];
|
||||
if(cg > 255) cg = 255;
|
||||
fire_g[y][x] = cg;
|
||||
@ -1552,28 +1552,28 @@ void draw_parts(pixel *vid)
|
||||
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
|
||||
{
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
else if(t==PT_DUST && parts[i].life >= 1)
|
||||
{
|
||||
x = nx;
|
||||
y = ny;
|
||||
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
|
||||
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;
|
||||
@ -1591,94 +1591,94 @@ void draw_parts(pixel *vid)
|
||||
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
|
||||
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.0628;
|
||||
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);
|
||||
if(mousex==(nx) && mousey==(ny))
|
||||
else if(t==PT_GRAV)
|
||||
{
|
||||
cr = 20;
|
||||
cg = 20;
|
||||
cb = 20;
|
||||
if(parts[i].vx>0)
|
||||
{
|
||||
int z;
|
||||
for(z = 0; z<NPART; z++) {
|
||||
if(parts[z].type)
|
||||
{
|
||||
if(parts[z].type==PT_WIFI&&parts[z].tmp==parts[i].tmp)
|
||||
xor_line(nx,ny,(int)(parts[z].x+0.5f),(int)(parts[z].y+0.5f),vid);
|
||||
}
|
||||
}
|
||||
cr += (parts[i].vx)*GRAV_R;
|
||||
cg += (parts[i].vx)*GRAV_G;
|
||||
cb += (parts[i].vx)*GRAV_B;
|
||||
}
|
||||
}
|
||||
else if((t==PT_BIZR||t==PT_BIZRG)&&parts[i].ctype)
|
||||
{
|
||||
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;
|
||||
if(fabs(parts[i].vx)+fabs(parts[i].vy)>0 &&(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)) {
|
||||
fg = 0;
|
||||
fb = 0;
|
||||
fr = 0;
|
||||
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.0628;
|
||||
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);
|
||||
if(mousex==(nx) && mousey==(ny))
|
||||
{
|
||||
int z;
|
||||
for(z = 0; z<NPART; z++) {
|
||||
if(parts[z].type)
|
||||
{
|
||||
if(parts[z].type==PT_WIFI&&parts[z].tmp==parts[i].tmp)
|
||||
xor_line(nx,ny,(int)(parts[z].x+0.5f),(int)(parts[z].y+0.5f),vid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if((t==PT_BIZR||t==PT_BIZRG)&&parts[i].ctype)
|
||||
{
|
||||
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;
|
||||
if(fabs(parts[i].vx)+fabs(parts[i].vy)>0 &&(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)) {
|
||||
fg = 0;
|
||||
fb = 0;
|
||||
fr = 0;
|
||||
fg = cg/40 * fabs(parts[i].vx)+fabs(parts[i].vy);
|
||||
fb = cb/40 * fabs(parts[i].vx)+fabs(parts[i].vy);
|
||||
fr = cr/40 * fabs(parts[i].vx)+fabs(parts[i].vy);
|
||||
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(cr, 0, 255), (int)restrict_flt(cg, 0, 255), (int)restrict_flt(cb, 0, 255));
|
||||
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(cr, 0, 255), (int)restrict_flt(cg, 0, 255), (int)restrict_flt(cb, 0, 255));
|
||||
x = nx/CELL;
|
||||
y = ny/CELL;
|
||||
fg += fire_g[y][x];
|
||||
@ -1690,70 +1690,70 @@ void draw_parts(pixel *vid)
|
||||
fr += fire_r[y][x];
|
||||
if(fr > 255) fr = 255;
|
||||
fire_r[y][x] = fr;
|
||||
}
|
||||
else
|
||||
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
|
||||
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;
|
||||
@ -1888,45 +1888,45 @@ 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_BRAY && parts[i].tmp==0)
|
||||
{
|
||||
int trans = parts[i].life * 7;
|
||||
blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
|
||||
}
|
||||
else if(t==PT_BRAY && parts[i].tmp==1)
|
||||
{
|
||||
int trans = parts[i].life/4;
|
||||
blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
|
||||
}
|
||||
else if(t==PT_BRAY && parts[i].tmp==2)
|
||||
{
|
||||
int trans = parts[i].life*100;
|
||||
blendpixel(vid, nx, ny, 255, 150, 50, trans);
|
||||
}
|
||||
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_BRAY && parts[i].tmp==0)
|
||||
{
|
||||
int trans = parts[i].life * 7;
|
||||
blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
|
||||
}
|
||||
else if(t==PT_BRAY && parts[i].tmp==1)
|
||||
{
|
||||
int trans = parts[i].life/4;
|
||||
blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
|
||||
}
|
||||
else if(t==PT_BRAY && parts[i].tmp==2)
|
||||
{
|
||||
int trans = parts[i].life*100;
|
||||
blendpixel(vid, nx, ny, 255, 150, 50, trans);
|
||||
}
|
||||
else if(t==PT_PHOT)
|
||||
{
|
||||
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
|
||||
@ -2291,7 +2291,7 @@ void draw_parts(pixel *vid)
|
||||
blendpixel(vid, nx-1, ny+1, GR, 10, 10, 112);
|
||||
}
|
||||
}
|
||||
else if(t==PT_PUMP)
|
||||
else if(t==PT_PUMP)
|
||||
{
|
||||
uint8 GR = 0x3B+(parts[i].life*19);
|
||||
vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(10, 10, GR);
|
||||
@ -2604,7 +2604,7 @@ void draw_parts(pixel *vid)
|
||||
|
||||
isplayer = 1; //It's a secret. Tssss...
|
||||
}
|
||||
else if(t==PT_STKM2) //Stick man should be visible in heat mode
|
||||
else if(t==PT_STKM2) //Stick man should be visible in heat mode
|
||||
{
|
||||
char buff[10]; //Buffer for HP
|
||||
|
||||
@ -2723,15 +2723,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;
|
||||
}
|
||||
if(MSIGN==i)
|
||||
{
|
||||
bq = b;
|
||||
b = SDL_GetMouseState(&mx, &my);
|
||||
mx /= sdl_scale;
|
||||
my /= sdl_scale;
|
||||
signs[i].x = mx;
|
||||
signs[i].y = my;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2961,12 +2961,12 @@ pixel *prerender_save(void *save, int size, int *width, int *height)
|
||||
if(!(j%2) && !(i%2))
|
||||
fb[(ry+j)*w+(rx+i)] = PIXPACK(0xC0C0C0);
|
||||
break;
|
||||
case 4:
|
||||
for(j=0; j<CELL; j+=2)
|
||||
for(i=(j>>1)&1; i<CELL; i+=2)
|
||||
fb[(ry+j)*w+(rx+i)] = PIXPACK(0x8080FF);
|
||||
k++;
|
||||
break;
|
||||
case 4:
|
||||
for(j=0; j<CELL; j+=2)
|
||||
for(i=(j>>1)&1; i<CELL; i+=2)
|
||||
fb[(ry+j)*w+(rx+i)] = PIXPACK(0x8080FF);
|
||||
k++;
|
||||
break;
|
||||
case 6:
|
||||
for(j=0; j<CELL; j+=2)
|
||||
for(i=(j>>1)&1; i<CELL; i+=2)
|
||||
@ -2986,7 +2986,7 @@ pixel *prerender_save(void *save, int size, int *width, int *height)
|
||||
else
|
||||
fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
|
||||
break;
|
||||
case WL_WALL:
|
||||
case WL_WALL:
|
||||
for(j=0; j<CELL; j++)
|
||||
for(i=0; i<CELL; i++)
|
||||
fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
|
||||
@ -3057,7 +3057,7 @@ pixel *prerender_save(void *save, int size, int *width, int *height)
|
||||
draw_line(fb , x, y+3, x+1, y+6, 255, 255, 255, w);
|
||||
draw_line(fb , x+1, y+6, x+3, y+12, 255, 255, 255, w);
|
||||
}
|
||||
else if(j==PT_STKM2)
|
||||
else if(j==PT_STKM2)
|
||||
{
|
||||
//Stickman drawing
|
||||
for(k=-2; k<=1; k++)
|
||||
@ -3177,27 +3177,27 @@ corrupt:
|
||||
|
||||
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(rx<=0)
|
||||
if(rx<=0)
|
||||
xor_pixel(x, y, vid);
|
||||
else if(ry<=0)
|
||||
else if(ry<=0)
|
||||
xor_pixel(x, y, vid);
|
||||
if(rx+ry<=0)
|
||||
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==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++)
|
||||
|
638
src/interface.c
638
src/interface.c
@ -101,16 +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;
|
||||
}
|
||||
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;
|
||||
@ -181,8 +181,8 @@ void add_sign_ui(pixel *vid_buf, int mx, int my)
|
||||
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);
|
||||
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);
|
||||
@ -200,10 +200,10 @@ void add_sign_ui(pixel *vid_buf, int mx, int my)
|
||||
ju = 2;
|
||||
|
||||
if(!nm && b && !bq && mx>=x0+104 && mx<=x0+130 && my>=y0+42 && my<=y0+59)
|
||||
{
|
||||
MSIGN = i;
|
||||
break;
|
||||
}
|
||||
{
|
||||
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)
|
||||
@ -246,25 +246,25 @@ void ui_edit_draw(pixel *vid_buf, ui_edit *ed)
|
||||
|
||||
if(ed->str[0])
|
||||
{
|
||||
if(ed->multiline){
|
||||
drawtextwrap(vid_buf, ed->x, ed->y, ed->w-14, str, 255, 255, 255, 255);
|
||||
drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255);
|
||||
} else {
|
||||
drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255);
|
||||
drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255);
|
||||
}
|
||||
if(ed->multiline) {
|
||||
drawtextwrap(vid_buf, ed->x, ed->y, ed->w-14, str, 255, 255, 255, 255);
|
||||
drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255);
|
||||
} else {
|
||||
drawtext(vid_buf, ed->x, ed->y, str, 255, 255, 255, 255);
|
||||
drawtext(vid_buf, ed->x+ed->w-11, ed->y-1, "\xAA", 128, 128, 128, 255);
|
||||
}
|
||||
}
|
||||
else if(!ed->focus)
|
||||
drawtext(vid_buf, ed->x, ed->y, ed->def, 128, 128, 128, 255);
|
||||
if(ed->focus)
|
||||
{
|
||||
if(ed->multiline){
|
||||
textnpos(str, ed->cursor, ed->w-14, &cx, &cy);
|
||||
} else {
|
||||
cx = textnwidth(str, ed->cursor);
|
||||
cy = 0;
|
||||
}
|
||||
|
||||
if(ed->multiline) {
|
||||
textnpos(str, ed->cursor, ed->w-14, &cx, &cy);
|
||||
} else {
|
||||
cx = textnwidth(str, ed->cursor);
|
||||
cy = 0;
|
||||
}
|
||||
|
||||
for(i=-3; i<9; i++)
|
||||
drawpixel(vid_buf, ed->x+cx, ed->y+i+cy, 255, 255, 255, 255);
|
||||
}
|
||||
@ -290,35 +290,35 @@ void ui_edit_process(int mx, int my, int mb, ui_edit *ed)
|
||||
else
|
||||
str = ed->str;
|
||||
|
||||
if(ed->multiline){
|
||||
if(mx>=ed->x+ed->w-11 && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+11)
|
||||
{
|
||||
ed->focus = 1;
|
||||
ed->cursor = 0;
|
||||
ed->str[0] = 0;
|
||||
}
|
||||
else if(mx>=ed->x-ed->nx && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+ed->h)
|
||||
{
|
||||
ed->focus = 1;
|
||||
ed->cursor = textposxy(str, ed->w-14, mx-ed->x, my-ed->y);
|
||||
}
|
||||
else
|
||||
ed->focus = 0;
|
||||
} else {
|
||||
if(mx>=ed->x+ed->w-11 && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+11)
|
||||
{
|
||||
ed->focus = 1;
|
||||
ed->cursor = 0;
|
||||
ed->str[0] = 0;
|
||||
}
|
||||
else if(mx>=ed->x-ed->nx && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+11)
|
||||
{
|
||||
ed->focus = 1;
|
||||
ed->cursor = textwidthx(str, mx-ed->x);
|
||||
}
|
||||
else
|
||||
ed->focus = 0;
|
||||
}
|
||||
if(ed->multiline) {
|
||||
if(mx>=ed->x+ed->w-11 && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+11)
|
||||
{
|
||||
ed->focus = 1;
|
||||
ed->cursor = 0;
|
||||
ed->str[0] = 0;
|
||||
}
|
||||
else if(mx>=ed->x-ed->nx && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+ed->h)
|
||||
{
|
||||
ed->focus = 1;
|
||||
ed->cursor = textposxy(str, ed->w-14, mx-ed->x, my-ed->y);
|
||||
}
|
||||
else
|
||||
ed->focus = 0;
|
||||
} else {
|
||||
if(mx>=ed->x+ed->w-11 && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+11)
|
||||
{
|
||||
ed->focus = 1;
|
||||
ed->cursor = 0;
|
||||
ed->str[0] = 0;
|
||||
}
|
||||
else if(mx>=ed->x-ed->nx && mx<ed->x+ed->w && my>=ed->y-5 && my<ed->y+11)
|
||||
{
|
||||
ed->focus = 1;
|
||||
ed->cursor = textwidthx(str, mx-ed->x);
|
||||
}
|
||||
else
|
||||
ed->focus = 0;
|
||||
}
|
||||
}
|
||||
if(ed->focus && sdl_key)
|
||||
{
|
||||
@ -551,14 +551,14 @@ void draw_svf_ui(pixel *vid_buf)
|
||||
break;
|
||||
case CM_FANCY:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255);
|
||||
break;
|
||||
break;
|
||||
case CM_NOTHING:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255);
|
||||
break;
|
||||
break;
|
||||
case CM_CRACK:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD4", 255, 55, 55, 255);
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD5", 55, 255, 55, 255);
|
||||
break;
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD5", 55, 255, 55, 255);
|
||||
break;
|
||||
case CM_GRAD:
|
||||
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xD3", 255, 50, 255, 255);
|
||||
break;
|
||||
@ -1183,9 +1183,9 @@ int save_name_ui(pixel *vid_buf)
|
||||
ed.focus = 1;
|
||||
ed.hide = 0;
|
||||
ed.cursor = strlen(svf_name);
|
||||
ed.multiline = 0;
|
||||
ed.multiline = 0;
|
||||
strcpy(ed.str, svf_name);
|
||||
|
||||
|
||||
ed2.x = x0+13;
|
||||
ed2.y = y0+45;
|
||||
ed2.w = 166;
|
||||
@ -1195,7 +1195,7 @@ int save_name_ui(pixel *vid_buf)
|
||||
ed2.focus = 0;
|
||||
ed2.hide = 0;
|
||||
ed2.cursor = strlen(svf_description);
|
||||
ed2.multiline = 1;
|
||||
ed2.multiline = 1;
|
||||
strcpy(ed2.str, svf_description);
|
||||
|
||||
cb.x = x0+10;
|
||||
@ -1216,7 +1216,7 @@ int save_name_ui(pixel *vid_buf)
|
||||
drawtext(vid_buf, x0+8, y0+8, "New simulation name:", 255, 255, 255, 255);
|
||||
drawtext(vid_buf, x0+10, y0+23, "\x82", 192, 192, 192, 255);
|
||||
drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255);
|
||||
|
||||
|
||||
drawrect(vid_buf, x0+8, y0+40, 176, 95, 192, 192, 192, 255);
|
||||
|
||||
ui_edit_draw(vid_buf, &ed);
|
||||
@ -1230,8 +1230,8 @@ int save_name_ui(pixel *vid_buf)
|
||||
|
||||
drawtext(vid_buf, x0+5, y0+79+YRES/4, "Save simulation", 255, 255, 255, 255);
|
||||
drawrect(vid_buf, x0, y0+74+YRES/4, 192, 16, 192, 192, 192, 255);
|
||||
|
||||
draw_line(vid_buf, x0+192, y0, x0+192, y0+90+YRES/4, 150, 150, 150, XRES+BARSIZE);
|
||||
|
||||
draw_line(vid_buf, x0+192, y0, x0+192, y0+90+YRES/4, 150, 150, 150, XRES+BARSIZE);
|
||||
|
||||
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
|
||||
|
||||
@ -1516,12 +1516,12 @@ 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)))
|
||||
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)
|
||||
else if(n==SLALT)
|
||||
{
|
||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||
}
|
||||
@ -1558,7 +1558,7 @@ 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, 0, 255, 255, 255);
|
||||
h = n;
|
||||
}
|
||||
else if(n==SLALT)
|
||||
else if(n==SLALT)
|
||||
{
|
||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||
}
|
||||
@ -1592,7 +1592,7 @@ 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, 0, 255, 255, 255);
|
||||
h = n;
|
||||
}
|
||||
else if(n==SLALT)
|
||||
else if(n==SLALT)
|
||||
{
|
||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||
}
|
||||
@ -1629,7 +1629,7 @@ 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, 0, 255, 255, 255);
|
||||
h = n;
|
||||
}
|
||||
else if(n==SLALT)
|
||||
else if(n==SLALT)
|
||||
{
|
||||
drawrect(vid_buf, x+30, y-1, 29, 17, 0, 255, 255, 255);
|
||||
}
|
||||
@ -1645,12 +1645,12 @@ 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(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
|
||||
if(i>=0&&i<SC_TOTAL)
|
||||
SEC = i;
|
||||
}
|
||||
|
||||
if(h==-1)
|
||||
{
|
||||
@ -1667,41 +1667,41 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
|
||||
|
||||
if(b==1&&h==-1)
|
||||
{
|
||||
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT) && SEC>=0)
|
||||
{
|
||||
SLALT = -1;
|
||||
SEC2 = SEC;
|
||||
}
|
||||
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT) && SEC>=0)
|
||||
{
|
||||
SLALT = -1;
|
||||
SEC2 = SEC;
|
||||
}
|
||||
}
|
||||
if(b==1&&h!=-1)
|
||||
{
|
||||
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
|
||||
{
|
||||
SLALT = h;
|
||||
SEC2 = -1;
|
||||
}
|
||||
else{
|
||||
*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(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT) && SEC>=0)
|
||||
{
|
||||
SLALT = -1;
|
||||
SEC2 = SEC;
|
||||
}
|
||||
}
|
||||
if(b==4&&h!=-1)
|
||||
{
|
||||
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
|
||||
{
|
||||
SLALT = h;
|
||||
SEC2 = -1;
|
||||
}
|
||||
else{
|
||||
*sr = h;
|
||||
}
|
||||
if(sdl_mod & (KMOD_LALT) && sdl_mod & (KMOD_SHIFT))
|
||||
{
|
||||
SLALT = h;
|
||||
SEC2 = -1;
|
||||
}
|
||||
else {
|
||||
*sr = h;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1749,8 +1749,8 @@ int sdl_poll(void)
|
||||
{
|
||||
player[0] = (int)(player[0])|0x04; //Jump command
|
||||
}
|
||||
|
||||
if(event.key.keysym.sym == SDLK_d)
|
||||
|
||||
if(event.key.keysym.sym == SDLK_d)
|
||||
{
|
||||
player2[0] = (int)(player2[0])|0x02; //Go right command
|
||||
}
|
||||
@ -1786,8 +1786,8 @@ int sdl_poll(void)
|
||||
{
|
||||
player[0] = (int)(player[0])&7;
|
||||
}
|
||||
|
||||
if(event.key.keysym.sym == SDLK_d || event.key.keysym.sym == SDLK_a)
|
||||
|
||||
if(event.key.keysym.sym == SDLK_d || event.key.keysym.sym == SDLK_a)
|
||||
{
|
||||
player2[1] = player2[0]; //Saving last movement
|
||||
player2[0] = (int)(player2[0])&12; //Stop command
|
||||
@ -2013,7 +2013,7 @@ int search_ui(pixel *vid_buf)
|
||||
ed.focus = 1;
|
||||
ed.hide = 0;
|
||||
ed.cursor = strlen(search_expr);
|
||||
ed.multiline = 0;
|
||||
ed.multiline = 0;
|
||||
strcpy(ed.str, search_expr);
|
||||
|
||||
sdl_wheel = 0;
|
||||
@ -2608,10 +2608,10 @@ int report_ui(pixel* vid_buf, char *save_id)
|
||||
ed.def = "Report details";
|
||||
ed.focus = 0;
|
||||
ed.hide = 0;
|
||||
ed.multiline = 1;
|
||||
ed.multiline = 1;
|
||||
ed.cursor = 0;
|
||||
strcpy(ed.str, "");
|
||||
|
||||
|
||||
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
|
||||
while(!sdl_poll())
|
||||
{
|
||||
@ -2619,42 +2619,42 @@ int report_ui(pixel* vid_buf, char *save_id)
|
||||
if(!b)
|
||||
break;
|
||||
}
|
||||
while(!sdl_poll()){
|
||||
fillrect(vid_buf, 200, 150, (XRES+BARSIZE-400), (YRES+MENUSIZE-300), 0,0,0, 255);
|
||||
while(!sdl_poll()) {
|
||||
fillrect(vid_buf, 200, 150, (XRES+BARSIZE-400), (YRES+MENUSIZE-300), 0,0,0, 255);
|
||||
drawrect(vid_buf, 200, 150, (XRES+BARSIZE-400), (YRES+MENUSIZE-300), 255, 255, 255, 255);
|
||||
|
||||
|
||||
drawrect(vid_buf, 205, 155, (XRES+BARSIZE-400)-10, (YRES+MENUSIZE-300)-28, 255, 255, 255, 170);
|
||||
|
||||
|
||||
bq = b;
|
||||
b = SDL_GetMouseState(&mx, &my);
|
||||
mx /= sdl_scale;
|
||||
my /= sdl_scale;
|
||||
|
||||
|
||||
|
||||
drawrect(vid_buf, 200, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 255);
|
||||
drawtext(vid_buf, 213, (YRES+MENUSIZE-150)-13, "Cancel", 255, 255, 255, 255);
|
||||
|
||||
|
||||
drawrect(vid_buf, (XRES+BARSIZE-400)+150, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 255);
|
||||
drawtext(vid_buf, (XRES+BARSIZE-400)+163, (YRES+MENUSIZE-150)-13, "Report", 255, 255, 255, 255);
|
||||
if(mx>(XRES+BARSIZE-400)+150 && my>(YRES+MENUSIZE-150)-18 && mx<(XRES+BARSIZE-400)+200 && my<(YRES+MENUSIZE-150)){
|
||||
fillrect(vid_buf, (XRES+BARSIZE-400)+150, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 40);
|
||||
if(b){
|
||||
if(execute_report(vid_buf, save_id, ed.str)){
|
||||
info_ui(vid_buf, "Success", "This save has been reported");
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if(mx>(XRES+BARSIZE-400)+150 && my>(YRES+MENUSIZE-150)-18 && mx<(XRES+BARSIZE-400)+200 && my<(YRES+MENUSIZE-150)) {
|
||||
fillrect(vid_buf, (XRES+BARSIZE-400)+150, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 40);
|
||||
if(b) {
|
||||
if(execute_report(vid_buf, save_id, ed.str)) {
|
||||
info_ui(vid_buf, "Success", "This save has been reported");
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mx>200 && my>(YRES+MENUSIZE-150)-18 && mx<250 && my<(YRES+MENUSIZE-150)){
|
||||
fillrect(vid_buf, 200, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 40);
|
||||
if(b)
|
||||
return 0;
|
||||
if(mx>200 && my>(YRES+MENUSIZE-150)-18 && mx<250 && my<(YRES+MENUSIZE-150)) {
|
||||
fillrect(vid_buf, 200, (YRES+MENUSIZE-150)-18, 50, 18, 255, 255, 255, 40);
|
||||
if(b)
|
||||
return 0;
|
||||
}
|
||||
ui_edit_draw(vid_buf, &ed);
|
||||
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
|
||||
ui_edit_process(mx, my, b, &ed);
|
||||
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
|
||||
ui_edit_process(mx, my, b, &ed);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -2663,8 +2663,8 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
|
||||
{
|
||||
int b=1,bq,mx,my,ca=0,thumb_w,thumb_h,active=0,active_2=0,cc=0,ccy=0,cix=0,hasdrawninfo=0,hasdrawnthumb=0,authoritah=0,myown=0,queue_open=0,data_size=0,retval=0,bc=255,openable=1;
|
||||
int nyd,nyu,ry,lv;
|
||||
|
||||
char *uri, *uri_2, *o_uri;
|
||||
|
||||
char *uri, *uri_2, *o_uri;
|
||||
void *data, *info_data;
|
||||
save_info *info = malloc(sizeof(save_info));
|
||||
void *http = NULL, *http_2 = NULL;
|
||||
@ -2672,7 +2672,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
|
||||
int status, status_2, info_ready = 0, data_ready = 0;
|
||||
time_t http_last_use = HTTP_TIMEOUT, http_last_use_2 = HTTP_TIMEOUT;
|
||||
pixel *save_pic;// = malloc((XRES/2)*(YRES/2));
|
||||
ui_edit ed;
|
||||
ui_edit ed;
|
||||
|
||||
pixel *old_vid=(pixel *)calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE);
|
||||
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
|
||||
@ -2683,18 +2683,18 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
|
||||
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);
|
||||
|
||||
ed.x = 57+(XRES/2)+1;
|
||||
ed.y = YRES+MENUSIZE-118;
|
||||
ed.w = XRES+BARSIZE-114-((XRES/2)+1);
|
||||
ed.h = 48;
|
||||
ed.x = 57+(XRES/2)+1;
|
||||
ed.y = YRES+MENUSIZE-118;
|
||||
ed.w = XRES+BARSIZE-114-((XRES/2)+1);
|
||||
ed.h = 48;
|
||||
ed.nx = 1;
|
||||
ed.def = "Add comment";
|
||||
ed.focus = 1;
|
||||
ed.hide = 0;
|
||||
ed.multiline = 1;
|
||||
ed.multiline = 1;
|
||||
ed.cursor = 0;
|
||||
strcpy(ed.str, "");
|
||||
|
||||
|
||||
memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE);
|
||||
|
||||
while(!sdl_poll())
|
||||
@ -2756,14 +2756,14 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
|
||||
if(status == 200)
|
||||
{
|
||||
pixel *full_save = prerender_save(data, data_size, &imgw, &imgh);
|
||||
if(full_save!=NULL){
|
||||
save_pic = rescale_img(full_save, imgw, imgh, &thumb_w, &thumb_h, 2);
|
||||
data_ready = 1;
|
||||
free(full_save);
|
||||
} else {
|
||||
error_ui(vid_buf, 0, "Save may be from a newer version");
|
||||
break;
|
||||
}
|
||||
if(full_save!=NULL) {
|
||||
save_pic = rescale_img(full_save, imgw, imgh, &thumb_w, &thumb_h, 2);
|
||||
data_ready = 1;
|
||||
free(full_save);
|
||||
} else {
|
||||
error_ui(vid_buf, 0, "Save may be from a newer version");
|
||||
break;
|
||||
}
|
||||
}
|
||||
active = 0;
|
||||
free(http);
|
||||
@ -2786,7 +2786,7 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
|
||||
free(http_2);
|
||||
http_2 = NULL;
|
||||
}
|
||||
|
||||
|
||||
if(data_ready && !hasdrawnthumb) {
|
||||
draw_image(vid_buf, save_pic, 51, 51, thumb_w, thumb_h, 255);
|
||||
hasdrawnthumb = 1;
|
||||
@ -2800,73 +2800,73 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
|
||||
cix = drawtext(vid_buf, cix+4, (YRES/2)+72, "Date:", 255, 255, 255, 155);
|
||||
cix = drawtext(vid_buf, cix+4, (YRES/2)+72, info->date, 255, 255, 255, 255);
|
||||
drawtextwrap(vid_buf, 62, (YRES/2)+86, (XRES/2)-24, info->description, 255, 255, 255, 200);
|
||||
|
||||
//Draw the score bars
|
||||
if(info->voteup>0||info->votedown>0)
|
||||
{
|
||||
lv = (info->voteup>info->votedown)?info->voteup:info->votedown;
|
||||
lv = (lv>10)?lv:10;
|
||||
|
||||
if(50>lv)
|
||||
{
|
||||
ry = ((float)(50)/(float)lv);
|
||||
//if(lv<8)
|
||||
//{
|
||||
// ry = ry/(8-lv);
|
||||
//}
|
||||
nyu = info->voteup*ry;
|
||||
nyd = info->votedown*ry;
|
||||
}
|
||||
else
|
||||
{
|
||||
ry = ((float)lv/(float)(50));
|
||||
nyu = info->voteup/ry;
|
||||
nyd = info->votedown/ry;
|
||||
}
|
||||
nyu = nyu>50?50:nyu;
|
||||
nyd = nyd>50?50:nyd;
|
||||
|
||||
fillrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+53, 52, 6, 0, 107, 10, 255);
|
||||
fillrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+59, 52, 6, 107, 10, 0, 255);
|
||||
drawrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+53, 52, 6, 128, 128, 128, 255);
|
||||
drawrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+59, 52, 6, 128, 128, 128, 255);
|
||||
|
||||
fillrect(vid_buf, 48+(XRES/2)-nyu, (YRES/2)+54, nyu, 4, 57, 187, 57, 255);
|
||||
fillrect(vid_buf, 48+(XRES/2)-nyd, (YRES/2)+60, nyd, 4, 187, 57, 57, 255);
|
||||
}
|
||||
//Draw the score bars
|
||||
if(info->voteup>0||info->votedown>0)
|
||||
{
|
||||
lv = (info->voteup>info->votedown)?info->voteup:info->votedown;
|
||||
lv = (lv>10)?lv:10;
|
||||
|
||||
if(50>lv)
|
||||
{
|
||||
ry = ((float)(50)/(float)lv);
|
||||
//if(lv<8)
|
||||
//{
|
||||
// ry = ry/(8-lv);
|
||||
//}
|
||||
nyu = info->voteup*ry;
|
||||
nyd = info->votedown*ry;
|
||||
}
|
||||
else
|
||||
{
|
||||
ry = ((float)lv/(float)(50));
|
||||
nyu = info->voteup/ry;
|
||||
nyd = info->votedown/ry;
|
||||
}
|
||||
nyu = nyu>50?50:nyu;
|
||||
nyd = nyd>50?50:nyd;
|
||||
|
||||
fillrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+53, 52, 6, 0, 107, 10, 255);
|
||||
fillrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+59, 52, 6, 107, 10, 0, 255);
|
||||
drawrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+53, 52, 6, 128, 128, 128, 255);
|
||||
drawrect(vid_buf, 48+(XRES/2)-51, (YRES/2)+59, 52, 6, 128, 128, 128, 255);
|
||||
|
||||
fillrect(vid_buf, 48+(XRES/2)-nyu, (YRES/2)+54, nyu, 4, 57, 187, 57, 255);
|
||||
fillrect(vid_buf, 48+(XRES/2)-nyd, (YRES/2)+60, nyd, 4, 187, 57, 57, 255);
|
||||
}
|
||||
|
||||
ccy = 0;
|
||||
for(cc=0; cc<info->comment_count; cc++) {
|
||||
if((ccy + 72 + ((textwidth(info->comments[cc])/(XRES+BARSIZE-100-((XRES/2)+1)-20)))*12)<(YRES+MENUSIZE-50)){
|
||||
drawtext(vid_buf, 60+(XRES/2)+1, ccy+60, info->commentauthors[cc], 255, 255, 255, 255);
|
||||
ccy += 12;
|
||||
ccy += drawtextwrap(vid_buf, 60+(XRES/2)+1, ccy+60, XRES+BARSIZE-100-((XRES/2)+1)-20, info->comments[cc], 255, 255, 255, 185);
|
||||
ccy += 10;
|
||||
if(ccy+52<YRES+MENUSIZE-50){ //Try not to draw off the screen.
|
||||
draw_line(vid_buf, 50+(XRES/2)+2, ccy+52, XRES+BARSIZE-50, ccy+52, 100, 100, 100, XRES+BARSIZE);
|
||||
}
|
||||
}
|
||||
if((ccy + 72 + ((textwidth(info->comments[cc])/(XRES+BARSIZE-100-((XRES/2)+1)-20)))*12)<(YRES+MENUSIZE-50)) {
|
||||
drawtext(vid_buf, 60+(XRES/2)+1, ccy+60, info->commentauthors[cc], 255, 255, 255, 255);
|
||||
ccy += 12;
|
||||
ccy += drawtextwrap(vid_buf, 60+(XRES/2)+1, ccy+60, XRES+BARSIZE-100-((XRES/2)+1)-20, info->comments[cc], 255, 255, 255, 185);
|
||||
ccy += 10;
|
||||
if(ccy+52<YRES+MENUSIZE-50) { //Try not to draw off the screen.
|
||||
draw_line(vid_buf, 50+(XRES/2)+2, ccy+52, XRES+BARSIZE-50, ccy+52, 100, 100, 100, XRES+BARSIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
hasdrawninfo = 1;
|
||||
myown = svf_login && !strcmp(info->author, svf_user);
|
||||
authoritah = svf_login && (!strcmp(info->author, svf_user) || svf_admin || svf_mod);
|
||||
authoritah = svf_login && (!strcmp(info->author, svf_user) || svf_admin || svf_mod);
|
||||
memcpy(old_vid, vid_buf, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE);
|
||||
}
|
||||
if(info_ready && svf_login){
|
||||
//Render the comment box.
|
||||
fillrect(vid_buf, 50+(XRES/2)+1, YRES+MENUSIZE-125, XRES+BARSIZE-100-((XRES/2)+1), 75, 0, 0, 0, 255);
|
||||
drawrect(vid_buf, 50+(XRES/2)+1, YRES+MENUSIZE-125, XRES+BARSIZE-100-((XRES/2)+1), 75, 200, 200, 200, 255);
|
||||
|
||||
drawrect(vid_buf, 54+(XRES/2)+1, YRES+MENUSIZE-121, XRES+BARSIZE-108-((XRES/2)+1), 48, 255, 255, 255, 200);
|
||||
|
||||
ui_edit_draw(vid_buf, &ed);
|
||||
|
||||
drawrect(vid_buf, XRES+BARSIZE-100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255);
|
||||
drawtext(vid_buf, XRES+BARSIZE-90, YRES+MENUSIZE-63, "Submit", 255, 255, 255, 255);
|
||||
}
|
||||
if(info_ready && svf_login) {
|
||||
//Render the comment box.
|
||||
fillrect(vid_buf, 50+(XRES/2)+1, YRES+MENUSIZE-125, XRES+BARSIZE-100-((XRES/2)+1), 75, 0, 0, 0, 255);
|
||||
drawrect(vid_buf, 50+(XRES/2)+1, YRES+MENUSIZE-125, XRES+BARSIZE-100-((XRES/2)+1), 75, 200, 200, 200, 255);
|
||||
|
||||
drawrect(vid_buf, 54+(XRES/2)+1, YRES+MENUSIZE-121, XRES+BARSIZE-108-((XRES/2)+1), 48, 255, 255, 255, 200);
|
||||
|
||||
ui_edit_draw(vid_buf, &ed);
|
||||
|
||||
drawrect(vid_buf, XRES+BARSIZE-100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 255);
|
||||
drawtext(vid_buf, XRES+BARSIZE-90, YRES+MENUSIZE-63, "Submit", 255, 255, 255, 255);
|
||||
}
|
||||
|
||||
//Open Button
|
||||
bc = openable?255:150;
|
||||
bc = openable?255:150;
|
||||
drawrect(vid_buf, 50, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc);
|
||||
drawtext(vid_buf, 73, YRES+MENUSIZE-63, "Open", 255, 255, 255, bc);
|
||||
drawtext(vid_buf, 58, YRES+MENUSIZE-64, "\x81", 255, 255, 255, bc);
|
||||
@ -2881,102 +2881,102 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
|
||||
drawtext(vid_buf, 168, YRES+MENUSIZE-63, "Report", 255, 255, 255, bc);
|
||||
drawtext(vid_buf, 158, YRES+MENUSIZE-63, "!", 255, 255, 255, bc);
|
||||
//Delete Button
|
||||
bc = authoritah?255:150;
|
||||
drawrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc);
|
||||
drawtext(vid_buf, 218, YRES+MENUSIZE-63, "Delete", 255, 255, 255, bc);
|
||||
drawtext(vid_buf, 206, YRES+MENUSIZE-64, "\xAA", 255, 255, 255, bc);
|
||||
//Open in browser button
|
||||
bc = 255;
|
||||
bc = authoritah?255:150;
|
||||
drawrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, bc);
|
||||
drawtext(vid_buf, 218, YRES+MENUSIZE-63, "Delete", 255, 255, 255, bc);
|
||||
drawtext(vid_buf, 206, YRES+MENUSIZE-64, "\xAA", 255, 255, 255, bc);
|
||||
//Open in browser button
|
||||
bc = 255;
|
||||
drawrect(vid_buf, 250, YRES+MENUSIZE-68, 107, 18, 255, 255, 255, bc);
|
||||
drawtext(vid_buf, 273, YRES+MENUSIZE-63, "Open in Browser", 255, 255, 255, bc);
|
||||
drawtext(vid_buf, 258, YRES+MENUSIZE-64, "\x81", 255, 255, 255, bc);
|
||||
|
||||
//Open Button
|
||||
if(sdl_key==SDLK_RETURN && openable) {
|
||||
|
||||
//Open Button
|
||||
if(sdl_key==SDLK_RETURN && openable) {
|
||||
queue_open = 1;
|
||||
}
|
||||
if(mx > 50 && mx < 50+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && openable && !queue_open) {
|
||||
if(mx > 50 && mx < 50+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && openable && !queue_open) {
|
||||
fillrect(vid_buf, 50, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
|
||||
if(b && !bq) {
|
||||
//Button Clicked
|
||||
//Button Clicked
|
||||
queue_open = 1;
|
||||
}
|
||||
}
|
||||
//Fav Button
|
||||
if(mx > 100 && mx < 100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && !queue_open) {
|
||||
//Fav Button
|
||||
if(mx > 100 && mx < 100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && !queue_open) {
|
||||
fillrect(vid_buf, 100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
|
||||
if(b && !bq) {
|
||||
if(b && !bq) {
|
||||
//Button Clicked
|
||||
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
|
||||
info_box(vid_buf, "Adding to favourites...");
|
||||
execute_fav(vid_buf, save_id);
|
||||
}
|
||||
}
|
||||
//Report Button
|
||||
if(mx > 150 && mx < 150+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready && !queue_open) {
|
||||
fillrect(vid_buf, 150, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
|
||||
if(b && !bq) {
|
||||
//Button Clicked
|
||||
if(report_ui(vid_buf, save_id)){
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
|
||||
info_box(vid_buf, "Adding to favourites...");
|
||||
execute_fav(vid_buf, save_id);
|
||||
}
|
||||
}
|
||||
//Delete Button
|
||||
if(mx > 200 && mx < 200+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && (authoritah || myown) && !queue_open) {
|
||||
fillrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
|
||||
if(b && !bq) {
|
||||
//Button Clicked
|
||||
if(myown || !info->publish){
|
||||
if(confirm_ui(vid_buf, "Are you sure you wish to delete this?", "You will not be able recover it.", "Delete")){
|
||||
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
|
||||
info_box(vid_buf, "Deleting...");
|
||||
if(execute_delete(vid_buf, save_id)){
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(confirm_ui(vid_buf, "Are you sure?", "This save will be removed from the search index.", "Remove")){
|
||||
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
|
||||
info_box(vid_buf, "Removing...");
|
||||
if(execute_delete(vid_buf, save_id)){
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Open in browser button
|
||||
if(mx > 250 && mx < 250+107 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && !queue_open) {
|
||||
//Report Button
|
||||
if(mx > 150 && mx < 150+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready && !queue_open) {
|
||||
fillrect(vid_buf, 150, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
|
||||
if(b && !bq) {
|
||||
//Button Clicked
|
||||
if(report_ui(vid_buf, save_id)) {
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Delete Button
|
||||
if(mx > 200 && mx < 200+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && (authoritah || myown) && !queue_open) {
|
||||
fillrect(vid_buf, 200, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
|
||||
if(b && !bq) {
|
||||
//Button Clicked
|
||||
if(myown || !info->publish) {
|
||||
if(confirm_ui(vid_buf, "Are you sure you wish to delete this?", "You will not be able recover it.", "Delete")) {
|
||||
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
|
||||
info_box(vid_buf, "Deleting...");
|
||||
if(execute_delete(vid_buf, save_id)) {
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(confirm_ui(vid_buf, "Are you sure?", "This save will be removed from the search index.", "Remove")) {
|
||||
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
|
||||
info_box(vid_buf, "Removing...");
|
||||
if(execute_delete(vid_buf, save_id)) {
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Open in browser button
|
||||
if(mx > 250 && mx < 250+107 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && !queue_open) {
|
||||
fillrect(vid_buf, 250, YRES+MENUSIZE-68, 107, 18, 255, 255, 255, 40);
|
||||
if(b && !bq) {
|
||||
//Button Clicked
|
||||
//TODO: Open link
|
||||
o_uri = malloc(7+strlen(SERVER)+41+strlen(save_id)*3);
|
||||
strcpy(o_uri, "http://" SERVER "/Browse/View.html?ID=");
|
||||
strcaturl(o_uri, save_id);
|
||||
open_link(o_uri);
|
||||
free(o_uri);
|
||||
//Button Clicked
|
||||
//TODO: Open link
|
||||
o_uri = malloc(7+strlen(SERVER)+41+strlen(save_id)*3);
|
||||
strcpy(o_uri, "http://" SERVER "/Browse/View.html?ID=");
|
||||
strcaturl(o_uri, save_id);
|
||||
open_link(o_uri);
|
||||
free(o_uri);
|
||||
}
|
||||
}
|
||||
//Submit Button
|
||||
if(mx > XRES+BARSIZE-100 && mx < XRES+BARSIZE-100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready && !queue_open) {
|
||||
fillrect(vid_buf, XRES+BARSIZE-100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
|
||||
if(b && !bq) {
|
||||
//Button Clicked
|
||||
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
|
||||
info_box(vid_buf, "Submitting Comment...");
|
||||
execute_submit(vid_buf, save_id, ed.str);
|
||||
ed.str[0] = 0;
|
||||
}
|
||||
}
|
||||
if(!(mx>50 && my>50 && mx<XRES+BARSIZE-50 && my<YRES+MENUSIZE-50) && b && !queue_open){
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
//Submit Button
|
||||
if(mx > XRES+BARSIZE-100 && mx < XRES+BARSIZE-100+50 && my > YRES+MENUSIZE-68 && my < YRES+MENUSIZE-50 && svf_login && info_ready && !queue_open) {
|
||||
fillrect(vid_buf, XRES+BARSIZE-100, YRES+MENUSIZE-68, 50, 18, 255, 255, 255, 40);
|
||||
if(b && !bq) {
|
||||
//Button Clicked
|
||||
fillrect(vid_buf, -1, -1, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, 192);
|
||||
info_box(vid_buf, "Submitting Comment...");
|
||||
execute_submit(vid_buf, save_id, ed.str);
|
||||
ed.str[0] = 0;
|
||||
}
|
||||
}
|
||||
if(!(mx>50 && my>50 && mx<XRES+BARSIZE-50 && my<YRES+MENUSIZE-50) && b && !queue_open) {
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(queue_open) {
|
||||
if(info_ready && data_ready) {
|
||||
@ -3026,34 +3026,34 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
|
||||
drawtext(vid_buf, 50+(XRES/4)-textwidth("Loading...")/2, 50+(YRES/4), "Loading...", 255, 255, 255, 128);
|
||||
}
|
||||
}
|
||||
if(!info_ready || !data_ready){
|
||||
info_box(vid_buf, "Loading");
|
||||
}
|
||||
if(!info_ready || !data_ready) {
|
||||
info_box(vid_buf, "Loading");
|
||||
}
|
||||
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
|
||||
memcpy(vid_buf, old_vid, ((XRES+BARSIZE)*(YRES+MENUSIZE))*PIXELSIZE);
|
||||
if(info_ready && svf_login){
|
||||
ui_edit_process(mx, my, b, &ed);
|
||||
}
|
||||
if(info_ready && svf_login) {
|
||||
ui_edit_process(mx, my, b, &ed);
|
||||
}
|
||||
|
||||
if(sdl_key==SDLK_ESCAPE){
|
||||
retval = 0;
|
||||
if(sdl_key==SDLK_ESCAPE) {
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(lasttime<TIMEOUT)
|
||||
lasttime++;
|
||||
}
|
||||
//Prevent those mouse clicks being passed down.
|
||||
while(!sdl_poll())
|
||||
//Prevent those mouse clicks being passed down.
|
||||
while(!sdl_poll())
|
||||
{
|
||||
b = SDL_GetMouseState(&mx, &my);
|
||||
if(!b)
|
||||
break;
|
||||
}
|
||||
//Close open connections
|
||||
if(http)
|
||||
//Close open connections
|
||||
if(http)
|
||||
http_async_req_close(http);
|
||||
if(http_2)
|
||||
if(http_2)
|
||||
http_async_req_close(http_2);
|
||||
return retval;
|
||||
}
|
||||
@ -3594,7 +3594,7 @@ int execute_delete(pixel *vid_buf, char *id)
|
||||
|
||||
if(result)
|
||||
free(result);
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void execute_submit(pixel *vid_buf, char *id, char *message)
|
||||
@ -3665,7 +3665,7 @@ int execute_report(pixel *vid_buf, char *id, char *reason)
|
||||
|
||||
if(result)
|
||||
free(result);
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void execute_fav(pixel *vid_buf, char *id)
|
||||
@ -3737,30 +3737,30 @@ int execute_vote(pixel *vid_buf, char *id, char *action)
|
||||
free(result);
|
||||
return 1;
|
||||
}
|
||||
void open_link(char *uri){
|
||||
void open_link(char *uri) {
|
||||
#ifdef WIN32
|
||||
ShellExecute(0, "OPEN", uri, NULL, NULL, 0);
|
||||
ShellExecute(0, "OPEN", uri, NULL, NULL, 0);
|
||||
#elif MACOSX
|
||||
//char *cmd[] = { "open", uri, (char *)0 };
|
||||
//execvp("open", cmd);
|
||||
//LSOpenCFURLRef(CFURLCreateWithString(NULL, CFStringCreateWithCString(NULL, uri, 0) ,NULL), NULL); //TODO: Get this crap working
|
||||
char *cmd = malloc(7+strlen(uri));
|
||||
strcpy(cmd, "open ");
|
||||
strappend(cmd, uri);
|
||||
system(cmd);
|
||||
//char *cmd[] = { "open", uri, (char *)0 };
|
||||
//execvp("open", cmd);
|
||||
//LSOpenCFURLRef(CFURLCreateWithString(NULL, CFStringCreateWithCString(NULL, uri, 0) ,NULL), NULL); //TODO: Get this crap working
|
||||
char *cmd = malloc(7+strlen(uri));
|
||||
strcpy(cmd, "open ");
|
||||
strappend(cmd, uri);
|
||||
system(cmd);
|
||||
#elif LIN32
|
||||
//execlp("xdg-open", "xdg-open", uri, (char *)0);
|
||||
char *cmd = malloc(11+strlen(uri));
|
||||
strcpy(cmd, "xdg-open ");
|
||||
strappend(cmd, uri);
|
||||
system(cmd);
|
||||
//execlp("xdg-open", "xdg-open", uri, (char *)0);
|
||||
char *cmd = malloc(11+strlen(uri));
|
||||
strcpy(cmd, "xdg-open ");
|
||||
strappend(cmd, uri);
|
||||
system(cmd);
|
||||
#elif LIN64
|
||||
//execlp("xdg-open", "xdg-open", uri, (char *)0);
|
||||
char *cmd = malloc(11+strlen(uri));
|
||||
strcpy(cmd, "xdg-open ");
|
||||
strappend(cmd, uri);
|
||||
system(cmd);
|
||||
//execlp("xdg-open", "xdg-open", uri, (char *)0);
|
||||
char *cmd = malloc(11+strlen(uri));
|
||||
strcpy(cmd, "xdg-open ");
|
||||
strappend(cmd, uri);
|
||||
system(cmd);
|
||||
#else
|
||||
printf("Cannot open browser\n");
|
||||
printf("Cannot open browser\n");
|
||||
#endif
|
||||
}
|
||||
|
476
src/main.c
476
src/main.c
@ -75,7 +75,7 @@ static const char *it_msg =
|
||||
"\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 cracker64\n"
|
||||
"\bgCopyright (c) 2010 Bryan Hoyle (New elements)\n"
|
||||
"\bgCopyright (c) 2010 Nathan Cousins (New elements, small engine mods.)\n"
|
||||
"\n"
|
||||
@ -307,24 +307,24 @@ 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){
|
||||
//Everybody loves a 16bit int
|
||||
if(i) {
|
||||
//Everybody loves a 16bit int
|
||||
//d[p++] = (parts[i-1].life+3)/4;
|
||||
int ttlife = (int)parts[i-1].life;
|
||||
int ttlife = (int)parts[i-1].life;
|
||||
d[p++] = ((ttlife&0xFF00)>>8);
|
||||
d[p++] = (ttlife&0x00FF);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(j=0; j<w*h; j++)
|
||||
for(j=0; j<w*h; j++)
|
||||
{
|
||||
i = m[j];
|
||||
if(i){
|
||||
//Now saving tmp!
|
||||
if(i) {
|
||||
//Now saving tmp!
|
||||
//d[p++] = (parts[i-1].life+3)/4;
|
||||
int tttmp = (int)parts[i-1].tmp;
|
||||
int tttmp = (int)parts[i-1].tmp;
|
||||
d[p++] = ((tttmp&0xFF00)>>8);
|
||||
d[p++] = (tttmp&0x00FF);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(j=0; j<w*h; j++)
|
||||
{
|
||||
@ -427,18 +427,18 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ver>=44){
|
||||
legacy_enable = c[3]&0x01;
|
||||
if(!sys_pause){
|
||||
sys_pause = (c[3]>>1)&0x01;
|
||||
}
|
||||
} else {
|
||||
if(c[3]==1||c[3]==0){
|
||||
legacy_enable = c[3];
|
||||
} else {
|
||||
legacy_beta = 1;
|
||||
}
|
||||
}
|
||||
if(ver>=44) {
|
||||
legacy_enable = c[3]&0x01;
|
||||
if(!sys_pause) {
|
||||
sys_pause = (c[3]>>1)&0x01;
|
||||
}
|
||||
} else {
|
||||
if(c[3]==1||c[3]==0) {
|
||||
legacy_enable = c[3];
|
||||
} else {
|
||||
legacy_beta = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bw = c[6];
|
||||
@ -504,35 +504,35 @@ 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;
|
||||
}
|
||||
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++;
|
||||
}
|
||||
@ -566,7 +566,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;
|
||||
gol[x][y]=0;
|
||||
if(j)// && !(isplayer == 1 && j==PT_STKM))
|
||||
{
|
||||
if(pmap[y][x])
|
||||
@ -582,10 +582,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_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;
|
||||
@ -636,7 +636,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
|
||||
player[18] = parts[i].y+12;
|
||||
|
||||
}
|
||||
if(parts[i].type == PT_STKM2)
|
||||
if(parts[i].type == PT_STKM2)
|
||||
{
|
||||
//player[2] = PT_DUST;
|
||||
|
||||
@ -671,46 +671,46 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
|
||||
i = m[j];
|
||||
if(i)
|
||||
{
|
||||
if(ver>=44){
|
||||
if(p >= size) {
|
||||
goto corrupt;
|
||||
}
|
||||
if(i <= NPART) {
|
||||
ttv = (d[p++])<<8;
|
||||
ttv |= (d[p++]);
|
||||
parts[i-1].life = ttv;
|
||||
} else {
|
||||
p+=2;
|
||||
}
|
||||
} else {
|
||||
if(p >= size)
|
||||
goto corrupt;
|
||||
if(i <= NPART)
|
||||
parts[i-1].life = d[p++]*4;
|
||||
else
|
||||
p++;
|
||||
}
|
||||
if(ver>=44) {
|
||||
if(p >= size) {
|
||||
goto corrupt;
|
||||
}
|
||||
if(i <= NPART) {
|
||||
ttv = (d[p++])<<8;
|
||||
ttv |= (d[p++]);
|
||||
parts[i-1].life = ttv;
|
||||
} else {
|
||||
p+=2;
|
||||
}
|
||||
} else {
|
||||
if(p >= size)
|
||||
goto corrupt;
|
||||
if(i <= NPART)
|
||||
parts[i-1].life = d[p++]*4;
|
||||
else
|
||||
p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ver>=44) {
|
||||
for(j=0; j<w*h; j++)
|
||||
{
|
||||
i = m[j];
|
||||
if(i)
|
||||
{
|
||||
if(p >= size) {
|
||||
goto corrupt;
|
||||
}
|
||||
if(i <= NPART) {
|
||||
ttv = (d[p++])<<8;
|
||||
ttv |= (d[p++]);
|
||||
parts[i-1].tmp = ttv;
|
||||
} else {
|
||||
p+=2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ver>=44){
|
||||
for(j=0; j<w*h; j++)
|
||||
{
|
||||
i = m[j];
|
||||
if(i)
|
||||
{
|
||||
if(p >= size) {
|
||||
goto corrupt;
|
||||
}
|
||||
if(i <= NPART) {
|
||||
ttv = (d[p++])<<8;
|
||||
ttv |= (d[p++]);
|
||||
parts[i-1].tmp = ttv;
|
||||
} else {
|
||||
p+=2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(j=0; j<w*h; j++)
|
||||
{
|
||||
i = m[j];
|
||||
@ -1097,7 +1097,7 @@ int main(int argc, char *argv[])
|
||||
int pastFPS = 0;
|
||||
int past = 0;
|
||||
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;
|
||||
char *ver_data=NULL, *tmp;
|
||||
int i, j, bq, fire_fc=0, do_check=0, old_version=0, http_ret=0, major, minor, old_ver_len;
|
||||
@ -1232,7 +1232,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if(!sys_pause||framerender)
|
||||
{
|
||||
update_air();
|
||||
update_air();
|
||||
}
|
||||
#ifdef OpenGL
|
||||
ClearScreen();
|
||||
@ -1251,17 +1251,17 @@ int main(int argc, char *argv[])
|
||||
memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||
}
|
||||
#endif
|
||||
|
||||
//Can't be too sure...
|
||||
if(bsx>1180)
|
||||
bsx = 1180;
|
||||
if(bsx<0)
|
||||
bsx = 0;
|
||||
if(bsy>1180)
|
||||
bsy = 1180;
|
||||
if(bsy<0)
|
||||
bsy = 0;
|
||||
|
||||
|
||||
//Can't be too sure...
|
||||
if(bsx>1180)
|
||||
bsx = 1180;
|
||||
if(bsx<0)
|
||||
bsx = 0;
|
||||
if(bsy>1180)
|
||||
bsy = 1180;
|
||||
if(bsy<0)
|
||||
bsy = 0;
|
||||
|
||||
update_particles(vid_buf);
|
||||
draw_parts(vid_buf);
|
||||
|
||||
@ -1391,22 +1391,22 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
set_cmode(CM_FANCY);
|
||||
}
|
||||
if(sdl_key=='8')
|
||||
if(sdl_key=='8')
|
||||
{
|
||||
set_cmode(CM_NOTHING);
|
||||
}
|
||||
if(sdl_key=='9')
|
||||
if(sdl_key=='9')
|
||||
{
|
||||
set_cmode(CM_GRAD);
|
||||
}
|
||||
if(sdl_key=='0')
|
||||
if(sdl_key=='0')
|
||||
{
|
||||
set_cmode(CM_CRACK);
|
||||
}
|
||||
if(sdl_key==SDLK_TAB)
|
||||
{
|
||||
CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ;
|
||||
}
|
||||
if(sdl_key==SDLK_TAB)
|
||||
{
|
||||
CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ;
|
||||
}
|
||||
if(sdl_key==SDLK_LEFTBRACKET) {
|
||||
if(sdl_zoom_trig==1)
|
||||
{
|
||||
@ -1420,30 +1420,30 @@ int main(int argc, char *argv[])
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
{
|
||||
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
|
||||
{
|
||||
{
|
||||
bsx -= ceil((bsx/5)+0.5f);
|
||||
bsy -= ceil((bsy/5)+0.5f);
|
||||
}
|
||||
bsy -= ceil((bsy/5)+0.5f);
|
||||
}
|
||||
if(bsx>1180)
|
||||
bsx = 1180;
|
||||
if(bsy>1180)
|
||||
if(bsy>1180)
|
||||
bsy = 1180;
|
||||
if(bsx<0)
|
||||
bsx = 0;
|
||||
if(bsy<0)
|
||||
if(bsy<0)
|
||||
bsy = 0;
|
||||
}
|
||||
}
|
||||
@ -1460,58 +1460,58 @@ int main(int argc, char *argv[])
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
{
|
||||
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
|
||||
{
|
||||
{
|
||||
bsx += ceil((bsx/5)+0.5f);
|
||||
bsy += ceil((bsy/5)+0.5f);
|
||||
}
|
||||
bsy += ceil((bsy/5)+0.5f);
|
||||
}
|
||||
if(bsx>1180)
|
||||
bsx = 1180;
|
||||
if(bsy>1180)
|
||||
if(bsy>1180)
|
||||
bsy = 1180;
|
||||
if(bsx<0)
|
||||
bsx = 0;
|
||||
if(bsy<0)
|
||||
if(bsy<0)
|
||||
bsy = 0;
|
||||
}
|
||||
}
|
||||
if(sdl_key=='d'&&(sdl_mod & (KMOD_CTRL)))
|
||||
DEBUG_MODE = !DEBUG_MODE;
|
||||
if(sdl_key=='i')
|
||||
{
|
||||
int nx, ny;
|
||||
for(nx = 0;nx<XRES/CELL;nx++)
|
||||
for(ny = 0;ny<YRES/CELL;ny++)
|
||||
{
|
||||
pv[ny][nx] = -pv[ny][nx];
|
||||
vx[ny][nx] = -vx[ny][nx];
|
||||
vy[ny][nx] = -vy[ny][nx];
|
||||
}
|
||||
}
|
||||
if((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT)))
|
||||
active_menu = 11;
|
||||
if(sdl_key==SDLK_INSERT || sdl_key==SDLK_BACKQUOTE)
|
||||
REPLACE_MODE = !REPLACE_MODE;
|
||||
if(sdl_key=='g')
|
||||
{
|
||||
if(sdl_mod & (KMOD_SHIFT))
|
||||
GRID_MODE = (GRID_MODE+9)%10;
|
||||
else
|
||||
GRID_MODE = (GRID_MODE+1)%10;
|
||||
}
|
||||
if(sdl_key=='t')
|
||||
if(sdl_key=='d'&&(sdl_mod & (KMOD_CTRL)))
|
||||
DEBUG_MODE = !DEBUG_MODE;
|
||||
if(sdl_key=='i')
|
||||
{
|
||||
int nx, ny;
|
||||
for(nx = 0; nx<XRES/CELL; nx++)
|
||||
for(ny = 0; ny<YRES/CELL; ny++)
|
||||
{
|
||||
pv[ny][nx] = -pv[ny][nx];
|
||||
vx[ny][nx] = -vx[ny][nx];
|
||||
vy[ny][nx] = -vy[ny][nx];
|
||||
}
|
||||
}
|
||||
if((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT)))
|
||||
active_menu = 11;
|
||||
if(sdl_key==SDLK_INSERT || sdl_key==SDLK_BACKQUOTE)
|
||||
REPLACE_MODE = !REPLACE_MODE;
|
||||
if(sdl_key=='g')
|
||||
{
|
||||
if(sdl_mod & (KMOD_SHIFT))
|
||||
GRID_MODE = (GRID_MODE+9)%10;
|
||||
else
|
||||
GRID_MODE = (GRID_MODE+1)%10;
|
||||
}
|
||||
if(sdl_key=='t')
|
||||
VINE_MODE = !VINE_MODE;
|
||||
if(sdl_key==SDLK_SPACE)
|
||||
sys_pause = !sys_pause;
|
||||
@ -1536,18 +1536,18 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
if(sdl_key=='r'&&(sdl_mod & (KMOD_CTRL))&&(sdl_mod & (KMOD_SHIFT)))
|
||||
if(sdl_key=='r'&&(sdl_mod & (KMOD_CTRL))&&(sdl_mod & (KMOD_SHIFT)))
|
||||
{
|
||||
save_mode = 1;
|
||||
copy_mode = 4;//invert
|
||||
}
|
||||
else if(sdl_key=='r'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
|
||||
else if(sdl_key=='r'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
|
||||
{
|
||||
save_mode = 1;
|
||||
copy_mode = 3;//rotate
|
||||
}
|
||||
else if(sdl_key=='r')
|
||||
GENERATION = 0;
|
||||
else if(sdl_key=='r')
|
||||
GENERATION = 0;
|
||||
if(sdl_key=='x'&&(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)))
|
||||
{
|
||||
save_mode = 1;
|
||||
@ -1606,24 +1606,24 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
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(!(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)
|
||||
if(bsy>1180)
|
||||
bsy = 1180;
|
||||
if(bsy<0)
|
||||
bsy = 0;
|
||||
@ -1670,15 +1670,15 @@ int main(int argc, char *argv[])
|
||||
#ifdef BETA
|
||||
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
|
||||
#else
|
||||
if(DEBUG_MODE)
|
||||
if(DEBUG_MODE)
|
||||
{
|
||||
int tctype = parts[cr>>8].ctype;
|
||||
if(tctype>=PT_NUM)
|
||||
tctype = 0;
|
||||
sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %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);
|
||||
//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 {
|
||||
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 (%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 {
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -1904,22 +1904,22 @@ int main(int argc, char *argv[])
|
||||
copy_mode = 0;
|
||||
clear_area(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL);
|
||||
}
|
||||
else if(copy_mode==3)//rotation
|
||||
else if(copy_mode==3)//rotation
|
||||
{
|
||||
if(save_h>save_w)
|
||||
save_w = save_h;
|
||||
rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL,0);//just do squares for now
|
||||
save_mode = 0;
|
||||
copy_mode = 0;
|
||||
}
|
||||
else if(copy_mode==4)//invertion
|
||||
if(save_h>save_w)
|
||||
save_w = save_h;
|
||||
rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL,0);//just do squares for now
|
||||
save_mode = 0;
|
||||
copy_mode = 0;
|
||||
}
|
||||
else if(copy_mode==4)//invertion
|
||||
{
|
||||
if(save_h>save_w)
|
||||
save_w = save_h;
|
||||
rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL,1);//just do squares for now
|
||||
save_mode = 0;
|
||||
copy_mode = 0;
|
||||
}
|
||||
if(save_h>save_w)
|
||||
save_w = save_h;
|
||||
rotate_area(save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL,1);//just do squares for now
|
||||
save_mode = 0;
|
||||
copy_mode = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
stamp_save(save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL);
|
||||
@ -2033,11 +2033,11 @@ int main(int argc, char *argv[])
|
||||
memset(fire_g, 0, sizeof(fire_g));
|
||||
memset(fire_b, 0, sizeof(fire_b));
|
||||
}
|
||||
if(x>=19 && x<=35 && svf_last && svf_open && !bq){
|
||||
//int tpval = sys_pause;
|
||||
parse_save(svf_last, svf_lsize, 1, 0, 0);
|
||||
//sys_pause = tpval;
|
||||
}
|
||||
if(x>=19 && x<=35 && svf_last && svf_open && !bq) {
|
||||
//int tpval = sys_pause;
|
||||
parse_save(svf_last, svf_lsize, 1, 0, 0);
|
||||
//sys_pause = tpval;
|
||||
}
|
||||
if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq)
|
||||
{
|
||||
if(b & SDL_BUTTON_LMASK)
|
||||
@ -2112,8 +2112,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if((sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)) && (sdl_mod & (KMOD_LSHIFT|KMOD_RSHIFT)) && !(sdl_mod & (KMOD_LALT)))
|
||||
{
|
||||
if(sdl_mod & (KMOD_CAPS))
|
||||
c = 0;
|
||||
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;
|
||||
@ -2200,14 +2200,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
if(save_mode)
|
||||
{
|
||||
if(copy_mode==3||copy_mode==4)//special drawing for rotate, can remove once it can do rectangles
|
||||
{
|
||||
if(save_h>save_w)
|
||||
save_w = save_h;
|
||||
xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL);
|
||||
}
|
||||
else
|
||||
xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL);
|
||||
if(copy_mode==3||copy_mode==4)//special drawing for rotate, can remove once it can do rectangles
|
||||
{
|
||||
if(save_h>save_w)
|
||||
save_w = save_h;
|
||||
xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_w*CELL);
|
||||
}
|
||||
else
|
||||
xor_rect(vid_buf, save_x*CELL, save_y*CELL, save_w*CELL, save_h*CELL);
|
||||
da = 51;
|
||||
db = 269;
|
||||
}
|
||||
@ -2331,22 +2331,22 @@ int main(int argc, char *argv[])
|
||||
FPS = 0;
|
||||
pastFPS = currentTime;
|
||||
}
|
||||
|
||||
|
||||
#ifdef BETA
|
||||
sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS);
|
||||
sprintf(uitext, "Version %d Beta %d FPS:%d Parts:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS);
|
||||
#else
|
||||
if(DEBUG_MODE)
|
||||
sprintf(uitext, "Version %d.%d FPS:%d Parts:%d Generation:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS,GENERATION);
|
||||
else
|
||||
sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPSB);
|
||||
if(DEBUG_MODE)
|
||||
sprintf(uitext, "Version %d.%d FPS:%d Parts:%d Generation:%d", SAVE_VERSION, MINOR_VERSION, FPSB, NUM_PARTS,GENERATION);
|
||||
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(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)
|
||||
@ -2378,7 +2378,7 @@ int main(int argc, char *argv[])
|
||||
else
|
||||
player[2] = PT_DUST;
|
||||
}
|
||||
if(isplayer2==0)
|
||||
if(isplayer2==0)
|
||||
{
|
||||
if(ptypes[sr].falldown>0 || sr == PT_NEUT || sr == PT_PHOT)
|
||||
player2[2] = sr;
|
||||
|
3165
src/powder.c
3165
src/powder.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user