// Open Legends Sprite Object Functions #if defined _sprites_included #endinput #endif #define _sprites_included enum _layer { _Background, _Underground2, _Underground, _Ground, _FirstLevel, _SecondLevel, _ThirdLevel, _Sky, _HUD }; /* enum _sublayer { } "0 - Background", "1 - Sprites", "2 - Entities", "3 - Top Background", "4 - Top Sprites", "5 - Top Entities", */ enum _animmode { animnormal, animnoinc, animnopause, } enum _Colours { Black, White, Red, Lime, Blue, Yellow, Magenta, Cyan, Gray, Olive, Purple, Teal, Maroon, Green, Navy, Silver, Orange, Darkgray } //Open Zelda's Legends Emulation #include //Colour Functions stock CreateColourHex(hex[], r = 255, g = 255, b = 255, a = 255) { hex[0] = ReturnChar(r / 16); hex[1] = ReturnChar(r - (r / 16)); hex[2] = ReturnChar(g / 16); hex[3] = ReturnChar(g - (g / 16)); hex[4] = ReturnChar(b / 16); hex[5] = ReturnChar(b - (b / 16)); hex[6] = ReturnChar(a / 16); hex[7] = ReturnChar(a - (a / 16)); hex[8] = 0; } //Drawing Functions native OZDrawAnim(ident[], x, y, depth, layer = 0, r = 255, g = 255, b = 255, a = 255, rot = 0, scale = 100) = DrawAnim; native OZDrawAnimNoInc(ident[], x, y, depth, layer = 0, r = 255, g = 255, b = 255, a = 255, rot = 0, scale = 100) = DrawAnimNoInc; native OZPutSprite(ident[], valx, valy, vald, layer = 0, r = 255, g = 255, b = 255, a = 255, rot = 0, scale = 100) = PutSprite; native OZDrawImage(code[], x, y, r = 255, g = 255, b = 255, a = 255, rot = 0, scale = 100) = DrawImage; native OZSetTextSize( size ) = SetTextSize; native OZDrawText(string[], x, y, red = 255, green = 255, blue = 255, alpha = 255) = DrawText; native OZDrawRectangle(x1, y1, x2, y2, red, green, blue, alpha = 255, angle = 0) = DrawRectangle; native OZDrawLine(x1, y1, x2, y2, width, red, green, blue, aplha = 255) = DrawLine; stock DrawAnim(ident[], x, y, depth, _animmode:mode = animnormal, _coord:coordType = _worldcoord, layer = 3, colour[] = "FFFFFFFF", rot = 0, scale = 100 ) { switch( mode ) { case animnormal: return OZDrawAnim(ident, ( coordType == _screencoord ? ConvertXCoords(x, _worldcoord) : x ), ( coordType == _screencoord ? ConvertYCoords(y, _worldcoord) : y ), depth, layer, ReturnNumber(colour, 0), ReturnNumber(colour, 1), ReturnNumber(colour, 2), ReturnNumber(colour, 3), rot, scale); case animnoinc: return OZDrawAnimNoInc(ident, ( coordType == _screencoord ? ConvertXCoords(x) : x ), ( coordType == _screencoord ? ConvertYCoords(y) : y ), depth, layer, ReturnNumber(colour, 0), ReturnNumber(colour, 1), ReturnNumber(colour, 2), ReturnNumber(colour, 3), rot, scale); case animnopause: TextFile("DrawAnim(.mode = animnopause) not support."); } return 0; } stock DrawSprite(ident[], x, y, depth, _coord:coordType = _worldcoord, layer = 3, colour[] = "FFFFFFFF", rot = 0, scale = 100, surface[] = {0} ) { if (surface[0] != 0) { TextFile("Drawing to surface not support."); return 0; } if ( layer == 5 ) return OZDrawImage(ident, ( coordType == _worldcoord ? ConvertXCoords(x, _screencoord) : x ), ( coordType == _screencoord ? ConvertYCoords(y, _worldcoord) : y ), ReturnNumber(colour, 0), ReturnNumber(colour, 1), ReturnNumber(colour, 2), ReturnNumber(colour, 3), rot, scale); else return OZPutSprite(ident, ( coordType == _screencoord ? ConvertXCoords(x, _worldcoord) : x ), ( coordType == _screencoord ? ConvertYCoords(y, _worldcoord) : y ), depth, 0, ReturnNumber(colour, 0), ReturnNumber(colour, 1), ReturnNumber(colour, 2), ReturnNumber(colour, 3), rot, scale); } stock DrawFill(ident[], x, y, w, h, depth, _coord:coordType = _worldcoord, layer = 0, colour[] = "FFFFFFFF", rot = 0, scale = 100, surface[] = {0} ) { TextFile("DrawFill not support."); return 0; } stock DrawText(Text[], x, y, _coord:coordType = _screencoord, layer = 5, colour[] = "FFFFFFFF", rot = 0, scale = 100, surface[] = {0}) { if (surface[0] != 0) { TextFile("Drawing to surface not support."); return 0; } OZSetTextSize( scale/10 ); return OZDrawText(Text, ( coordType == _worldcoord ? ConvertXCoords(x, _screencoord) : x ), ( coordType == _screencoord ? ConvertYCoords(y, _worldcoord) : y ), ReturnNumber(colour, 0), ReturnNumber(colour, 1), ReturnNumber(colour, 2), ReturnNumber(colour, 3)); } stock DrawBitmapText(Text[], x, y, style, _coord:coordType = _screencoord, layer = 5, colour[] = "FFFFFFFF", rot = 0, scale = 100, surface[] = {0}) { /* if (surface[0] != 0) { TextFile("Drawing to surface not support."); return 0; } new length = strlen(Text); new thisx = x; new thisy = y; new spacing = 8; new prefix[7] = "_charX"; new spacer_image[9] = "_charX32"; new temp[4]; new thischar; new gfx[11]; if ( 0 <= style <= 9 ) style += 48; else if ( 10 <= style <= 36 ) style += 55; else if ( 37 <= style <= 62 ) style += 87; else style = 49; prefix[5] = style; spacer_image[5] = style; spacing = GetWidth(spacer_image); for(new n = 0; n