Skip to content

Commit

Permalink
fix(std_zh): update to remove use of 'deprecated' functions/vars
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilyV99 committed Apr 7, 2024
1 parent a58cf4f commit 61cccce
Showing 1 changed file with 31 additions and 27 deletions.
58 changes: 31 additions & 27 deletions resources/include/std_zh/std_functions.zh
Expand Up @@ -999,7 +999,8 @@ int DMapMapGraphicsIndex()
// Convert between map and DMap screens
int DMapToMap(int screen, int dmap)
{
return screen+Game->DMapOffset[dmap];
dmapdata dm = Game->LoadDMapData(dmap);
return screen+dm->Offset;
}

// Returns the dot product of two vectors.
Expand Down Expand Up @@ -1356,10 +1357,11 @@ int GetEquipmentY()
//return ((Hero->Equipment&0xFF00)>>8);
}

//Returns true if DMap Flag 'flag' is set on dmap 'dmap'
//Returns true if DMap bitwise flags 'flag' is set on dmap 'dmap'
bool GetDMapFlag(int dmap, int flag)
{
return (Game->DMapFlags[dmap]&flag);
dmapdata dm = Game->LoadDMapData(dmap);
return (dm->Flags&flag);
}

int GetFirstItemOf(int itemclass)
Expand Down Expand Up @@ -2480,7 +2482,8 @@ int longrand(int max)

int MapToDMap(int screen, int dmap)
{
return screen-Game->DMapOffset[dmap];
dmapdata dm = Game->LoadDMapData(dmap);
return screen-dm->Offset;
}

void MakeBlockable(eweapon e)
Expand Down Expand Up @@ -2966,11 +2969,12 @@ int ScreenItem()
return -1;
}

//Sets a certain DMap flag to 'state'
//Sets certain DMap bitwise flags to 'state'
void SetDMapFlag(int dmap, int flag, bool state)
{
if(state) Game->DMapFlags[dmap] |= flag;
else Game->DMapFlags[dmap] &= ~flag;
dmapdata dm = Game->LoadDMapData(dmap);
if(state) dm->Flags |= flag;
else dm->Flags ~= flag;
}

//Writes items to both the A and the b item slots.
Expand Down Expand Up @@ -3389,9 +3393,9 @@ void SetVisibleOnDungeonMap(bool state)
{
dmapdata dm = Game->LoadDMapData(Game->CurDMap);
int scr = Game->CurScreen;
int col = (scr % 0x10)-Game->DMapOffset[dm->ID];
int col = (scr % 0x10)-dm->Offset;
int row = (scr>>4);
//screen-Game->DMapOffset[dm->ID];
//screen-dm->Offset;
//could get screen X and Y from curscreen and dmapoffset in a separate function
(state) ? (dm->Grid[row] |= ((128>>col))) : (dm->Grid[row] ~= ((128>>col)));
}
Expand All @@ -3402,7 +3406,7 @@ void SetVisibleOnDungeonMap(bool state)
void SetVisibleOnDungeonMap(int scr, bool state)
{
dmapdata dm = Game->LoadDMapData(Game->CurDMap);
int col = (scr % 0x10)-Game->DMapOffset[dm->ID];
int col = (scr % 0x10)-dm->Offset;
int row = (scr>>4);
(state) ? (dm->Grid[row] |= ((128>>col))) : (dm->Grid[row] ~= ((128>>col)));
}
Expand All @@ -3413,7 +3417,7 @@ void SetVisibleOnDungeonMap(int scr, bool state)
void SetVisibleOnDungeonMap(dmapdata dm, bool state)
{
int scr = Game->CurScreen;
int col = (scr % 0x10)-Game->DMapOffset[dm->ID];
int col = (scr % 0x10)-dm->Offset;
int row = (scr>>4);
(state) ? (dm->Grid[row] |= ((128>>col))) : (dm->Grid[row] ~= ((128>>col)));
}
Expand All @@ -3423,7 +3427,7 @@ void SetVisibleOnDungeonMap(dmapdata dm, bool state)
//Respects DMap Offsets.
void SetVisibleOnDungeonMap(dmapdata dm, int scr, bool state)
{
int col = (scr % 0x10)-Game->DMapOffset[dm->ID];
int col = (scr % 0x10)-dm->Offset;
int row = (scr>>4);
(state) ? (dm->Grid[row] |= ((128>>col))) : (dm->Grid[row] ~= ((128>>col)));
}
Expand All @@ -3444,9 +3448,9 @@ void SetVisibleOnDungeonMap(bool no_offset, bool state)
{
dmapdata dm = Game->LoadDMapData(Game->CurDMap);
int scr = Game->CurScreen;
int col = (scr % 0x10) - (no_offset ? 0 : Game->DMapOffset[dm->ID]);
int col = (scr % 0x10) - (no_offset ? 0 : dm->Offset);
int row = (scr>>4);
//screen-Game->DMapOffset[dm->ID];
//screen-dm->Offset;
//could get screen X and Y from curscreen and dmapoffset in a separate function
(state) ? (dm->Grid[row] |= ((128>>col))) : (dm->Grid[row] ~= ((128>>col)));
}
Expand All @@ -3457,7 +3461,7 @@ void SetVisibleOnDungeonMap(bool no_offset, bool state)
void SetVisibleOnDungeonMap(int scr, bool no_offset, bool state)
{
dmapdata dm = Game->LoadDMapData(Game->CurDMap);
int col = (scr % 0x10) - (no_offset ? 0 : Game->DMapOffset[dm->ID]);
int col = (scr % 0x10) - (no_offset ? 0 : dm->Offset);
int row = (scr>>4);
(state) ? (dm->Grid[row] |= ((128>>col))) : (dm->Grid[row] ~= ((128>>col)));
}
Expand All @@ -3468,7 +3472,7 @@ void SetVisibleOnDungeonMap(int scr, bool no_offset, bool state)
void SetVisibleOnDungeonMap(dmapdata dm, bool no_offset, bool state)
{
int scr = Game->CurScreen;
int col = (scr % 0x10) - (no_offset ? 0 : Game->DMapOffset[dm->ID]);
int col = (scr % 0x10) - (no_offset ? 0 : dm->Offset);
int row = (scr>>4);
(state) ? (dm->Grid[row] |= ((128>>col))) : (dm->Grid[row] ~= ((128>>col)));
}
Expand All @@ -3478,7 +3482,7 @@ void SetVisibleOnDungeonMap(dmapdata dm, bool no_offset, bool state)
//If bool no_offset is set true, the screen position ignores DMap offsets.
void SetVisibleOnDungeonMap(dmapdata dm, int scr, bool no_offset, bool state)
{
int col = (scr % 0x10) - (no_offset ? 0 : Game->DMapOffset[dm->ID]);
int col = (scr % 0x10) - (no_offset ? 0 : dm->Offset);
int row = (scr>>4);
(state) ? (dm->Grid[row] |= ((128>>col))) : (dm->Grid[row] ~= ((128>>col)));
}
Expand Down Expand Up @@ -3669,9 +3673,9 @@ bool VisibleOnDungeonMap()
{
dmapdata dm = Game->LoadDMapData(Game->CurDMap);
int scr = Game->CurScreen;
int col = (scr % 0x10)-Game->DMapOffset[dm->ID];
int col = (scr % 0x10)-dm->Offset;
int row = (scr>>4);
//screen-Game->DMapOffset[dm->ID];
//screen-dm->Offset;
//could get screen X and Y from curscreen and dmapoffset in a separate function
return (dm->Grid[row]&((128>>col)));
}
Expand All @@ -3681,7 +3685,7 @@ bool VisibleOnDungeonMap()
bool VisibleOnDungeonMap(int scr)
{
dmapdata dm = Game->LoadDMapData(Game->CurDMap);
int col = (scr % 0x10)-Game->DMapOffset[dm->ID];
int col = (scr % 0x10)-dm->Offset;
int row = (scr>>4);
return (dm->Grid[row]&((128>>col)));
}
Expand All @@ -3691,7 +3695,7 @@ bool VisibleOnDungeonMap(int scr)
bool VisibleOnDungeonMap(dmapdata dm)
{
int scr = Game->CurScreen;
int col = (scr % 0x10)-Game->DMapOffset[dm->ID];
int col = (scr % 0x10)-dm->Offset;
int row = (scr>>4);
return (dm->Grid[row]&((128>>col)));
}
Expand All @@ -3700,7 +3704,7 @@ bool VisibleOnDungeonMap(dmapdata dm)
//Accepts a specific screen ID on a specified dmapdata pointer.
bool VisibleOnDungeonMap(dmapdata dm, int scr)
{
int col = (scr % 0x10)-Game->DMapOffset[dm->ID];
int col = (scr % 0x10)-dm->Offset;
int row = (scr>>4);
return (dm->Grid[row]&((128>>col)));
}
Expand All @@ -3721,9 +3725,9 @@ bool VisibleOnDungeonMap(bool no_offset)
{
dmapdata dm = Game->LoadDMapData(Game->CurDMap);
int scr = Game->CurScreen;
int col = (scr % 0x10) - (no_offset ? 0 : Game->DMapOffset[dm->ID]);
int col = (scr % 0x10) - (no_offset ? 0 : dm->Offset);
int row = (scr>>4);
//screen-Game->DMapOffset[dm->ID];
//screen-dm->Offset;
//could get screen X and Y from curscreen and dmapoffset in a separate function
return (dm->Grid[row]&((128>>col)));
}
Expand All @@ -3734,7 +3738,7 @@ bool VisibleOnDungeonMap(bool no_offset)
bool VisibleOnDungeonMap(int scr, bool no_offset)
{
dmapdata dm = Game->LoadDMapData(Game->CurDMap);
int col = (scr % 0x10) - (no_offset ? 0 : Game->DMapOffset[dm->ID]);
int col = (scr % 0x10) - (no_offset ? 0 : dm->Offset);
int row = (scr>>4);
return (dm->Grid[row]&((128>>col)));
}
Expand All @@ -3745,7 +3749,7 @@ bool VisibleOnDungeonMap(int scr, bool no_offset)
bool VisibleOnDungeonMap(dmapdata dm, bool no_offset)
{
int scr = Game->CurScreen;
int col = (scr % 0x10) - (no_offset ? 0 : Game->DMapOffset[dm->ID]);
int col = (scr % 0x10) - (no_offset ? 0 : dm->Offset);
int row = (scr>>4);
return (dm->Grid[row]&((128>>col)));
}
Expand All @@ -3755,7 +3759,7 @@ bool VisibleOnDungeonMap(dmapdata dm, bool no_offset)
//If bool no_offset is set true, the screen position ignores DMap offsets.
bool VisibleOnDungeonMap(dmapdata dm, int scr, bool no_offset)
{
int col = (scr % 0x10) - (no_offset ? 0 : Game->DMapOffset[dm->ID]);
int col = (scr % 0x10) - (no_offset ? 0 : dm->Offset);
int row = (scr>>4);
return (dm->Grid[row]&((128>>col)));
}
Expand Down

0 comments on commit 61cccce

Please sign in to comment.