diff --git a/src/scripting/codegeneration/codegen.cpp b/src/scripting/codegeneration/codegen.cpp index d87e601ff..37ff715dd 100644 --- a/src/scripting/codegeneration/codegen.cpp +++ b/src/scripting/codegeneration/codegen.cpp @@ -676,7 +676,7 @@ FxExpression *FxBoolCast::Resolve(FCompileContext &ctx) delete this; return x; } - else if (basex->ValueType->GetRegType() == REGT_INT || basex->ValueType->GetRegType() == REGT_FLOAT || basex->ValueType->GetRegType() == REGT_POINTER) + else if ((basex->ValueType->GetRegType() == REGT_INT || basex->ValueType->GetRegType() == REGT_FLOAT || basex->ValueType->GetRegType() == REGT_POINTER) && !basex->IsVector()) { if (basex->isConstant()) { @@ -797,7 +797,7 @@ FxExpression *FxIntCast::Resolve(FCompileContext &ctx) return x; } } - else if (basex->ValueType->GetRegType() == REGT_FLOAT) + else if (basex->ValueType->GetRegType() == REGT_FLOAT && !basex->IsVector()) { if (basex->isConstant()) { @@ -875,7 +875,7 @@ FxExpression *FxFloatCast::Resolve(FCompileContext &ctx) CHECKRESOLVED(); SAFE_RESOLVE(basex, ctx); - if (basex->ValueType->GetRegType() == REGT_FLOAT) + if (basex->ValueType->GetRegType() == REGT_FLOAT && !basex->IsVector()) { FxExpression *x = basex; basex = NULL; @@ -1095,11 +1095,11 @@ ExpEmit FxStringCast::Emit(VMFunctionBuilder *build) from.Free(build); ExpEmit to(build, REGT_STRING); - if (ValueType == TypeName) + if (basex->ValueType == TypeName) { build->Emit(OP_CAST, to.RegNum, from.RegNum, CAST_N2S); } - else if (ValueType == TypeSound) + else if (basex->ValueType == TypeSound) { build->Emit(OP_CAST, to.RegNum, from.RegNum, CAST_So2S); } @@ -1325,7 +1325,7 @@ FxExpression *FxTypeCast::Resolve(FCompileContext &ctx) { goto basereturn; } - else if (ValueType->GetRegType() == REGT_FLOAT) + else if (ValueType->GetRegType() == REGT_FLOAT && !IsVector()) { FxExpression *x = new FxFloatCast(basex); x = x->Resolve(ctx); @@ -4867,6 +4867,7 @@ ExpEmit FxLocalVariable::Emit(VMFunctionBuilder *build) } + //========================================================================== // // @@ -7671,11 +7672,17 @@ ExpEmit FxLocalVariableDeclaration::Emit(VMFunctionBuilder *build) } emitval.Free(build); } - else + else if (Init->ExprType != EFX_LocalVariable) { // take over the register that got allocated while emitting the Init expression. RegNum = emitval.RegNum; } + else + { + ExpEmit out(build, emitval.RegType, emitval.RegCount); + build->Emit(ValueType->GetMoveOp(), out.RegNum, emitval.RegNum); + RegNum = out.RegNum; + } } return ExpEmit(); } diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 3ab33bfd9..6de64d07e 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -177,5 +177,3 @@ zscript/chex/chexweapons.txt zscript/chex/chexitems.txt zscript/chex/chexdecorations.txt zscript/chex/chexplayer.txt - -zscript/test2.txt diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 363036507..18f0facd0 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -53,6 +53,7 @@ class Actor : Thinker native return GetPointer(ptr_select1) == GetPointer(ptr_select2); } + native void SetOrigin(vector3 newpos, bool moving); native Actor GetPointer(int aaptr); native Actor SpawnMissile(Actor dest, class type, Actor owner = null); native void TraceBleed(int damage, Actor missile); @@ -296,7 +297,7 @@ class Actor : Thinker native deprecated native void A_PlaySoundEx(sound whattoplay, name slot, bool looping = false, int attenuation = 0); deprecated native void A_StopSoundEx(name slot); native void A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10); - native state A_Jump(int chance = 256, state label, ...); + native state A_Jump(int chance, state label, ...); native void A_CustomMissile(class missiletype, float spawnheight = 32, float spawnofs_xy = 0, float angle = 0, int flags = 0, float pitch = 0, int ptr = AAPTR_TARGET); native void A_CustomBulletAttack(float spread_xy, float spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", float range = 0, int flags = 0, int ptr = AAPTR_TARGET, class missile = null, float Spawnheight = 32, float Spawnofs_xy = 0); native void A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = 0, color color2 = 0, int flags = 0, int aim = 0, float maxdiff = 0, class pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class spawnclass = null, float spawnofs_z = 0, int spiraloffset = 270, int limit = 0);