Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \\
- // Coolgamers Z3 Scrolling, Version 2 Update/Itteration 4 Module 1. \\
- // Module 1: \\
- // General engine functions, variables, & constants. \\
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \\
- // ~ Constants and Variables ~
- const int WMS_LINK = 88; // Weapon/Misc Sprite ID of Link.
- const int NODETECT_HITXOFFSET = 214747; // Use with ->HitXOffset when ->CollDetect can't be used.
- const int OP_INVIS = 0; // Use like OP_OPAQUE and OP_TRANS with scrolling engine drawing functions.
- const int EMPTY_VAL = -1; // A value used for when an array indice is "empty". May not be used in things where the value actually normally go below 0.
- // The size of the combo list. You can make this smaller, as it isn't very likely that someone would need the stats of every single combo in the combo list.
- const int COMBO_LIST_SIZE = 65280; // The size of the entire combo list is 65280 combos, starting at 0.
- // Combo data; Solidity, the Tile of the combo's, the Type of the combo's, and the Inherent Flag of the combos.
- int ComboData_Solid[65280];
- int ComboData_Tile[65280];
- int ComboData_Type[65280];
- int ComboData_IFlag[65280];
- // Map sizes
- const int MAP_COMBO_WIDTH = 256;
- const int MAP_COMBO_HEIGHT = 88;
- const int MAP_COMBO_SIZE = 22528;
- const int MAP_HALFCOMBO_WIDTH = 512;
- const int MAP_HALFCOMBO_HEIGHT = 176;
- const int MAP_HALFCOMBO_SIZE = 90112;
- // Map data.
- int Map_Combo_ID_Layer_0[22528];
- int Map_Combo_ID_Layer_1[22528];
- int Map_Combo_ID_Layer_2[22528];
- int Map_Combo_ID_Layer_3[22528];
- int Map_Combo_ID_Layer_4[22528];
- int Map_Combo_ID_Layer_5[22528];
- int Map_Combo_ID_Layer_6[22528];
- int Map_Combo_CSet_Layer_0[22528];
- int Map_Combo_CSet_Layer_1[22528];
- int Map_Combo_CSet_Layer_2[22528];
- int Map_Combo_CSet_Layer_3[22528];
- int Map_Combo_CSet_Layer_4[22528];
- int Map_Combo_CSet_Layer_5[22528];
- int Map_Combo_CSet_Layer_6[22528];
- int Map_Combo_Flag_Layer_0[22528];
- // Stored similar to combos, whenever the screen position collides with this it won't go any further than the NoShift position.
- // The no-shift direction is stored in 4 bits: 0000b.
- // The least significant bit is up, the second least significant bit is down, the third least significant bit is left, and the fourth least significant bit is right.
- int Map_NoShift[22528];
- // The directions to not shift.
- const int NOSHIFT_UP = 0x01;
- const int NOSHIFT_DOWN = 0x02;
- const int NOSHIFT_LEFT = 0x04;
- const int NOSHIFT_RIGHT = 0x08;
- // Combo Solidity
- const int COMBO_TOPLEFT = 0x01;
- const int COMBO_TOPRIGHT = 0x04;
- const int COMBO_BOTTOMLEFT = 0x02;
- const int COMBO_BOTTOMRIGHT = 0x08;
- // Screen position. Used as an indice.
- int ScreenPosX = 0;
- int ScreenPosY = 0;
- // Used for choosing enemies on each map. I don't remember exactly how, but I believe an array will be used with this.
- int FakeMap = 0;
- // ~ Functions ~
- // Loads all of the data (combos, flags, CSets) on map "map" into "map_id_buffer", "map_flag_buffer", and "map_cset_buffer" respectivly.
- void Map_Load_Data(int map, int map_id_buffer, int map_flag_buffer, int map_cset_buffer)
- {
- Map_Load_Combos(map, map_id_buffer);
- Map_Load_Flags(map, map_flag_buffer);
- Map_Load_CSets(map, map_cset_buffer);
- }
- void Map_Load_Combos(int map, int map_id_buffer)
- {
- // Holds a second variable for an indice in the buffer.
- int mapPos = 0;
- // Clears the map array
- for(int i = 0; i < MAP_COMBO_SIZE; i += 1) {map_id_buffer[i] = EMPTY_VAL;}
- // Load all of the combos on map "map" into "map_id_buffer".
- for(int i = 0; i < 8; i += 1) // map screen height
- {
- for(int i2 = 0; i2 < 11; i2 += 1) // screen combo height
- {
- for(int i3 = 0; i3 < 16; i3 += 1) // map screen width
- {
- for(int i4 = 0; i4 < 16; i4 += 1) // screen combo width
- {
- int screenNum = ((i * 16) + i3);
- int comboNum = ((i2 * 16) + i4);
- map_id_buffer[mapPos] = Game->GetComboData(map, screenNum, comboNum);
- mapPos += 1;
- }
- }
- }
- }
- }
- void Map_Load_Flags(int map, int map_flag_buffer)
- {
- // Holds a second variable for an indice in the buffer.
- int mapPos = 0;
- // Clears the map array
- for(int i = 0; i < MAP_COMBO_SIZE; i += 1) {map_flag_buffer[i] = EMPTY_VAL;}
- // Load all of the flags on map "map" into "map_flag_buffer".
- for(int i = 0; i < 8; i += 1) // map screen height
- {
- for(int i2 = 0; i2 < 11; i2 += 1) // screen combo height
- {
- for(int i3 = 0; i3 < 16; i3 += 1) // map screen width
- {
- for(int i4 = 0; i4 < 16; i4 += 1) // screen combo width
- {
- int screenNum = ((i * 16) + i3);
- int comboNum = ((i2 * 16) + i4);
- map_flag_buffer[mapPos] = Game->GetComboFlag(map, screenNum, comboNum);
- mapPos += 1;
- }
- }
- }
- }
- }
- void Map_Load_CSets(int map, int map_cset_buffer)
- {
- // Holds a second variable for an indice in the buffer.
- int mapPos = 0;
- // Clears the map array
- for(int i = 0; i < MAP_COMBO_SIZE; i += 1) {map_cset_buffer[i] = EMPTY_VAL;}
- // Load all of the csets on map "map" into "map_cset_buffer".
- for(int i = 0; i < 8; i += 1) // map screen height
- {
- for(int i2 = 0; i2 < 11; i2 += 1) // screen combo height
- {
- for(int i3 = 0; i3 < 16; i3 += 1) // map screen width
- {
- for(int i4 = 0; i4 < 16; i4 += 1) // screen combo width
- {
- int screenNum = ((i * 16) + i3);
- int comboNum = ((i2 * 16) + i4);
- map_cset_buffer[mapPos] = Game->GetComboCSet(map, screenNum, comboNum);
- mapPos += 1;
- }
- }
- }
- }
- }
- void LoadComboData(int combo_solid_buffer, int combo_tile_buffer, int combo_type_buffer, int combo_iflag_buffer)
- {
- int StartCombo = Screen->ComboD[0];
- for(int i = 0; i < COMBO_LIST_SIZE; i += 1)
- {
- Screen->ComboD[0] = i;
- combo_solid_buffer[i] = Screen->ComboS[0];
- combo_tile_buffer[i] = Game->ComboTile(i);
- combo_type_buffer[i] = Screen->ComboT[0];
- combo_iflag_buffer[i] = Screen->ComboI[0];
- }
- Screen->ComboD[0] = StartCombo;
- // This is to remove any enemies spawned by combos, such as spinning tiles.
- for(int i = 1; i <= Screen->NumNPCs(); i += 1)
- {
- npc en = Screen->LoadNPC(i);
- Remove(en);
- }
- }
- int PosToMapLoc(int x, int y)
- {return ((FloorToMultiple(ScreenPosY + y, 16) / 16) * 256) + (FloorToMultiple(ScreenPosX + x, 16) / 16);}
- // Used for solidity. Returns if the position is in a combos topleft, topright, bottomleft, or bottomright corner.
- int PosToComboCorner(int x, int y)
- {
- int CornerX = (FloorToMultiple(ScreenPosOffsetX() + x, 8) / 8);
- int CornerY = (FloorToMultiple(ScreenPosOffsetY() + y, 8) / 8);
- if(IsEven(CornerX))
- {
- if(IsEven(CornerY))
- {
- return COMBO_TOPLEFT;
- }
- if(IsOdd(CornerY))
- {
- return COMBO_BOTTOMLEFT;
- }
- }
- if(IsOdd(CornerX))
- {
- if(IsEven(CornerY))
- {
- return COMBO_TOPRIGHT;
- }
- if(IsOdd(CornerY))
- {
- return COMBO_BOTTOMRIGHT;
- }
- }
- }
- int ScreenLocX()
- {return FloorToMultiple(ScreenPosX, 16) / 16;}
- int ScreenLocY()
- {return FloorToMultiple(ScreenPosY, 16) / 16;}
- int ScreenPosOffsetX()
- {return ScreenPosX - FloorToMultiple(ScreenPosX, 16);}
- int ScreenPosOffsetY()
- {return ScreenPosY - FloorToMultiple(ScreenPosY, 16);}
- // Mouse positions.
- float MouseX()
- {return Link->InputMouseX;}
- float MouseY()
- {return Link->InputMouseY;}
- // void DrawMapCombos(int screen_loc_x, int screen_loc_y, int screen_pos_offset_x, int screen_pos_offset_y, int map_id_buffer, int map_flag_buffer, int map_cset_buffer)
- void DrawMapCombos(int screen_pos_x, int screen_pos_y, int map_id_buffer, int map_flag_buffer, int map_cset_buffer)
- {
- int screen_loc_x = FloorToMultiple(screen_pos_x, 16) / 16;
- int screen_loc_y = FloorToMultiple(screen_pos_y, 16) / 16;
- if(ScreenPosOffsetX() % 16 == 0)
- {
- if(ScreenPosOffsetY() % 16 == 0)
- {
- for(int i = 0; i < 12; i += 1)
- {
- for(int i2 = 0; i2 < 16; i2 += 1)
- {
- int iLoc1 = i * 16; // y combo position
- int iLoc2 = i2 * 16; // x combo position
- Screen->FastCombo(0, iLoc2, iLoc1, map_id_buffer[((screen_loc_y + i) * 256) + (screen_loc_x + i2)], map_cset_buffer[((screen_loc_y + i) * 256) + (screen_loc_x + i2)], OP_OPAQUE);
- }
- }
- }
- if(ScreenPosOffsetY() % 16 != 0)
- {
- for(int i = -1; i < 12; i += 1)
- {
- for(int i2 = 0; i2 < 17; i2 += 1)
- {
- int iLoc1 = i * 16; // y combo position
- int iLoc2 = i2 * 16; // x combo position
- Screen->FastCombo(0, iLoc2, (i * 16) - ScreenPosOffsetY(), map_id_buffer[((screen_loc_y + i) * 256) + (screen_loc_x + i2)], map_cset_buffer[((screen_loc_y + i) * 256) + (screen_loc_x + i2)], OP_OPAQUE);
- }
- }
- }
- }
- if(ScreenPosOffsetX() % 16 != 0)
- {
- if(ScreenPosOffsetY() % 16 == 0)
- {
- for(int i = 0; i < 12; i += 1)
- {
- for(int i2 = -1; i2 < 17; i2 += 1)
- {
- int iLoc1 = i * 16; // y combo position
- int iLoc2 = i2 * 16; // x combo position
- Screen->FastCombo(0, iLoc2 - ScreenPosOffsetX(), iLoc1, map_id_buffer[((screen_loc_y + i) * 256) + (screen_loc_x + i2)], map_cset_buffer[((screen_loc_y + i) * 256) + (screen_loc_x + i2)], OP_OPAQUE);
- }
- }
- }
- if(ScreenPosOffsetY() % 16 != 0)
- {
- for(int i = -1; i < 12; i += 1)
- {
- for(int i2 = -1; i2 < 17; i2 += 1)
- {
- int iLoc1 = i * 16; // y combo position
- int iLoc2 = i2 * 16; // x combo position
- Screen->FastCombo(0, iLoc2 - ScreenPosOffsetX(), (i * 16) - ScreenPosOffsetY(), map_id_buffer[((screen_loc_y + i) * 256) + (screen_loc_x + i2)], map_cset_buffer[((screen_loc_y + i) * 256) + (screen_loc_x + i2)], OP_OPAQUE);
- }
- }
- }
- }
- }
- // ~ Math Related Functions ~
- // These do things not completely related to map handling.
- // Floors a value to a multiple.
- int FloorToMultiple(int input, int multiple)
- {
- if(multiple == 0) {return 0;}
- int mul = Abs(multiple);
- return Floor(input/mul)*mul;
- }
- // returns the value of a number, wraped around within "low" and "high" (inclusive).
- float WrapVal(float num, float low, float high)
- {
- float val = num;
- if(val < low)
- {
- val = (high - Abs(low - val));
- }
- else if(num > high)
- {
- num = (low + Abs(high - val));
- }
- }
- // returns if an x position is in the screen bounds.
- bool InScreenBoundsX(float x)
- {
- if(x >= 0 && x < 256) {return true;}
- else {return false;}
- }
- // returns if a y position is in the screen bounds.
- bool InScreenBoundsY(float y)
- {
- if(y >= 0 && y < 176) {return true;}
- else {return false;}
- }
- void FastFloat(int x, int y, float number)
- {
- int num_didgets = 0;
- for(int i = 0; i < 4; i += 1)
- {
- if(number - Abs(number) > 0)
- {
- num_didgets += 1;
- }
- }
- Screen->DrawInteger(7, x, y, FONT_Z3SMALL, 1, 0, -1, -1, number, num_didgets, OP_OPAQUE);
- }
- // Returns the state of a binary flag 'flag' of 'num'.
- bool CheckFlag(int num, int flag)
- {
- return (num & flag);
- }
- // Returns 'num' after the state of binary flag 'flag' was changed.
- int SetFlag(int num, int flag, bool state)
- {
- if(state) num |= flag;
- if(!state) num &= ~(flag);
- return num;
- }
- // Put this before the main while(true) loop.
- void SCRL_PreGameLoopFunc()
- {
- ClearTrace();
- LoadComboData(ComboData_Solid, ComboData_Tile, ComboData_Type, ComboData_IFlag);
- Map_Load_Data(2, Map_Combo_ID_Layer_0, Map_Combo_Flag_Layer_0, Map_Combo_CSet_Layer_0);
- ScreenPosX = 112 * 16;
- ScreenPosY = 44 * 16;
- for(int i = 0; i < MAP_COMBO_SIZE; i += 1)
- {
- if(Map_Combo_ID_Layer_0[i] == 912)
- {
- Map_NoShift[i] = NOSHIFT_LEFT | NOSHIFT_RIGHT;
- }
- }
- Link->X = 120;
- Link->Y = 80;
- Link->Invisible = true; // So links actual tile isn't drawn.
- // LinkStats[LS_ANIMATIONDELAY] = 6; // the delay of Links' animation per frame.
- LinkStats[LS_ANIMATION_SHEET_START] = 520; // the start of Links tilesheet.
- LinkStats[LS_OPACITY] = OP_OPAQUE;
- LinkStats[LS_ACTION] = SCRL_LA_STAND;
- LinkStats[LS_HIT_X] = 120;
- LinkStats[LS_HIT_Y] = 80;
- LinkStats[LS_DRAW_X] = 120;
- LinkStats[LS_DRAW_Y] = 80;
- LinkStats[LS_HIT_X_OFFSET] = 0;
- LinkStats[LS_HIT_Y_OFFSET] = 0;
- LinkStats[LS_ANIMATIONFRAMES] = 4;
- // LinkStats[LS_ANIMATIONDELAY] = 6;
- LinkStats[LS_DIR_OR_ACTION_END_TILEDIST] = 4;
- SetLinkActionFrameDelays();
- }
- void DebugStuff()
- {
- int maxNumWidth = 6*6; // max width of the largest possible number.
- FastFloat(maxNumWidth*0, -56+(6*0), ScreenPosX);
- FastFloat(maxNumWidth*1, -56+(6*0), ScreenPosY);
- // ...
- }
- void Z3_Scrolling()
- {
- Link->Action = LA_FROZEN; // So the actual Link doesn't do things like use built in items or actually move onscreen.
- Link->DrawXOffset = (Link->X - 120);
- Link->HitXOffset = Link->DrawXOffset;
- Link->X = 120;
- Link->DrawYOffset = (Link->Y - 80);
- Link->HitYOffset = Link->DrawYOffset;
- Link->Y = 80;
- if(LinkStats[LS_ACTION] == SCRL_LA_WALK || LinkStats[LS_ACTION] == SCRL_LA_SWIM)
- {
- // Pans the screen left.
- if(LinkStats[LS_DIR] == DIR_LEFT || LinkStats[LS_DIR] == DIR_LEFTUP || LinkStats[LS_DIR] == DIR_LEFTDOWN)
- {
- if((ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] - 1, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 8)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] - 1, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 8)) == 0
- && (ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] - 1, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 15)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] - 1, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 15)) == 0)
- {
- if((ScreenPosX - 1) >= 0)
- {
- ScreenPosX -= 1;
- }
- else
- {
- LinkStats[LS_HIT_X] -= 1;
- LinkStats[LS_DRAW_X] -= 1;
- }
- }
- }
- // Pans the screen right.
- if(LinkStats[LS_DIR] == DIR_RIGHT || LinkStats[LS_DIR] == DIR_RIGHTUP || LinkStats[LS_DIR] == DIR_RIGHTDOWN)
- {
- if((ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 16, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 8)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 16, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 8)) == 0
- && (ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 16, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 15)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 16, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 15)) == 0)
- {
- if((ScreenPosX + 256) < (MAP_COMBO_WIDTH * 16))
- {
- ScreenPosX += 1;
- }
- else
- {
- LinkStats[LS_HIT_X] += 1;
- LinkStats[LS_DRAW_X] += 1;
- }
- }
- }
- // Pans the screen up.
- if(LinkStats[LS_DIR] == DIR_UP || LinkStats[LS_DIR] == DIR_LEFTUP || LinkStats[LS_DIR] == DIR_RIGHTUP)
- {
- if((ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET], LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 7)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET], LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 7)) == 0
- && (ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 8, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 7)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 8, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 7)) == 0
- && (ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 15, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 7)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 15, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 7)) == 0)
- {
- if((ScreenPosY - 1) >= 0)
- {
- ScreenPosY -= 1;
- }
- else
- {
- LinkStats[LS_HIT_Y] -= 1;
- LinkStats[LS_DRAW_Y] -= 1;
- }
- }
- }
- // Pans the screen down.
- if(LinkStats[LS_DIR] == DIR_DOWN || LinkStats[LS_DIR] == DIR_LEFTDOWN || LinkStats[LS_DIR] == DIR_RIGHTDOWN)
- {
- if((ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET], LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 16)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET], LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 16)) == 0
- && (ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 8, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 16)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 8, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 16)) == 0
- && (ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 15, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 16)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 15, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 16)) == 0)
- {
- if((ScreenPosY + 176) < (MAP_COMBO_HEIGHT * 16))
- {
- ScreenPosY += 1;
- }
- else
- {
- LinkStats[LS_HIT_Y] += 1;
- LinkStats[LS_DRAW_Y] += 1;
- }
- }
- }
- if(LinkStats[LS_HIT_X] < 120)
- {
- if(LinkStats[LS_DIR] == DIR_RIGHT || LinkStats[LS_DIR] == DIR_RIGHTUP || LinkStats[LS_DIR] == DIR_RIGHTDOWN)
- {
- if((ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 16, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 8)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 16, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 8)) == 0
- && (ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 16, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 15)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 16, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 15)) == 0)
- {
- LinkStats[LS_HIT_X] += 1;
- LinkStats[LS_DRAW_X] += 1;
- }
- }
- }
- else if(LinkStats[LS_HIT_X] > 120)
- {
- if(LinkStats[LS_DIR] == DIR_LEFT || LinkStats[LS_DIR] == DIR_LEFTUP || LinkStats[LS_DIR] == DIR_LEFTDOWN)
- {
- if((ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] - 1, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 8)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] - 1, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 8)) == 0
- && (ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] - 1, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 15)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] - 1, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 15)) == 0)
- {
- LinkStats[LS_HIT_X] -= 1;
- LinkStats[LS_DRAW_X] -= 1;
- }
- }
- }
- if(LinkStats[LS_HIT_Y] < 80)
- {
- if(LinkStats[LS_DIR] == DIR_DOWN || LinkStats[LS_DIR] == DIR_LEFTDOWN || LinkStats[LS_DIR] == DIR_RIGHTDOWN)
- {
- if((ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET], LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 16)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET], LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 16)) == 0
- && (ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 8, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 16)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 8, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 16)) == 0
- && (ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 15, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 16)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 15, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 16)) == 0)
- {
- LinkStats[LS_HIT_Y] += 1;
- LinkStats[LS_DRAW_Y] += 1;
- }
- }
- }
- else if(LinkStats[LS_HIT_Y] > 80)
- {
- if(LinkStats[LS_DIR] == DIR_UP || LinkStats[LS_DIR] == DIR_LEFTUP || LinkStats[LS_DIR] == DIR_RIGHTUP)
- {
- if((ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET], LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 7)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET], LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 7)) == 0
- && (ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 8, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 7)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 8, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 7)) == 0
- && (ComboData_Solid[Map_Combo_ID_Layer_0[PosToMapLoc(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 15, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 7)]] & PosToComboCorner(LinkStats[LS_HIT_X] + LinkStats[LS_HIT_X_OFFSET] + 15, LinkStats[LS_HIT_Y] + LinkStats[LS_HIT_Y_OFFSET] + 7)) == 0)
- {
- LinkStats[LS_HIT_Y] -= 1;
- LinkStats[LS_DRAW_Y] -= 1;
- }
- }
- }
- }
- LinkStats[LS_HIT_X] = Clamp(LinkStats[LS_HIT_X], 0, MAP_COMBO_WIDTH*16);
- LinkStats[LS_DRAW_X] = Clamp(LinkStats[LS_DRAW_X], 0, MAP_COMBO_WIDTH*16);
- LinkStats[LS_HIT_Y] = Clamp(LinkStats[LS_HIT_Y], 0, MAP_COMBO_HEIGHT*16);
- LinkStats[LS_DRAW_Y] = Clamp(LinkStats[LS_DRAW_Y], 0, MAP_COMBO_HEIGHT*16);
- // Draws the tiles to the screen.
- DrawMapCombos(ScreenPosX, ScreenPosY, Map_Combo_ID_Layer_0, Map_Combo_Flag_Layer_0, Map_Combo_CSet_Layer_0); // Leave this as-is.
- HandleCustomWeapons();
- HandleCustomSprites();
- HandleLink(); // From Mod. 2
- }
- global script Global
- {
- void run()
- {
- SCRL_PreGameLoopFunc();
- while(true)
- {
- Z3_Scrolling();
- // Feel free to comment this out, it shouldn't functionally change how anything (important, atleast) works, just shows values and stuff.
- // DebugStuff();
- Waitframe();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement