Made the lights editor more useful/usable.

tints for terrain, nicer save+load commands.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4159 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2012-12-04 18:19:20 +00:00
parent 472710d177
commit 52bacf161b
6 changed files with 411 additions and 312 deletions

View file

@ -32,6 +32,7 @@ static camdata_t *camdata;
static var float splinefile = -1; static var float splinefile = -1;
static var int edit_type = 0; static var int edit_type = 0;
static vector submenu_position; static vector submenu_position;
static var float autocvar_cl_demospeed = 1;
void(int *dest, int bytes) memclr = void(int *dest, int bytes) memclr =
{ {
@ -45,10 +46,17 @@ void(int *dest, int bytes) memclr =
void() spline_init = void() spline_init =
{ {
string camfilename;
if (isdemo())
camfilename = serverkey("ip"); //this always contains the name of the demo rather than the original ip, which is not known.
else
camfilename = mapname; //otherwise just use the current map (though really we should just disable this)
camfilename = strcat(camfilename, ".cam");
/*precache the shader*/ /*precache the shader*/
shaderforname("camsplineshader", "{\n{\nmap construction.tga\nblendfunc blend\nrgbgen vertex\nalphagen vertex\n}\n}\n"); shaderforname("camsplineshader", "{\n{\nmap construction.tga\nblendfunc blend\nrgbgen vertex\nalphagen vertex\n}\n}\n");
splinefile = fopen("spline.dat", FILE_MMAP_RW, sizeof(camdata_t)); splinefile = fopen(camfilename, FILE_MMAP_RW, sizeof(camdata_t));
if (splinefile < 0) if (splinefile < 0)
{ {
/*too lazy to create a file, just use it as a malloc*/ /*too lazy to create a file, just use it as a malloc*/
@ -62,7 +70,7 @@ void() spline_init =
if (camdata->ver != VER) if (camdata->ver != VER)
{ {
print("spline.dat version is outdated, wiping.\n"); print(sprintf("%s version is outdated, wiping.\n", camfilename));
memclr ((int*)camdata, sizeof(camdata_t)); memclr ((int*)camdata, sizeof(camdata_t));
camdata->ver = VER; camdata->ver = VER;
} }
@ -88,7 +96,7 @@ static vector(spline_t *s, float frac) spline_pos =
vector v1, v2; vector v1, v2;
if (s->numpoints < 2) if (s->numpoints < 2)
{ {
return; return '0 0 0';
} }
frac *= s->numpoints; frac *= s->numpoints;
if (frac < 0) if (frac < 0)
@ -499,7 +507,7 @@ float slidertestfloat1, slidertestfloat2, slidertestfloat3;
static float *curslider; static float *curslider;
static menu_t menu; static menu_t menu;
int (vector *curmousepos, vector mousediff, float key) submenu = void (vector *curmousepos, vector mousediff, float key) submenu =
{ {
local vector pos, cpos; local vector pos, cpos;
local spline_t *s; local spline_t *s;
@ -623,7 +631,7 @@ int (vector *curmousepos, vector mousediff, float key) submenu =
menu->flags = MF_DS_VALUE; menu->flags = MF_DS_VALUE;
point1 = '0 0 0'; // << problem with using a global value identifier i cant reuse point point1 = '0 0 0'; // << problem with using a global value identifier i cant reuse point
str = "move spline: "; str = "move spline: ";
drawstring(pos, str, '8 8 0', '1 1 1', 1); drawrawstring(pos, str, '8 8 0', '1 1 1', 1);
pos_y += 8; pos_y += 8;
sliderf_fixed_widgit(&menu, " x:", pos, &point1_x); pos_y += 8; sliderf_fixed_widgit(&menu, " x:", pos, &point1_x); pos_y += 8;
sliderf_fixed_widgit(&menu, " y:", pos, &point1_y); pos_y += 8; sliderf_fixed_widgit(&menu, " y:", pos, &point1_y); pos_y += 8;
@ -632,7 +640,7 @@ int (vector *curmousepos, vector mousediff, float key) submenu =
menu->flags = 0; menu->flags = 0;
} }
drawrawstring(pos, sprintf("isdemo: %f", isdemo()), '8 8 0', '1 1 1', 1); // drawrawstring(pos, sprintf("isdemo: %f", isdemo()), '8 8 0', '1 1 1', 1);
} }
int (vector *curmousepos, vector mousediff, float key) testmenu = int (vector *curmousepos, vector mousediff, float key) testmenu =
@ -660,6 +668,7 @@ int (vector *curmousepos, vector mousediff) editor_spline_overlay =
local spline_t *s; local spline_t *s;
local int ri; local int ri;
local string str; local string str;
float min, sec;
if (splinefile < 0) if (splinefile < 0)
spline_init(); spline_init();
@ -688,6 +697,17 @@ int (vector *curmousepos, vector mousediff) editor_spline_overlay =
menu->flags = MF_DS_VALUE; menu->flags = MF_DS_VALUE;
checkboxi_widgit(&menu, "", v, &edit_type); checkboxi_widgit(&menu, "", v, &edit_type);
v_x = 0;
v_y += 8;
sliderf_widgit(&menu, "demo speed", v, &autocvar_cl_demospeed, 0, 1);
cvar_set("cl_demospeed", ftos(autocvar_cl_demospeed));
v_y += 8;
sec = time;
min = floor(sec/60);
sec -= min*60;
drawrawstring(v, sprintf("time: %g:%02.0f", min, sec), '8 8 0', '1 1 1', 1);
submenu_position = pos + '0 8'; submenu_position = pos + '0 8';
submenu(curmousepos, mousediff, -1); submenu(curmousepos, mousediff, -1);

View file

@ -1,7 +1,3 @@
float autocvar_ca_show;
float autocvar_ca_editormode;
string autocvar_ca_colourtint;
enum enum
{ {
MODE_INITIAL=0, MODE_INITIAL=0,
@ -12,6 +8,10 @@ enum
MODE_PARTICLEEDIT=4, MODE_PARTICLEEDIT=4,
}; };
float autocvar_ca_show;
var float autocvar_ca_editormode = MODE_LIGHTEDIT;
string autocvar_ca_colourtint;
var vector vidsize = '640 480 0'; var vector vidsize = '640 480 0';
vector curmousepos; vector curmousepos;
vector mousediff; vector mousediff;
@ -405,3 +405,9 @@ void(float prevprogs) init =
externset(0, wrap_InputEvent, "CSQC_InputEvent"); externset(0, wrap_InputEvent, "CSQC_InputEvent");
} }
}; };
void() CSQC_Shutdown =
{
spline_shutdown();
};

View file

@ -275,14 +275,29 @@ float gamespeed;
#define LFLAG_NOSHADOWS 256 #define LFLAG_NOSHADOWS 256
#define LFLAG_SHADOWMAP 512 #define LFLAG_SHADOWMAP 512
#define LFLAG_CREPUSCULAR 1024 #define LFLAG_CREPUSCULAR 1024
void(vector) makevectors = #1; #define TEREDIT_RELOAD 0
#define TEREDIT_SAVE 1
#define TEREDIT_SETHOLE 2
#define TEREDIT_HEIGHT_SET 3
#define TEREDIT_HEIGHT_SMOOTH 4
#define TEREDIT_HEIGHT_SPREAD 5
#define TEREDIT_HEIGHT_RAISE 6
#define TEREDIT_HEIGHT_FLATTEN 18
#define TEREDIT_HEIGHT_LOWER 7
#define TEREDIT_TEX_KILL 8
#define TEREDIT_TEX_GET 9
#define TEREDIT_MIX_PAINT 10
#define TEREDIT_MIX_UNIFY 11
#define TEREDIT_MIX_NOISE 12
#define TEREDIT_MIX_BLUR 13
#define TEREDIT_WATER_SET 14
#define TEREDIT_MESH_ADD 15
#define TEREDIT_MESH_KILL 16
#define TEREDIT_TINT 17
void(vector vang) makevectors = #1;
void(entity e, vector o) setorigin = #2; void(entity e, vector o) setorigin = #2;
void(entity e, string m) setmodel = #3; void(entity e, string m) setmodel = #3;
void(entity e, vector min, vector max) setsize = #4; void(entity e, vector min, vector max) setsize = #4;
#ifdef SSQC
void(float style, float val) lightstylestatic = #5;
void() break = #6;
#endif
float() random = #7; float() random = #7;
void(entity e, float chan, string samp, float vol, float atten, optional float speedpct, optional float flags) sound = #8; void(entity e, float chan, string samp, float vol, float atten, optional float speedpct, optional float flags) sound = #8;
vector(vector v) normalize = #9; vector(vector v) normalize = #9;
@ -293,20 +308,10 @@ float(vector v) vectoyaw = #13;
entity() spawn = #14; entity() spawn = #14;
void(entity e) remove = #15; void(entity e) remove = #15;
void(vector v1, vector v2, float nomonsters, entity ent) traceline = #16; void(vector v1, vector v2, float nomonsters, entity ent) traceline = #16;
#ifdef SSQC
entity() checkclient = #17;
#endif
entity(entity start, .string fld, string match) find = #18; entity(entity start, .string fld, string match) find = #18;
void(string s) precache_sound = #19; void(string s) precache_sound = #19;
void(string s) precache_model = #20; void(string s) precache_model = #20;
#ifdef SSQC
void(entity client, string s) stuffcmd = #21;
#endif
entity(vector org, float rad) findradius = #22; entity(vector org, float rad) findradius = #22;
#ifdef SSQC
void(string s) bprint = #23;
void(entity client, string s) sprint = #24;
#endif
void(string s, ...) dprint = #25; void(string s, ...) dprint = #25;
string(float val) ftos = #26; string(float val) ftos = #26;
string(vector val) vtos = #27; string(vector val) vtos = #27;
@ -324,9 +329,6 @@ float(float) ceil = #38;
float(entity ent) checkbottom = #40; float(entity ent) checkbottom = #40;
float(vector pos) pointcontents = #41; float(vector pos) pointcontents = #41;
float(float) fabs = #43; float(float) fabs = #43;
#ifdef SSQC
vector(entity player, float missilespeed) aim = #44;
#endif
float(string) cvar = #45; float(string) cvar = #45;
void(string, ...) localcmd = #46; void(string, ...) localcmd = #46;
entity(entity) nextent = #47; entity(entity) nextent = #47;
@ -334,136 +336,77 @@ void(vector pos, vector dir, float colour, float count) particle = #48;
#define ChangeYaw changeyaw #define ChangeYaw changeyaw
void() changeyaw = #49; void() changeyaw = #49;
vector(vector fwd, optional vector up) vectoangles = #51; vector(vector fwd, optional vector up) vectoangles = #51;
#ifdef SSQC float(float angle) sin = #60; /* Part of DP_QC_SINCOSSQRTPOW*/
void(float to, float val) WriteByte = #52; float(float angle) cos = #61; /* Part of DP_QC_SINCOSSQRTPOW*/
void(float to, float val) WriteChar = #53; float(float value) sqrt = #62; /* Part of DP_QC_SINCOSSQRTPOW*/
void(float to, float val) WriteShort = #54; void(entity ent) changepitch = #63; /* Part of DP_QC_CHANGEPITCH*/
void(float to, float val) WriteLong = #55;
void(float to, float val) WriteCoord = #56;
void(float to, float val) WriteAngle = #57;
void(float to, string val) WriteString = #58;
void(float to, entity val) WriteEntity = #59;
#endif
float(float angle) sin = #60;
float(float angle) cos = #61;
float(float value) sqrt = #62;
void(entity ent) changepitch = #63;
void(entity ent, entity ignore) tracetoss = #64; void(entity ent, entity ignore) tracetoss = #64;
string(entity ent) etos = #65; string(entity ent) etos = #65; /* Part of DP_QC_ETOS*/
void(float step) movetogoal = #67; void(float step) movetogoal = #67;
#ifdef SSQC
void(string s) precache_file = #68;
#endif
void(entity e) makestatic = #69; void(entity e) makestatic = #69;
#ifdef SSQC
void(string mapname, optional string newmapstartspot) changelevel = #70;
#endif
void(string cvarname, string valuetoset) cvar_set = #72; void(string cvarname, string valuetoset) cvar_set = #72;
#ifdef SSQC
void(entity ent, string text, ...) centerprint = #73;
#endif
void (vector pos, string samp, float vol, float atten) ambientsound = #74; void (vector pos, string samp, float vol, float atten) ambientsound = #74;
void(string str) precache_model2 = #75; void(string str) precache_model2 = #75;
void(string str) precache_sound2 = #76; void(string str) precache_sound2 = #76;
#ifdef SSQC float(string) stof = #81; /* Part of FRIK_FILE, FTE_STRINGS, QW_ENGINE, ZQ_QC_STRINGS*/
void(string str) precache_file2 = #77; void(vector start, vector mins, vector maxs, vector end, float nomonsters, entity ent) tracebox = #90; /* Part of DP_QC_TRACEBOX*/
void() setspawnparms = #78; vector() randomvec = #91; /* Part of DP_QC_RANDOMVEC*/
void(entity killer, entity killee) logfrag = #79;
string(entity e, string key) infokey = #80;
#endif
float(string) stof = #81;
#ifdef SSQC
void(vector where, float set) multicast = #82;
#endif
void(vector start, vector mins, vector maxs, vector end, float nomonsters, entity ent) tracebox = #90;
vector() randomvec = #91;
vector(vector org) getlight = #92; vector(vector org) getlight = #92;
void(string cvarname, string defaultvalue) registercvar = #93; void(string cvarname, string defaultvalue) registercvar = #93; /* Part of DP_REGISTERCVAR*/
float(float a, float b, ...) min = #94; float(float a, float b, ...) min = #94; /* Part of DP_QC_MINMAXBOUND*/
float(float a, float b, ...) max = #95; float(float a, float b, ...) max = #95; /* Part of DP_QC_MINMAXBOUND*/
float(float minimum, float val, float maximum) bound = #96; float(float minimum, float val, float maximum) bound = #96; /* Part of DP_QC_MINMAXBOUND*/
float(float value, float exp) pow = #97; float(float value, float exp) pow = #97; /* Part of DP_QC_SINCOSSQRTPOW*/
entity(entity start, .float fld, float match) findfloat = #98; entity(entity start, .float fld, float match) findfloat = #98; /* Part of DP_QC_FINDFLOAT*/
float(string extname) checkextension = #99; float(string extname) checkextension = #99;
#ifdef SSQC float(string filename, float mode, optional float mmapminsize) fopen = #110; /* Part of FRIK_FILE*/
float(string builtinname) builtin_find = #100; void(float fhandle) fclose = #111; /* Part of FRIK_FILE*/
float(float value) anglemod = #102; string(float fhandle) fgets = #112; /* Part of FRIK_FILE*/
void(string slot, string picname, float x, float y, float zone, optional entity player) showpic = #104; void(float fhandle, string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7) fputs = #113; /* Part of FRIK_FILE*/
void(string slot, optional entity player) hidepic = #105; float(string s) strlen = #114; /* Part of FRIK_FILE, FTE_STRINGS, ZQ_QC_STRINGS*/
void(string slot, float x, float y, float zone, optional entity player) movepic = #106; string(string s1, optional string s2, ...) strcat = #115; /* Part of FRIK_FILE, FTE_STRINGS, ZQ_QC_STRINGS*/
void(string slot, string picname, optional entity player) changepic = #107; string(string s, float start, float length) substring = #116; /* Part of FRIK_FILE, FTE_STRINGS, ZQ_QC_STRINGS*/
#endif vector(string s) stov = #117; /* Part of FRIK_FILE, FTE_STRINGS, ZQ_QC_STRINGS*/
float(string filename, float mode, optional float mmapminsize) fopen = #110; string(string s) strzone = #118; /* Part of FRIK_FILE, FTE_STRINGS, ZQ_QC_STRINGS*/
void(float fhandle) fclose = #111; void(string s) strunzone = #119; /* Part of FRIK_FILE, FTE_STRINGS, ZQ_QC_STRINGS*/
string(float fhandle) fgets = #112;
void(float fhandle, string s) fputs = #113;
float(string s) strlen = #114;
string(string s1, optional string s2, ...) strcat = #115;
string(string s, float start, float length) substring = #116;
vector(string s) stov = #117;
string(string s) strzone = #118;
void(string s) strunzone = #119;
#ifdef SSQC
void(string cvar, float val) cvar_setf = #176;
#endif
float(string modelname, optional float queryonly) getmodelindex = #200; float(string modelname, optional float queryonly) getmodelindex = #200;
__variant(float prnum, string funcname, ...) externcall = #201; __variant(float prnum, string funcname, ...) externcall = #201; /* Part of FTE_MULTIPROGS*/
float(string progsname) addprogs = #202; float(string progsname) addprogs = #202; /* Part of FTE_MULTIPROGS*/
__variant(float prnum, string varname) externvalue = #203; __variant(float prnum, string varname) externvalue = #203; /* Part of FTE_MULTIPROGS*/
void(float prnum, __variant newval, string varname) externset = #204; void(float prnum, __variant newval, string varname) externset = #204; /* Part of FTE_MULTIPROGS*/
float(string input, string token) instr = #206; float(string input, string token) instr = #206; /* Part of FTE_MULTIPROGS*/
void(float portal, float state) openportal = #207; void(float portal, float state) openportal = #207;
#ifdef SSQC void(optional __variant ret) abort = #211; /* Part of FTE_MULTITHREADED*/
float(float attributes, string effectname, ...) RegisterTempEnt = #208; void(vector org, vector dmin, vector dmax, float colour, float effect, float count) particle2 = #215; /* Part of FTE_HEXEN2*/
void(float type, vector pos, ...) CustomTempEnt = #209; void(vector org, vector box, float colour, float effect, float count) particle3 = #216; /* Part of FTE_HEXEN2*/
float(optional float sleeptime) fork = #210; void(vector org, float radius, float colour, float effect, float count) particle4 = #217; /* Part of FTE_HEXEN2*/
#endif float(float number, float quantity) bitshift = #218; /* Part of EXT_BITSHIFT*/
void(optional __variant ret) abort = #211; void(vector pos) te_lightningblood = #219; /* Part of FTE_TE_STANDARDEFFECTBUILTINS*/
#ifdef SSQC float(string s1, string sub, optional float startidx) strstrofs = #221; /* Part of FTE_STRINGS*/
void(float sleeptime) sleep = #212; float(string str, float index) str2chr = #222; /* Part of FTE_STRINGS*/
void(entity player, string key, string value) forceinfokey = #213; string(float chr, ...) chr2str = #223; /* Part of FTE_STRINGS*/
void(string filename, float starttag, entity edict) chat = #214; string(float ccase, float redalpha, float redchars, string str, ...) strconv = #224; /* Part of FTE_STRINGS*/
#endif string(float pad, string str1, ...) strpad = #225; /* Part of FTE_STRINGS*/
void(vector org, vector dmin, vector dmax, float colour, float effect, float count) particle2 = #215; string(string old, string key, string value) infoadd = #226; /* Part of FTE_STRINGS*/
void(vector org, vector box, float colour, float effect, float count) particle3 = #216; string(string info, string key) infoget = #227; /* Part of FTE_STRINGS*/
void(vector org, float radius, float colour, float effect, float count) particle4 = #217; float(string s1, string s2, float len) strncmp = #228; /* Part of FTE_STRINGS*/
float(float number, float quantity) bitshift = #218; float(string s1, string s2) strcasecmp = #229; /* Part of FTE_STRINGS*/
void(vector pos) te_lightningblood = #219; float(string s1, string s2, float len) strncasecmp = #230; /* Part of FTE_STRINGS*/
float(string s1, string sub, optional float startidx) strstrofs = #221; void() calltimeofday = #231; /* Part of FTE_CALLTIMEOFDAY*/
float(string str, float index) str2chr = #222;
string(float chr, ...) chr2str = #223;
string(float ccase, float redalpha, float redchars, string str, ...) strconv = #224;
string(float pad, string str1, ...) strpad = #225;
string(string old, string key, string value) infoadd = #226;
string(string info, string key) infoget = #227;
float(string s1, string s2, float len) strncmp = #228;
float(string s1, string s2) strcasecmp = #229;
float(string s1, string s2, float len) strncasecmp = #230;
void() calltimeofday = #231;
#ifdef SSQC
void(float num, float type, .void fld) clientstat = #232;
void(float num, float type, string name) globalstat = #233;
void(entity player) isbackbuffered = #234;
#endif
void(vector angle) rotatevectorsbyangle = #235; void(vector angle) rotatevectorsbyangle = #235;
void(vector fwd, vector right, vector up) rotatevectorsbyvectors = #236; void(vector fwd, vector right, vector up) rotatevectorsbyvectors = #236;
float(float mdlindex, string skinname) skinforname = #237; float(float mdlindex, string skinname) skinforname = #237;
#ifdef CSQC #ifdef CSQC
float(string shadername, optional string defaultshader, ...) shaderforname = #238; float(string shadername, optional string defaultshader, ...) shaderforname = #238;
#endif #endif
void(vector org, optional float count) te_bloodqw = #239; void(vector org, optional float count) te_bloodqw = #239; /* Part of FTE_TE_STANDARDEFFECTBUILTINS*/
#ifdef SSQC
float(vector viewpos, entity entity) checkpvs = #240;
entity(string match, optional float matchnum) matchclientname = #241;
void(string dest, string content) sendpacket = #242;
#endif
#ifdef CSQC #ifdef CSQC
vector(entity ent, float tagnum) rotatevectorsbytag = #244; vector(entity ent, float tagnum) rotatevectorsbytag = #244;
#endif #endif
int(string) stoi = #259; int(string) stoi = #259; /* Part of FTE_QC_INTCONV*/
string(int) itos = #260; string(int) itos = #260; /* Part of FTE_QC_INTCONV*/
int(string) stoh = #261; int(string) stoh = #261; /* Part of FTE_QC_INTCONV*/
string(int) htos = #262; string(int) htos = #262; /* Part of FTE_QC_INTCONV*/
float(float modlindex, optional float useabstransforms) skel_create = #263; float(float modlindex, optional float useabstransforms) skel_create = #263;
float(float skel, entity ent, float modelindex, float retainfrac, float firstbone, float lastbone, optional float addfrac) skel_build = #264; float(float skel, entity ent, float modelindex, float retainfrac, float firstbone, float lastbone, optional float addfrac) skel_build = #264;
float(float skel) skel_get_numbones = #265; float(float skel) skel_get_numbones = #265;
@ -477,13 +420,11 @@ void(float skel, float bonenum, vector org, optional vector fwd, optional vector
void(float skel, float startbone, float endbone, vector org, optional vector fwd, optional vector right, optional vector up) skel_mul_bones = #273; void(float skel, float startbone, float endbone, vector org, optional vector fwd, optional vector right, optional vector up) skel_mul_bones = #273;
void(float skeldst, float skelsrc, float startbone, float entbone) skel_copybones = #274; void(float skeldst, float skelsrc, float startbone, float entbone) skel_copybones = #274;
void(float skel) skel_delete = #275; void(float skel) skel_delete = #275;
void(float modidx, string framename) frameforname = #276; float(float modidx, string framename) frameforname = #276;
float(float modidx, float framenum) frameduration = #277; float(float modidx, float framenum) frameduration = #277;
void(float action, vector pos, float radius, float quant) terrain_edit = #278; void(float action, vector pos, float radius, float quant) terrain_edit = #278;
void() touchtriggers = #279; void() touchtriggers = #279;
#ifdef SSQC float(entity skelent, string dollname, float parentskel) skel_ragupdate = #281;
void(float buf, float fl) writefloat = #280;
#endif
float*(float skel) skel_mmap = #282; float*(float skel) skel_mmap = #282;
void(entity ent, float bonenum, vector org, optional vector angorfwd, optional vector right, optional vector up) skel_set_bone_world = #283; void(entity ent, float bonenum, vector org, optional vector angorfwd, optional vector right, optional vector up) skel_set_bone_world = #283;
string(float modidx, float framenum) frametoname = #284; string(float modidx, float framenum) frametoname = #284;
@ -566,129 +507,114 @@ __variant(float lno, float fld) dynamiclight_get = #372;
void(float lno, float fld, __variant value) dynamiclight_set = #373; void(float lno, float fld, __variant value) dynamiclight_set = #373;
string(float efnum, float body) particleeffectquery = #374; string(float efnum, float body) particleeffectquery = #374;
#endif #endif
void*(int size) memalloc = #384; void*(int size) memalloc = #384; /* Part of FTE_MEMALLOC*/
void(void *ptr) memfree = #385; void(void *ptr) memfree = #385; /* Part of FTE_MEMALLOC*/
void(void *dst, void *src, int size) memcpy = #386; void(void *dst, void *src, int size) memcpy = #386; /* Part of FTE_MEMALLOC*/
void(void *dst, int val, int size) memset = #387; void(void *dst, int val, int size) memset = #387; /* Part of FTE_MEMALLOC*/
void(entity from, entity to) copyentity = #400; void(entity from, entity to) copyentity = #400; /* Part of DP_QC_COPYENTITY*/
#ifdef SSQC entity(.string field, string match) findchain = #402; /* Part of DP_QC_FINDCHAIN*/
void(entity from, entity to) setcolors = #401; entity(.float fld, float match) findchainfloat = #403; /* Part of DP_QC_FINDCHAINFLOAT*/
#endif void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404; /* Part of DP_SV_EFFECT*/
entity(string field, string match) findchain = #402; void(vector org, vector dir, float count) te_blood = #405; /* Part of DP_TE_BLOOD*/
entity(float fld, float match) findchainfloat = #403; void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406; /* Part of DP_TE_BLOODSHOWER*/
void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404; void(vector org, vector color) te_explosionrgb = #407; /* Part of DP_TE_EXPLOSIONRGB*/
void(vector org, vector dir, float count) te_blood = #405; void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408; /* Part of DP_TE_PARTICLECUBE*/
void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406; void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409; /* Part of _DP_TE_PARTICLERAIN*/
void(vector org, vector color) te_explosionrgb = #407; void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410; /* Part of _DP_TE_PARTICLESNOW*/
void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408; void(vector org, vector vel, float howmany) te_spark = #411; /* Part of DP_TE_SPARK*/
void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409; void(vector org) te_gunshotquad = #412; /* Part of _DP_TE_QUADEFFECTS1*/
void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410; void(vector org) te_spikequad = #413; /* Part of _DP_TE_QUADEFFECTS1*/
void(vector org, vector vel, float howmany) te_spark = #411; void(vector org) te_superspikequad = #414; /* Part of _DP_TE_QUADEFFECTS1*/
void(vector org) te_gunshotquad = #412; void(vector org) te_explosionquad = #415; /* Part of _DP_TE_QUADEFFECTS1*/
void(vector org) te_spikequad = #413; void(vector org) te_smallflash = #416; /* Part of DP_TE_SMALLFLASH*/
void(vector org) te_superspikequad = #414; void(vector org, float radius, float lifetime, vector color) te_customflash = #417; /* Part of _DP_TE_CUSTOMFLASH*/
void(vector org) te_explosionquad = #415; void(vector org, optional float count) te_gunshot = #418; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/
void(vector org) te_smallflash = #416; void(vector org) te_spike = #419; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/
void(vector org, float radius, float lifetime, vector color) te_customflash = #417; void(vector org) te_superspike = #420; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/
void(vector org) te_gunshot = #418; void(vector org) te_explosion = #421; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/
void(vector org) te_spike = #419; void(vector org) te_tarexplosion = #422; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/
void(vector org) te_superspike = #420; void(vector org) te_wizspike = #423; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/
void(vector org) te_explosion = #421; void(vector org) te_knightspike = #424; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/
void(vector org) te_tarexplosion = #422; void(vector org) te_lavasplash = #425; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/
void(vector org) te_wizspike = #423; void(vector org) te_teleport = #426; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/
void(vector org) te_knightspike = #424; void(vector org, float color, float colorlength) te_explosion2 = #427; /* Part of DP_TE_STANDARDEFFECTBUILTINS*/
void(vector org) te_lavasplash = #425; void(entity own, vector start, vector end) te_lightning1 = #428; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/
void(vector org) te_teleport = #426; void(entity own, vector start, vector end) te_lightning2 = #429; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/
void(vector org, float color, float colorlength) te_explosion2 = #427; void(entity own, vector start, vector end) te_lightning3 = #430; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/
void(entity own, vector start, vector end) te_lightning1 = #428; void(entity own, vector start, vector end) te_beam = #431; /* Part of DP_TE_STANDARDEFFECTBUILTINS*/
void(entity own, vector start, vector end) te_lightning2 = #429; void(vector dir) vectorvectors = #432; /* Part of DP_QC_VECTORVECTORS*/
void(entity own, vector start, vector end) te_lightning3 = #430; void(vector org) te_plasmaburn = #433; /* Part of _DP_TE_PLASMABURN*/
void(entity own, vector start, vector end) te_beam = #431; float(entity e, float s) getsurfacenumpoints = #434; /* Part of DP_QC_GETSURFACE*/
void(vector dir) vectorvectors = #432; vector(entity e, float s, float n) getsurfacepoint = #435; /* Part of DP_QC_GETSURFACE*/
void(vector org) te_plasmaburn = #433; vector(entity e, float s) getsurfacenormal = #436; /* Part of DP_QC_GETSURFACE*/
float(entity e, float s) getsurfacenumpoints = #434; string(entity e, float s) getsurfacetexture = #437; /* Part of DP_QC_GETSURFACE*/
vector(entity e, float s, float n) getsurfacepoint = #435; float(entity e, vector p) getsurfacenearpoint = #438; /* Part of DP_QC_GETSURFACE*/
vector(entity e, float s) getsurfacenormal = #436; float(string s) tokenize = #441; /* Part of KRIMZON_SV_PARSECLIENTCOMMAND*/
string(entity e, float s) getsurfacetexture = #437; string(float n) argv = #442; /* Part of KRIMZON_SV_PARSECLIENTCOMMAND*/
float(entity e, vector p) getsurfacenearpoint = #438; float(string pattern, float caseinsensitive, float quiet) search_begin = #444; /* Part of DP_QC_FS_SEARCH*/
#ifdef SSQC void(float handle) search_end = #445; /* Part of DP_QC_FS_SEARCH*/
void(entity e, string s) clientcommand = #440; float(float handle) search_getsize = #446; /* Part of DP_QC_FS_SEARCH*/
#endif string(float handle, float num) search_getfilename = #447; /* Part of DP_QC_FS_SEARCH*/
float(string s) tokenize = #441; string(string cvarname) cvar_string = #448; /* Part of DP_QC_CVAR_STRING*/
string(float n) argv = #442; entity(entity start, .float fld, float match) findflags = #449; /* Part of DP_QC_FINDFLAGS*/
#ifdef SSQC entity(.float fld, float match) findchainflags = #450; /* Part of DP_QC_FINDCHAINFLAGS*/
void(entity e, entity tagentity, string tagname) setattachment = #443; float(entity ent, string tagname) gettagindex = #451; /* Part of DP_MD3_TAGSINFO*/
#endif vector(entity ent, float tagindex) gettaginfo = #452; /* Part of DP_MD3_TAGSINFO*/
float(string pattern, float caseinsensitive, float quiet) search_begin = #444; entity(float entnum) edict_num = #459; /* Part of DP_QC_EDICT_NUM*/
void(float handle) search_end = #445; float() buf_create = #460; /* Part of DP_QC_STRINGBUFFERS*/
float(float handle) search_getsize = #446; void(float bufhandle) buf_del = #461; /* Part of DP_QC_STRINGBUFFERS*/
string(float handle, float num) search_getfilename = #447; float(float bufhandle) buf_getsize = #462; /* Part of DP_QC_STRINGBUFFERS*/
string(string cvarname) cvar_string = #448; void(float bufhandle_from, float bufhandle_to) buf_copy = #463; /* Part of DP_QC_STRINGBUFFERS*/
entity(entity start, .entity fld, float match) findflags = #449; void(float bufhandle, float sortpower, float backward) buf_sort = #464; /* Part of DP_QC_STRINGBUFFERS*/
entity(.float fld, float match) findchainflags = #450; string(float bufhandle, string glue) buf_implode = #465; /* Part of DP_QC_STRINGBUFFERS*/
float(entity ent, string tagname) gettagindex = #451; string(float bufhandle, float string_index) bufstr_get = #466; /* Part of DP_QC_STRINGBUFFERS*/
vector(entity ent, float tagindex) gettaginfo = #452; void(float bufhandle, float string_index, string str) bufstr_set = #467; /* Part of DP_QC_STRINGBUFFERS*/
#ifdef SSQC float(float bufhandle, string str, float order) bufstr_add = #468; /* Part of DP_QC_STRINGBUFFERS*/
void(entity player) dropclient = #453; void(float bufhandle, float string_index) bufstr_free = #469; /* Part of DP_QC_STRINGBUFFERS*/
entity() spawnclient = #454; float(float s) asin = #471; /* Part of DP_QC_ASINACOSATANATAN2TAN*/
float(entity client) clienttype = #455; float(float c) acos = #472; /* Part of DP_QC_ASINACOSATANATAN2TAN*/
void(float target, string str) WriteUnterminatedString = #456; float(float t) atan = #473; /* Part of DP_QC_ASINACOSATANATAN2TAN*/
#endif float(float c, float s) atan2 = #474; /* Part of DP_QC_ASINACOSATANATAN2TAN*/
entity(float entnum) edict_num = #459; float(float a) tan = #475; /* Part of DP_QC_ASINACOSATANATAN2TAN*/
float() buf_create = #460; float(string s) strlennocol = #476; /* Part of DP_QC_STRINGCOLORFUNCTIONS*/
void(float bufhandle) buf_del = #461; string(string s) strdecolorize = #477; /* Part of DP_QC_STRINGCOLORFUNCTIONS*/
float(float bufhandle) buf_getsize = #462; string(float uselocaltime, string format, ...) strftime = #478; /* Part of DP_QC_STRFTIME*/
void(float bufhandle_from, float bufhandle_to) buf_copy = #463; float(string s, string separator1, ...) tokenizebyseparator = #479; /* Part of DP_QC_TOKENIZEBYSEPARATOR*/
void(float bufhandle, float sortpower, float backward) buf_sort = #464; string(string s) strtolower = #480; /* Part of DP_QC_STRING_CASE_FUNCTIONS*/
string(float bufhandle, string glue) buf_implode = #465; string(string s) strtoupper = #481; /* Part of DP_QC_STRING_CASE_FUNCTIONS*/
string(float bufhandle, float string_index) bufstr_get = #466; string(string s) cvar_defstring = #482; /* Part of DP_QC_CVAR_DEFSTRING*/
void(float bufhandle, float string_index, string str) bufstr_set = #467;
float(float bufhandle, string str, float order) bufstr_add = #468;
void(float bufhandle, float string_index) bufstr_free = #469;
float(float s) asin = #471;
float(float c) acos = #472;
float(float t) atan = #473;
float(float c, float s) atan2 = #474;
float(float a) tan = #475;
float(string s) strlennocol = #476;
string(string s) strdecolorize = #477;
string(float uselocaltime, string format, ...) strftime = #478;
float(string s, string separator1, ...) tokenizebyseparator = #479;
string(string s) strtolower = #480;
string(string s) strtoupper = #481;
string(string s) cvar_defstring = #482;
#ifdef CSQC #ifdef CSQC
void(vector origin, string sample, float volume, float attenuation) pointsound = #483; void(vector origin, string sample, float volume, float attenuation) pointsound = #483; /* Part of DP_SV_POINTSOUND*/
#endif #endif
string(string search, string replace, string subject) strreplace = #484; string(string search, string replace, string subject) strreplace = #484; /* Part of DP_QC_STRREPLACE*/
string(string search, string replace, string subject) strireplace = #485; string(string search, string replace, string subject) strireplace = #485; /* Part of DP_QC_STRREPLACE*/
vector(entity e, float s, float n, float a) getsurfacepointattribute = #486; vector(entity e, float s, float n, float a) getsurfacepointattribute = #486; /* Part of DP_QC_GETSURFACEPOINTATTRIBUTE*/
#ifdef CSQC #ifdef CSQC
float(string name) gecko_create = #487; float(string name) gecko_create = #487; /* Part of DP_GECKO_SUPPORT*/
void(string name) gecko_destroy = #488; void(string name) gecko_destroy = #488; /* Part of DP_GECKO_SUPPORT*/
void(string name, string URI) gecko_navigate = #489; void(string name, string URI) gecko_navigate = #489; /* Part of DP_GECKO_SUPPORT*/
float(string name, float key, float eventtype) gecko_keyevent = #490; float(string name, float key, float eventtype) gecko_keyevent = #490; /* Part of DP_GECKO_SUPPORT*/
void(string name, float x, float y) gecko_mousemove = #491; void(string name, float x, float y) gecko_mousemove = #491; /* Part of DP_GECKO_SUPPORT*/
void(string name, float w, float h) gecko_resize = #492; void(string name, float w, float h) gecko_resize = #492; /* Part of DP_GECKO_SUPPORT*/
vector(string name) gecko_get_texture_extent = #493; vector(string name) gecko_get_texture_extent = #493; /* Part of DP_GECKO_SUPPORT*/
#endif #endif
float(float caseinsensitive, string s, ...) crc16 = #494; float(float caseinsensitive, string s, ...) crc16 = #494; /* Part of DP_QC_CRC16*/
float(string name) cvar_type = #495; float(string name) cvar_type = #495; /* Part of DP_QC_CVAR_TYPE*/
//float() numentityfields = #496; float() numentityfields = #496; /* Part of DP_QC_ENTITYDATA*/
//string(float fieldnum) entityfieldname = #497; string(float fieldnum) entityfieldname = #497; /* Part of DP_QC_ENTITYDATA*/
//float(float fieldnum) entityfieldtype = #498; float(float fieldnum) entityfieldtype = #498; /* Part of DP_QC_ENTITYDATA*/
//string(float fieldnum, entity ent) getentityfieldstring = #499; string(float fieldnum, entity ent) getentityfieldstring = #499; /* Part of DP_QC_ENTITYDATA*/
//float(float fieldnum, entity ent, string s) putentityfieldstring = #500; float(float fieldnum, entity ent, string s) putentityfieldstring = #500; /* Part of DP_QC_ENTITYDATA*/
//void(float to, string s, float sz) WritePicture = #501; //void(float to, string s, float sz) WritePicture = #501; /* Part of DP_SV_WRITEPICTURE*/
//string() ReadPicture = #501; //string() ReadPicture = #501;
string(string filename) whichpack = #503; string(string filename) whichpack = #503; /* Part of DP_QC_WHICHPACK*/
#ifdef CSQC #ifdef CSQC
__variant(float entnum, float fieldnum) getentity = #504; __variant(float entnum, float fieldnum) getentity = #504;
#endif #endif
string(string in) uri_escape = #510; string(string in) uri_escape = #510; /* Part of DP_QC_URI_ESCAPE*/
string(string in) uri_unescape = #511; string(string in) uri_unescape = #511; /* Part of DP_QC_URI_ESCAPE*/
float(entity ent) num_for_edict = #512; float(entity ent) num_for_edict = #512;
void(string str) tokenize_console = #514; float(string str) tokenize_console = #514;
float(float idx) argv_start_index = #515; float(float idx) argv_start_index = #515;
float(float idx) argv_end_index = #516; float(float idx) argv_end_index = #516;
string(string cvarname) cvar_description = #518; string(string cvarname) cvar_description = #518;
@ -697,14 +623,11 @@ float(optional float timetype) gettime = #519;
#endif #endif
void(string s) loadfromdata = #529; void(string s) loadfromdata = #529;
void(string s) loadfromfile = #530; void(string s) loadfromfile = #530;
#ifdef SSQC
float(string mname) precache_vwep_model = #532;
#endif
void(.../*, string funcname*/) callfunction = #605; void(.../*, string funcname*/) callfunction = #605;
void(float fh, entity e) writetofile = #606; void(float fh, entity e) writetofile = #606;
float(string s) isfunction = #607; float(string s) isfunction = #607;
void(entity e, string s) parseentitydata = #608; void(entity e, string s) parseentitydata = #608;
string(...) sprintf = #627; string(string fmt, ...) sprintf = #627;
float(entity e, float s) getsurfacenumtriangles = #628; float(entity e, float s) getsurfacenumtriangles = #628;
vector(entity e, float s, float n) getsurfacetriangle = #629; vector(entity e, float s, float n) getsurfacetriangle = #629;
#pragma noref 0 #pragma noref 0

View file

@ -3,10 +3,15 @@
/*you probably want to change this if you're running hexen2*/ /*you probably want to change this if you're running hexen2*/
var string autocvar_cg_editor_lightmodel = "progs/s_light.spr"; var string autocvar_cg_editor_lightmodel = "progs/s_light.spr";
var float autocvar_r_editlights_import_ambient = 0;
var float autocvar_r_editlights_import_diffuse = 1;
var float autocvar_r_editlights_import_specular = 1;
static float selectedlight; static float selectedlight;
static float editfield; static float editfield;
static string editvalue; static string editvalue;
static entity tempent; static entity tempent;
static float helphidden;
void() editor_lights_add = void() editor_lights_add =
{ {
float l; float l;
@ -35,7 +40,8 @@ void() editor_lights_add =
}; };
#define NUMLFIELDS 14 #define NUMLFIELDS 14
static string fldname[NUMLFIELDS+1] = { "bad", #define NUMCMDS 7
static string fldname[NUMLFIELDS+1+NUMCMDS] = { "bad",
" num", " num",
" org", " org",
" rgb", " rgb",
@ -49,7 +55,15 @@ static string fldname[NUMLFIELDS+1] = { "bad",
" csc", " csc",
" amb", " amb",
" dif", " dif",
" spc" " spc",
"Save",
"World Lights",
"Dynamic Lights",
"Toggle Help",
"Wipe All",
"Import",
"Reload"
}; };
static string(int fld, float foredit) readfield = static string(int fld, float foredit) readfield =
{ {
@ -183,28 +197,46 @@ void(vector m) editor_lights_overlay =
drawrawstring('0 32 0' + '0 8 0' * (float)i, s, '8 8 0', col, 1); drawrawstring('0 32 0' + '0 8 0' * (float)i, s, '8 8 0', col, 1);
} }
i+=1;
for (i = NUMLFIELDS+1f; i <= NUMLFIELDS+NUMCMDS; i++)
{
s = strcat(ftos(i), " ", fldname[i]);
if (editfield == i)
col = '1 0 0';
else if (m_y == i && m_x < 64)
col = '0 0 1';
else
col = '1 1 1';
drawrawstring('0 32 0' + '0 8 0' * (float)i, s, '8 8 0', col, 1);
}
i+=1i;
if (helphidden)
return;
if (editfield == 5) if (editfield == 5)
{ {
drawrawstring('0 32 0' + '0 8 0' * (float)i, "d: dynamic mode\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "d: dynamic mode\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "w: realtime world lights mode\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "w: realtime world lights mode\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "l: lightmap hack (not valid above index 32)\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "l: lightmap hack (not valid above index 32)\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "f: flashblend coronas\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "f: flashblend coronas\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "c: does not cast shadows\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "c: does not cast shadows\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "s: shadowmapped light\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "s: shadowmapped light\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "r: crepuscular rays\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "r: crepuscular rays\n", '8 8 0', '1 1 1', 1); i+=1i;
} }
else else
{ {
drawrawstring('0 32 0' + '0 8 0' * (float)i, "+/- change selected light\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "+/- change selected light\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "mouse also selects lights\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "mouse also selects lights\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "m moves the light to the crosshair\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "m moves the light to the crosshair\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "i inserts new light\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "i inserts new light\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "p points the light to aim at the crosshair\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "@ changes the light's radius\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "[ and ] move the light towards/away from indicated plane\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "# changes the light's shadow flag\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "don't forget to save\n", '8 8 0', '1 1 1', 1); i+=1; drawrawstring('0 32 0' + '0 8 0' * (float)i, "p points the light to aim at the crosshair\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "[ and ] move the light towards/away from indicated plane\n", '8 8 0', '1 1 1', 1); i+=1i;
drawrawstring('0 32 0' + '0 8 0' * (float)i, "don't forget to save\n", '8 8 0', '1 1 1', 1); i+=1i;
} }
}; };
@ -233,7 +265,7 @@ float(float keyc, float unic, vector m) editor_lights_key =
vector t = unproject(m + '0 0 8192'); vector t = unproject(m + '0 0 8192');
vector o = unproject(m); vector o = unproject(m);
string ns; string ns;
if (keyc == 512) if (keyc == 512 || (!editfield && unic == 13 && m_x < 64))
{ {
if (editfield) if (editfield)
{ {
@ -242,12 +274,40 @@ float(float keyc, float unic, vector m) editor_lights_key =
editfield = 0; editfield = 0;
} }
editfield = floor((m_y - 32f) / 8f); editfield = floor((m_y - 32f) / 8f);
if (editfield <= 0 || editfield > NUMLFIELDS || m_x >= 64) if (editfield <= 0 || editfield > NUMLFIELDS+NUMCMDS || m_x >= 64)
{ {
editfield = 0; editfield = 0;
selectbestlight(t - o, o); selectbestlight(t - o, o);
} }
else if (editfield > NUMLFIELDS)
{
switch(editfield - (NUMLFIELDS+1))
{
case 0:
localcmd("r_editlights_save\n");
break;
case 1:
localcmd("toggle r_shadow_realtime_world\n");
break;
case 2:
localcmd("toggle r_shadow_realtime_dynamic\n");
break;
case 3:
helphidden = !helphidden;
break;
case 4:
localcmd("r_editlights_reload none\n");
break;
case 5:
localcmd("r_editlights_reload bsp\n");
break;
case 6:
localcmd("r_editlights_reload\n");
break;
}
editfield = 0;
}
else else
editvalue = strzone(readfield(editfield, 1)); editvalue = strzone(readfield(editfield, 1));
} }
@ -277,27 +337,27 @@ float(float keyc, float unic, vector m) editor_lights_key =
writefield(editfield, ns); writefield(editfield, ns);
} }
else if (keyc >= '0' && keyc <= '9') else if (unic >= '0' && unic <= '9')
{ {
editfield = keyc - '0'; editfield = unic - '0';
editvalue = strzone(readfield(editfield, 1)); editvalue = strzone(readfield(editfield, 1));
} }
else if (keyc == '=') else if (unic == '=')
selectedlight++; selectedlight++;
else if (keyc == '-') else if (unic == '-')
selectedlight--; selectedlight--;
else if (keyc == 'n') else if (unic == 'n' || unic == 'N')
localcmd("noclip\n"); localcmd("noclip\n");
// else if (keyc == 's') // else if (unic == 's' || unic == 'S')
// { // {
// selectbestlight(t - o, o); // selectbestlight(t - o, o);
// } // }
else if (keyc == 'm') else if (unic == 'm' || unic == 'M')
{ {
traceline(o, t, TRUE, world); traceline(o, t, TRUE, world);
dynamiclight_set(selectedlight, LFIELD_ORIGIN, trace_endpos + trace_plane_normal*4); dynamiclight_set(selectedlight, LFIELD_ORIGIN, trace_endpos + trace_plane_normal*4);
} }
else if (keyc == 'p') else if (unic == 'p' || unic == 'P')
{ {
traceline(o, t, TRUE, world); traceline(o, t, TRUE, world);
vector ang = vectoangles((trace_endpos + trace_plane_normal*4f) - (vector)dynamiclight_get(selectedlight, LFIELD_ORIGIN)); vector ang = vectoangles((trace_endpos + trace_plane_normal*4f) - (vector)dynamiclight_get(selectedlight, LFIELD_ORIGIN));
@ -305,10 +365,10 @@ float(float keyc, float unic, vector m) editor_lights_key =
dynamiclight_set(selectedlight, LFIELD_ANGLES, ang); dynamiclight_set(selectedlight, LFIELD_ANGLES, ang);
/*if we're pointing the light at something, it should probably have a fov*/ /*if we're pointing the light at something, it should probably have a fov*/
if (!(float)dynamiclight_get(selectedlight, LFIELD_ORIGIN)) if (!(float)dynamiclight_get(selectedlight, LFIELD_FOV))
dynamiclight_set(selectedlight, LFIELD_FOV, 90); dynamiclight_set(selectedlight, LFIELD_FOV, 90);
} }
else if (keyc == 'i') else if (unic == 'i' || unic == 'I')
{ {
for (selectedlight = 32; ; selectedlight++) for (selectedlight = 32; ; selectedlight++)
{ {
@ -321,6 +381,9 @@ float(float keyc, float unic, vector m) editor_lights_key =
dynamiclight_set(selectedlight, LFIELD_STYLE, 0); dynamiclight_set(selectedlight, LFIELD_STYLE, 0);
dynamiclight_set(selectedlight, LFIELD_ANGLES, '0 0 0'); dynamiclight_set(selectedlight, LFIELD_ANGLES, '0 0 0');
dynamiclight_set(selectedlight, LFIELD_FLAGS, LFLAG_REALTIMEMODE); dynamiclight_set(selectedlight, LFIELD_FLAGS, LFLAG_REALTIMEMODE);
dynamiclight_set(selectedlight, LFIELD_AMBIENTSCALE, autocvar_r_editlights_import_ambient);
dynamiclight_set(selectedlight, LFIELD_DIFFUSESCALE, autocvar_r_editlights_import_diffuse);
dynamiclight_set(selectedlight, LFIELD_SPECULARSCALE, autocvar_r_editlights_import_specular);
/*place it at the pointed location*/ /*place it at the pointed location*/
traceline(o, t, TRUE, world); traceline(o, t, TRUE, world);
@ -329,19 +392,39 @@ float(float keyc, float unic, vector m) editor_lights_key =
} }
} }
} }
else if (keyc == '[') else if (unic == '[')
{ {
o = getproperty(11); o = getproperty(11);
traceline(o, t, TRUE, world); traceline(o, t, TRUE, world);
dynamiclight_set(selectedlight, LFIELD_ORIGIN, dynamiclight_get(selectedlight, LFIELD_ORIGIN) - trace_plane_normal); dynamiclight_set(selectedlight, LFIELD_ORIGIN, dynamiclight_get(selectedlight, LFIELD_ORIGIN) - trace_plane_normal);
} }
else if (keyc == ']') else if (unic == ']')
{ {
o = getproperty(11); o = getproperty(11);
traceline(o, t, TRUE, world); traceline(o, t, TRUE, world);
dynamiclight_set(selectedlight, LFIELD_ORIGIN, dynamiclight_get(selectedlight, LFIELD_ORIGIN) + trace_plane_normal); dynamiclight_set(selectedlight, LFIELD_ORIGIN, dynamiclight_get(selectedlight, LFIELD_ORIGIN) + trace_plane_normal);
} }
else if (keyc == 127) else if (unic == '\'' || unic == '@')
{
o = getproperty(11);
traceline(o, t, TRUE, world);
dynamiclight_set(selectedlight, LFIELD_RADIUS, 1.5*vlen(trace_endpos - dynamiclight_get(selectedlight, LFIELD_ORIGIN)));
}
else if (unic == '#')
{
float fl;
fl = dynamiclight_get(selectedlight, LFIELD_FLAGS);
if (fl & LFLAG_NOSHADOWS)
fl -= LFLAG_NOSHADOWS;
else
fl += LFLAG_NOSHADOWS;
dynamiclight_set(selectedlight, LFIELD_FLAGS, (float)fl);
}
else if (unic == '{')
dynamiclight_set(selectedlight, LFIELD_RADIUS, dynamiclight_get(selectedlight, LFIELD_RADIUS) - 15);
else if (unic == '}')
dynamiclight_set(selectedlight, LFIELD_RADIUS, dynamiclight_get(selectedlight, LFIELD_RADIUS) + 15);
else if (unic == 127)
dynamiclight_set(selectedlight, LFIELD_RADIUS, 0); dynamiclight_set(selectedlight, LFIELD_RADIUS, 0);
else else
return FALSE; return FALSE;

View file

@ -17,27 +17,31 @@ enum
ter_water_set = 14, //lower the terrain in a bell (negative value to raise) ter_water_set = 14, //lower the terrain in a bell (negative value to raise)
ter_mesh_add = 15, //add a mesh ter_mesh_add = 15, //add a mesh
ter_mesh_kill = 16, //remove meshes within the radius ter_mesh_kill = 16, //remove meshes within the radius
ter_tint = 17, //pants new colour modifiers/tints
ter_height_flatten, //smooth the heights slightly (non-destructive), such that the middle becomes flatter faster than the edges
ter_blank, ter_blank,
ter_radius, ter_radius,
ter_quant, ter_quant,
ter_strength, ter_strength,
ter_mesh, ter_mesh,
ter_tintval,
ter_tex, ter_tex,
ter_count ter_count
}; };
static var float eradius = 256; static var float eradius = 256;
static var float equant = 8; static var float equant = 8;
static var float epercent = 80; static var float epercent = 40;
static string tex[8]; static string tex[8];
static var string tint[8] = {"1 1 1", "1.2 0.9 0.9", "0 1 0"};
static string meshname; static string meshname;
static float curtool; static float curtool;
static int painttex; static int painttex;
static float mautorepeattime; static float mautorepeattime;
static entity tempent; static entity tempent;
float autocvar_mod_terrain_networked;
vector vidsize; vector vidsize;
float mousedown; float mousedown;
@ -60,6 +64,7 @@ static string toolname[ter_count] =
"water set", "water set",
"mesh add", "mesh add",
"mesh kill", "mesh kill",
"mesh tint",
"", "",
"rad", "rad",
"quant", "quant",
@ -80,24 +85,45 @@ void(vector m) editor_do =
t = o + normalize(t)*8192; t = o + normalize(t)*8192;
traceline(o, t, TRUE, world); traceline(o, t, TRUE, world);
self = world;
switch(curtool) switch(curtool)
{ {
case ter_reload: case ter_reload:
case ter_save: case ter_save:
mautorepeattime = 0; //don't autorepeat that... mautorepeattime = 0; //don't autorepeat that...
if (autocvar_mod_terrain_networked)
sendevent("teredit", "f", curtool);
else
{
if (curtool == ter_save)
print("Saving...\n");
else if (curtool == ter_reload)
print("Reloading...\n");
terrain_edit(curtool); terrain_edit(curtool);
}
break; break;
case ter_sethole: //use view center instead of targetted - you cannot target that which is not there case ter_sethole: //use view center instead of targetted - you cannot target that which is not there
if (autocvar_mod_terrain_networked)
sendevent("teredit", "fvff", curtool, trace_endpos, eradius, equant);
else
terrain_edit(curtool, trace_endpos, eradius, equant); terrain_edit(curtool, trace_endpos, eradius, equant);
break; break;
case ter_height_smooth: case ter_height_smooth:
case ter_height_spread:
if (autocvar_mod_terrain_networked)
sendevent("teredit", "fvff", curtool, trace_endpos, eradius, epercent/100.0);
else
terrain_edit(curtool, trace_endpos, eradius, epercent/100.0); terrain_edit(curtool, trace_endpos, eradius, epercent/100.0);
break; break;
case ter_height_set: case ter_height_set:
case ter_height_smooth: case ter_height_smooth:
case ter_height_raise: case ter_height_raise:
case ter_height_lower: case ter_height_lower:
if (autocvar_mod_terrain_networked)
sendevent("teredit", "fvff", curtool, trace_endpos, eradius, equant);
else
terrain_edit(curtool, trace_endpos, eradius, equant); terrain_edit(curtool, trace_endpos, eradius, equant);
break; break;
case ter_tex_get: case ter_tex_get:
@ -114,21 +140,40 @@ void(vector m) editor_do =
// terrain_edit(curtool, trace_endpos, eradius, equant, emix); // terrain_edit(curtool, trace_endpos, eradius, equant, emix);
// break; // break;
case ter_mixpaint: case ter_mixpaint:
if (autocvar_mod_terrain_networked)
sendevent("teredit", "fvffs", curtool, trace_endpos, eradius, epercent/100.0, tex[painttex]);
else
terrain_edit(curtool, trace_endpos, eradius, epercent/100.0, tex[painttex]); terrain_edit(curtool, trace_endpos, eradius, epercent/100.0, tex[painttex]);
break; break;
case ter_tex_kill: case ter_tex_kill:
if (autocvar_mod_terrain_networked)
sendevent("teredit", "fvffs", curtool, trace_endpos, eradius, equant, tex[painttex]);
else
terrain_edit(curtool, trace_endpos, eradius, equant, tex[painttex]); terrain_edit(curtool, trace_endpos, eradius, equant, tex[painttex]);
break; break;
case ter_mixconcentrate: case ter_mixconcentrate:
case ter_mixnoise: case ter_mixnoise:
case ter_mixblur: case ter_mixblur:
if (autocvar_mod_terrain_networked)
sendevent("teredit", "fvff", curtool, trace_endpos, eradius, equant);
else
terrain_edit(curtool, trace_endpos, eradius, equant); terrain_edit(curtool, trace_endpos, eradius, equant);
break; break;
case ter_tint:
if (autocvar_mod_terrain_networked)
sendevent("teredit", "fvffvf", curtool, trace_endpos, eradius, epercent/100.0, stov(tint[painttex]), 1);
else
terrain_edit(curtool, trace_endpos, eradius, epercent/100.0, stov(tint[painttex]), 1);
break;
case ter_mesh_add: case ter_mesh_add:
terrain_edit(curtool, tempent); terrain_edit(curtool, tempent);
break; break;
case ter_mesh_kill: case ter_mesh_kill:
if (autocvar_mod_terrain_networked)
sendevent("teredit", "fvf", curtool, trace_endpos, eradius);
else
terrain_edit(curtool, trace_endpos, eradius); terrain_edit(curtool, trace_endpos, eradius);
break; break;
} }
@ -148,11 +193,20 @@ float(float keyc, float unic, vector m) editor_terrain_key =
txt = itos((int)epercent); txt = itos((int)epercent);
if (curtool == ter_mesh) if (curtool == ter_mesh)
txt = meshname; txt = meshname;
if (curtool == ter_tintval)
txt = tint[painttex];
if (curtool == ter_tex) if (curtool == ter_tex)
txt = tex[painttex]; txt = tex[painttex];
if (keyc == 10 || keyc == 13) if (keyc == 10 || keyc == 13)
{
if (curtool == ter_mesh)
nt = ter_mesh_add;
else if (curtool == ter_tintval)
nt = ter_tint;
else
nt = ter_mixpaint; nt = ter_mixpaint;
}
else if (keyc == 127) else if (keyc == 127)
txt = substring(txt, 0, -2); txt = substring(txt, 0, -2);
else if (keyc == 8) else if (keyc == 8)
@ -178,6 +232,12 @@ float(float keyc, float unic, vector m) editor_terrain_key =
strunzone(tex[painttex]); strunzone(tex[painttex]);
tex[painttex] = txt; tex[painttex] = txt;
} }
if (curtool == ter_tintval)
{
txt = strzone(txt);
strunzone(tint[painttex]);
tint[painttex] = txt;
}
curtool = nt; curtool = nt;
} }
@ -222,7 +282,6 @@ float(float keyc, float unic, vector m) editor_terrain_key =
} }
else else
return FALSE; return FALSE;
return TRUE;
} }
else if (unic == '[') else if (unic == '[')
equant -= 1; equant -= 1;
@ -250,6 +309,12 @@ float(float keyc, float unic, vector m) editor_terrain_key =
painttex = 7; painttex = 7;
else else
return FALSE; return FALSE;
if (curtool == ter_save || curtool == ter_reload)
{
editor_do('0 0 0');
curtool = -1;
}
return TRUE; return TRUE;
}; };
@ -378,6 +443,8 @@ void(vector mousepos) editor_terrain_overlay =
drawpic(pos + '0 8 0', tex[painttex], '128 128 0', '1 1 1', 1); drawpic(pos + '0 8 0', tex[painttex], '128 128 0', '1 1 1', 1);
} }
else if (i == ter_tintval)
drawstring(pos, sprintf("Tint%1i: %s", painttex, tint[painttex]), '8 8 0', colour, 1, 0);
else else
drawstring(pos, toolname[i], '8 8 0', colour, 1, 0); drawstring(pos, toolname[i], '8 8 0', colour, 1, 0);
pos_y += 8; pos_y += 8;

View file

@ -57,7 +57,7 @@ void(menu_t *menu, string fieldname, vector pos, float *value, float minv, float
{ {
if (mousepos_y >= pos_y && mousepos_y < pos_y + 8 && render_only == 0) if (mousepos_y >= pos_y && mousepos_y < pos_y + 8 && render_only == 0)
{ {
col_x = (sin(time*3.14)+1) / 2; col_x = (sin(cltime*3.14)+1) / 2;
col_y = col_x; col_y = col_x;
col_z = 1; col_z = 1;
} }
@ -73,7 +73,7 @@ void(menu_t *menu, string fieldname, vector pos, float *value, float minv, float
drawstring(spos, "^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", '8 8 0', '1 1 1', 1, 0); drawstring(spos, "^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", '8 8 0', '1 1 1', 1, 0);
if (!(menu->flags & MF_DS_VALUE)) if (!(menu->flags & MF_DS_VALUE))
drawstring(spos + '88 0', ftos(f), '8 8 0', col, 1, 0); drawstring(spos + '88 0', ftos(f), '8 8 0', col, 1, 0);
spos_x += 9*8*(f - minv) / (maxv - minv); spos_x += 4 + 9*8*(f - minv) / (maxv - minv);
drawstring(spos, "^Ue083", '8 8 0', '1 1 1', 1, 0); drawstring(spos, "^Ue083", '8 8 0', '1 1 1', 1, 0);
} }
else if (mousepos_y >= pos_y && mousepos_y < pos_y + 8) else if (mousepos_y >= pos_y && mousepos_y < pos_y + 8)
@ -133,7 +133,7 @@ void(menu_t *menu, string fieldname, vector pos, float *value) sliderf_fixed_wid
{ {
if (cursor_in_widget(pos, epos, mousepos) && render_only == 0) if (cursor_in_widget(pos, epos, mousepos) && render_only == 0)
{ {
col_x = (sin(time*3.14)+1) / 2; col_x = (sin(cltime*3.14)+1) / 2;
col_y = col_x; col_y = col_x;
col_z = 1; col_z = 1;
} }
@ -209,7 +209,7 @@ void(menu_t *menu, string fieldname, vector pos, int *value, int minv, int maxv)
{ {
if (mousepos_y >= pos_y && mousepos_y < pos_y + 8 && render_only == 0) if (mousepos_y >= pos_y && mousepos_y < pos_y + 8 && render_only == 0)
{ {
col_x = (sin(time*3.14)+1) / 2; col_x = (sin(cltime*3.14)+1) / 2;
col_y = col_x; col_y = col_x;
col_z = 1; col_z = 1;
} }
@ -261,7 +261,7 @@ void(string fieldname, vector pos, vector *mousepos_in, float *value, float key)
{ {
if (mousepos_y >= pos_y && mousepos_y < pos_y + 8 && render_only == 0) if (mousepos_y >= pos_y && mousepos_y < pos_y + 8 && render_only == 0)
{ {
col_x = (sin(time*3.14)+1) / 2; col_x = (sin(cltime*3.14)+1) / 2;
col_y = col_x; col_y = col_x;
col_z = 1; col_z = 1;
} }
@ -309,7 +309,7 @@ void(menu_t *menu, string fieldname, vector pos, int *value) checkboxi_widgit =
{ {
if (cursor_in_widget(pos, epos, mousepos) && render_only == 0) if (cursor_in_widget(pos, epos, mousepos) && render_only == 0)
{ {
col_x = (sin(time*3.14)+1) / 2; col_x = (sin(cltime*3.14)+1) / 2;
col_y = col_x; col_y = col_x;
col_z = 1; col_z = 1;
} }
@ -354,7 +354,7 @@ int (menu_t *menu, string fieldname, vector pos) button_widget =
{ {
if (cursor_in_widget(pos, epos, mousepos) && render_only == 0) if (cursor_in_widget(pos, epos, mousepos) && render_only == 0)
{ {
col_x = (sin(time*3.14)+1) / 2; col_x = (sin(cltime*3.14)+1) / 2;
col_y = col_x; col_y = col_x;
col_z = 1; col_z = 1;
} }