// General Open Legends Functions #if defined _legends_included #endinput #endif #define _legends_included #include // Define 8 Directions enum _Directions{ north, east, south, west, northeast, southeast, southwest, northwest, } enum _Keys{ UP, DOWN, LEFT, RIGHT, ACTION1, ACTION2, ACTION3, ACTION4, ACTION5, ACTION6, ACTION7, ACTION8, ACTION9, MENU, } enum _Flags{ Active, Open, Dead, Visible, Taken, Cuttable, Large, Pickable, Pushed, Interacting, Owned, } enum _imagetype{ _sprite, _animation } //Open Zelda's Legends Emulation native QKey(); native AKey(); native SKey(); native WKey(); native EnterKey(); native UpKey(); native DownKey(); native LeftKey(); native RightKey(); native SetQKey(val); native SetAKey(val); native SetSKey(val); native SetWKey(val); native SetEnterKey(val); native SetUpKey(val); native SetDownKey(val); native SetLeftKey(val); native SetRightKey(val); #if defined _beta native EKey(); native DKey(); native ZKey(); native XKey(); native CKey(); native SetEKey(val); native SetDKey(val); native SetZKey(val); native SetXKey(val); native SetCKey(val); #endif //Input stock GetKey(_Keys:key, ) { switch( key) { case 0: return UpKey(); case 1: return DownKey(); case 2: return LeftKey(); case 3: return RightKey(); case 4: return AKey(); case 5: return SKey(); case 7: return QKey(); case 8: return WKey(); #if defined _beta case 6: return DKey(); case 9: return EKey(); case 10: return ZKey(); case 11: return XKey(); case 12: return CKey(); #elseif case 6..12: return -1; #endif case 13: return EnterKey(); default: return -1; } } // SetKey?? stock GetMousePosition(&x,&y,_coord:coordType = _screencoord) { TextFile("OZ has no mouse input"); } //Dimensions + Position native OZGetWidth(ident[]) = GetWidth; native OZGetHeight(ident[]) = GetHeight; native OZGetAnimWidth(ident[]) = GetAnimWidth; native OZGetAnimHeight(ident[]) = GetAnimHeight; native OZGetGroupMinX() = GetGroupMinX; native OZGetGroupMinY() = GetGroupMinY; native OZGetGroupMaxX() = GetGroupMaxX; native OZGetGroupMaxY() = GetGroupMaxY; native OZSetWorldX(val) = SetWorldX; native OZSetWorldY(val) = SetWorldY; native OZGetWorldX() = GetWorldY; native OZGetWorldY() = GetWorldY; native OZGetX(ident[] = "this") = GetX; native OZGetY(ident[] = "this") = GetY; stock GetWidth(ident[], check = _sprite) { if ( !strcmp("_group", ident) ) { return OZGetGroupMaxX() - OZGetGroupMinX(); } if (check == _sprite ) { return OZGetWidth(ident); } if (check == _animation ) { return OZGetAnimWidth(ident); } } stock GetHeight(ident[], check = _sprite) { if ( !strcmp("_group", ident) ) { return OZGetGroupMaxY() - OZGetGroupMinY(); } if (check == _sprite ) { return OZGetHeight(ident); } if (check == _animation ) { return OZGetAnimHeight(ident); } } stock GetPosition(ident[], &x, &y, _coord:coordType = _worldcoord) { if ( !strcmp("_world", ident) ) { x = ( coordType == _screencoord ? ConvertXCoords(OZGetWorldX()) : OZGetWorldX() ); y = ( coordType == _screencoord ? ConvertYCoords(OZGetWorldY()) : OZGetWorldY() ); } else { x = ( coordType == _screencoord ? ConvertXCoords(OZGetX()) : OZGetX() ); y = ( coordType == _screencoord ? ConvertYCoords(OZGetY()) : OZGetY() ); } } stock SetPosition(ident[], x, y, _coord:coordType = _worldcoord) { if ( coordType == _screencoord ) return false; // if ( !strcmp("_world", ident) ) { OZSetWorldX(x); OZSetWorldY(y); } else if ( !strcmp("_group", ident) ) { return false; } else { OZGetX(ident, x); OZGetY(ident, y); } return true; } //Storage + Flags native OZisOpen(ident[] = "this") = isOpen; native OZSetOpenFlag(ident[], val) = SetOpenFlag; native OZisTaken(ident[] = "this") = isTaken; native OZSetTakenFlag(ident[], val) = SetTakenFlag; native OZisDead(ident[] = "this") = isDead; native OZSetDeadFlag(ident[], val) = SetDeadFlag; native OZisVisible(ident[] = "this") = isVisible; native OZSetVisibleFlag(ident[], val) = SetVisibleFlag; native OZisActive(ident[] = "this") = isActive; native OZSetActiveFlag(ident[], val) = SetActiveFlag; native OZisCuttable(ident[] = "this") = isCuttable; native OZSetCuttableFlag(ident[], val) = SetCuttableFlag; native OZisLarge(ident[] = "this") = isLarge; native OZSetLargeFlag(ident[], val) = SetLargeFlag; native OZisPickable(ident[] = "this") = isPickable; native OZSetPickableFlag(ident[], val) = SetPickableFlag; native OZisPushed(ident[] = "this") = isPushed; native OZSetPushedFlag(ident[], val) = SetPushedFlag; native OZisInteracting(ident[] = "this") = isInteracting; native OZSetInteractingFlag(ident[], val) = SetInteractingFlag; native OZisOwned(ident[] = "this") = isOwned; native OZSetOwnedFlag(ident[], val) = SetOwnedFlag; stock GetFlag(ident[], _Flags:flag) { switch( flag ) { case 0: return OZisActive(ident); case 1: return OZisOpen(ident); case 2: return OZisDead(ident); case 3: return OZisVisible(ident); case 4: return OZisTaken(ident); case 5: return OZisCuttable(ident); case 6: return OZisLarge(ident); case 7: return OZisPickable(ident); case 8: return OZisPushed(ident); case 9: return OZisInteracting(ident); case 10: return OZisOwned(ident); default: return 0; } } // should 'value' be bool? stock SetFlag(ident[], _Flags:flag, value) { switch( flag ) { case 0: return OZSetActiveFlag(ident, value); case 1: return OZSetOpenFlag(ident, value); case 2: return OZSetDeadFlag(ident, value); case 3: return OZSetVisibleFlag(ident, value); case 4: return OZSetTakenFlag(ident, value); case 5: return OZSetCuttableFlag(ident, value); case 6: return OZSetLargeFlag(ident, value); case 7: return OZSetPickableFlag(ident, value); case 8: return OZSetPushedFlag(ident, value); case 9: return OZisInteracting(ident, value); case 10: return OZisOwned(ident, value); default: { TextFile("OZ doesn't support any more Flags"); return 0; } } } native OZSetGlobal(index, val) = SetGlobal; native OZGetGlobal(index) = SetGlobal; native OZSetLocal(index, val) = SetLocal; native OZGetLocal(index) = GetLocal; native OZSetValue(ident[], index, val) = SetValue; native OZGetValue(ident[], index) = GetValue; native GetDirection(ident[] = "this"); native SetDirection(ident[], val); native SetType(ident[], val); native GetType(ident[] = "this"); native SetState(ident[], val); native GetState(ident[] = "this"); native GetInitialX(ident[] = "this"); native GetInitialY(ident[] = "this"); native GetWeight(ident[] = "this"); native SetWeight(ident[], val); native GetBounceValue(ident[] = "this"); native SetBounceValue(ident[], val); native SetHealth(ident[], val); native SetMaxHealth(ident[], val); native GetHealth(ident[] = "this"); native GetMaxHealth(ident[] = "this"); native SetDamage(ident[], val); native GetDamage(ident[] = "this"); native SetLiftLevel(ident[], val); native GetLiftLevel(ident[] = "this"); stock SetValue(entity[], index, value) { if ( !strcmp("_group", entity) ) { return OZSetLocal(index, value); } else if ( !strcmp("_world", entity) ) { return OZSetGlobal(index, value); } else { return OZSetValue(entity, index, value); } } stock GetValue(entity[], index) { if ( !strcmp("_group", entity) ) { return OZGetLocal(index); } else if ( !strcmp("_world", entity) ) { return OZGetGlobal(index); } else { return OZGetValue(entity, index); } } native OZGetString(ident[], index, string[]) = GetString; native OZSetString(ident[], index, string[]) = SetString; native SetItem(ident[], code[]); native GetItem(ident[], code[]); native SetImage(ident[], code[]); native GetImage(ident[], code[]); native AllocateStrings(ident[], numstr, length); stock GetString(entity[], index, string[]) { if ( !strcmp("_group", entity) || !strcmp("_world", entity)) { TextFile("GetString('_group')/GetString('_world'): Not Support in OZ"); return -1; } else { return OZGetString(entity, index, string); } } stock SetString(entity[], index, string[]) { if ( !strcmp("_group", entity) || !strcmp("_world", entity)) { TextFile("SetString('_group')/SetString('_world'): Not Support in OZ"); return -1; } else { return OZSetString(entity, index, string); } } native OZSetFloat(ident[], index, floatval) = SetFloat; native OZGetFloat(ident[], index) = GetFloat; stock GetFloat(entity[], index) { if ( !strcmp("_group", entity) || !strcmp("_world", entity)) { TextFile("GetFloat('_group')/GetFloat('_world'): Not Support in OZ"); return -1; } else { return OZGetFloat(entity, index, string); } } stock SetFloat(entity[], index, float) { if ( !strcmp("_group", entity) || !strcmp("_world", entity)) { TextFile("SetFloat('_group')/SetFloat('_world'): Not Support in OZ"); return -1; } else { return OZSetFloat(entity, index, float); } } //Misc native NearPoint(x1, y1, x2, y2, dist); native CalculateAngle(x1,y1,x2,y2); native SetPauseLevel(val); native GetPauseLevel(); native FirstRun(); native Wipe(direction, speed); // Other entity functions native AngleMove(ident[] = "this"); native AngleCollide(ident[], val1, val2, val3, val4, val5, val6); native SetAngleFromDir(ident[] = "this"); native SetDirFromAngle(ident[] = "this"); native ChangeDirection(ident[] = "this"); native GetAnglePointX(ident[], dist, xoffset); native GetAnglePointY(ident[], dist, yoffset); native Respawn(ident[], seconds); // Collision/Mask native SetCollisionRect(ident[], index, solid, left, top, right, bottom); native ClearCollisionRect(ident[], index); native Collide(ident[], ident2[]); native CollideAll(ident[], ident2[]); native CollidePoint(ident[], x, y); native CheckMask(x, y, checkForObjects = 0); // Entities Functions native CallFunction(ident[], isLibrary, funcname[], typestr[], ...); native CreateEntity(code[], x, y, ident[]); native CreateEntityWithID(code[], x, y, ident[]); native GetEntityCount(); native StartEntity(dist = 40, x=-999, y=-999); native GetCurrentEntity(); native NextEntity(); native DeleteEntity(ident[] = "this"); native GetParam( ident[] ); native GetParent( ident[], buffer[] ); #if defined _beta native isInside(); native Save(); native Load(); native GetPlayerName(name[]); native SetPlayerName(name[]); #endif #endif