Skip to content

Commit

Permalink
refactor(std_zh): remove instances of deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilyV99 committed Apr 3, 2024
1 parent 5c33808 commit 331bbd4
Show file tree
Hide file tree
Showing 42 changed files with 111 additions and 109 deletions.
2 changes: 0 additions & 2 deletions resources/include/EmilyMisc.zh
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,6 @@ namespace Emily
colorscr_txt(SYS_BLACK, SYS_WHITE, FONT_SATURN, waitmsg, MAPSCREENSHOT_HIDES_SUBSCR);
Waitframe();
}
b->Free();
dm->Map = olddm[0];
dm->Level = olddm[1];
dm->Offset = olddm[2];
Expand Down Expand Up @@ -1617,7 +1616,6 @@ namespace Emily
Waitframe();
}
}
b->Free();
dm->Map = olddm[0];
dm->Level = olddm[1];
dm->Offset = olddm[2];
Expand Down
58 changes: 31 additions & 27 deletions resources/include/std_zh/std_functions.zh
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,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 @@ -1357,10 +1358,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 @@ -2481,7 +2483,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 @@ -2967,11 +2970,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 @@ -3390,9 +3394,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 @@ -3403,7 +3407,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 @@ -3414,7 +3418,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 @@ -3424,7 +3428,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 @@ -3445,9 +3449,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 @@ -3458,7 +3462,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 @@ -3469,7 +3473,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 @@ -3479,7 +3483,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 @@ -3670,9 +3674,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 @@ -3682,7 +3686,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 @@ -3692,7 +3696,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 @@ -3701,7 +3705,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 @@ -3722,9 +3726,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 @@ -3735,7 +3739,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 @@ -3746,7 +3750,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 @@ -3756,7 +3760,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
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-1.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-11.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-12.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-14.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-15.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-16.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-17.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-18.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-2.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-21.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-23.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-24.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-25.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-26.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-27.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-3.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-31.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-32.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-33.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-34.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-35.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-37.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-4.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-46.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-47.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-48.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-6.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-8.txt
Git LFS file not shown
4 changes: 2 additions & 2 deletions tests/snapshots/jit/100_rooms_of_wisdom/zasm-ffc-9.txt
Git LFS file not shown

0 comments on commit 331bbd4

Please sign in to comment.