m32script: stuff for fiddling with polymer lights

git-svn-id: https://svn.eduke32.com/eduke32@1521 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2009-10-03 13:20:31 +00:00
parent 540962f35c
commit 40d655100c
5 changed files with 39 additions and 3 deletions

View file

@ -94,6 +94,7 @@ enum GameEvent_t {
EVENT_KEYS2D, EVENT_KEYS2D,
EVENT_KEYS3D, EVENT_KEYS3D,
EVENT_OVERHEADEDITOR, EVENT_OVERHEADEDITOR,
EVENT_PREKEYS3D,
MAXEVENTS MAXEVENTS
}; };

View file

@ -4504,6 +4504,8 @@ static void Keys3d(void)
enddrawing(); enddrawing();
} }
X_OnEvent(EVENT_PREKEYS3D, -1);
if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_V]) // ' V if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_V]) // ' V
{ {
keystatus[KEYSC_V] = 0; keystatus[KEYSC_V] = 0;

View file

@ -246,6 +246,7 @@ const char *keyw[] =
"displayrand", "displayrand",
"clamp",
"inv", // inversion function.. not internal "inv", // inversion function.. not internal
"sqrt", "sqrt",
"mulscale", "mulscale",
@ -306,6 +307,7 @@ const char *keyw[] =
"ifoutside", "ifoutside",
// BUILD functions // BUILD functions
"resetkey",
"insertsprite", "insertsprite",
"dupsprite", "dupsprite",
"deletesprite", "deletesprite",
@ -342,6 +344,7 @@ const char *keyw[] =
"definequote", "definequote",
"redefinequote", "redefinequote",
"print",
"quote", "quote",
"error", "error",
"printmessage16", "printmessage16",
@ -2516,6 +2519,11 @@ repeatcase:
break; break;
// *** other math // *** other math
case CON_CLAMP:
C_GetNextVarType(GAMEVAR_READONLY);
C_GetManyVars(2);
return 0;
case CON_INV: case CON_INV:
C_GetNextVarType(GAMEVAR_READONLY); C_GetNextVarType(GAMEVAR_READONLY);
return 0; return 0;
@ -2699,6 +2707,7 @@ repeatcase:
} }
// *** BUILD functions // *** BUILD functions
case CON_RESETKEY:
case CON_INSERTSPRITE: case CON_INSERTSPRITE:
case CON_DUPSPRITE: case CON_DUPSPRITE:
case CON_DELETESPRITE: case CON_DELETESPRITE:
@ -2876,6 +2885,7 @@ repeatcase:
} }
return 0; return 0;
case CON_PRINT:
case CON_QUOTE: case CON_QUOTE:
case CON_ERRORINS: case CON_ERRORINS:
case CON_PRINTMESSAGE16: case CON_PRINTMESSAGE16:
@ -3079,6 +3089,7 @@ static void C_AddDefaultDefinitions(void)
C_AddDefinition("EVENT_KEYS2D", EVENT_KEYS2D, LABEL_EVENT); C_AddDefinition("EVENT_KEYS2D", EVENT_KEYS2D, LABEL_EVENT);
C_AddDefinition("EVENT_KEYS3D", EVENT_KEYS3D, LABEL_EVENT); C_AddDefinition("EVENT_KEYS3D", EVENT_KEYS3D, LABEL_EVENT);
C_AddDefinition("EVENT_OVERHEADEDITOR", EVENT_OVERHEADEDITOR, LABEL_EVENT); C_AddDefinition("EVENT_OVERHEADEDITOR", EVENT_OVERHEADEDITOR, LABEL_EVENT);
C_AddDefinition("EVENT_PREKEYS3D", EVENT_PREKEYS3D, LABEL_EVENT);
C_AddDefinition("CLIPMASK0", CLIPMASK0, LABEL_DEFINE); C_AddDefinition("CLIPMASK0", CLIPMASK0, LABEL_DEFINE);
C_AddDefinition("CLIPMASK1", CLIPMASK1, LABEL_DEFINE); C_AddDefinition("CLIPMASK1", CLIPMASK1, LABEL_DEFINE);

View file

@ -308,6 +308,7 @@ enum ScriptKeywords_t
CON_DISPLAYRAND, CON_DISPLAYRAND,
// other math // other math
CON_CLAMP,
CON_INV, CON_INV,
CON_SQRT, CON_SQRT,
CON_MULSCALE, CON_MULSCALE,
@ -382,6 +383,7 @@ enum ScriptKeywords_t
/// CON_IFNOSOUNDS, /// CON_IFNOSOUNDS,
// BUILD functions // BUILD functions
CON_RESETKEY,
CON_INSERTSPRITE, CON_INSERTSPRITE,
CON_DUPSPRITE, CON_DUPSPRITE,
CON_DELETESPRITE, CON_DELETESPRITE,
@ -420,6 +422,7 @@ enum ScriptKeywords_t
// strings // strings
CON_DEFINEQUOTE, CON_DEFINEQUOTE,
CON_REDEFINEQUOTE, CON_REDEFINEQUOTE,
CON_PRINT,
CON_QUOTE, CON_QUOTE,
CON_ERRORINS, CON_ERRORINS,
CON_PRINTMESSAGE16, CON_PRINTMESSAGE16,

View file

@ -823,6 +823,17 @@ skip_check:
continue; continue;
// *** other math // *** other math
case CON_CLAMP:
insptr++;
{
int32_t var=*insptr++, min=Gv_GetVarX(*insptr++), max=Gv_GetVarX(*insptr++);
int32_t val=Gv_GetVarX(var);
if (val<min) Gv_SetVarX(var, min);
else if (val>max) Gv_SetVarX(var, max);
}
continue;
case CON_INV: case CON_INV:
Gv_SetVarX(*(insptr+1), -Gv_GetVarX(*(insptr+1))); Gv_SetVarX(*(insptr+1), -Gv_GetVarX(*(insptr+1)));
insptr += 2; insptr += 2;
@ -1334,6 +1345,7 @@ badindex:
case CON_IFHITKEY: case CON_IFHITKEY:
case CON_IFHOLDKEY: case CON_IFHOLDKEY:
case CON_RESETKEY:
insptr++; insptr++;
{ {
int32_t key=Gv_GetVarX(*insptr); int32_t key=Gv_GetVarX(*insptr);
@ -1343,9 +1355,13 @@ badindex:
vm.g_errorFlag = 1; vm.g_errorFlag = 1;
continue; continue;
} }
X_DoConditional(keystatus[key]);
if (tw==CON_IFHITKEY) if (tw != CON_RESETKEY)
X_DoConditional(keystatus[key]);
else
insptr++;
if (tw != CON_IFHOLDKEY)
{ {
if (!(key==0 || key==KEYSC_ESC || key==KEYSC_TILDE || key==KEYSC_gENTER || if (!(key==0 || key==KEYSC_ESC || key==KEYSC_TILDE || key==KEYSC_gENTER ||
key==KEYSC_LALT || key==KEYSC_RALT || key==KEYSC_LCTRL || key==KEYSC_RCTRL || key==KEYSC_LALT || key==KEYSC_RALT || key==KEYSC_LCTRL || key==KEYSC_RCTRL ||
@ -2027,6 +2043,7 @@ badindex:
} }
continue; continue;
case CON_PRINT:
case CON_QUOTE: case CON_QUOTE:
case CON_ERRORINS: case CON_ERRORINS:
case CON_PRINTMESSAGE16: case CON_PRINTMESSAGE16:
@ -2046,6 +2063,8 @@ badindex:
X_ERROR_INVALIDQUOTE(i, ScriptQuotes); X_ERROR_INVALIDQUOTE(i, ScriptQuotes);
if (tw==CON_PRINT)
OSD_Printf("%s\n", ScriptQuotes[i]);
if (tw==CON_QUOTE) if (tw==CON_QUOTE)
message("%s", ScriptQuotes[i]); message("%s", ScriptQuotes[i]);
else if (tw==CON_PRINTMESSAGE16) else if (tw==CON_PRINTMESSAGE16)