Skip to content

Commit

Permalink
wall icon's setId and blockId now combined.
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonpilgrim committed Oct 22, 2008
1 parent bd750e4 commit b472df4
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 163 deletions.
50 changes: 4 additions & 46 deletions Classes/Gbl.cs
Expand Up @@ -296,55 +296,13 @@ public static string SavePath
public static byte mapWallType; // byte_1D53C
public static byte mapWallRoof; // byte_1D53D

public static void wordSetArray_1D53A(int index, short value)
public class SetBlock
{
switch (index)
{
case 1: word_1D53E = value; break;
case 2: word_1D542 = value; break;
case 3: word_1D546 = value; break;
}
}

public static short wordGetArray_1D53A(int index)
{
switch (index)
{
case 1: return word_1D53E;
case 2: return word_1D542;
case 3: return word_1D546;
default: throw new System.NotSupportedException();
}
}

public static void wordSetArray_1D53C(int index, short value)
{
switch (index)
{
case 1: word_1D540 = value; break;
case 2: word_1D544 = value; break;
case 3: word_1D548 = value; break;
default: throw new System.NotSupportedException();
}
}

public static short wordGetArray_1D53C(int index)
{
switch (index)
{
case 1: return word_1D540;
case 2: return word_1D544;
case 3: return word_1D548;
default: throw new System.NotSupportedException();
}
public int blockId; // byte_1D53A[di] 1*4
public int setId; // byte_1D53C[di] 1*4
}

public static short word_1D53E; // byte_1D53A[di] 1*4
public static short word_1D540; // byte_1D53C[di] 1*4
public static short word_1D542; // byte_1D53A[di] 2*4
public static short word_1D544; // byte_1D53C[di] 2*4
public static short word_1D546; // byte_1D53A[di] 3*4
public static short word_1D548; // byte_1D53C[di] 3*4
public static SetBlock[] setBlocks = new SetBlock[3];

public static DaxArray byte_1D556;
public static string lastDaxFile;
Expand Down
12 changes: 6 additions & 6 deletions engine/ovr003.cs
Expand Up @@ -583,8 +583,8 @@ internal static void CMD_NewECL()
}
else
{
gbl.word_1D53E = -1;
gbl.word_1D540 = -1;
gbl.setBlocks[0].blockId = -1;
gbl.setBlocks[0].setId = -1;
}

if (var_2 != 0xff)
Expand All @@ -593,8 +593,8 @@ internal static void CMD_NewECL()
}
else
{
gbl.word_1D542 = -1;
gbl.word_1D544 = -1;
gbl.setBlocks[1].blockId = -1;
gbl.setBlocks[1].setId = -1;
}

if (var_1 != 0xff)
Expand All @@ -603,8 +603,8 @@ internal static void CMD_NewECL()
}
else
{
gbl.word_1D546 = -1;
gbl.word_1D548 = -1;
gbl.setBlocks[2].blockId = -1;
gbl.setBlocks[2].setId = -1;
}
}
}
Expand Down
34 changes: 16 additions & 18 deletions engine/ovr008.cs
Expand Up @@ -266,28 +266,26 @@ internal static void sub_30580(bool[] flags, int encounter_distance, byte pic_bl
if (flags[1] == false ||
gbl.byte_1EE96 != gbl.area2_ptr.field_5C2)
{
if (encounter_distance == 0)
if (encounter_distance == 0 &&
gbl.game_state == 4)
{
if (gbl.game_state == 4)
if (gbl.byte_1EE95 == 0 ||
gbl.byte_1B2E9 != 0)
{
if (gbl.byte_1EE95 == 0 ||
gbl.byte_1B2E9 != 0)
gbl.byte_1EE96 = (byte)gbl.area2_ptr.field_5C2;
gbl.byte_1EE8C = true;
if (gbl.area2_ptr.field_5C2 == 0xff)
{
gbl.byte_1EE96 = (byte)gbl.area2_ptr.field_5C2;
gbl.byte_1EE8C = true;
if (gbl.area2_ptr.field_5C2 == 0xff)
{
ovr030.load_pic_final(ref gbl.byte_1D556, 0, pic_block_id, "PIC");
flags[1] = true;
ovr030.load_pic_final(ref gbl.byte_1D556, 0, pic_block_id, "PIC");
flags[1] = true;

ovr030.sub_7000A(gbl.byte_1D556.frames[0].picture, true, 3, 3);
}
else
{
set_and_draw_head_body(pic_block_id, (byte)gbl.area2_ptr.field_5C2);
flags[1] = true;
gbl.byte_1EE8D = false;
}
ovr030.sub_7000A(gbl.byte_1D556.frames[0].picture, true, 3, 3);
}
else
{
set_and_draw_head_body(pic_block_id, (byte)gbl.area2_ptr.field_5C2);
flags[1] = true;
gbl.byte_1EE8D = false;
}
}
}
Expand Down
26 changes: 12 additions & 14 deletions engine/ovr012.cs
Expand Up @@ -86,15 +86,14 @@ class ovr012
gbl.can_pick_door = true;
gbl.can_knock_door = true;

gbl.word_1D53E = 0;
gbl.word_1D540 = 1;
gbl.byte_1AD44 = 3;

gbl.word_1D542 = -1;
gbl.word_1D544 = -1;

gbl.word_1D546 = -1;
gbl.word_1D548 = -1;
gbl.setBlocks[0].blockId = 0;
gbl.setBlocks[0].setId = 1;
gbl.setBlocks[1].blockId = -1;
gbl.setBlocks[1].setId = -1;
gbl.setBlocks[2].blockId = -1;
gbl.setBlocks[2].setId = -1;

gbl.AnimationsOn = true;
gbl.PicsOn = true;
Expand Down Expand Up @@ -199,15 +198,14 @@ class ovr012
gbl.can_pick_door = true;
gbl.can_knock_door = true;

gbl.word_1D53E = 0;
gbl.word_1D540 = 1;

gbl.byte_1AD44 = 3;

gbl.word_1D542 = -1;
gbl.word_1D544 = -1;
gbl.word_1D546 = -1;
gbl.word_1D548 = -1;
gbl.setBlocks[0].blockId = 0;
gbl.setBlocks[0].setId = 1;
gbl.setBlocks[1].blockId = -1;
gbl.setBlocks[1].setId = -1;
gbl.setBlocks[2].blockId = -1;
gbl.setBlocks[2].setId = -1;

gbl.DelayBetweenCharacters = true;
gbl.reload_ecl_and_pictures = false;
Expand Down
54 changes: 18 additions & 36 deletions engine/ovr017.cs
Expand Up @@ -1589,23 +1589,14 @@ internal static void loadSaveGame(string file_name)
seg051.BlockRead(1, data, file);
gbl.game_state = data[0];

seg051.BlockRead(2, data, file);
gbl.word_1D53E = Sys.ArrayToShort(data, 0);

seg051.BlockRead(2, data, file);
gbl.word_1D540 = Sys.ArrayToShort(data, 0);

seg051.BlockRead(2, data, file);
gbl.word_1D542 = Sys.ArrayToShort(data, 0);

seg051.BlockRead(2, data, file);
gbl.word_1D544 = Sys.ArrayToShort(data, 0);

seg051.BlockRead(2, data, file);
gbl.word_1D546 = Sys.ArrayToShort(data, 0);
for (int i = 0; i < 3; i++)
{
seg051.BlockRead(2, data, file);
gbl.setBlocks[i].blockId = Sys.ArrayToShort(data, 0);

seg051.BlockRead(2, data, file);
gbl.word_1D548 = Sys.ArrayToShort(data, 0);
seg051.BlockRead(2, data, file);
gbl.setBlocks[i].setId = Sys.ArrayToShort(data, 0);
}

seg051.BlockRead(1, data, file);
int number_of_players = data[0];
Expand Down Expand Up @@ -1666,22 +1657,17 @@ internal static void loadSaveGame(string file_name)
{
if (gbl.game_state != 0)
{
if (gbl.word_1D53E > 0)
if (gbl.setBlocks[0].blockId > 0)
{
ovr031.Load3DMap(gbl.area_ptr.current_3DMap_block_id);
}

if (gbl.word_1D53E > 0)
{
ovr031.LoadWalldef((byte)gbl.word_1D540, (byte)gbl.word_1D53E);
}
if (gbl.word_1D542 > 0)
for (int i = 0; i < 3; i++)
{
ovr031.LoadWalldef((byte)gbl.word_1D544, (byte)gbl.word_1D542);
}
if (gbl.word_1D546 > 0)
{
ovr031.LoadWalldef((byte)gbl.word_1D548, (byte)gbl.word_1D546);
if (gbl.setBlocks[i].blockId > 0)
{
ovr031.LoadWalldef(gbl.setBlocks[i].setId, gbl.setBlocks[i].blockId);
}
}
}
}
Expand Down Expand Up @@ -1796,15 +1782,11 @@ internal static void SaveGame()
data[0] = gbl.game_state;
seg051.BlockWrite(1, data, save_file);

Sys.ShortToArray(gbl.word_1D53E, data, 0);
Sys.ShortToArray(gbl.word_1D540, data, 2);

Sys.ShortToArray(gbl.word_1D542, data, 4);
Sys.ShortToArray(gbl.word_1D544, data, 6);

Sys.ShortToArray(gbl.word_1D546, data, 8);
Sys.ShortToArray(gbl.word_1D548, data, 10);

for (int i = 0; i < 3; i++)
{
Sys.ShortToArray((short)gbl.setBlocks[i].blockId, data, (i * 4) + 0);
Sys.ShortToArray((short)gbl.setBlocks[i].setId, data, (i * 4) + 2);
}
seg051.BlockWrite(12, data, save_file);

int party_count = 0;
Expand Down

0 comments on commit b472df4

Please sign in to comment.