Implement SPSET(4)

This commit is contained in:
otya128 committed 2016-12-31 20:15:54 +09:00
1 parent 4b41376cb5
commit af16cffeeb
1 file changed
+19
+19
View File
@@ -1485,6 +1485,25 @@ class BuiltinFunction
return; return;
p.sprite.spset(ix, defno); p.sprite.spset(ix, defno);
} }
static void SPSET(PetitComputer p, int u, int v, int w, int h, int attr, out int ix)
{
if (u < 0)
throw new OutOfRange(smilebasicFunctionName, 1);
if (v < 0)
throw new OutOfRange(smilebasicFunctionName, 2);
if (w > p.graphic.width || w < 0)
throw new OutOfRange(smilebasicFunctionName, 3);
if (h > p.graphic.height || h < 0)
throw new OutOfRange(smilebasicFunctionName, 4);
if (u + w > p.graphic.width)
throw new OutOfRange(smilebasicFunctionName);
if (v + h > p.graphic.height)
throw new OutOfRange(smilebasicFunctionName);
ix = p.sprite.allocSprite();
if (ix == -1)
return;
p.sprite.spset(ix, u, v, w, h, cast(SpriteAttr)attr);
}
static void SPCHR(PetitComputer p, int id, int defno, DefaultValue!(int, false) V, DefaultValue!(int, false) W, DefaultValue!(int, false) H, DefaultValue!(int, false) ATTR) static void SPCHR(PetitComputer p, int id, int defno, DefaultValue!(int, false) V, DefaultValue!(int, false) W, DefaultValue!(int, false) H, DefaultValue!(int, false) ATTR)
{ {
if (!p.sprite.isValidSpriteId(id)) if (!p.sprite.isValidSpriteId(id))