diff --git a/quakec/csaddon/src/cam.qc b/quakec/csaddon/src/cam.qc index ed1fb4ec4..0a680ac54 100644 --- a/quakec/csaddon/src/cam.qc +++ b/quakec/csaddon/src/cam.qc @@ -32,6 +32,7 @@ static camdata_t *camdata; static var float splinefile = -1; static var int edit_type = 0; static vector submenu_position; +static var float autocvar_cl_demospeed = 1; void(int *dest, int bytes) memclr = { @@ -45,10 +46,17 @@ void(int *dest, int bytes) memclr = 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*/ 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) { /*too lazy to create a file, just use it as a malloc*/ @@ -62,7 +70,7 @@ void() spline_init = 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)); camdata->ver = VER; } @@ -88,7 +96,7 @@ static vector(spline_t *s, float frac) spline_pos = vector v1, v2; if (s->numpoints < 2) { - return; + return '0 0 0'; } frac *= s->numpoints; if (frac < 0) @@ -499,7 +507,7 @@ float slidertestfloat1, slidertestfloat2, slidertestfloat3; static float *curslider; 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 spline_t *s; @@ -623,7 +631,7 @@ int (vector *curmousepos, vector mousediff, float key) submenu = menu->flags = MF_DS_VALUE; point1 = '0 0 0'; // << problem with using a global value identifier i cant reuse point 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; sliderf_fixed_widgit(&menu, " x:", pos, &point1_x); 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; } - 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 = @@ -660,6 +668,7 @@ int (vector *curmousepos, vector mousediff) editor_spline_overlay = local spline_t *s; local int ri; local string str; + float min, sec; if (splinefile < 0) spline_init(); @@ -688,6 +697,17 @@ int (vector *curmousepos, vector mousediff) editor_spline_overlay = menu->flags = MF_DS_VALUE; 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(curmousepos, mousediff, -1); diff --git a/quakec/csaddon/src/csaddon.qc b/quakec/csaddon/src/csaddon.qc index 30d3b611c..3be0a5d1e 100644 --- a/quakec/csaddon/src/csaddon.qc +++ b/quakec/csaddon/src/csaddon.qc @@ -1,7 +1,3 @@ -float autocvar_ca_show; -float autocvar_ca_editormode; -string autocvar_ca_colourtint; - enum { MODE_INITIAL=0, @@ -12,6 +8,10 @@ enum MODE_PARTICLEEDIT=4, }; +float autocvar_ca_show; +var float autocvar_ca_editormode = MODE_LIGHTEDIT; +string autocvar_ca_colourtint; + var vector vidsize = '640 480 0'; vector curmousepos; vector mousediff; @@ -405,3 +405,9 @@ void(float prevprogs) init = externset(0, wrap_InputEvent, "CSQC_InputEvent"); } }; + +void() CSQC_Shutdown = +{ + spline_shutdown(); +}; + diff --git a/quakec/csaddon/src/csplat.qc b/quakec/csaddon/src/csplat.qc index df6bb95aa..0b2ac8cd5 100644 --- a/quakec/csaddon/src/csplat.qc +++ b/quakec/csaddon/src/csplat.qc @@ -275,14 +275,29 @@ float gamespeed; #define LFLAG_NOSHADOWS 256 #define LFLAG_SHADOWMAP 512 #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, string m) setmodel = #3; 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; void(entity e, float chan, string samp, float vol, float atten, optional float speedpct, optional float flags) sound = #8; vector(vector v) normalize = #9; @@ -293,20 +308,10 @@ float(vector v) vectoyaw = #13; entity() spawn = #14; void(entity e) remove = #15; 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; void(string s) precache_sound = #19; void(string s) precache_model = #20; -#ifdef SSQC -void(entity client, string s) stuffcmd = #21; -#endif 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; string(float val) ftos = #26; string(vector val) vtos = #27; @@ -324,9 +329,6 @@ float(float) ceil = #38; float(entity ent) checkbottom = #40; float(vector pos) pointcontents = #41; float(float) fabs = #43; -#ifdef SSQC -vector(entity player, float missilespeed) aim = #44; -#endif float(string) cvar = #45; void(string, ...) localcmd = #46; entity(entity) nextent = #47; @@ -334,136 +336,77 @@ void(vector pos, vector dir, float colour, float count) particle = #48; #define ChangeYaw changeyaw void() changeyaw = #49; vector(vector fwd, optional vector up) vectoangles = #51; -#ifdef SSQC -void(float to, float val) WriteByte = #52; -void(float to, float val) WriteChar = #53; -void(float to, float val) WriteShort = #54; -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; +float(float angle) sin = #60; /* Part of DP_QC_SINCOSSQRTPOW*/ +float(float angle) cos = #61; /* Part of DP_QC_SINCOSSQRTPOW*/ +float(float value) sqrt = #62; /* Part of DP_QC_SINCOSSQRTPOW*/ +void(entity ent) changepitch = #63; /* Part of DP_QC_CHANGEPITCH*/ 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; -#ifdef SSQC -void(string s) precache_file = #68; -#endif void(entity e) makestatic = #69; -#ifdef SSQC -void(string mapname, optional string newmapstartspot) changelevel = #70; -#endif 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(string str) precache_model2 = #75; void(string str) precache_sound2 = #76; -#ifdef SSQC -void(string str) precache_file2 = #77; -void() setspawnparms = #78; -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; +float(string) stof = #81; /* Part of FRIK_FILE, FTE_STRINGS, QW_ENGINE, ZQ_QC_STRINGS*/ +void(vector start, vector mins, vector maxs, vector end, float nomonsters, entity ent) tracebox = #90; /* Part of DP_QC_TRACEBOX*/ +vector() randomvec = #91; /* Part of DP_QC_RANDOMVEC*/ vector(vector org) getlight = #92; -void(string cvarname, string defaultvalue) registercvar = #93; -float(float a, float b, ...) min = #94; -float(float a, float b, ...) max = #95; -float(float minimum, float val, float maximum) bound = #96; -float(float value, float exp) pow = #97; -entity(entity start, .float fld, float match) findfloat = #98; +void(string cvarname, string defaultvalue) registercvar = #93; /* Part of DP_REGISTERCVAR*/ +float(float a, float b, ...) min = #94; /* Part of DP_QC_MINMAXBOUND*/ +float(float a, float b, ...) max = #95; /* Part of DP_QC_MINMAXBOUND*/ +float(float minimum, float val, float maximum) bound = #96; /* Part of DP_QC_MINMAXBOUND*/ +float(float value, float exp) pow = #97; /* Part of DP_QC_SINCOSSQRTPOW*/ +entity(entity start, .float fld, float match) findfloat = #98; /* Part of DP_QC_FINDFLOAT*/ float(string extname) checkextension = #99; -#ifdef SSQC -float(string builtinname) builtin_find = #100; -float(float value) anglemod = #102; -void(string slot, string picname, float x, float y, float zone, optional entity player) showpic = #104; -void(string slot, optional entity player) hidepic = #105; -void(string slot, float x, float y, float zone, optional entity player) movepic = #106; -void(string slot, string picname, optional entity player) changepic = #107; -#endif -float(string filename, float mode, optional float mmapminsize) fopen = #110; -void(float fhandle) fclose = #111; -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 filename, float mode, optional float mmapminsize) fopen = #110; /* Part of FRIK_FILE*/ +void(float fhandle) fclose = #111; /* Part of FRIK_FILE*/ +string(float fhandle) fgets = #112; /* Part of FRIK_FILE*/ +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*/ +float(string s) strlen = #114; /* Part of FRIK_FILE, FTE_STRINGS, ZQ_QC_STRINGS*/ +string(string s1, optional string s2, ...) strcat = #115; /* Part of FRIK_FILE, FTE_STRINGS, ZQ_QC_STRINGS*/ +string(string s, float start, float length) substring = #116; /* Part of FRIK_FILE, FTE_STRINGS, ZQ_QC_STRINGS*/ +vector(string s) stov = #117; /* Part of FRIK_FILE, FTE_STRINGS, ZQ_QC_STRINGS*/ +string(string s) strzone = #118; /* Part of FRIK_FILE, FTE_STRINGS, ZQ_QC_STRINGS*/ +void(string s) strunzone = #119; /* Part of FRIK_FILE, FTE_STRINGS, ZQ_QC_STRINGS*/ float(string modelname, optional float queryonly) getmodelindex = #200; -__variant(float prnum, string funcname, ...) externcall = #201; -float(string progsname) addprogs = #202; -__variant(float prnum, string varname) externvalue = #203; -void(float prnum, __variant newval, string varname) externset = #204; -float(string input, string token) instr = #206; +__variant(float prnum, string funcname, ...) externcall = #201; /* Part of FTE_MULTIPROGS*/ +float(string progsname) addprogs = #202; /* Part of FTE_MULTIPROGS*/ +__variant(float prnum, string varname) externvalue = #203; /* Part of FTE_MULTIPROGS*/ +void(float prnum, __variant newval, string varname) externset = #204; /* Part of FTE_MULTIPROGS*/ +float(string input, string token) instr = #206; /* Part of FTE_MULTIPROGS*/ void(float portal, float state) openportal = #207; -#ifdef SSQC -float(float attributes, string effectname, ...) RegisterTempEnt = #208; -void(float type, vector pos, ...) CustomTempEnt = #209; -float(optional float sleeptime) fork = #210; -#endif -void(optional __variant ret) abort = #211; -#ifdef SSQC -void(float sleeptime) sleep = #212; -void(entity player, string key, string value) forceinfokey = #213; -void(string filename, float starttag, entity edict) chat = #214; -#endif -void(vector org, vector dmin, vector dmax, float colour, float effect, float count) particle2 = #215; -void(vector org, vector box, float colour, float effect, float count) particle3 = #216; -void(vector org, float radius, float colour, float effect, float count) particle4 = #217; -float(float number, float quantity) bitshift = #218; -void(vector pos) te_lightningblood = #219; -float(string s1, string sub, optional float startidx) strstrofs = #221; -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(optional __variant ret) abort = #211; /* Part of FTE_MULTITHREADED*/ +void(vector org, vector dmin, vector dmax, float colour, float effect, float count) particle2 = #215; /* Part of FTE_HEXEN2*/ +void(vector org, vector box, float colour, float effect, float count) particle3 = #216; /* Part of FTE_HEXEN2*/ +void(vector org, float radius, float colour, float effect, float count) particle4 = #217; /* Part of FTE_HEXEN2*/ +float(float number, float quantity) bitshift = #218; /* Part of EXT_BITSHIFT*/ +void(vector pos) te_lightningblood = #219; /* Part of FTE_TE_STANDARDEFFECTBUILTINS*/ +float(string s1, string sub, optional float startidx) strstrofs = #221; /* Part of FTE_STRINGS*/ +float(string str, float index) str2chr = #222; /* Part of FTE_STRINGS*/ +string(float chr, ...) chr2str = #223; /* Part of FTE_STRINGS*/ +string(float ccase, float redalpha, float redchars, string str, ...) strconv = #224; /* Part of FTE_STRINGS*/ +string(float pad, string str1, ...) strpad = #225; /* Part of FTE_STRINGS*/ +string(string old, string key, string value) infoadd = #226; /* Part of FTE_STRINGS*/ +string(string info, string key) infoget = #227; /* Part of FTE_STRINGS*/ +float(string s1, string s2, float len) strncmp = #228; /* Part of FTE_STRINGS*/ +float(string s1, string s2) strcasecmp = #229; /* Part of FTE_STRINGS*/ +float(string s1, string s2, float len) strncasecmp = #230; /* Part of FTE_STRINGS*/ +void() calltimeofday = #231; /* Part of FTE_CALLTIMEOFDAY*/ void(vector angle) rotatevectorsbyangle = #235; void(vector fwd, vector right, vector up) rotatevectorsbyvectors = #236; float(float mdlindex, string skinname) skinforname = #237; #ifdef CSQC float(string shadername, optional string defaultshader, ...) shaderforname = #238; #endif -void(vector org, optional float count) te_bloodqw = #239; -#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 +void(vector org, optional float count) te_bloodqw = #239; /* Part of FTE_TE_STANDARDEFFECTBUILTINS*/ #ifdef CSQC vector(entity ent, float tagnum) rotatevectorsbytag = #244; #endif -int(string) stoi = #259; -string(int) itos = #260; -int(string) stoh = #261; -string(int) htos = #262; +int(string) stoi = #259; /* Part of FTE_QC_INTCONV*/ +string(int) itos = #260; /* Part of FTE_QC_INTCONV*/ +int(string) stoh = #261; /* Part of FTE_QC_INTCONV*/ +string(int) htos = #262; /* Part of FTE_QC_INTCONV*/ 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) 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 skeldst, float skelsrc, float startbone, float entbone) skel_copybones = #274; 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; void(float action, vector pos, float radius, float quant) terrain_edit = #278; void() touchtriggers = #279; -#ifdef SSQC -void(float buf, float fl) writefloat = #280; -#endif +float(entity skelent, string dollname, float parentskel) skel_ragupdate = #281; 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; 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; string(float efnum, float body) particleeffectquery = #374; #endif -void*(int size) memalloc = #384; -void(void *ptr) memfree = #385; -void(void *dst, void *src, int size) memcpy = #386; -void(void *dst, int val, int size) memset = #387; -void(entity from, entity to) copyentity = #400; -#ifdef SSQC -void(entity from, entity to) setcolors = #401; -#endif -entity(string field, string match) findchain = #402; -entity(float fld, float match) findchainfloat = #403; -void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404; -void(vector org, vector dir, float count) te_blood = #405; -void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406; -void(vector org, vector color) te_explosionrgb = #407; -void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408; -void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409; -void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410; -void(vector org, vector vel, float howmany) te_spark = #411; -void(vector org) te_gunshotquad = #412; -void(vector org) te_spikequad = #413; -void(vector org) te_superspikequad = #414; -void(vector org) te_explosionquad = #415; -void(vector org) te_smallflash = #416; -void(vector org, float radius, float lifetime, vector color) te_customflash = #417; -void(vector org) te_gunshot = #418; -void(vector org) te_spike = #419; -void(vector org) te_superspike = #420; -void(vector org) te_explosion = #421; -void(vector org) te_tarexplosion = #422; -void(vector org) te_wizspike = #423; -void(vector org) te_knightspike = #424; -void(vector org) te_lavasplash = #425; -void(vector org) te_teleport = #426; -void(vector org, float color, float colorlength) te_explosion2 = #427; -void(entity own, vector start, vector end) te_lightning1 = #428; -void(entity own, vector start, vector end) te_lightning2 = #429; -void(entity own, vector start, vector end) te_lightning3 = #430; -void(entity own, vector start, vector end) te_beam = #431; -void(vector dir) vectorvectors = #432; -void(vector org) te_plasmaburn = #433; -float(entity e, float s) getsurfacenumpoints = #434; -vector(entity e, float s, float n) getsurfacepoint = #435; -vector(entity e, float s) getsurfacenormal = #436; -string(entity e, float s) getsurfacetexture = #437; -float(entity e, vector p) getsurfacenearpoint = #438; -#ifdef SSQC -void(entity e, string s) clientcommand = #440; -#endif -float(string s) tokenize = #441; -string(float n) argv = #442; -#ifdef SSQC -void(entity e, entity tagentity, string tagname) setattachment = #443; -#endif -float(string pattern, float caseinsensitive, float quiet) search_begin = #444; -void(float handle) search_end = #445; -float(float handle) search_getsize = #446; -string(float handle, float num) search_getfilename = #447; -string(string cvarname) cvar_string = #448; -entity(entity start, .entity fld, float match) findflags = #449; -entity(.float fld, float match) findchainflags = #450; -float(entity ent, string tagname) gettagindex = #451; -vector(entity ent, float tagindex) gettaginfo = #452; -#ifdef SSQC -void(entity player) dropclient = #453; -entity() spawnclient = #454; -float(entity client) clienttype = #455; -void(float target, string str) WriteUnterminatedString = #456; -#endif -entity(float entnum) edict_num = #459; -float() buf_create = #460; -void(float bufhandle) buf_del = #461; -float(float bufhandle) buf_getsize = #462; -void(float bufhandle_from, float bufhandle_to) buf_copy = #463; -void(float bufhandle, float sortpower, float backward) buf_sort = #464; -string(float bufhandle, string glue) buf_implode = #465; -string(float bufhandle, float string_index) bufstr_get = #466; -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; +void*(int size) memalloc = #384; /* Part of FTE_MEMALLOC*/ +void(void *ptr) memfree = #385; /* Part of FTE_MEMALLOC*/ +void(void *dst, void *src, int size) memcpy = #386; /* Part of FTE_MEMALLOC*/ +void(void *dst, int val, int size) memset = #387; /* Part of FTE_MEMALLOC*/ +void(entity from, entity to) copyentity = #400; /* Part of DP_QC_COPYENTITY*/ +entity(.string field, string match) findchain = #402; /* Part of DP_QC_FINDCHAIN*/ +entity(.float fld, float match) findchainfloat = #403; /* Part of DP_QC_FINDCHAINFLOAT*/ +void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404; /* Part of DP_SV_EFFECT*/ +void(vector org, vector dir, float count) te_blood = #405; /* Part of DP_TE_BLOOD*/ +void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406; /* Part of DP_TE_BLOODSHOWER*/ +void(vector org, vector color) te_explosionrgb = #407; /* Part of DP_TE_EXPLOSIONRGB*/ +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, vector vel, float howmany, float color) te_particlerain = #409; /* Part of _DP_TE_PARTICLERAIN*/ +void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410; /* Part of _DP_TE_PARTICLESNOW*/ +void(vector org, vector vel, float howmany) te_spark = #411; /* Part of DP_TE_SPARK*/ +void(vector org) te_gunshotquad = #412; /* Part of _DP_TE_QUADEFFECTS1*/ +void(vector org) te_spikequad = #413; /* Part of _DP_TE_QUADEFFECTS1*/ +void(vector org) te_superspikequad = #414; /* Part of _DP_TE_QUADEFFECTS1*/ +void(vector org) te_explosionquad = #415; /* Part of _DP_TE_QUADEFFECTS1*/ +void(vector org) te_smallflash = #416; /* Part of DP_TE_SMALLFLASH*/ +void(vector org, float radius, float lifetime, vector color) te_customflash = #417; /* Part of _DP_TE_CUSTOMFLASH*/ +void(vector org, optional float count) te_gunshot = #418; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/ +void(vector org) te_spike = #419; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/ +void(vector org) te_superspike = #420; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/ +void(vector org) te_explosion = #421; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/ +void(vector org) te_tarexplosion = #422; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/ +void(vector org) te_wizspike = #423; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/ +void(vector org) te_knightspike = #424; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/ +void(vector org) te_lavasplash = #425; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/ +void(vector org) te_teleport = #426; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/ +void(vector org, float color, float colorlength) te_explosion2 = #427; /* Part of DP_TE_STANDARDEFFECTBUILTINS*/ +void(entity own, vector start, vector end) te_lightning1 = #428; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/ +void(entity own, vector start, vector end) te_lightning2 = #429; /* Part of DP_TE_STANDARDEFFECTBUILTINS, FTE_TE_STANDARDEFFECTBUILTINS*/ +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_beam = #431; /* Part of DP_TE_STANDARDEFFECTBUILTINS*/ +void(vector dir) vectorvectors = #432; /* Part of DP_QC_VECTORVECTORS*/ +void(vector org) te_plasmaburn = #433; /* Part of _DP_TE_PLASMABURN*/ +float(entity e, float s) getsurfacenumpoints = #434; /* Part of DP_QC_GETSURFACE*/ +vector(entity e, float s, float n) getsurfacepoint = #435; /* Part of DP_QC_GETSURFACE*/ +vector(entity e, float s) getsurfacenormal = #436; /* Part of DP_QC_GETSURFACE*/ +string(entity e, float s) getsurfacetexture = #437; /* Part of DP_QC_GETSURFACE*/ +float(entity e, vector p) getsurfacenearpoint = #438; /* Part of DP_QC_GETSURFACE*/ +float(string s) tokenize = #441; /* Part of KRIMZON_SV_PARSECLIENTCOMMAND*/ +string(float n) argv = #442; /* Part of KRIMZON_SV_PARSECLIENTCOMMAND*/ +float(string pattern, float caseinsensitive, float quiet) search_begin = #444; /* Part of DP_QC_FS_SEARCH*/ +void(float handle) search_end = #445; /* Part of DP_QC_FS_SEARCH*/ +float(float handle) search_getsize = #446; /* Part of DP_QC_FS_SEARCH*/ +string(float handle, float num) search_getfilename = #447; /* Part of DP_QC_FS_SEARCH*/ +string(string cvarname) cvar_string = #448; /* Part of DP_QC_CVAR_STRING*/ +entity(entity start, .float fld, float match) findflags = #449; /* Part of DP_QC_FINDFLAGS*/ +entity(.float fld, float match) findchainflags = #450; /* Part of DP_QC_FINDCHAINFLAGS*/ +float(entity ent, string tagname) gettagindex = #451; /* Part of DP_MD3_TAGSINFO*/ +vector(entity ent, float tagindex) gettaginfo = #452; /* Part of DP_MD3_TAGSINFO*/ +entity(float entnum) edict_num = #459; /* Part of DP_QC_EDICT_NUM*/ +float() buf_create = #460; /* Part of DP_QC_STRINGBUFFERS*/ +void(float bufhandle) buf_del = #461; /* Part of DP_QC_STRINGBUFFERS*/ +float(float bufhandle) buf_getsize = #462; /* Part of DP_QC_STRINGBUFFERS*/ +void(float bufhandle_from, float bufhandle_to) buf_copy = #463; /* Part of DP_QC_STRINGBUFFERS*/ +void(float bufhandle, float sortpower, float backward) buf_sort = #464; /* Part of DP_QC_STRINGBUFFERS*/ +string(float bufhandle, string glue) buf_implode = #465; /* Part of DP_QC_STRINGBUFFERS*/ +string(float bufhandle, float string_index) bufstr_get = #466; /* Part of DP_QC_STRINGBUFFERS*/ +void(float bufhandle, float string_index, string str) bufstr_set = #467; /* Part of DP_QC_STRINGBUFFERS*/ +float(float bufhandle, string str, float order) bufstr_add = #468; /* Part of DP_QC_STRINGBUFFERS*/ +void(float bufhandle, float string_index) bufstr_free = #469; /* Part of DP_QC_STRINGBUFFERS*/ +float(float s) asin = #471; /* Part of DP_QC_ASINACOSATANATAN2TAN*/ +float(float c) acos = #472; /* Part of DP_QC_ASINACOSATANATAN2TAN*/ +float(float t) atan = #473; /* Part of DP_QC_ASINACOSATANATAN2TAN*/ +float(float c, float s) atan2 = #474; /* Part of DP_QC_ASINACOSATANATAN2TAN*/ +float(float a) tan = #475; /* Part of DP_QC_ASINACOSATANATAN2TAN*/ +float(string s) strlennocol = #476; /* Part of DP_QC_STRINGCOLORFUNCTIONS*/ +string(string s) strdecolorize = #477; /* Part of DP_QC_STRINGCOLORFUNCTIONS*/ +string(float uselocaltime, string format, ...) strftime = #478; /* Part of DP_QC_STRFTIME*/ +float(string s, string separator1, ...) tokenizebyseparator = #479; /* Part of DP_QC_TOKENIZEBYSEPARATOR*/ +string(string s) strtolower = #480; /* Part of DP_QC_STRING_CASE_FUNCTIONS*/ +string(string s) strtoupper = #481; /* Part of DP_QC_STRING_CASE_FUNCTIONS*/ +string(string s) cvar_defstring = #482; /* Part of DP_QC_CVAR_DEFSTRING*/ #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 -string(string search, string replace, string subject) strreplace = #484; -string(string search, string replace, string subject) strireplace = #485; -vector(entity e, float s, float n, float a) getsurfacepointattribute = #486; +string(string search, string replace, string subject) strreplace = #484; /* Part of DP_QC_STRREPLACE*/ +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; /* Part of DP_QC_GETSURFACEPOINTATTRIBUTE*/ #ifdef CSQC -float(string name) gecko_create = #487; -void(string name) gecko_destroy = #488; -void(string name, string URI) gecko_navigate = #489; -float(string name, float key, float eventtype) gecko_keyevent = #490; -void(string name, float x, float y) gecko_mousemove = #491; -void(string name, float w, float h) gecko_resize = #492; -vector(string name) gecko_get_texture_extent = #493; +float(string name) gecko_create = #487; /* Part of DP_GECKO_SUPPORT*/ +void(string name) gecko_destroy = #488; /* Part of DP_GECKO_SUPPORT*/ +void(string name, string URI) gecko_navigate = #489; /* Part of DP_GECKO_SUPPORT*/ +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; /* Part of DP_GECKO_SUPPORT*/ +void(string name, float w, float h) gecko_resize = #492; /* Part of DP_GECKO_SUPPORT*/ +vector(string name) gecko_get_texture_extent = #493; /* Part of DP_GECKO_SUPPORT*/ #endif -float(float caseinsensitive, string s, ...) crc16 = #494; -float(string name) cvar_type = #495; -//float() numentityfields = #496; -//string(float fieldnum) entityfieldname = #497; -//float(float fieldnum) entityfieldtype = #498; -//string(float fieldnum, entity ent) getentityfieldstring = #499; -//float(float fieldnum, entity ent, string s) putentityfieldstring = #500; -//void(float to, string s, float sz) WritePicture = #501; +float(float caseinsensitive, string s, ...) crc16 = #494; /* Part of DP_QC_CRC16*/ +float(string name) cvar_type = #495; /* Part of DP_QC_CVAR_TYPE*/ +float() numentityfields = #496; /* Part of DP_QC_ENTITYDATA*/ +string(float fieldnum) entityfieldname = #497; /* Part of DP_QC_ENTITYDATA*/ +float(float fieldnum) entityfieldtype = #498; /* Part of DP_QC_ENTITYDATA*/ +string(float fieldnum, entity ent) getentityfieldstring = #499; /* Part of DP_QC_ENTITYDATA*/ +float(float fieldnum, entity ent, string s) putentityfieldstring = #500; /* Part of DP_QC_ENTITYDATA*/ +//void(float to, string s, float sz) WritePicture = #501; /* Part of DP_SV_WRITEPICTURE*/ //string() ReadPicture = #501; -string(string filename) whichpack = #503; +string(string filename) whichpack = #503; /* Part of DP_QC_WHICHPACK*/ #ifdef CSQC __variant(float entnum, float fieldnum) getentity = #504; #endif -string(string in) uri_escape = #510; -string(string in) uri_unescape = #511; +string(string in) uri_escape = #510; /* Part of DP_QC_URI_ESCAPE*/ +string(string in) uri_unescape = #511; /* Part of DP_QC_URI_ESCAPE*/ 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_end_index = #516; string(string cvarname) cvar_description = #518; @@ -697,14 +623,11 @@ float(optional float timetype) gettime = #519; #endif void(string s) loadfromdata = #529; void(string s) loadfromfile = #530; -#ifdef SSQC -float(string mname) precache_vwep_model = #532; -#endif void(.../*, string funcname*/) callfunction = #605; void(float fh, entity e) writetofile = #606; float(string s) isfunction = #607; void(entity e, string s) parseentitydata = #608; -string(...) sprintf = #627; +string(string fmt, ...) sprintf = #627; float(entity e, float s) getsurfacenumtriangles = #628; vector(entity e, float s, float n) getsurfacetriangle = #629; #pragma noref 0 diff --git a/quakec/csaddon/src/editor_lights.qc b/quakec/csaddon/src/editor_lights.qc index 09f2d9c54..4cb432751 100644 --- a/quakec/csaddon/src/editor_lights.qc +++ b/quakec/csaddon/src/editor_lights.qc @@ -3,10 +3,15 @@ /*you probably want to change this if you're running hexen2*/ 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 editfield; static string editvalue; static entity tempent; +static float helphidden; void() editor_lights_add = { float l; @@ -35,7 +40,8 @@ void() editor_lights_add = }; #define NUMLFIELDS 14 -static string fldname[NUMLFIELDS+1] = { "bad", +#define NUMCMDS 7 +static string fldname[NUMLFIELDS+1+NUMCMDS] = { "bad", " num", " org", " rgb", @@ -49,7 +55,15 @@ static string fldname[NUMLFIELDS+1] = { "bad", " csc", " amb", " dif", - " spc" + " spc", + + "Save", + "World Lights", + "Dynamic Lights", + "Toggle Help", + "Wipe All", + "Import", + "Reload" }; 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); } - 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) { - 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, "w: realtime world lights mode\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+=1; - 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, "c: does not cast shadows\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+=1; - 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, "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+=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+=1i; + 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+=1i; + 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+=1i; } 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, "mouse also selects lights\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+=1; - 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, "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, "[ 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, "don't forget to save\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+=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+=1i; + 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, "@ changes the light's radius\n", '8 8 0', '1 1 1', 1); i+=1i; + 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, "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 o = unproject(m); string ns; - if (keyc == 512) + if (keyc == 512 || (!editfield && unic == 13 && m_x < 64)) { if (editfield) { @@ -242,12 +274,40 @@ float(float keyc, float unic, vector m) editor_lights_key = editfield = 0; } 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; 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 editvalue = strzone(readfield(editfield, 1)); } @@ -277,27 +337,27 @@ float(float keyc, float unic, vector m) editor_lights_key = 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)); } - else if (keyc == '=') + else if (unic == '=') selectedlight++; - else if (keyc == '-') + else if (unic == '-') selectedlight--; - else if (keyc == 'n') + else if (unic == 'n' || unic == 'N') localcmd("noclip\n"); -// else if (keyc == 's') +// else if (unic == 's' || unic == 'S') // { // selectbestlight(t - o, o); // } - else if (keyc == 'm') + else if (unic == 'm' || unic == 'M') { traceline(o, t, TRUE, world); 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); 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); /*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); } - else if (keyc == 'i') + else if (unic == 'i' || unic == 'I') { 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_ANGLES, '0 0 0'); 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*/ 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); traceline(o, t, TRUE, world); dynamiclight_set(selectedlight, LFIELD_ORIGIN, dynamiclight_get(selectedlight, LFIELD_ORIGIN) - trace_plane_normal); } - else if (keyc == ']') + else if (unic == ']') { o = getproperty(11); traceline(o, t, TRUE, world); 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); else return FALSE; diff --git a/quakec/csaddon/src/editor_terrain.qc b/quakec/csaddon/src/editor_terrain.qc index d6316b107..690b0c21b 100644 --- a/quakec/csaddon/src/editor_terrain.qc +++ b/quakec/csaddon/src/editor_terrain.qc @@ -17,27 +17,31 @@ enum ter_water_set = 14, //lower the terrain in a bell (negative value to raise) ter_mesh_add = 15, //add a mesh 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_radius, ter_quant, ter_strength, ter_mesh, + ter_tintval, ter_tex, ter_count }; static var float eradius = 256; static var float equant = 8; -static var float epercent = 80; +static var float epercent = 40; 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 float curtool; static int painttex; static float mautorepeattime; static entity tempent; +float autocvar_mod_terrain_networked; + vector vidsize; float mousedown; @@ -60,6 +64,7 @@ static string toolname[ter_count] = "water set", "mesh add", "mesh kill", + "mesh tint", "", "rad", "quant", @@ -80,25 +85,46 @@ void(vector m) editor_do = t = o + normalize(t)*8192; traceline(o, t, TRUE, world); + self = world; + switch(curtool) { case ter_reload: case ter_save: mautorepeattime = 0; //don't autorepeat that... - terrain_edit(curtool); + 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); + } break; case ter_sethole: //use view center instead of targetted - you cannot target that which is not there - terrain_edit(curtool, trace_endpos, eradius, equant); + if (autocvar_mod_terrain_networked) + sendevent("teredit", "fvff", curtool, trace_endpos, eradius, equant); + else + terrain_edit(curtool, trace_endpos, eradius, equant); break; case ter_height_smooth: - terrain_edit(curtool, trace_endpos, eradius, epercent/100.0); + 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); break; case ter_height_set: case ter_height_smooth: case ter_height_raise: case ter_height_lower: - terrain_edit(curtool, trace_endpos, eradius, equant); + if (autocvar_mod_terrain_networked) + sendevent("teredit", "fvff", curtool, trace_endpos, eradius, equant); + else + terrain_edit(curtool, trace_endpos, eradius, equant); break; case ter_tex_get: strunzone(tex[0]); @@ -114,22 +140,41 @@ void(vector m) editor_do = // terrain_edit(curtool, trace_endpos, eradius, equant, emix); // break; case ter_mixpaint: - terrain_edit(curtool, trace_endpos, eradius, epercent/100.0, tex[painttex]); + 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]); break; case ter_tex_kill: - terrain_edit(curtool, trace_endpos, eradius, equant, tex[painttex]); + 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]); break; case ter_mixconcentrate: case ter_mixnoise: case ter_mixblur: - terrain_edit(curtool, trace_endpos, eradius, equant); + if (autocvar_mod_terrain_networked) + sendevent("teredit", "fvff", curtool, trace_endpos, eradius, equant); + else + terrain_edit(curtool, trace_endpos, eradius, equant); + 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: terrain_edit(curtool, tempent); break; case ter_mesh_kill: - terrain_edit(curtool, trace_endpos, eradius); + if (autocvar_mod_terrain_networked) + sendevent("teredit", "fvf", curtool, trace_endpos, eradius); + else + terrain_edit(curtool, trace_endpos, eradius); break; } }; @@ -148,11 +193,20 @@ float(float keyc, float unic, vector m) editor_terrain_key = txt = itos((int)epercent); if (curtool == ter_mesh) txt = meshname; + if (curtool == ter_tintval) + txt = tint[painttex]; if (curtool == ter_tex) txt = tex[painttex]; if (keyc == 10 || keyc == 13) - nt = ter_mixpaint; + { + if (curtool == ter_mesh) + nt = ter_mesh_add; + else if (curtool == ter_tintval) + nt = ter_tint; + else + nt = ter_mixpaint; + } else if (keyc == 127) txt = substring(txt, 0, -2); else if (keyc == 8) @@ -178,6 +232,12 @@ float(float keyc, float unic, vector m) editor_terrain_key = strunzone(tex[painttex]); tex[painttex] = txt; } + if (curtool == ter_tintval) + { + txt = strzone(txt); + strunzone(tint[painttex]); + tint[painttex] = txt; + } curtool = nt; } @@ -222,7 +282,6 @@ float(float keyc, float unic, vector m) editor_terrain_key = } else return FALSE; - return TRUE; } else if (unic == '[') equant -= 1; @@ -250,6 +309,12 @@ float(float keyc, float unic, vector m) editor_terrain_key = painttex = 7; else return FALSE; + + if (curtool == ter_save || curtool == ter_reload) + { + editor_do('0 0 0'); + curtool = -1; + } 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); } + else if (i == ter_tintval) + drawstring(pos, sprintf("Tint%1i: %s", painttex, tint[painttex]), '8 8 0', colour, 1, 0); else drawstring(pos, toolname[i], '8 8 0', colour, 1, 0); pos_y += 8; diff --git a/quakec/csaddon/src/menu.qc b/quakec/csaddon/src/menu.qc index a5420bf9d..86e6a0980 100644 --- a/quakec/csaddon/src/menu.qc +++ b/quakec/csaddon/src/menu.qc @@ -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) { - col_x = (sin(time*3.14)+1) / 2; + col_x = (sin(cltime*3.14)+1) / 2; col_y = col_x; 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); if (!(menu->flags & MF_DS_VALUE)) 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); } 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) { - col_x = (sin(time*3.14)+1) / 2; + col_x = (sin(cltime*3.14)+1) / 2; col_y = col_x; 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) { - col_x = (sin(time*3.14)+1) / 2; + col_x = (sin(cltime*3.14)+1) / 2; col_y = col_x; 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) { - col_x = (sin(time*3.14)+1) / 2; + col_x = (sin(cltime*3.14)+1) / 2; col_y = col_x; 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) { - col_x = (sin(time*3.14)+1) / 2; + col_x = (sin(cltime*3.14)+1) / 2; col_y = col_x; 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) { - col_x = (sin(time*3.14)+1) / 2; + col_x = (sin(cltime*3.14)+1) / 2; col_y = col_x; col_z = 1; }