Skip to content

Commit

Permalink
Version 0.1.1 Update
Browse files Browse the repository at this point in the history
Mostly a bug-fix update with 2 new options in the settings menu.
  • Loading branch information
DavidSM64 committed Jul 9, 2017
1 parent c78a7c4 commit 75896e1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 12 deletions.
53 changes: 42 additions & 11 deletions src/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ private void glControl1_Load(object sender, EventArgs e)
GL.Enable(EnableCap.Texture2D);
GL.Enable(EnableCap.AlphaTest);
GL.AlphaFunc(AlphaFunction.Gequal, 0.5f);

if (Globals.doBackfaceCulling)
GL.Enable(EnableCap.CullFace);
else
GL.Disable(EnableCap.CullFace);
}

private void glControl1_Resize(object sender, EventArgs e)
Expand All @@ -296,7 +301,9 @@ private void glControl1_Resize(object sender, EventArgs e)

private void loadROMToolStripMenuItem_Click(object sender, EventArgs e)
{
loadROM(false);
DialogResult saveResult = Prompts.ShowShouldSaveDialog();
if(saveResult != DialogResult.Cancel)
loadROM(false);
}

private void saveROMAsToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -526,16 +533,25 @@ private void selectLeveToolStripMenuItem_Click(object sender, EventArgs e)
if (newLevel.changeLevel)
{
//Console.WriteLine("Changing Level to " + newLevel.levelID);
level = new Level(newLevel.levelID, 1);
camera.setCameraMode(CameraMode.FLY, ref camMtx);
camera.setLevel(level);
LevelScripts.parse(ref level, 0x15, 0);
level.sortAndAddNoModelEntries();
level.CurrentAreaID = level.Areas[0].AreaID;
resetObjectVariables();
refreshObjectsInList();
glControl1.Invalidate();
updateAreaButtons();
Level testLevel = new Level(newLevel.levelID, 1);
LevelScripts.parse(ref testLevel, 0x15, 0);
if (testLevel.Areas.Count > 0)
{
level = testLevel;
camera.setCameraMode(CameraMode.FLY, ref camMtx);
camera.setLevel(level);
level.sortAndAddNoModelEntries();
level.CurrentAreaID = level.Areas[0].AreaID;
resetObjectVariables();
refreshObjectsInList();
glControl1.Invalidate();
updateAreaButtons();
}
else
{
ushort id = newLevel.levelID;
MessageBox.Show("Error: No areas found in level ID: 0x" + id.ToString("X"));
}
}
}

Expand Down Expand Up @@ -679,6 +695,7 @@ private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEv
((WarpInstant)warp).updateROMData();
}
}
Globals.needToSave = true;
}

// I never want CategorizedAlphabetical, so I change it back to Categorized if detected.
Expand Down Expand Up @@ -892,6 +909,7 @@ private void moveObj_MouseMove(object sender, MouseEventArgs e)
glControl1.Invalidate();
propertyGrid1.Refresh();
glControl1.Update(); // Needed after calling propertyGrid1.Refresh();
Globals.needToSave = true;
}
}
}
Expand Down Expand Up @@ -929,6 +947,7 @@ private void movObj_UpDown_MouseMove(object sender, MouseEventArgs e)
propertyGrid1.Refresh();
glControl1.Update(); // Needed after calling propertyGrid1.Refresh();
moveObj_UpDown_lastMouseY = e.Y;
Globals.needToSave = true;
}
}
}
Expand Down Expand Up @@ -996,6 +1015,7 @@ private void rotObj_MouseMove(object sender, MouseEventArgs e)
glControl1.Invalidate();
propertyGrid1.Refresh();
glControl1.Update(); // Needed after calling propertyGrid1.Refresh();
Globals.needToSave = true;
}
}
}
Expand All @@ -1020,6 +1040,7 @@ private void dropObjectToGround()
glControl1.Invalidate();
propertyGrid1.Refresh();
glControl1.Update(); // Needed after calling propertyGrid1.Refresh();
Globals.needToSave = true;
}
}

Expand All @@ -1035,6 +1056,15 @@ private void AreaButton_Click(object sender, EventArgs e)
trySwitchArea(area);
}

private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (Globals.needToSave)
{
DialogResult saveResult = Prompts.ShowShouldSaveDialog();
e.Cancel = (saveResult == DialogResult.Cancel);
}
}

bool rotObj_Yaw_mouseDown = false;
int rotObj_Yaw_lastMouseY = 0;
private void rotObj_Yaw_MouseDown(object sender, MouseEventArgs e)
Expand Down Expand Up @@ -1074,6 +1104,7 @@ private void rotObj_Yaw_MouseMove(object sender, MouseEventArgs e)
propertyGrid1.Refresh();
glControl1.Update(); // Needed after calling propertyGrid1.Refresh();
rotObj_Yaw_lastMouseY = e.Y;
Globals.needToSave = true;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/LevelInfo/Object3D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void updateROMData()
else if (Globals.list_selected == 1) // Macro Object
{
//Console.WriteLine("Preset ID = 0x" + presetID.ToString("X"));
ushort first = (ushort)((ushort)((yRot << 9) / 2.8125f) | (presetID & 0x1FF));
ushort first = (ushort)((((ushort)(yRot / 2.8125f) & 0x7F) << 9) | (presetID & 0x1FF));
rom.writeHalfword(romAddr, first);
rom.writeHalfword(romAddr + 2, xPos);
rom.writeHalfword(romAddr + 4, yPos);
Expand Down

0 comments on commit 75896e1

Please sign in to comment.