EmilyMisc.zh#

Variables#

Functions#

int

Emily::dirX(int dir)

int

Emily::dirY(int dir)

int

Emily::remX(int dir)

int

Emily::remY(int dir)

int

Emily::addX(int dir, int add)

int

Emily::addY(int dir, int add)

int

Emily::SpinDir8(int dir, int count = 1)

int

Emily::HorzFlip(int dir)

int

Emily::VertFlip(int dir)

bool

Emily::CanWalkM(lweapon weap, mapdata map, int dir, int step, bool useHit)

bool

Emily::CanWalkM(eweapon weap, mapdata map, int dir, int step, bool useHit)

bool

Emily::CanWalkM(npc n, mapdata map, int dir, int step, bool useHit)

bool

Emily::CanWalkM(ffc f, mapdata map, int dir, int step, bool useEffect)

bool

Emily::CanWalkM(mapdata map, int dir, int step)

bool

Emily::CanWalkM(int x, int y, int xx, int yy, mapdata map, int dir, int step)

bool

Emily::CanWalkS(int x, int y, int xx, int yy, int dir, int step)

bool

Emily::CanWalkMFull(lweapon weap, mapdata map, int dir, int step, bool useHit)

bool

Emily::CanWalkMFull(eweapon weap, mapdata map, int dir, int step, bool useHit)

bool

Emily::CanWalkMFull(npc n, mapdata map, int dir, int step, bool useHit)

bool

Emily::CanWalkMFull(ffc f, mapdata map, int dir, int step, bool useEffect)

bool

Emily::CanWalkMFull(mapdata map, int dir, int step)

bool

Emily::CanWalkMFull(int x, int y, int xx, int yy, mapdata map, int dir, int step)

bool

Emily::CanWalkSFull(int x, int y, int xx, int yy, int dir, int step)

mapdata

Emily::CurMapdata()

mapdata

Emily::loadLayer(mapdata m, int layer)

int

Emily::InvVectorX(int deltax, int angle)

int

Emily::InvVectorY(int deltay, int angle)

bool

Emily::TriangleRectCollision(int tx1, int ty1, int tx2, int ty2, int tx3, int ty3, int rx1, int ry1, int rx2, int ry2)

bool

Emily::HeroTriangleCollision(int tx1, int ty1, int tx2, int ty2, int tx3, int ty3)

bool

Emily::HeroTriangleCollision(int tx1, int ty1, int tx2, int ty2, int tx3, int ty3, bool bigHitbox)

bool

Emily::lineRectIntersect(int x1, int y1, int x2, int y2, int left, int right, int top, int bottom)

bool

Emily::pointTriangleCollision(int x1, int y1, int x2, int y2, int x3, int y3, int px, int py)

void

Emily::ffcSolid(ffc anFFC)

bool

Emily::HeroIsScrolling()

bool

Emily::HeroIsScrollingOrWarping()

bool

Emily::CanScrollInDir(int dir)

int

Emily::InFrontCenteredX(int dir, int dist)

int

Emily::InFrontCenteredY(int dir, int dist)

void

Emily::haltFFC(ffc f)

void

Emily::MooshDrawTile(int layer, int cx, int cy, int tile, int blockw, int blockh, int cset, int xscale, int yscale, int rx, int ry, int rangle, int flip, bool transparency, int opacity)

void

Emily::ColorScreen(int layer, int color, bool subscrArea)

void

Emily::DrawStrings(int layer, int x, int y, int font, int color, int background_color, int format, char32[] ptr, int opacity, int verticalSpacing, int MaxWidth)

void

Emily::DrawStrings(int layer, int x, int y, int font, int color, int background_color, int format, char32[] ptr, int opacity, int shadow_type, int shadow_color, int verticalSpacing, int MaxWidth)

void

Emily::DrawStringsBitmap(bitmap b, int layer, int x, int y, int font, int color, int background_color, int format, char32[] ptr, int opacity, int verticalSpacing, int MaxWidth)

void

Emily::DrawStringsBitmap(bitmap b, int layer, int x, int y, int font, int color, int background_color, int format, char32[] ptr, int opacity, int shadow_type, int shadow_color, int verticalSpacing, int MaxWidth)

int

Emily::DrawStringsCount(int font, char32[] ptr, int MaxWidth)

int

Emily::DrawStringsWid(int font, char32[] ptr, int MaxWidth)

void

Emily::getFontName(char32[] buf, int font)

void

Emily::colorscr_txt(int color, int txtcolor, int font, char32[] buf, bool hidesubscr)

bitmap

Emily::create(int w, int h)

void

Emily::doMapScreenshot(int map, int frameDelay = 10)

void

Emily::doAllMapScreenshots(int frameDelay = 10)

untyped

Emily::large_memmove(untyped[] dest, int dpos, untyped[] src, int spos, int n)

int

Emily::item_tile(int id)

int

Emily::item_cset(int id)

Variable descriptions#

const bool Emily::MAPDATA_USECURSCREEN = true πŸ”— Source

If true, then calling CanWalkM with the current screen’s mapdata will use Screen-> instead of the provided mapdata->


const int Emily::SCRNSHOT_DMAP = 511 πŸ”— Source

end start Fancy screenshot thing


const int Emily::SYS_WHITE = 245 πŸ”— Source


const int Emily::SYS_BLACK = 224 πŸ”— Source


const bool Emily::MAPSCREENSHOT_HIDES_SUBSCR = true πŸ”— Source


Function descriptions#

int Emily::dirX(int dir) πŸ”— Source

Returns 1 if the dir is rightward, -1 if leftward, 0 if neither


int Emily::dirY(int dir) πŸ”— Source

Returns 1 if the dir is downward, -1 if upward, 0 if neither


int Emily::remX(int dir) πŸ”— Source

Removes the horizontal component of a direction


int Emily::remY(int dir) πŸ”— Source

Removes the vertical component of a direction


int Emily::addX(int dir, int add) πŸ”— Source

Adds the horizontal component of a direction


int Emily::addY(int dir, int add) πŸ”— Source

Adds the vertical component of a direction


int Emily::SpinDir8(int dir, int count = 1) πŸ”— Source

Spin a dir clockwise 45Β°, count number of times If count is negative, will spin counterclockwise instead


int Emily::HorzFlip(int dir) πŸ”— Source

Flip a dir horizontally


int Emily::VertFlip(int dir) πŸ”— Source

Flip a dir horizontally


bool Emily::CanWalkM(lweapon weap, mapdata map, int dir, int step, bool useHit) πŸ”— Source

This function (and set of overloads) acts as CanWalk, but uses an arbitrary mapdata pointer for solidity, rather than the current screen. Related: CurMapdata()

lweapon


bool Emily::CanWalkM(eweapon weap, mapdata map, int dir, int step, bool useHit) πŸ”— Source

eweapon


bool Emily::CanWalkM(npc n, mapdata map, int dir, int step, bool useHit) πŸ”— Source

npc


bool Emily::CanWalkM(ffc f, mapdata map, int dir, int step, bool useEffect) πŸ”— Source

ffc


bool Emily::CanWalkM(mapdata map, int dir, int step) πŸ”— Source

Link


bool Emily::CanWalkM(int x, int y, int xx, int yy, mapdata map, int dir, int step) πŸ”— Source

Main


bool Emily::CanWalkS(int x, int y, int xx, int yy, int dir, int step) πŸ”— Source

invalid direction Current Screen


bool Emily::CanWalkMFull(lweapon weap, mapdata map, int dir, int step, bool useHit) πŸ”— Source

invalid direction end Standard start Full (Checks the FULL hitbox, not just where you are moving into) lweapon


bool Emily::CanWalkMFull(eweapon weap, mapdata map, int dir, int step, bool useHit) πŸ”— Source

eweapon


bool Emily::CanWalkMFull(npc n, mapdata map, int dir, int step, bool useHit) πŸ”— Source

npc


bool Emily::CanWalkMFull(ffc f, mapdata map, int dir, int step, bool useEffect) πŸ”— Source

ffc


bool Emily::CanWalkMFull(mapdata map, int dir, int step) πŸ”— Source

Link


bool Emily::CanWalkMFull(int x, int y, int xx, int yy, mapdata map, int dir, int step) πŸ”— Source

Main


bool Emily::CanWalkSFull(int x, int y, int xx, int yy, int dir, int step) πŸ”— Source

invalid direction Current Screen


mapdata Emily::CurMapdata() πŸ”— Source

Returns a mapdata pointer to the current screen (Perm version).


mapdata Emily::loadLayer(mapdata m, int layer) πŸ”— Source

Returns a mapdata pointer to the specified layer of the given pointer. Will be perm version unless Game->LoadTempScreen(0) is provided, in which case it will return the temp layer.


int Emily::InvVectorX(int deltax, int angle) πŸ”— Source

Returns the length of the line which has an angle of angle, and results in a change in x of deltax


int Emily::InvVectorY(int deltay, int angle) πŸ”— Source

Returns the length of the line which has an angle of angle, and results in a change in y of deltay


bool Emily::TriangleRectCollision(int tx1, int ty1, int tx2, int ty2, int tx3, int ty3, int rx1, int ry1, int rx2, int ry2) πŸ”— Source

Checks if the given rectangle and triangle collide


bool Emily::HeroTriangleCollision(int tx1, int ty1, int tx2, int ty2, int tx3, int ty3) πŸ”— Source

Checks if the given triangle collides with Hero, using Hero->BigHitbox’s setting


bool Emily::HeroTriangleCollision(int tx1, int ty1, int tx2, int ty2, int tx3, int ty3, bool bigHitbox) πŸ”— Source

Checks if the given triangle collides with Hero, with an option for bigHitbox


bool Emily::lineRectIntersect(int x1, int y1, int x2, int y2, int left, int right, int top, int bottom) πŸ”— Source

Returns true if the line specified by points (x1,y1), (x2,y2) intersects with the rectangle defined by (left,right,top,bottom) Based on: https://seblee.me/2009/05/super-fast-trianglerectangle-intersection-test/


bool Emily::pointTriangleCollision(int x1, int y1, int x2, int y2, int x3, int y3, int px, int py) πŸ”— Source

Returns true if a point (px,py) is within the triangle defined by (x1,y1), (x2,y2), (x3,y3)


void Emily::ffcSolid(ffc anFFC) πŸ”— Source

My attempt at a solid FFC function. Call ffcSolid(ffc) each frame to make the ffc solid. This is not fully tested.


bool Emily::HeroIsScrolling() πŸ”— Source

Returns true if Hero is scrolling, or about to begin scrolling. Any scripted draws intended to not draw during scrolling should run only if this returns false. Due to variance with Hero’s movement (1 or 2 pixels), this may sometimes return true extraneously.


bool Emily::HeroIsScrollingOrWarping() πŸ”— Source

Returns true if Hero is scrolling, or about to begin scrolling. Any scripted draws intended to not draw during scrolling should run only if this returns false. Due to variance with Hero’s movement (1 or 2 pixels), this may sometimes return true extraneously.


bool Emily::CanScrollInDir(int dir) πŸ”— Source

Returns true if scrolling in a particular direction from this screen is valid. This checks for the edge of the map, respecting sidewarps.


int Emily::InFrontCenteredX(int dir, int dist) πŸ”— Source

Returns the X-offset to add to a sprite’s coordinate to be directly in front of it, by β€˜dist’ pixels of them


int Emily::InFrontCenteredY(int dir, int dist) πŸ”— Source

Returns the Y-offset to add to a sprite’s coordinate to be directly in front of it, by β€˜dist’ pixels of them


void Emily::haltFFC(ffc f) πŸ”— Source

Zeroes all movement factors of an FFC


void Emily::MooshDrawTile(int layer, int cx, int cy, int tile, int blockw, int blockh, int cset, int xscale, int yscale, int rx, int ry, int rangle, int flip, bool transparency, int opacity) πŸ”— Source

end start Drawing Functions As the name of the function implies, this was stolen from Moosh.


void Emily::ColorScreen(int layer, int color, bool subscrArea) πŸ”— Source

Colors the entire screen. bool subscrArea determines if the passive subscreen should be included.


void Emily::DrawStrings(int layer, int x, int y, int font, int color, int background_color, int format, char32[] ptr, int opacity, int verticalSpacing, int MaxWidth) πŸ”— Source

This will work as DrawString, but, it can draw over multiple vertical lines. Text over the Max Width, as well as newline characters (’n’), will break to the next line. New params: β€˜verticalSpacing’ is the extra space to include between lines. β€˜MaxWidth’ is the width at which text will be forced onto the next line.


void Emily::DrawStrings(int layer, int x, int y, int font, int color, int background_color, int format, char32[] ptr, int opacity, int shadow_type, int shadow_color, int verticalSpacing, int MaxWidth) πŸ”— Source

end


void Emily::DrawStringsBitmap(bitmap b, int layer, int x, int y, int font, int color, int background_color, int format, char32[] ptr, int opacity, int verticalSpacing, int MaxWidth) πŸ”— Source

This will work as DrawString, but, it can draw over multiple vertical lines. Text over the Max Width, as well as newline characters (’n’), will break to the next line. New params: β€˜b’ is the bitmap to render to. β€˜verticalSpacing’ is the extra space to include between lines. β€˜MaxWidth’ is the width at which text will be forced onto the next line.


void Emily::DrawStringsBitmap(bitmap b, int layer, int x, int y, int font, int color, int background_color, int format, char32[] ptr, int opacity, int shadow_type, int shadow_color, int verticalSpacing, int MaxWidth) πŸ”— Source

end


int Emily::DrawStringsCount(int font, char32[] ptr, int MaxWidth) πŸ”— Source

Same as DrawStrings, but, does not draw anything. Returns the number of lines that DrawStrings would use.


int Emily::DrawStringsWid(int font, char32[] ptr, int MaxWidth) πŸ”— Source

Same as DrawStrings, but, does not draw anything. Returns the width that DrawStrings would hit, at max.


void Emily::getFontName(char32[] buf, int font) πŸ”— Source

end end Drawing Functions


void Emily::colorscr_txt(int color, int txtcolor, int font, char32[] buf, bool hidesubscr) πŸ”— Source

end


bitmap Emily::create(int w, int h) πŸ”— Source

end


void Emily::doMapScreenshot(int map, int frameDelay = 10) πŸ”— Source


void Emily::doAllMapScreenshots(int frameDelay = 10) πŸ”— Source

end


untyped Emily::large_memmove(untyped[] dest, int dpos, untyped[] src, int spos, int n) πŸ”— Source

As memmove(), but with a larger buffer


int Emily::item_tile(int id) πŸ”— Source

end Gets an item’s tile, animated based on β€˜Game->Time’


int Emily::item_cset(int id) πŸ”— Source

Gets an item’s cset, animated based on β€˜Game->Time’