Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize cell/world coordinate conversions. #5758

Merged
merged 9 commits into from
Jun 28, 2014

Conversation

pchote
Copy link
Member

@pchote pchote commented Jun 27, 2014

Part 3 / 5 of the isometric terrain implementation.

  • CPos.CenterPosition has been replaced with Map.CenterOfCell.
  • WPos.ToCPos has been replaced with Map.CellContaining.
  • A bunch of plumbing changes so that a Map is available where it is needed.
  • Cleaned up some more legacy code.

Moving the conversions into Map will allow these checks to be extended in future PRs to account for rectangular vs isometric cell grids, and use heightmap data.

var testSequence = info.Sequence + "-" + terrain;
var sequence = anim.HasSequence(testSequence) ? testSequence : info.Sequence;
anim.PlayFetchIndex(sequence, () => index);
anim.IsDecoration = true;

// Z-order is one set to the top of the footprint
var offset = cellOffset.ToWVec() - centerOffset;
var offset = self.World.Map.CenterOfCell(cell) - self.World.Map.CenterOfCell(location) - centerOffset;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an unnecessary calculation. Why are you not re-using cellOffset like before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is no longer possible to convert directly between CVec and WVec, as the result now depends on outside information (cell grid type, map heightmap). This instead converts both cells to a world position, and then calculates the WVec directly.

@Mailaender
Copy link
Member

Patch bomb and lot's of rebase and re-adaption pain for everybody else, but straight forward conversions that seemed easy to review.

👍 Can't find any regressions.

Mailaender added a commit that referenced this pull request Jun 28, 2014
Generalize cell/world coordinate conversions.
@Mailaender Mailaender merged commit 7fa5171 into OpenRA:bleed Jun 28, 2014
@pchote pchote mentioned this pull request Jun 28, 2014
18 tasks
@pchote pchote deleted the cell-world-conversions branch June 28, 2014 09:45
obrakmann added a commit to obrakmann/OpenRA that referenced this pull request Jul 5, 2014
Specifically, the CPos::CenterPosition -> Map::CenterOfCell rename (OpenRA#5758),
as well as the additional argument to Paradrop::SetLZ (OpenRA#5695).
noyanbaykal pushed a commit to noyanbaykal/OpenRA that referenced this pull request Jul 13, 2014
Specifically, the CPos::CenterPosition -> Map::CenterOfCell rename (OpenRA#5758),
as well as the additional argument to Paradrop::SetLZ (OpenRA#5695).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants