Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // tango.zh
- // Version 1.0.0
- // Screen Freezing
- const int FFC_FREEZE_1 = 31;
- const int FFC_FREEZE_2 = 32;
- const int SCREEN_FREEZE_COMBO_1 = 151;
- const int SCREEN_FREEZE_COMBO_2 = 151;
- const int MENU_FREEZE_ALL = 151;
- // Standard settings -----------------------------------------------------------
- // How fast messages scroll
- const int __TANGO_SCROLL_SPEED = 4;
- // How much holding A speeds up text
- const int __TANGO_SPEEDUP_FACTOR = 5;
- // Whether holding A or B speeds up scrolling to the next message
- const int __TANGO_SCROLL_SPEEDUP = 1;
- // Whether a sound is played when a space is printed
- const int __TANGO_SFX_ON_SPACE = 0;
- // Whether there's a delay before a space, as with printable characters
- const int __TANGO_DELAY_ON_SPACE = 1;
- // Strings that advance automatically will wait this long before doing so
- const int __TANGO_AUTO_ADVANCE_TIME = 90;
- // Layer to draw on
- const int __TANGO_DRAWING_LAYER = 6;
- // Offscreen bitmap to use for text rendering
- const int __TANGO_BITMAP = 6;
- // String codes are marked by this character
- // 64 is @
- const int __TANGO_CODE_DELIMITER = 64;
- // Whether the current string scrolls up before displaying the next one
- // rather than just disappearing
- const int __TANGO_SCROLL_TO_NEXT = 1;
- // The maximum length of a string handled by @string.
- // Increasing this will make the function take more space in the buffer.
- // It's not necessary to account for the null terminator.
- const int __TANGO_MAX_STRING_FUNC_LENGTH = 16;
- // End standard settings -------------------------------------------------------
- // Advanced settings -----------------------------------------------------------
- // Custom variables
- float Tango_D[8]; // Access as @d0 to @d8; can be safely removed
- int talkCount;
- float a2;
- const float VAR_TANGO_D0 = 0.0055;
- const float VAR_TANGO_D7 = 0.0062;
- const int VAR_TALKCOUNT = 11772.9723;
- const int IDX_TALKCOUNT = 10;
- const float VAR_A2 = 0.0036; //arbitrary argument for @a2
- float Tango_GetCustomVar(int var)
- {
- if(var>=VAR_TANGO_D0 && var<=VAR_TANGO_D7)
- return Tango_D[(var-VAR_TANGO_D0)*10000];
- else if(var==VAR_TALKCOUNT)
- {
- ffc f=GetCurrentFFC();
- return f->Misc[IDX_TALKCOUNT];
- }
- else if (var==VAR_A2)
- {
- return a2;
- }
- else
- {
- Tango_LogUndefinedVariable(var);
- return 0;
- }
- }
- void Tango_SetCustomVar(int var, float value)
- {
- if(var>=VAR_TANGO_D0 && var<=VAR_TANGO_D7)
- Tango_D[(var-VAR_TANGO_D0)*10000]=value;
- else if(var==VAR_TALKCOUNT)
- {
- ffc f=GetCurrentFFC();
- f->Misc[IDX_TALKCOUNT]=value;
- }
- else if (var==VAR_A2)
- {
- a2=value;
- }
- else
- Tango_LogUndefinedVariable(var);
- }
- int Func_Name(int string){
- return Tango_ConvertFunctionName(string);
- }
- // Custom functions
- const float FUNC_WARPLINK = 1940.4746; // @warplink()
- const float FUNC_GIVEITEM = 720.9516; // @giveitem()
- const float FUNC_BOMBDEATH = 2545.7314; //@bombdeath()
- const float FUNC_INCREASE = 915.4514; //@counter()
- const float FUNC_TAKEMONEY = 11753.4841; //@takmoney()
- const float FUNC_HASITEM = 100.7733; //@hasitem()
- const float FUNC_LEARNSLASH = 51629.3737; //@learnslash()
- float __Tango_RunCustomFunction(float function, float args)
- {
- if(function==FUNC_WARPLINK){
- Link->Warp(args[0], args[1]); // Use args[0] and args[1] if you want it to take arguments
- }
- else if(function==FUNC_INCREASE){
- int cr_type = args[0];
- int num = args[1];
- if(Game->Counter[cr_type] >= 0
- && (Game->Counter[cr_type]+num)<=Game->MCounter[cr_type]){
- Game->Counter[cr_type] += num;
- return 1;
- }
- else if(Game->Counter[cr_type] >= 0
- && (Game->Counter[cr_type]+num)>Game->MCounter[cr_type]){
- Game->Counter[cr_type] = Game->MCounter[cr_type];
- return 1;
- }
- else
- return 0;
- }
- else if(function==FUNC_GIVEITEM){
- int it=args[0];
- item the_item;
- the_item = Screen->CreateItem(it);
- the_item->X= Link->X;
- the_item->Y= Link->Y;
- }
- else if(function==FUNC_BOMBDEATH){
- eweapon Superbomb = Screen->CreateEWeapon(EW_SBOMBBLAST);
- Superbomb->X=Link->X;
- Superbomb->Y=Link->Y-16;
- Superbomb->Damage=96;
- }
- else if(function==FUNC_TAKEMONEY){
- int amount=args[0];
- if (Game->Counter[CR_RUPEES] >= amount){
- Game->DCounter[CR_RUPEES] -= amount;
- return 1;
- }
- else{
- return 0;
- }
- }
- else if(function==FUNC_HASITEM){
- int it=args[0];
- if (Link->Item[it]){
- return 1;
- }
- else{
- return 0;
- }
- }
- else if(function==FUNC_LEARNSLASH){
- Game->Generic[GEN_CANSLASH] = 1;
- }
- else{
- Tango_LogUndefinedFunction(function);
- }
- return 0;
- }
- // Menu data
- const int __TANGO_MAX_MENU_ITEMS = 6;
- float __Tango_Data[42]; // 24+3*__TANGO_MAX_MENU_ITEMS
- // Style data
- const int __TANGO_NUM_STYLES = 10;
- int __Tango_Styles[260]; // 26 * __TANGO_NUM_STYLES
- // Text buffer and slots
- int __Tango_Buffer[1216]; // Arbitrary size
- const int __TANGO_NUM_SLOTS = 4;
- int __Tango_SlotData[80]; // 20 * __TANGO_NUM_SLOTS
- // Slot types and definitions
- const int TANGO_SLOT_NAVI = 0;
- const int TANGO_SLOT_POPUP = 1;
- const int TANGO_SLOT_NORMAL = 2;
- const int WINDOW_SLOT_1 = 3;
- const int WINDOW_SLOT_2 = 4;
- int __Tango_SlotDefs[] = {
- // 0
- TANGO_SLOT_NAVI,
- 0, // Starting index in __Tango_StringBuffer
- 64, // Maximum length after processing
- 256, 0, // X, Y on offscreen bitmap
- 128, 64, // Width, height on offscreen bitmap
- // 1
- TANGO_SLOT_POPUP,
- 64,
- 128,
- 256, 64,
- 128, 64,
- // 2
- TANGO_SLOT_NORMAL,
- 192,
- 512,
- 0, 0,
- 256, 256,
- // 3
- TANGO_SLOT_NORMAL,
- 704,
- 512,
- 0, 256,
- 256, 256
- };
- // These must be implemented in order for TANGO_FLAG_FREEZE_SCREEN to work.
- // These must be implemented in order for TANGO_FLAG_FREEZE_SCREEN to work.
- // These are used by TANGO_FLAG_FREEZE_SCREEN.
- void __Tango_FreezeScreen(){
- ffc freezer=Screen->LoadFFC(31);
- freezer->Data=MENU_FREEZE_ALL; //2252
- freezer=Screen->LoadFFC(FFC_FREEZE_2);
- freezer->Data=0;
- SuspendGhostZHScripts();
- }
- void __Tango_UnfreezeScreen(){
- ffc freezer=Screen->LoadFFC(31);
- freezer->Data=0;
- freezer=Screen->LoadFFC(FFC_FREEZE_2);
- freezer->Data=0;
- ResumeGhostZHScripts();
- }
- // Edit these functions to change which buttons are used.
- // Return Link->Press* for advance/end string button
- bool __Tango_PressAdvance()
- {
- return Link->PressA;
- }
- // Return Link->Input* for advance/end string button
- bool __Tango_InputAdvance()
- {
- return Link->InputA;
- }
- // Unset Link->Input* and Link->Press* for advance/end string button
- void __Tango_UnpressAdvance()
- {
- Link->InputA=false;
- Link->PressA=false;
- }
- // Return Link->Press* for speedup button
- bool __Tango_PressSpeedup()
- {
- return Link->PressA;
- }
- // Return Link->Input* for speedup button
- bool __Tango_InputSpeedup()
- {
- return Link->InputA;
- }
- // Unset Link->Input* and Link->Press* for speedup button
- void __Tango_UnpressSpeedup()
- {
- Link->InputA=false;
- Link->PressA=false;
- }
- // Return Link->Press* for super speed button
- bool __Tango_PressSuperSpeed()
- {
- return Link->PressB;
- }
- // Return Link->Input* for super speed button
- bool __Tango_InputSuperSpeed()
- {
- return Link->InputB;
- }
- // Unset Link->Input* and Link->Press* for super speed button
- void __Tango_UnpressSuperSpeed()
- {
- Link->InputB=false;
- Link->PressB=false;
- }
- // Return Link->Press* for menu select button
- bool __Tango_PressMenuSelect()
- {
- return Link->PressA;
- }
- // Return Link->Press* for menu cancel button
- bool __Tango_PressMenuCancel()
- {
- return Link->PressB;
- }
- // Return Link->Input* for both menu select and cancel buttons
- bool __Tango_InputMenu()
- {
- return Link->InputA || Link->InputB;
- }
- // Unset Link->Input* and Link->Press* for menu select and cancel buttons
- void __Tango_UnpressMenu()
- {
- Link->InputA=false;
- Link->PressA=false;
- Link->InputB=false;
- Link->PressB=false;
- }
- // Import stringControlCode.zh instead of stringControlCodeDisabled.zh
- // to enable string control codes.
- //import "tango/1.0/stringControlCodeDisabled.zh"
- import "tango/1.3/stringControlCode.zh"
- // Import loggingFull.zh instead of loggingMinimal.zh for more useful
- // error messages. This will bloat scripts, so it should only be used
- // for debugging.
- //import "tango/1.0/loggingMinimal.zh"
- import "tango/1.3/loggingFull.zh"
- // End advanced settings -------------------------------------------------------
- //--------------Common Functions Here--------------------------------------------
- // Uses Tango to display a ZC message (Quest > Strings). Returns the number of
- // the text slot used or TANGO_INVALID if the message could not be displayed.
- int ShowMessage(int message, int type, int style, float x, float y){
- int slot=Tango_GetFreeSlot(type);
- if(slot==TANGO_INVALID)
- return TANGO_INVALID;
- Tango_ClearSlot(slot);
- Tango_LoadMessage(slot, message, '%');
- Tango_SetSlotStyle(slot, style);
- Tango_SetSlotPosition(slot, x, y);
- Tango_ActivateSlot(slot);
- return slot;
- }
- void ShowMessage(int message, int type, int style, int size, float x, float y){
- int slot=Tango_GetFreeSlot(type);
- if(slot==TANGO_INVALID)
- return;
- Tango_ClearSlot(slot);
- Tango_LoadMessage(slot, message, '%');
- Tango_SetSlotStyle(slot, style);
- Tango_SetSlotPosition(slot, x, y);
- SetStyleSize(style,size);
- Tango_ActivateSlot(slot);
- }
- import "tango/1.3/access.zh"
- import "tango/1.3/common.zh"
- import "tango/1.3/drawing.zh"
- import "tango/1.3/font.zh"
- import "tango/1.3/functions.zh"
- import "tango/1.3/loading.zh"
- import "tango/1.3/menu.zh"
- import "tango/1.3/messages.zh"
- import "tango/1.3/metrics.zh"
- import "tango/1.3/processing.zh"
- import "tango/1.3/style.zh"
- import "tango/1.3/user.zh"
- import "tango/1.3/validation.zh"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement