[Scummvm-git-logs] scummvm master -> 74f20c23e1a2bee93ba467f66ebd2dd0cba4a8e9

criezy criezy at scummvm.org
Tue Apr 6 23:01:39 UTC 2021


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
fdadacfac1 AGS: Fix passing arguments to ags_pal_render plugins
74f20c23e1 AGS: Fix memory issue in ags_pal_render DoFire


Commit: fdadacfac1608a86db793d2b84d16489ab973256
    https://github.com/scummvm/scummvm/commit/fdadacfac1608a86db793d2b84d16489ab973256
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-04-07T00:01:23+01:00

Commit Message:
AGS: Fix passing arguments to ags_pal_render plugins

Changed paths:
    engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
    engines/ags/plugins/ags_pal_render/pal_render.h
    engines/ags/plugins/ags_pal_render/raycast.cpp
    engines/ags/plugins/ags_pal_render/raycast.h


diff --git a/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp b/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
index 146d6443e6..7d53e5c24a 100644
--- a/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
+++ b/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
@@ -136,21 +136,25 @@ BITMAP *backgroundimage;
 PALSTRUCT objectivepal[256];
 int bgimgspr;
 
-void WriteObjectivePalette(unsigned char index, unsigned char r, unsigned char b, unsigned char g) {
+void WriteObjectivePalette(ScriptMethodParams &params) {
+	PARAMS4(unsigned char, index, unsigned char, r, unsigned char, b, unsigned char, g);
 	objectivepal[index].r = r;
 	objectivepal[index].b = b;
 	objectivepal[index].g = g;
 }
 
-int ReadObjectivePaletteR(unsigned char index) {
-	return objectivepal[index].r;
+void ReadObjectivePaletteR(ScriptMethodParams &params) {
+	PARAMS1(unsigned char, index);
+	params._result = (int)objectivepal[index].r;
 }
 
-int ReadObjectivePaletteB(unsigned char index) {
-	return objectivepal[index].b;
+void ReadObjectivePaletteB(ScriptMethodParams &params) {
+	PARAMS1(unsigned char, index);
+	params._result = (int)objectivepal[index].b;
 }
-int ReadObjectivePaletteG(unsigned char index) {
-	return objectivepal[index].g;
+void ReadObjectivePaletteG(ScriptMethodParams &params) {
+	PARAMS1(unsigned char, index);
+	params._result = (int)objectivepal[index].g;
 }
 
 
@@ -184,8 +188,8 @@ void PreMultiply_Alphas () //Ha ha, this isn't the kind of premultiplcation you'
 }
 */
 
-int GetModifiedBackgroundImage() {
-	return bgimgspr;
+void GetModifiedBackgroundImage(ScriptMethodParams &params) {
+	params._result = bgimgspr;
 }
 
 unsigned short root(unsigned short x) {
@@ -234,16 +238,24 @@ float FastCos(float x) {
 	return FastSin(x + halfpi);
 }
 
-FLOAT_RETURN_TYPE AGSFastSin(SCRIPT_FLOAT(x)) {
-	INIT_SCRIPT_FLOAT(x);
+void AGSFastRoot(ScriptMethodParams &params) {
+	PARAMS1(unsigned short, x);
+	x = root(x);
+	params._result = (int)x;
+}
+
+void AGSFastSin(ScriptMethodParams &params) {
+	PARAMS1(int32, xi);
+	float x = PARAM_TO_FLOAT(xi);
 	x = FastSin(x);
-	RETURN_FLOAT(x);
+	params._result = PARAM_FROM_FLOAT(x);
 }
 
-FLOAT_RETURN_TYPE AGSFastCos(SCRIPT_FLOAT(x)) {
-	INIT_SCRIPT_FLOAT(x);
+void AGSFastCos(ScriptMethodParams &params) {
+	PARAMS1(int32, xi);
+	float x = PARAM_TO_FLOAT(xi);
 	x = FastSin(x + halfpi);
-	RETURN_FLOAT(x);
+	params._result = PARAM_FROM_FLOAT(x);
 }
 
 
@@ -302,47 +314,56 @@ void DrawLens(int ox, int oy) {
 	engine->FreeBitmap(lenswrite);
 }
 
-void SetLensPos(int x, int y) {
+void SetLensPos(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
 	LensOption.x = x;
 	LensOption.y = y;
 }
 
-int GetLensX() {
-	return LensOption.x;
+void GetLensX(ScriptMethodParams &params) {
+	params._result = LensOption.x;
 }
 
-int GetLensY() {
-	return LensOption.y;
+void GetLensY(ScriptMethodParams &params) {
+	params._result =  LensOption.y;
 }
 
-void SetLensDrawn(int toggle) {
+void SetLensDrawn(ScriptMethodParams &params) {
+	PARAMS1(int, toggle);
 	if (toggle > 0) LensOption.draw = 1;
 	else LensOption.draw = 0;
 }
 
-int GetLensDrawn() {
-	return LensOption.draw;
+void GetLensDrawn(ScriptMethodParams &params) {
+	params._result = LensOption.draw;
 }
 
-void SetLensOffsetClamp(int clamp) {
+void SetLensOffsetClamp(ScriptMethodParams &params) {
+	PARAMS1(int, clamp);
 	if (clamp < 0) LensOption.clampoffset = LensOption.lenswidth;
 	else LensOption.clampoffset = clamp;
 }
 
-int GetLensOffsetClamp() {
-	return LensOption.clampoffset;
+void GetLensOffsetClamp(ScriptMethodParams &params) {
+	params._result = LensOption.clampoffset;
 }
 
-int GetLensLevel() {
-	return LensOption.level;
+void GetLensLevel(ScriptMethodParams &params) {
+	params._result = LensOption.level;
 }
 
-void SetLensLevel(int level) {
+void SetLensLevel(ScriptMethodParams &params) {
+	PARAMS1(int, level);
 	if (level < 0 || level > 4) engine->AbortGame("SetLensLevel: Invalid level.");
 	else LensOption.level = level;
 }
 
-void LensInitialize(int width, int zoom, int lensx, int lensy, int level, int clamp = -1) {
+void LensInitialize(ScriptMethodParams &params) {
+	PARAMS5(int, width, int, zoom, int, lensx, int, lensy, int, level);
+	int clamp = -1;
+	if (params.size() > 5)
+		clamp = (int)params[5];
+
 	int32 sw, sh, radius;
 	if (width < 1) engine->AbortGame("Invalid lens dimension!");
 	radius = width >> 1;
@@ -383,7 +404,7 @@ void LensInitialize(int width, int zoom, int lensx, int lensy, int level, int cl
 	else LensOption.level = level;
 }
 
-void ResetRemapping() {
+void ResetRemapping(ScriptMethodParams &) {
 	for (int j = 0; j < 256; ++j) {
 		cycle_remap [j] = j;
 	}
@@ -397,16 +418,18 @@ int plasmadata3 [MAX_PLASMA_COMPLEXITY];
 int plasmaroottype;
 
 
-void SetPlasmaRootType(int real) {
+void SetPlasmaRootType(ScriptMethodParams &params) {
+	PARAMS1(int, real);
 	if (real) plasmaroottype = 1;
 	else plasmaroottype = 0;
 }
 
-int GetPlasmaRootType() {
-	return plasmaroottype;
+void GetPlasmaRootType(ScriptMethodParams &params) {
+	params._result = plasmaroottype;
 }
 
-void SetPlasmaType(int component, int type, int data, int data2, int data3) {
+void SetPlasmaType(ScriptMethodParams &params) {
+	PARAMS5(int, component, int, type, int, data, int, data2, int, data3);
 	if (component >= MAX_PLASMA_COMPLEXITY) engine->AbortGame("Plasma too complex!");
 	else {
 		plasmatype [component] = type;
@@ -422,7 +445,7 @@ void SetPlasmaType(int component, int type, int data, int data2, int data3) {
 	//4 = Diagonal Bars (data=width)
 }
 
-void ResetPlasmaSettings() {
+void ResetPlasmaSettings(ScriptMethodParams &) {
 	int i = 0;
 	while (i < MAX_PLASMA_COMPLEXITY) {
 		plasmatype [i] = 0;
@@ -433,7 +456,8 @@ void ResetPlasmaSettings() {
 	}
 }
 
-void DrawPlasma(int slot, int palstart, int palend) {
+void DrawPlasma(ScriptMethodParams &params) {
+	PARAMS3(int, slot, int, palstart, int, palend);
 	BITMAP *plasmaspr = engine->GetSpriteGraphic(slot);
 	if (!plasmaspr) engine->AbortGame("Plasma: Not a sprite I can load.");
 	int32 w, h, basecol, range = 0;
@@ -481,7 +505,8 @@ void DrawPlasma(int slot, int palstart, int palend) {
 	engine->NotifySpriteUpdated(slot);
 }
 
-void DoFire(int spriteId, int masksprite, int palstart, int palend, int strength, int seed, int cutoff, int windspeed) {
+void DoFire(ScriptMethodParams &params) {
+	PARAMS8(int, spriteId, int, masksprite, int, palstart, int, palend, int, strength, int, seed, int, cutoff, int, windspeed);
 	BITMAP *firespr = engine->GetSpriteGraphic(masksprite);
 	BITMAP *firecolorspr = engine->GetSpriteGraphic(spriteId);
 	BITMAP *seedspr;
@@ -623,7 +648,8 @@ unsigned char MixColorAdditive (unsigned char fg,unsigned char bg,unsigned char
     return result;
 }
 */
-unsigned char GetColor565(unsigned char r, unsigned char g, unsigned char b) {
+void GetColor565(ScriptMethodParams &params) {
+	PARAMS3(unsigned char, r, unsigned char, g, unsigned char, b);
 	//BITMAP *clutspr = engine->GetSpriteGraphic (clutslot);
 	//if (!clutspr) engine->AbortGame ("MixColorAlpha: Can't load CLUT sprite into memory.");
 	//uint8 *clutarray = engine->GetRawBitmapSurface (clutspr);
@@ -632,10 +658,11 @@ unsigned char GetColor565(unsigned char r, unsigned char g, unsigned char b) {
 	unsigned char result = *(clutp + i);
 	result = cycle_remap [result]; //Once again, to make sure that the palette slot used is the right one.
 	//engine->ReleaseBitmapSurface (clutspr);
-	return result;
+	params._result = (int)result;
 }
 
-void CycleRemap(int start, int end) {
+void CycleRemap(ScriptMethodParams &params) {
+	PARAMS2(int, start, int, end);
 	if (end > start) {
 		// Rotate left
 		int wraparound = cycle_remap [start];
@@ -654,12 +681,17 @@ void CycleRemap(int start, int end) {
 	}
 }
 
-unsigned char GetRemappedSlot(unsigned char slot) {
-	return cycle_remap [slot];
+void GetRemappedSlot(ScriptMethodParams &params) {
+	PARAMS1(unsigned char, slot);
+	params._result = cycle_remap [slot];
 }
 
-int LoadCLUT(int slot) {
-	if (engine->GetSpriteWidth(slot) != 256 || engine->GetSpriteHeight(slot) != 256) return 1;
+void LoadCLUT(ScriptMethodParams &params) {
+	PARAMS1(int, slot);
+	if (engine->GetSpriteWidth(slot) != 256 || engine->GetSpriteHeight(slot) != 256) {
+		params._result = 1;
+		return;
+	};
 	BITMAP *clutimage = engine->GetSpriteGraphic(slot);
 	uint8 *clutarray = engine->GetRawBitmapSurface(clutimage);
 	int pitch = engine->GetBitmapPitch(clutimage);
@@ -670,18 +702,20 @@ int LoadCLUT(int slot) {
 	}
 	clutslot = slot;
 	engine->ReleaseBitmapSurface(clutimage);
-	return 0;
+	params._result = 0;
 }
 
-void SetReflections(int toggle) {
+void SetReflections(ScriptMethodParams &params) {
+	PARAMS1(int, toggle);
 	drawreflections = toggle;
 }
 
-int IsReflectionsOn() {
-	return drawreflections;
+void IsReflectionsOn(ScriptMethodParams &params) {
+	params._result = drawreflections;
 }
 
-int GetLuminosityFromPalette(int slot) {
+void GetLuminosityFromPalette(ScriptMethodParams &params) {
+	PARAMS1(int, slot);
 	AGSColor *pal = engine->GetPalette();
 	int lum = (pal[slot].r +
 	           pal[slot].r +
@@ -691,16 +725,18 @@ int GetLuminosityFromPalette(int slot) {
 	           pal[slot].g +
 	           pal[slot].g +
 	           pal[slot].b) >> 3;
-	return lum;
+	params._result = lum;
 }
 
 
 
-void SetStarsOriginPoint(int x, int y) {
+void SetStarsOriginPoint(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
 	Starfield.originx = x;
 	Starfield.originy = y;
 }
-void InitializeStars(int slot, int maxstars) {
+void InitializeStars(ScriptMethodParams &params) {
+	PARAMS2(int, slot, int, maxstars);
 	int32 sw, sh = 0;
 	BITMAP *canvas = engine->GetSpriteGraphic(slot);
 	engine->GetBitmapDimensions(canvas, &sw, &sh, nullptr);
@@ -719,7 +755,8 @@ void InitializeStars(int slot, int maxstars) {
 	}
 }
 
-void IterateStars(int slot) {
+void IterateStars(ScriptMethodParams &params) {
+	PARAMS1(int, slot);
 	long sw, sh = 0;
 	sw = engine->GetSpriteWidth(slot);
 	sh = engine->GetSpriteHeight(slot);
@@ -739,50 +776,57 @@ void IterateStars(int slot) {
 		}
 	}
 }
-int GetStarfieldOverscan() {
-	return Starfield.overscan;
+void GetStarfieldOverscan(ScriptMethodParams &params) {
+	params._result = Starfield.overscan;
 }
-void SetStarfieldOverscan(int overscan) {
+void SetStarfieldOverscan(ScriptMethodParams &params) {
+	PARAMS1(int, overscan);
 	Starfield.overscan = overscan;
 }
 
-int GetStarfieldOriginX() {
-	return Starfield.originx;
+void GetStarfieldOriginX(ScriptMethodParams &params) {
+	params._result = Starfield.originx;
 }
 
-int GetStarfieldOriginY() {
-	return Starfield.originy;
+void GetStarfieldOriginY(ScriptMethodParams &params) {
+	params._result = Starfield.originy;
 }
 
-void SetStarfieldDepthMultiplier(int multi) {
+void SetStarfieldDepthMultiplier(ScriptMethodParams &params) {
+	PARAMS1(int, multi);
 	Starfield.depthmultiplier = multi;
 }
 
-int GetStarfieldDepthMultiplier() {
-	return Starfield.depthmultiplier;
+void GetStarfieldDepthMultiplier(ScriptMethodParams &params) {
+	params._result = Starfield.depthmultiplier;
 }
 
-int GetStarfieldMaxStars() {
-	return Starfield.maxstars;
+void GetStarfieldMaxStars(ScriptMethodParams &params) {
+	params._result = Starfield.maxstars;
 }
 
-void SetStarSpriteScaleBoost(int star, int boost) {
+void SetStarSpriteScaleBoost(ScriptMethodParams &params) {
+	PARAMS2(int, star, int, boost);
 	stars[star].scaleboost = boost;
 }
 
-int GetStarSpriteScaleBoost(int star) {
-	return stars[star].scaleboost;
+void GetStarSpriteScaleBoost(ScriptMethodParams &params) {
+	PARAMS1(int, star);
+	params._result = stars[star].scaleboost;
 }
 
-void SetStarMaxRadius(int star, int radius) {
+void SetStarMaxRadius(ScriptMethodParams &params) {
+	PARAMS2(int, star, int, radius);
 	stars[star].maxrad = radius;
 }
 
-int GetStarMaxRadius(int star) {
-	return stars[star].maxrad;
+void GetStarMaxRadius(ScriptMethodParams &params) {
+	PARAMS1(int, star);
+	params._result = stars[star].maxrad;
 }
 
-void RotateStar(int star, int angle, int px, int py) {
+void RotateStar(ScriptMethodParams &params) {
+	PARAMS4(int, star, int, angle, int, px, int, py);
 	float rsin = rot_sine_LUT[angle];
 	float rcos = rot_cos_LUT[angle];
 	float fPx = (float)px;
@@ -798,47 +842,56 @@ void RotateStar(int star, int angle, int px, int py) {
 	i++;
 }
 
-FLOAT_RETURN_TYPE GetStarX(int i) {
+void GetStarX(ScriptMethodParams &params) {
+	PARAMS1(int, i);
 	float starx = (float)stars[i].x;
-	RETURN_FLOAT(starx);
+	params._result = PARAM_FROM_FLOAT(starx);
 }
 
-FLOAT_RETURN_TYPE GetStarY(int i) {
+void GetStarY(ScriptMethodParams &params) {
+	PARAMS1(int, i);
 	float stary = (float)stars[i].y;
-	RETURN_FLOAT(stary);
+	params._result = PARAM_FROM_FLOAT(stary);
 }
 
-FLOAT_RETURN_TYPE GetStarZ(int i) {
+void GetStarZ(ScriptMethodParams &params) {
+	PARAMS1(int, i);
 	float starz = (float)stars[i].z;
-	RETURN_FLOAT(starz);
+	params._result = PARAM_FROM_FLOAT(starz);
 }
 
-void SetStarPosition(int star, SCRIPT_FLOAT(x), SCRIPT_FLOAT(y), SCRIPT_FLOAT(z)) {
-	INIT_SCRIPT_FLOAT(x);
-	INIT_SCRIPT_FLOAT(y);
-	INIT_SCRIPT_FLOAT(z);
+void SetStarPosition(ScriptMethodParams &params) {
+	PARAMS4(int, star, int32, xi, int32, yi, int32, zi);
+	float x = PARAM_TO_FLOAT(xi);
+	float y = PARAM_TO_FLOAT(yi);
+	float z = PARAM_TO_FLOAT(zi);
 	stars[star].x = x;
 	stars[star].y = y;
 	stars[star].z = z;
 }
 
-void SetStarColor(int star, unsigned char color) {
+void SetStarColor(ScriptMethodParams &params) {
+	PARAMS2(int, star, unsigned char, color);
 	stars[star].color = color;
 }
 
-unsigned char GetStarColor(int star) {
-	return stars[star].color;
+void GetStarColor(ScriptMethodParams &params) {
+	PARAMS1(int, star);
+	params._result = (int)stars[star].color;
 }
 
-void SetStarSprite(int star, int slot) {
+void SetStarSprite(ScriptMethodParams &params) {
+	PARAMS2(int, star, int, slot);
 	stars[star].sprite = slot;
 }
 
-int GetStarSprite(int star) {
-	return stars[star].sprite;
+void GetStarSprite(ScriptMethodParams &params) {
+	PARAMS1(int, star);
+	params._result = stars[star].sprite;
 }
 
-void SetStarSpriteRange(int start, int end, int slot) {
+void SetStarSpriteRange(ScriptMethodParams &params) {
+	PARAMS3(int, start, int, end, int, slot);
 	int sfix = start;
 	int efix = end;
 	if (start > Starfield.maxstars) sfix = Starfield.maxstars - 1;
@@ -847,7 +900,8 @@ void SetStarSpriteRange(int start, int end, int slot) {
 		stars[i].sprite = slot;
 }
 
-void DrawStars(int slot, int maskslot) {
+void DrawStars(ScriptMethodParams &params) {
+	PARAMS2(int, slot, int, maskslot);
 	int32 sw, sh = 0;
 	BITMAP *canvas = engine->GetSpriteGraphic(slot);
 	if (!canvas) engine->AbortGame("DrawStars: Can't load sprite slot.");
@@ -1027,7 +1081,13 @@ void DrawStars(int slot, int maskslot) {
 }
 
 
-int CreateTranslucentOverlay(int id, int spriteId, int alpha, int level, int ox, int oy, int mask = 0, int blendmode = 0) {
+void CreateTranslucentOverlay(ScriptMethodParams &params) {
+	PARAMS6(int, id, int, spriteId, int, alpha, int, level, int, ox, int, oy);
+	int mask = 0, blendmode = 0;
+	if (params.size() > 6)
+		mask = params[6];
+	if (params.size() > 7)
+		blendmode = params[7];
 	BITMAP *testspr = engine->GetSpriteGraphic(spriteId);
 	if (testspr) overlay[id].sprite = spriteId;
 	else engine->AbortGame("CreateTranslucentOverlay: Invalid spriteId.");
@@ -1039,90 +1099,106 @@ int CreateTranslucentOverlay(int id, int spriteId, int alpha, int level, int ox,
 	overlay[id].y = oy;
 	overlay[id].enabled = true;
 	overlay[id].blendtype = blendmode;
-	return 0;
+	params._result = 0;
 }
 
-int DeleteTranslucentOverlay(int id) {
+void DeleteTranslucentOverlay(ScriptMethodParams &params) {
+	PARAMS1(int, id);
 	overlay[id].enabled = false;
 	overlay[id].sprite = 0;
 	overlay[id].x = 0;
 	overlay[id].y = 0;
 	overlay[id].level = 0;
 	overlay[id].trans = 0;
-	return 0;
+	params._result = 0;
 }
 
-int MoveTranslucentOverlay(int id, int ox, int oy) {
+void MoveTranslucentOverlay(ScriptMethodParams &params) {
+	PARAMS3(int, id, int, ox, int, oy);
 	overlay[id].x = ox;
 	overlay[id].y = oy;
-	return 0;
+	params._result = 0;
 }
 
-int GetTranslucentOverlayX(int id) {
-	return overlay[id].x;
+void GetTranslucentOverlayX(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = overlay[id].x;
 }
 
-int GetTranslucentOverlayY(int id) {
-	return overlay[id].y;
+void GetTranslucentOverlayY(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = overlay[id].y;
 }
 
-int GetTranslucentOverlaySprite(int id) {
-	return overlay[id].sprite;
+void GetTranslucentOverlaySprite(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = overlay[id].sprite;
 }
 
-int GetTranslucentOverlayLevel(int id) {
-	return overlay[id].level;
+void GetTranslucentOverlayLevel(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = overlay[id].level;
 }
 
-int GetTranslucentOverlayEnabled(int id) {
-	return overlay[id].enabled;
+void GetTranslucentOverlayEnabled(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = overlay[id].enabled;
 }
 
-int GetTranslucentOverlayAlpha(int id) {
-	return overlay[id].trans;
+void GetTranslucentOverlayAlpha(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = overlay[id].trans;
 }
 
-int SetTranslucentOverlayAlpha(int id, int alpha) {
+void SetTranslucentOverlayAlpha(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, alpha);
 	if (alpha >= 0 && alpha < 256)
 		overlay[id].trans = alpha;
 	else
 		engine->AbortGame("CreateTranslucentOverlay: Invalid alpha selected.");
-	return 0;
+	params._result = 0;
 }
 
-int SetTranslucentOverlayEnabled(int id, int toggle) {
+void SetTranslucentOverlayEnabled(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, toggle);
 	if (toggle > 0)
 		overlay[id].enabled = true;
 	else
 		overlay[id].enabled = false;
-	return 0;
+	params._result = 0;
 }
 
-void SetCharacterReflected(int id, int refl) {
+void SetCharacterReflected(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, refl);
 	if (refl > 0) Reflection.Characters[id].reflect = 1;
 	else Reflection.Characters[id].reflect = 0;
 }
 
-void SetObjectReflected(int id, int refl) {
+void SetObjectReflected(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, refl);
 	if (refl > 0)
 		Reflection.Objects[id].reflect = 1;
 	else
 		Reflection.Objects[id].reflect = 0;
 }
 
-int GetCharacterReflected(int id) {
-	return Reflection.Characters[id].reflect;
+void GetCharacterReflected(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = Reflection.Characters[id].reflect;
 }
 
-int GetObjectReflected(int id) {
-	return Reflection.Objects[id].reflect;
+void GetObjectReflected(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = Reflection.Objects[id].reflect;
 }
 
-void ReplaceCharacterReflectionView(int id, int view) {
+void ReplaceCharacterReflectionView(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, view);
 	Reflection.Characters[id].replaceview = view - 1;
 }
 
-void SetObjectReflectionIgnoreScaling(int id, int wb) {
+void SetObjectReflectionIgnoreScaling(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, wb);
 	if (wb) Reflection.Objects[id].ignorescaling = 1;
 	else    Reflection.Objects[id].ignorescaling = 0;
 }
@@ -1293,7 +1369,16 @@ int DrawReflections(int id, int charobj = 0) {
 }
 
 
-int DrawTransSprite(int spriteId, int bg, int translevel, int mask = 0, int blendmode = 0, int use_objpal = 0) {
+void DrawTransSprite(ScriptMethodParams &params) {
+	PARAMS3(int, spriteId, int, bg, int, translevel);
+	int mask = 0, blendmode = 0, use_objpal = 0;
+	if (params.size() > 3)
+		mask = params[3];
+	if (params.size() > 4)
+		blendmode = params[4];
+	if (params.size() > 5)
+		use_objpal = params[5];
+
 	BITMAP *maskspr = nullptr;
 	if (mask > 0) maskspr = engine->GetSpriteGraphic(mask);
 	if (!maskspr && mask > 0) {
@@ -1352,7 +1437,7 @@ int DrawTransSprite(int spriteId, int bg, int translevel, int mask = 0, int blen
 	//engine->ReleaseBitmapSurface (clutspr);
 	engine->ReleaseBitmapSurface(spritespr);
 	engine->NotifySpriteUpdated(spriteId);
-	return 0;
+	params._result = 0;
 }
 
 int DrawTranslucentOverlay(int spriteId, int translevel, int ox, int oy, int mask = 0, int blendmode = 0) {
@@ -1449,7 +1534,7 @@ void AGSPalRender::AGS_EngineStartup(IAGSEngine *lpEngine) {
 	engine->RegisterScriptFunction("PALInternal::GetLuminosityFromPalette^1", (void *)GetLuminosityFromPalette);
 	engine->RegisterScriptFunction("PALInternal::FastSin^1", (void *)AGSFastSin);
 	engine->RegisterScriptFunction("PALInternal::FastCos^1", (void *)AGSFastCos);
-	engine->RegisterScriptFunction("PALInternal::FastRoot^1", (void *)root);
+	engine->RegisterScriptFunction("PALInternal::FastRoot^1", (void *)AGSFastRoot);
 	engine->RegisterScriptFunction("PALInternal::GetRemappedSlot^1", (void *)GetRemappedSlot);
 	engine->RegisterScriptFunction("PALInternal::ResetRemapping^0", (void *)ResetRemapping);
 	engine->RegisterScriptFunction("PALInternal::GetModifiedBackgroundImage", (void *)GetModifiedBackgroundImage);
@@ -1551,7 +1636,7 @@ void AGSPalRender::AGS_EngineStartup(IAGSEngine *lpEngine) {
 	engine->RegisterScriptFunction("LensDistort::SetOffsetClamp^1", (void *)SetLensOffsetClamp);
 	engine->RegisterScriptFunction("LensDistort::GetOffsetClamp^0", (void *)GetLensOffsetClamp);
 	engine->RegisterScriptFunction("LensDistort::GetLevel^0", (void *)GetLensLevel);
-	engine->RegisterScriptFunction("LensDistort::SetLevel^1", (void *)GetLensLevel);
+	engine->RegisterScriptFunction("LensDistort::SetLevel^1", (void *)SetLensLevel);
 	engine->RegisterScriptFunction("LensDistort::Initialize^6", (void *)LensInitialize);
 
 	engine->RegisterScriptFunction("Translucence::CreateOverlay^8", (void *)CreateTranslucentOverlay);
@@ -1625,7 +1710,8 @@ void AGSPalRender::AGS_EngineStartup(IAGSEngine *lpEngine) {
 	//PreMultiply_Alphas ();
 	plasmaroottype = 0;
 	Make_Sin_Lut();
-	Init_Raycaster();
+	ScriptMethodParams params;
+	Init_Raycaster(params);
 }
 
 void AGSPalRender::AGS_EngineShutdown() {
@@ -1732,7 +1818,8 @@ int64 AGSPalRender::AGS_EngineOnEvent(int event, NumberPtr data) {
 		syncGame(s);
 	}
 	if (event == AGSE_ENTERROOM) {
-		ResetRemapping();
+		ScriptMethodParams params;
+		ResetRemapping(params);
 		delete[] Reflection.Objects;
 		Reflection.Objects = new objrefopt [engine->GetNumObjects()]();
 	}
@@ -1813,14 +1900,20 @@ void AGSPalRender::syncGame(Serializer &s) {
 	}
 
 	s.syncAsInt(textureSlot);
-	if (s.isLoading() && textureSlot)
-		MakeTextures(textureSlot);
+	if (s.isLoading() && textureSlot) {
+		ScriptMethodParams params;
+		params.push_back(textureSlot);
+		MakeTextures(params);
+	}
 
 	s.syncAsInt(skybox);
 	s.syncAsInt(ambientlight);
 
-	if (s.isLoading())
-		LoadCLUT(clutslot);
+	if (s.isLoading()) {
+		ScriptMethodParams params;
+		params.push_back(clutslot);
+		LoadCLUT(params);
+	}
 }
 
 } // namespace AGSPalRender
diff --git a/engines/ags/plugins/ags_pal_render/pal_render.h b/engines/ags/plugins/ags_pal_render/pal_render.h
index edc5f18ab9..5ee805e99d 100644
--- a/engines/ags/plugins/ags_pal_render/pal_render.h
+++ b/engines/ags/plugins/ags_pal_render/pal_render.h
@@ -31,10 +31,17 @@ namespace AGS3 {
 namespace Plugins {
 namespace AGSPalRender {
 
-#define SCRIPT_FLOAT(x) int32 __script_float##x
-#define INIT_SCRIPT_FLOAT(x) float x; memcpy(&x, &__script_float##x, sizeof(float))
-#define FLOAT_RETURN_TYPE int32
-#define RETURN_FLOAT(x) int32 __ret##x; memcpy(&__ret##x, &x, sizeof(float)); return __ret##x
+inline float PARAM_TO_FLOAT(int32 xi) {
+	float x;
+	memcpy(&x, &xi, sizeof(float));
+	return x;
+}
+
+inline int32 PARAM_FROM_FLOAT(float x) {
+	int32 xi;
+	memcpy(&xi, &x, sizeof(float));
+	return xi;
+}
 
 struct PALSTRUCT {
 	byte r;
@@ -180,7 +187,7 @@ public:
 
 };
 
-unsigned char GetColor565(unsigned char r, unsigned char g, unsigned char b);
+void GetColor565(ScriptMethodParams &params);
 
 unsigned short root(unsigned short x);
 float FastSin(float x);
diff --git a/engines/ags/plugins/ags_pal_render/raycast.cpp b/engines/ags/plugins/ags_pal_render/raycast.cpp
index d4a104d88c..6820f7af3d 100644
--- a/engines/ags/plugins/ags_pal_render/raycast.cpp
+++ b/engines/ags/plugins/ags_pal_render/raycast.cpp
@@ -22,6 +22,7 @@
 
 #include "ags/lib/allegro.h"
 #include "ags/plugins/ags_pal_render/raycast.h"
+#include "ags/plugins/plugin_base.h"
 
 namespace AGS3 {
 namespace Plugins {
@@ -79,7 +80,8 @@ int selectedX;
 int selectedY;
 unsigned char selectedColor;
 
-void Ray_SelectTile(int x, int y, unsigned char color) {
+void Ray_SelectTile(ScriptMethodParams &params) {
+	PARAMS3(int, x, int, y, unsigned char, color);
 	if (x < 0 || x >= MAP_WIDTH) selectedX = -1;
 	else if (y < 0 || y >= MAP_HEIGHT) selectedY = -1;
 	else {
@@ -89,21 +91,24 @@ void Ray_SelectTile(int x, int y, unsigned char color) {
 	}
 }
 
-int Ray_HasSeenTile(int x, int y) {
-	if (x < 0 || x >= MAP_WIDTH) return -1;
-	else if (y < 0 || y >= MAP_HEIGHT) return -1;
-	return seenMap [x][y];
+void Ray_HasSeenTile(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
+	if (x < 0 || x >= MAP_WIDTH) params._result = -1;
+	else if (y < 0 || y >= MAP_HEIGHT) params._result = -1;
+	else params._result = seenMap [x][y];
 }
 
-void Ray_SetNoClip(int value) {
+void Ray_SetNoClip(ScriptMethodParams &params) {
+	PARAMS1(int, value);
 	noclip = value;
 }
 
-int Ray_GetNoClip() {
-	return noclip;
+void Ray_GetNoClip(ScriptMethodParams &params) {
+	params._result = noclip;
 }
 
-void Ray_DrawTile(int spr, int tile) {
+void Ray_DrawTile(ScriptMethodParams &params) {
+	PARAMS2(int, spr, int, tile);
 	BITMAP *img = engine->GetSpriteGraphic(spr);
 	uint8 *sprarray = engine->GetRawBitmapSurface(img);
 	int pitch = engine->GetBitmapPitch(img);
@@ -113,7 +118,8 @@ void Ray_DrawTile(int spr, int tile) {
 	engine->ReleaseBitmapSurface(img);
 }
 
-void Ray_DrawOntoTile(int spr, int tile) {
+void Ray_DrawOntoTile(ScriptMethodParams &params) {
+	PARAMS2(int, spr, int, tile);
 	BITMAP *img = engine->GetSpriteGraphic(spr);
 	uint8 *sprarray = engine->GetRawBitmapSurface(img);
 	int pitch = engine->GetBitmapPitch(img);
@@ -123,43 +129,49 @@ void Ray_DrawOntoTile(int spr, int tile) {
 	engine->ReleaseBitmapSurface(img);
 }
 
-int Ray_GetTileX_At(int x, int y) {
-	if (x < 0 || x >= S_WIDTH  || y < 0 || y >= S_HEIGHT) return -1;
-	else return editorMap [x][y] >> 16;
+void Ray_GetTileX_At(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
+	if (x < 0 || x >= S_WIDTH  || y < 0 || y >= S_HEIGHT) params._result = -1;
+	else params._result = editorMap [x][y] >> 16;
 }
 
-int Ray_GetTileY_At(int x, int y) {
-	if (x < 0 || x >= S_WIDTH  || y < 0 || y >= S_HEIGHT) return -1;
-	else return editorMap [x][y] & 0x0000FFFF;
+void Ray_GetTileY_At(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
+	if (x < 0 || x >= S_WIDTH  || y < 0 || y >= S_HEIGHT) params._result = -1;
+	else params._result = editorMap [x][y] & 0x0000FFFF;
 }
 
-void Ray_SetWallAt(int x, int y, int id) {
+void Ray_SetWallAt(ScriptMethodParams &params) {
+	PARAMS3(int, x, int, y, int, id);
 	if (x < 0 || x >= MAP_WIDTH) return;
 	if (y < 0 || y >= MAP_HEIGHT) return;
 	worldMap [x][y] = id;
 }
 
-int Ray_GetWallAt(int x, int y) {
-	if (x < 0 || x >= MAP_WIDTH) return -1;
-	if (y < 0 || y >= MAP_HEIGHT) return -1;
-	return worldMap [x][y];
+void Ray_GetWallAt(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
+	if (x < 0 || x >= MAP_WIDTH) params._result = -1;
+	else if (y < 0 || y >= MAP_HEIGHT) params._result = -1;
+	else params._result = worldMap [x][y];
 }
 
-int Ray_GetAmbientWeight() {
-	return ambientweight;
+void Ray_GetAmbientWeight(ScriptMethodParams &params) {
+	params._result = ambientweight;
 }
 
-void Ray_SetAmbientLight(int value) {
+void Ray_SetAmbientLight(ScriptMethodParams &params) {
+	PARAMS1(int, value);
 	ambientlight = MIN(255, MAX(0, value));
 }
 
-void Ray_SetAmbientColor(int color, int amount) {
+void Ray_SetAmbientColor(ScriptMethodParams &params) {
+	PARAMS2(int, color, int, amount);
 	ambientcolor = color;
 	ambientcolorAmount = amount;
 }
 
-int Ray_GetAmbientLight() {
-	return ambientlight;
+void Ray_GetAmbientLight(ScriptMethodParams &params) {
+	params._result = ambientlight;
 }
 double fsqrt(double y) {
 	double x, z, tempf;
@@ -177,39 +189,45 @@ double fsqrt(double y) {
 	return x * y;
 }
 
-void Ray_SetWallHotspot(int id, char hotsp) {
+void Ray_SetWallHotspot(ScriptMethodParams &params) {
+	PARAMS2(int, id, char, hotsp);
 	wallData[id].hotspotinteract = hotsp;
 }
 
-void Ray_SetWallTextures(int id, int n, int s, int w, int e) {
+void Ray_SetWallTextures(ScriptMethodParams &params) {
+	PARAMS5(int, id, int, n, int, s, int, w, int, e);
 	wallData[id].texture[0] = n;
 	wallData[id].texture[1] = s;
 	wallData[id].texture[2] = w;
 	wallData[id].texture[3] = e;
 }
 
-void Ray_SetWallSolid(int id, int n, int s, int w, int e) {
+void Ray_SetWallSolid(ScriptMethodParams &params) {
+	PARAMS5(int, id, int, n, int, s, int, w, int, e);
 	wallData[id].solid [0] = MAX(0, MIN(n, 1));
 	wallData[id].solid [1] = MAX(0, MIN(s, 1));
 	wallData[id].solid [2] = MAX(0, MIN(w, 1));
 	wallData[id].solid [3] = MAX(0, MIN(e, 1));
 }
 
-void Ray_SetWallIgnoreLighting(int id, int n, int s, int w, int e) {
+void Ray_SetWallIgnoreLighting(ScriptMethodParams &params) {
+	PARAMS5(int, id, int, n, int, s, int, w, int, e);
 	wallData[id].ignorelighting [0] = MAX(0, MIN(n, 1));
 	wallData[id].ignorelighting [1] = MAX(0, MIN(s, 1));
 	wallData[id].ignorelighting [2] = MAX(0, MIN(w, 1));
 	wallData[id].ignorelighting [3] = MAX(0, MIN(e, 1));
 }
 
-void Ray_SetWallAlpha(int id, int n, int s, int w, int e) {
+void Ray_SetWallAlpha(ScriptMethodParams &params) {
+	PARAMS5(int, id, int, n, int, s, int, w, int, e);
 	wallData[id].alpha [0] = MAX(0, MIN(n, 255));
 	wallData[id].alpha [1] = MAX(0, MIN(s, 255));
 	wallData[id].alpha [2] = MAX(0, MIN(w, 255));
 	wallData[id].alpha [3] = MAX(0, MIN(e, 255));
 }
 
-void Ray_SetWallBlendType(int id, int n, int s, int w, int e) {
+void Ray_SetWallBlendType(ScriptMethodParams &params) {
+	PARAMS5(int, id, int, n, int, s, int, w, int, e);
 	wallData[id].blendtype [0] = MAX(0, MIN(n, 10));
 	wallData[id].blendtype [1] = MAX(0, MIN(s, 10));
 	wallData[id].blendtype [2] = MAX(0, MIN(w, 10));
@@ -219,103 +237,118 @@ void Ray_SetWallBlendType(int id, int n, int s, int w, int e) {
 
 
 
-int Ray_GetWallHotspot(int id) {
-	return wallData[id].hotspotinteract;
+void Ray_GetWallHotspot(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = wallData[id].hotspotinteract;
 }
 
-int Ray_GetWallTexture(int id, int dir) {
-	return wallData[id].texture[dir];
+void Ray_GetWallTexture(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, dir);
+	params._result = wallData[id].texture[dir];
 }
 
-int Ray_GetWallSolid(int id, int dir) {
-	return wallData[id].solid [dir];
+void Ray_GetWallSolid(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, dir);
+	params._result = wallData[id].solid [dir];
 }
 
-int Ray_GetWallIgnoreLighting(int id, int dir) {
-	return wallData[id].ignorelighting [dir];
+void Ray_GetWallIgnoreLighting(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, dir);
+	params._result = wallData[id].ignorelighting [dir];
 }
 
-int Ray_GetWallAlpha(int id, int dir) {
-	return wallData[id].alpha [dir];
+void Ray_GetWallAlpha(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, dir);
+	params._result = wallData[id].alpha [dir];
 }
 
-int Ray_GetWallBlendType(int id, int dir) {
-	return wallData[id].blendtype [dir];
+void Ray_GetWallBlendType(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, dir);
+	params._result = wallData[id].blendtype [dir];
 }
 
 
 
 
 
-FLOAT_RETURN_TYPE Ray_GetMoveSpeed() {
+void Ray_GetMoveSpeed(ScriptMethodParams &params) {
 	float mSpeed = (float)moveSpeed;
-	RETURN_FLOAT(mSpeed);
+	params._result = PARAM_FROM_FLOAT(mSpeed);
 }
 
 
-void Ray_SetMoveSpeed(SCRIPT_FLOAT(speed)) {
-	INIT_SCRIPT_FLOAT(speed);
+void Ray_SetMoveSpeed(ScriptMethodParams &params) {
+	PARAMS1(int32, speedi);
+	float speed = PARAM_TO_FLOAT(speedi);
 	moveSpeed = (double)speed;
 }
 
-FLOAT_RETURN_TYPE Ray_GetRotSpeed() {
+void Ray_GetRotSpeed(ScriptMethodParams &params) {
 	float rSpeed = (float)rotSpeed;
-	RETURN_FLOAT(rSpeed);
+	params._result = PARAM_FROM_FLOAT(rSpeed);
 }
 
-void Ray_SetRotSpeed(SCRIPT_FLOAT(speed)) {
-	INIT_SCRIPT_FLOAT(speed);
+void Ray_SetRotSpeed(ScriptMethodParams &params) {
+	PARAMS1(int32, speedi);
+	float speed = PARAM_TO_FLOAT(speedi);
 	rotSpeed = (double)speed;
 }
 
 
-int Ray_GetLightAt(int x, int y) {
-	return lightMap [x][y];
+void Ray_GetLightAt(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
+	params._result = lightMap [x][y];
 }
 
-void Ray_SetLightAt(int x, int y, int light) {
+void Ray_SetLightAt(ScriptMethodParams &params) {
+	PARAMS3(int, x, int, y, int, light);
 	lightMap [x][y] = light;
 }
 
-void Ray_SetPlaneY(SCRIPT_FLOAT(y)) {
-	INIT_SCRIPT_FLOAT(y);
+void Ray_SetPlaneY(ScriptMethodParams &params) {
+	PARAMS1(int32, yi);
+	float y = PARAM_TO_FLOAT(yi);
 	planeY = (double)y;
 }
 
-FLOAT_RETURN_TYPE Ray_GetPlaneY() {
+void Ray_GetPlaneY(ScriptMethodParams &params) {
 	float pY = (float)planeY;
-	RETURN_FLOAT(pY);
+	params._result = PARAM_FROM_FLOAT(pY);
 }
 
-void Ray_SetPlayerPosition(SCRIPT_FLOAT(x), SCRIPT_FLOAT(y)) {
-	INIT_SCRIPT_FLOAT(x);
-	INIT_SCRIPT_FLOAT(y);
+void Ray_SetPlayerPosition(ScriptMethodParams &params) {
+	PARAMS2(int32, xi, int32, yi);
+	float x = PARAM_TO_FLOAT(xi);
+	float y = PARAM_TO_FLOAT(yi);
 	posX = (double)x;
 	posY = (double)y;
 }
 
-FLOAT_RETURN_TYPE Ray_GetPlayerX() {
+void Ray_GetPlayerX(ScriptMethodParams &params) {
 
 	float x = (float)posX;
-	RETURN_FLOAT(x);
+	params._result = PARAM_FROM_FLOAT(x);
 }
 
-FLOAT_RETURN_TYPE Ray_GetPlayerY() {
+void Ray_GetPlayerY(ScriptMethodParams &params) {
 	float y = (float)posY;
-	RETURN_FLOAT(y);
+	params._result = PARAM_FROM_FLOAT(y);
 }
 
-int Ray_GetPlayerAngle() {
+void Ray_GetPlayerAngle(ScriptMethodParams &params) {
 	double bgrad = atan2(dirY, dirX);
 	int bgdeg = (int)(bgrad / PI * 180.0) + 180;
-	return bgdeg % 360;
+	params._result = bgdeg % 360;
 }
 
-void Ray_SetPlayerAngle(int angle) {
+void Ray_SetPlayerAngle(ScriptMethodParams &params) {
+	PARAMS1(int, angle);
 	int realangle = angle % 360;
 	if (realangle < 0) realangle += 360;
 
-	int anglediff = realangle - Ray_GetPlayerAngle();
+	ScriptMethodParams playerAngle;
+	Ray_GetPlayerAngle(playerAngle);
+	int anglediff = realangle - playerAngle._result;
 	double radians = 0.0174533 * anglediff;
 	double oldDirX = dirX;
 	dirX = dirX * cos(radians) - dirY * sin(radians);
@@ -344,7 +377,8 @@ void LoadHeightMap(int heightmapSlot) {
 	heightmapOn = true;
 }
 
-void LoadMap(int worldmapSlot, int lightmapSlot, int ceilingmapSlot, int floormapSlot) {
+void LoadMap(ScriptMethodParams &params) {
+	PARAMS4(int, worldmapSlot, int, lightmapSlot, int, ceilingmapSlot, int, floormapSlot);
 	int tempw = engine->GetSpriteWidth(worldmapSlot);
 	int temph = engine->GetSpriteHeight(worldmapSlot);
 	BITMAP *worldmapBm = nullptr;
@@ -401,119 +435,144 @@ void LoadMap(int worldmapSlot, int lightmapSlot, int ceilingmapSlot, int floorma
 	//LoadHeightMap (31); //debug only
 }
 
-FLOAT_RETURN_TYPE Ray_GetSpriteScaleX(int id) {
+void Ray_GetSpriteScaleX(ScriptMethodParams &params) {
+	PARAMS1(int, id);
 	float scale = (float)sprite[id].uDivW;
-	RETURN_FLOAT(scale);
+	params._result = PARAM_FROM_FLOAT(scale);
 }
 
-void Ray_SetSpriteScaleX(int id, SCRIPT_FLOAT(scale)) {
-	INIT_SCRIPT_FLOAT(scale);
+void Ray_SetSpriteScaleX(ScriptMethodParams &params) {
+	PARAMS2(int, id, int32, scalei);
+	float scale = PARAM_TO_FLOAT(scalei);
 	sprite[id].uDivW = scale;
 }
 
-FLOAT_RETURN_TYPE Ray_GetSpriteScaleY(int id) {
+void Ray_GetSpriteScaleY(ScriptMethodParams &params) {
+	PARAMS1(int, id);
 	float scale = (float)sprite[id].uDivH;
-	RETURN_FLOAT(scale);
+	params._result = PARAM_FROM_FLOAT(scale);
 }
 
-void Ray_SetSpriteScaleY(int id, SCRIPT_FLOAT(scale)) {
-	INIT_SCRIPT_FLOAT(scale);
+void Ray_SetSpriteScaleY(ScriptMethodParams &params) {
+	PARAMS2(int, id, int32, scalei);
+	float scale = PARAM_TO_FLOAT(scalei);
 	sprite[id].uDivH = scale;
 }
 
-int Ray_GetSpriteAlpha(int id) {
-	return sprite[id].alpha;
+void Ray_GetSpriteAlpha(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = sprite[id].alpha;
 }
 
-void Ray_SetSpriteAlpha(int id, int alpha) {
+void Ray_SetSpriteAlpha(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, alpha);
 	sprite[id].alpha = alpha;
 }
 
-int Ray_GetSpritePic(int id) {
-	return sprite[id].texture;
+void Ray_GetSpritePic(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = sprite[id].texture;
 }
 
-void Ray_SetSpritePic(int id, int slot) {
+void Ray_SetSpritePic(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, slot);
 	sprite[id].texture = slot;
 }
 
 
 
-int Ray_GetSpriteAngle(int id) {
-	return sprite[id].angle;
+void Ray_GetSpriteAngle(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = sprite[id].angle;
 }
 
-void Ray_SetSpriteAngle(int id, int angle) {
+void Ray_SetSpriteAngle(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, angle);
 	sprite[id].angle = angle % 360;
 }
 
-int Ray_GetSpriteInteractObj(int id) {
-	return sprite[id].objectinteract;
+void Ray_GetSpriteInteractObj(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = sprite[id].objectinteract;
 }
 
-void Ray_SetSpriteView(int id, int view) {
+void Ray_SetSpriteView(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, view);
 	sprite[id].view = view;
 }
 
-void Ray_SetSpriteBlendType(int id, int type) {
+void Ray_SetSpriteBlendType(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, type);
 	sprite[id].blendmode = type;
 }
 
-int Ray_GetSpriteBlendType(int id) {
-	return sprite[id].blendmode;
+void Ray_GetSpriteBlendType(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = sprite[id].blendmode;
 }
 
 
-int Ray_GetSpriteView(int id) {
-	return sprite[id].view;
+void Ray_GetSpriteView(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = sprite[id].view;
 }
 
-void Ray_SetSpriteFrame(int id, int frame) {
+void Ray_SetSpriteFrame(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, frame);
 	sprite[id].frame = frame;
 }
 
-int Ray_GetSpriteFrame(int id) {
-	return sprite[id].frame;
+void Ray_GetSpriteFrame(ScriptMethodParams &params) {
+	PARAMS1(int, id);
+	params._result = sprite[id].frame;
 }
 
-void Ray_SetSpriteInteractObj(int id, int obj) {
+void Ray_SetSpriteInteractObj(ScriptMethodParams &params) {
+	PARAMS2(int, id, int, obj);
 	sprite[id].objectinteract = obj;
 }
 
-void Ray_SetSpritePosition(int id, SCRIPT_FLOAT(x), SCRIPT_FLOAT(y)) {
-	INIT_SCRIPT_FLOAT(x);
-	INIT_SCRIPT_FLOAT(y);
+void Ray_SetSpritePosition(ScriptMethodParams &params) {
+	PARAMS3(int, id, int32, xi, int32, yi);
+	float x = PARAM_TO_FLOAT(xi);
+	float y = PARAM_TO_FLOAT(yi);
 	sprite[id].x = x;
 	sprite[id].y = y;
 }
 
-void Ray_SetSpriteVertOffset(int id, SCRIPT_FLOAT(vMove)) {
-	INIT_SCRIPT_FLOAT(vMove);
+void Ray_SetSpriteVertOffset(ScriptMethodParams &params) {
+	PARAMS2(int, id, int32, vMovei);
+	float vMove = PARAM_TO_FLOAT(vMovei);
 	sprite[id].vMove = vMove;
 }
 
 
-FLOAT_RETURN_TYPE Ray_GetSpriteVertOffset(int id) {
+void Ray_GetSpriteVertOffset(ScriptMethodParams &params) {
+	PARAMS1(int, id);
 	float x = (float)sprite[id].vMove;
-	RETURN_FLOAT(x);
+	params._result = PARAM_FROM_FLOAT(x);
 }
 
-FLOAT_RETURN_TYPE Ray_GetSpriteX(int id) {
+void Ray_GetSpriteX(ScriptMethodParams &params) {
+	PARAMS1(int, id);
 	float x = (float)sprite[id].x;
-	RETURN_FLOAT(x);
+	params._result = PARAM_FROM_FLOAT(x);
 }
 
-FLOAT_RETURN_TYPE Ray_GetSpriteY(int id) {
+void Ray_GetSpriteY(ScriptMethodParams &params) {
+	PARAMS1(int, id);
 	float y = (float)sprite[id].y;
-	RETURN_FLOAT(y);
+	params._result = PARAM_FROM_FLOAT(y);
 }
 
-void Ray_InitSprite(int id, SCRIPT_FLOAT(x), SCRIPT_FLOAT(y), int slot, unsigned char alpha, int blendmode, SCRIPT_FLOAT(scale_x), SCRIPT_FLOAT(scale_y), SCRIPT_FLOAT(vMove)) {
-	INIT_SCRIPT_FLOAT(x);
-	INIT_SCRIPT_FLOAT(y);
-	INIT_SCRIPT_FLOAT(scale_x);
-	INIT_SCRIPT_FLOAT(scale_y);
-	INIT_SCRIPT_FLOAT(vMove);
+void Ray_InitSprite(ScriptMethodParams &params) {
+	PARAMS9(int, id, int32, xi, int32, yi, int, slot, unsigned char, alpha, int, blendmode, int32, scale_xi, int32, scale_yi, int32, vMovei);
+	float x = PARAM_TO_FLOAT(xi);
+	float y = PARAM_TO_FLOAT(yi);
+	float scale_x = PARAM_TO_FLOAT(scale_xi);
+	float scale_y = PARAM_TO_FLOAT(scale_yi);
+	float vMove = PARAM_TO_FLOAT(vMovei);
+
 	sprite[id].x = x;
 	sprite[id].y = y;
 	sprite[id].texture = slot;
@@ -527,7 +586,8 @@ void Ray_InitSprite(int id, SCRIPT_FLOAT(x), SCRIPT_FLOAT(y), int slot, unsigned
 //function used to sort the sprites
 void combSort(int *order, double *dist, int amount);
 
-void MakeTextures(int slot) {
+void MakeTextures(ScriptMethodParams &params) {
+	PARAMS1(int, slot);
 	textureSlot = slot;
 	int sourceWidth = engine->GetSpriteWidth(slot);
 	int sourceHeight = engine->GetSpriteHeight(slot);
@@ -575,84 +635,95 @@ void MakeTextures(int slot) {
 
 //double ZBuffer[screenWidth][screenHeight];
 
-void Ray_SetFloorAt(int x, int y, int tex) {
+void Ray_SetFloorAt(ScriptMethodParams &params) {
+	PARAMS3(int, x, int, y, int, tex);
 	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT || tex > 511) return;
 	else floorMap[x][y] = tex;
 }
 
-void Ray_SetCeilingAt(int x, int y, int tex) {
+void Ray_SetCeilingAt(ScriptMethodParams &params) {
+	PARAMS3(int, x, int, y, int, tex);
 	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT || tex > 511) return;
 	else ceilingMap[x][y] = tex;
 }
 
-int Ray_GetCeilingAt(int x, int y) {
-	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) return -1;
-	else return ceilingMap [x][y];
+void Ray_GetCeilingAt(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
+	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) params._result = -1;
+	else params._result = ceilingMap [x][y];
 }
 
 
-int Ray_GetFloorAt(int x, int y) {
-	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) return -1;
-	else return floorMap [x][y];
+void Ray_GetFloorAt(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
+	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) params._result = -1;
+	else params._result = floorMap [x][y];
 }
 
 
-int Ray_GetLightingAt(int x, int y) {
-	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) return -1;
+void Ray_GetLightingAt(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
+	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) params._result = -1;
 	else {
 		int lighting = 0;
 		if (ceilingMap[x][y] == 0) {
 			lighting = ambientlight;
 			if (ambientlight < lightMap [x][y]) lighting = lightMap[x][y];
 		}
-		return lighting;
+		params._result = lighting;
 	}
 }
 
-void Ray_SetLightingAt(int x, int y, unsigned char lighting) {
+void Ray_SetLightingAt(ScriptMethodParams &params) {
+	PARAMS3(int, x, int, y, unsigned char, lighting);
 	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) return;
 	else {
 		lightMap [x][y] = lighting;
 	}
 }
 
-void Ray_SetSkyBox(int slot) {
+void Ray_SetSkyBox(ScriptMethodParams &params) {
+	PARAMS1(int, slot);
 	BITMAP *test = engine->GetSpriteGraphic(slot);
 	if (test) {
 		skybox = slot;
 	} else engine->AbortGame("Ray_SetSkybox: No such sprite!");
 }
 
-int Ray_GetSkyBox(int slot) {
-	return skybox;
+void Ray_GetSkyBox(ScriptMethodParams &params) {
+	//PARAMS1(int, slot);
+	params._result = skybox;
 }
 
-int Ray_GetHotspotAt(int x, int y) {
-	if (!interactionmap) return -1;
-	else if (x > S_WIDTH || x < 0 || y > S_HEIGHT || y < 0) return -1;
-	else return interactionmap [x * S_WIDTH + y] & 0x00FF;
+void Ray_GetHotspotAt(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
+	if (!interactionmap) params._result = -1;
+	else if (x > S_WIDTH || x < 0 || y > S_HEIGHT || y < 0) params._result = -1;
+	else params._result = interactionmap [x * S_WIDTH + y] & 0x00FF;
 }
 
-int Ray_GetObjectAt(int x, int y) {
-	if (!interactionmap) return -1;
-	else if (x > S_WIDTH || x < 0 || y > S_HEIGHT || y < 0) return -1;
-	else return interactionmap [x * S_WIDTH + y] >> 8;
+void Ray_GetObjectAt(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
+	if (!interactionmap) params._result = -1;
+	else if (x > S_WIDTH || x < 0 || y > S_HEIGHT || y < 0) params._result = -1;
+	else params._result = interactionmap [x * S_WIDTH + y] >> 8;
 }
 
-FLOAT_RETURN_TYPE Ray_GetDistanceAt(int x, int y) {
+void Ray_GetDistanceAt(ScriptMethodParams &params) {
+	PARAMS2(int, x, int, y);
 	float falsereturn = -1.0f;
 	if (!ZBuffer) {
-		RETURN_FLOAT(falsereturn);
+		params._result = PARAM_FROM_FLOAT(falsereturn);
 	} else if (x > S_WIDTH || x < 0 || y > S_HEIGHT || y < 0) {
-		RETURN_FLOAT(falsereturn);
+		params._result = PARAM_FROM_FLOAT(falsereturn);
 	} else {
 
 		float zbuf = (float)ZBuffer[x][y];
-		RETURN_FLOAT(zbuf);
+		params._result = PARAM_FROM_FLOAT(zbuf);
 	}
 }
 
-void Init_Raycaster() {
+void Init_Raycaster(ScriptMethodParams &) {
 	if (ZBuffer)
 		return;
 	//if (!worldMap) return;
@@ -677,7 +748,8 @@ void Init_Raycaster() {
 }
 
 bool rendering;
-void Raycast_Render(int slot) {
+void Raycast_Render(ScriptMethodParams &params) {
+	PARAMS1(int, slot);
 	ambientweight = 0;
 	raycastOn = true;
 	double playerrad = atan2(dirY, dirX) + (2.0 * PI);
@@ -1315,7 +1387,7 @@ void Raycast_Render(int slot) {
 
 }
 
-void QuitCleanup() {
+void QuitCleanup(ScriptMethodParams &) {
 	if (!rendering) {
 		for (int i = 0; i < S_WIDTH; ++i) {
 			if (transcolorbuffer[i])delete [] transcolorbuffer[i];
@@ -1332,7 +1404,7 @@ void QuitCleanup() {
 	}
 }
 
-void MoveForward() {
+void MoveForward(ScriptMethodParams &) {
 	double newposx = 0;
 	if (dirX > 0) newposx = 0.1 + posX + dirX * moveSpeed;
 	else newposx = -0.1 + posX + dirX * moveSpeed;
@@ -1387,7 +1459,7 @@ void MoveForward() {
 	}
 }
 
-void MoveBackward() {
+void MoveBackward(ScriptMethodParams &) {
 	double newposx = 0;
 	if (dirX > 0) newposx = -0.1 + posX - dirX * moveSpeed;
 	else newposx = 0.1 + posX - dirX * moveSpeed;
@@ -1459,7 +1531,7 @@ void MoveBackward ()
 }
 */
 
-void RotateLeft() {
+void RotateLeft(ScriptMethodParams &) {
 	double oldDirX = dirX;
 	dirX = dirX * cos(rotSpeed) - dirY * sin(rotSpeed);
 	dirY = oldDirX * sin(rotSpeed) + dirY * cos(rotSpeed);
@@ -1468,7 +1540,7 @@ void RotateLeft() {
 	planeY = oldPlaneX * sin(rotSpeed) + planeY * cos(rotSpeed);
 }
 
-void RotateRight() {
+void RotateRight(ScriptMethodParams &) {
 	double oldDirX = dirX;
 	dirX = dirX * cos(-rotSpeed) - dirY * sin(-rotSpeed);
 	dirY = oldDirX * sin(-rotSpeed) + dirY * cos(-rotSpeed);
diff --git a/engines/ags/plugins/ags_pal_render/raycast.h b/engines/ags/plugins/ags_pal_render/raycast.h
index ab83fa413b..4e5faa3a4d 100644
--- a/engines/ags/plugins/ags_pal_render/raycast.h
+++ b/engines/ags/plugins/ags_pal_render/raycast.h
@@ -104,103 +104,103 @@ extern int skybox;
 
 
 
-void MakeTextures(int slot);
-void Raycast_Render(int slot);
-void MoveForward();
-void MoveBackward();
-void RotateLeft();
-void RotateRight();
-void Init_Raycaster();
-void QuitCleanup();
-void LoadMap(int worldmapSlot, int lightmapSlot, int ceilingmapSlot, int floormapSlot);
-void Ray_InitSprite(int id, SCRIPT_FLOAT(x), SCRIPT_FLOAT(y), int slot, unsigned char alpha, int blendmode, SCRIPT_FLOAT(scale_x), SCRIPT_FLOAT(scale_y), SCRIPT_FLOAT(vMove));
-void Ray_SetPlayerPosition(SCRIPT_FLOAT(x), SCRIPT_FLOAT(y));
-FLOAT_RETURN_TYPE Ray_GetPlayerX();
-FLOAT_RETURN_TYPE Ray_GetPlayerY();
-int Ray_GetPlayerAngle();
-void Ray_SetPlayerAngle(int angle);
-
-int Ray_GetWallHotspot(int id);
-int Ray_GetWallTexture(int id, int dir);
-int Ray_GetWallSolid(int id, int dir);
-int Ray_GetWallIgnoreLighting(int id, int dir);
-int Ray_GetWallAlpha(int id, int dir);
-int Ray_GetWallBlendType(int id, int dir);
-
-void Ray_SelectTile(int x, int y, unsigned char color);
-
-int Ray_GetHotspotAt(int x, int y);
-int Ray_GetObjectAt(int x, int y);
-
-void Ray_DrawTile(int spr, int tile);
-void Ray_DrawOntoTile(int spr, int tile);
-void Ray_SetNoClip(int value);
-int Ray_GetNoClip();
-void Ray_SetSpriteInteractObj(int id, int obj);
-int  Ray_GetSpriteInteractObj(int id);
-void Ray_SetSpritePosition(int id, SCRIPT_FLOAT(x), SCRIPT_FLOAT(y));
-void Ray_SetSpriteVertOffset(int id, SCRIPT_FLOAT(vMove));
-FLOAT_RETURN_TYPE Ray_GetSpriteVertOffset(int id);
-FLOAT_RETURN_TYPE Ray_GetSpriteX(int id);
-FLOAT_RETURN_TYPE Ray_GetSpriteY(int id);
-
-void Ray_SetWallHotspot(int id, char hotsp);
-void Ray_SetWallTextures(int id, int n, int s, int w, int e);
-void Ray_SetWallSolid(int id, int n, int s, int w, int e);
-void Ray_SetWallIgnoreLighting(int id, int n, int s, int w, int e);
-void Ray_SetWallAlpha(int id, int n, int s, int w, int e);
-void Ray_SetWallBlendType(int id, int n, int s, int w, int e);
-
-FLOAT_RETURN_TYPE Ray_GetMoveSpeed();
-void Ray_SetMoveSpeed(SCRIPT_FLOAT(speed));
-FLOAT_RETURN_TYPE Ray_GetRotSpeed();
-void Ray_SetRotSpeed(SCRIPT_FLOAT(speed));
-int Ray_GetWallAt(int x, int y);
-int Ray_GetLightAt(int x, int y);
-void Ray_SetLightAt(int x, int y, int light);
-void Ray_SetWallAt(int x, int y, int id);
-void Ray_SetPlaneY(SCRIPT_FLOAT(y));
-FLOAT_RETURN_TYPE Ray_GetDistanceAt(int x, int y);
-int Ray_GetSpriteAngle(int id);
-void Ray_SetSpriteAngle(int id, int angle);
-void Ray_SetSpriteView(int id, int view);
-int Ray_GetSpriteView(int id);
-void Ray_SetSpriteFrame(int id, int frame);
-int Ray_GetSpriteFrame(int id);
-
-int Ray_GetTileX_At(int x, int y);
-int Ray_GetTileY_At(int x, int y);
-
-void Ray_SetSkyBox(int slot);
-int Ray_GetSkyBox(int slot);
-
-void Ray_SetAmbientLight(int value);
-int Ray_GetAmbientLight();
-void Ray_SetAmbientColor(int color, int amount);
-
-
-int Ray_GetSpriteAlpha(int id);
-void Ray_SetSpriteAlpha(int id, int alpha);
-int Ray_GetSpritePic(int id);
-void Ray_SetSpritePic(int id, int slot);
-
-FLOAT_RETURN_TYPE Ray_GetSpriteScaleX(int id);
-void Ray_SetSpriteScaleX(int id, SCRIPT_FLOAT(scale));
-FLOAT_RETURN_TYPE Ray_GetSpriteScaleY(int id);
-void Ray_SetSpriteScaleY(int id, SCRIPT_FLOAT(scale));
-
-void Ray_SetSpriteBlendType(int id, int type);
-int Ray_GetSpriteBlendType(int id);
-
-void Ray_SetFloorAt(int x, int y, int tex);
-void Ray_SetCeilingAt(int x, int y, int tex);
-int Ray_GetCeilingAt(int x, int y);
-int Ray_GetFloorAt(int x, int y);
-int Ray_GetLightingAt(int x, int y);
-void Ray_SetLightingAt(int x, int y, unsigned char lighting);
-int Ray_GetAmbientWeight();
-
-int Ray_HasSeenTile(int x, int y);
+void MakeTextures(ScriptMethodParams &params);
+void Raycast_Render(ScriptMethodParams &params);
+void MoveForward(ScriptMethodParams &params);
+void MoveBackward(ScriptMethodParams &params);
+void RotateLeft(ScriptMethodParams &params);
+void RotateRight(ScriptMethodParams &params);
+void Init_Raycaster(ScriptMethodParams &params);
+void QuitCleanup(ScriptMethodParams &params);
+void LoadMap(ScriptMethodParams &params);
+void Ray_InitSprite(ScriptMethodParams &params);
+void Ray_SetPlayerPosition(ScriptMethodParams &params);
+void Ray_GetPlayerX(ScriptMethodParams &params);
+void Ray_GetPlayerY(ScriptMethodParams &params);
+void Ray_GetPlayerAngle(ScriptMethodParams &params);
+void Ray_SetPlayerAngle(ScriptMethodParams &params);
+
+void Ray_GetWallHotspot(ScriptMethodParams &params);
+void Ray_GetWallTexture(ScriptMethodParams &params);
+void Ray_GetWallSolid(ScriptMethodParams &params);
+void Ray_GetWallIgnoreLighting(ScriptMethodParams &params);
+void Ray_GetWallAlpha(ScriptMethodParams &params);
+void Ray_GetWallBlendType(ScriptMethodParams &params);
+
+void Ray_SelectTile(ScriptMethodParams &params);
+
+void Ray_GetHotspotAt(ScriptMethodParams &params);
+void Ray_GetObjectAt(ScriptMethodParams &params);
+
+void Ray_DrawTile(ScriptMethodParams &params);
+void Ray_DrawOntoTile(ScriptMethodParams &params);
+void Ray_SetNoClip(ScriptMethodParams &params);
+void Ray_GetNoClip(ScriptMethodParams &params);
+void Ray_SetSpriteInteractObj(ScriptMethodParams &params);
+void  Ray_GetSpriteInteractObj(ScriptMethodParams &params);
+void Ray_SetSpritePosition(ScriptMethodParams &params);
+void Ray_SetSpriteVertOffset(ScriptMethodParams &params);
+void Ray_GetSpriteVertOffset(ScriptMethodParams &params);
+void Ray_GetSpriteX(ScriptMethodParams &params);
+void Ray_GetSpriteY(ScriptMethodParams &params);
+
+void Ray_SetWallHotspot(ScriptMethodParams &params);
+void Ray_SetWallTextures(ScriptMethodParams &params);
+void Ray_SetWallSolid(ScriptMethodParams &params);
+void Ray_SetWallIgnoreLighting(ScriptMethodParams &params);
+void Ray_SetWallAlpha(ScriptMethodParams &params);
+void Ray_SetWallBlendType(ScriptMethodParams &params);
+
+void Ray_GetMoveSpeed(ScriptMethodParams &params);
+void Ray_SetMoveSpeed(ScriptMethodParams &params);
+void Ray_GetRotSpeed(ScriptMethodParams &params);
+void Ray_SetRotSpeed(ScriptMethodParams &params);
+void Ray_GetWallAt(ScriptMethodParams &params);
+void Ray_GetLightAt(ScriptMethodParams &params);
+void Ray_SetLightAt(ScriptMethodParams &params);
+void Ray_SetWallAt(ScriptMethodParams &params);
+void Ray_SetPlaneY(ScriptMethodParams &params);
+void Ray_GetDistanceAt(ScriptMethodParams &params);
+void Ray_GetSpriteAngle(ScriptMethodParams &params);
+void Ray_SetSpriteAngle(ScriptMethodParams &params);
+void Ray_SetSpriteView(ScriptMethodParams &params);
+void Ray_GetSpriteView(ScriptMethodParams &params);
+void Ray_SetSpriteFrame(ScriptMethodParams &params);
+void Ray_GetSpriteFrame(ScriptMethodParams &params);
+
+void Ray_GetTileX_At(ScriptMethodParams &params);
+void Ray_GetTileY_At(ScriptMethodParams &params);
+
+void Ray_SetSkyBox(ScriptMethodParams &params);
+void Ray_GetSkyBox(ScriptMethodParams &params);
+
+void Ray_SetAmbientLight(ScriptMethodParams &params);
+void Ray_GetAmbientLight(ScriptMethodParams &params);
+void Ray_SetAmbientColor(ScriptMethodParams &params);
+
+
+void Ray_GetSpriteAlpha(ScriptMethodParams &params);
+void Ray_SetSpriteAlpha(ScriptMethodParams &params);
+void Ray_GetSpritePic(ScriptMethodParams &params);
+void Ray_SetSpritePic(ScriptMethodParams &params);
+
+void Ray_GetSpriteScaleX(ScriptMethodParams &params);
+void Ray_SetSpriteScaleX(ScriptMethodParams &params);
+void Ray_GetSpriteScaleY(ScriptMethodParams &params);
+void Ray_SetSpriteScaleY(ScriptMethodParams &params);
+
+void Ray_SetSpriteBlendType(ScriptMethodParams &params);
+void Ray_GetSpriteBlendType(ScriptMethodParams &params);
+
+void Ray_SetFloorAt(ScriptMethodParams &params);
+void Ray_SetCeilingAt(ScriptMethodParams &params);
+void Ray_GetCeilingAt(ScriptMethodParams &params);
+void Ray_GetFloorAt(ScriptMethodParams &params);
+void Ray_GetLightingAt(ScriptMethodParams &params);
+void Ray_SetLightingAt(ScriptMethodParams &params);
+void Ray_GetAmbientWeight(ScriptMethodParams &params);
+
+void Ray_HasSeenTile(ScriptMethodParams &params);
 
 } // namespace AGSPalRender
 } // namespace Plugins


Commit: 74f20c23e1a2bee93ba467f66ebd2dd0cba4a8e9
    https://github.com/scummvm/scummvm/commit/74f20c23e1a2bee93ba467f66ebd2dd0cba4a8e9
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-04-07T00:01:23+01:00

Commit Message:
AGS: Fix memory issue in ags_pal_render DoFire

Changed paths:
    engines/ags/plugins/ags_pal_render/ags_pal_render.cpp


diff --git a/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp b/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
index 7d53e5c24a..034c410db7 100644
--- a/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
+++ b/engines/ags/plugins/ags_pal_render/ags_pal_render.cpp
@@ -547,6 +547,7 @@ void DoFire(ScriptMethodParams &params) {
 				ABS((int)::AGS::g_vm->getRandomNumber(0x7fffffff) % 10) > 7)
 			fire[firexy] = 255;
 		sparky = ABS((int)::AGS::g_vm->getRandomNumber(0x7fffffff) % (h - 2));
+		firexy = (h - sparky) * firePitch + x;
 		if (sparky < h && sparky > 0 && fire[firexy] > cutoff &&
 				ABS((int)::AGS::g_vm->getRandomNumber(0x7fffffff) % 10) > 7)
 			fire[firexy] = 0;




More information about the Scummvm-git-logs mailing list