mirror of
https://github.com/rh-hideout/pokeemerald-expansion.git
synced 2026-03-21 18:04:50 -05:00
Merge d9d3f7ab1e into 264d99215b
This commit is contained in:
commit
64ff6565bc
|
|
@ -1447,6 +1447,18 @@
|
|||
.2byte \metatileId
|
||||
.2byte \impassable
|
||||
.endm
|
||||
|
||||
@ Set a metatile at all tiles within the bounds [xmin,ymin] to [xmax,ymax] inclusive with desired elevation
|
||||
.macro setmetatileinrange xmin:req, ymin:req, xmax:req, ymax:req, tileid:req, collision=FALSE, elevation=0xFF
|
||||
callnative ScriptSetMetatileInRange
|
||||
.byte \xmin
|
||||
.byte \ymin
|
||||
.byte \xmax
|
||||
.byte \ymax
|
||||
.2byte \tileid
|
||||
.byte \collision
|
||||
.byte \elevation
|
||||
.endm
|
||||
|
||||
@ Queues a weather change to the default weather for the map.
|
||||
.macro resetweather
|
||||
|
|
|
|||
37
src/scrcmd.c
37
src/scrcmd.c
|
|
@ -2758,6 +2758,43 @@ bool8 ScrCmd_setmetatile(struct ScriptContext *ctx)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void NativeFunc_SetMetatileInRange(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 xmin = ScriptReadByte(ctx);
|
||||
u8 ymin = ScriptReadByte(ctx);
|
||||
u8 xmax = ScriptReadByte(ctx);
|
||||
u8 ymax = ScriptReadByte(ctx);
|
||||
u16 tileId = VarGet(ScriptReadHalfword(ctx));
|
||||
bool8 hasCollision = ScriptReadByte(ctx);
|
||||
u8 elevation = ScriptReadByte(ctx);
|
||||
u32 i, j;
|
||||
|
||||
if (xmin > xmax)
|
||||
SWAP(xmin, xmax, i);
|
||||
|
||||
if (ymin > ymax)
|
||||
SWAP(ymin, ymax, i);
|
||||
|
||||
xmin += MAP_OFFSET;
|
||||
ymin += MAP_OFFSET;
|
||||
xmax += MAP_OFFSET;
|
||||
ymax += MAP_OFFSET;
|
||||
|
||||
// try set impassable
|
||||
if (hasCollision)
|
||||
tileId |= MAPGRID_COLLISION_MASK;
|
||||
|
||||
// set elevation
|
||||
if (elevation < 15)
|
||||
tileId |= (elevation << MAPGRID_ELEVATION_SHIFT);
|
||||
|
||||
for (i = xmin; i <= xmax; i++)
|
||||
{
|
||||
for (j = ymin; j <= ymax; j++)
|
||||
MapGridSetMetatileEntryAt(i, j, tileId);
|
||||
}
|
||||
}
|
||||
|
||||
bool8 ScrCmd_opendoor(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user