chiark / gitweb /
hidden: New PieceRenderInstructions etc. API
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 Jan 2021 18:48:52 +0000 (18:48 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 Jan 2021 22:21:44 +0000 (22:21 +0000)
This is how things are going to be.  We need to call these everywhere,
and make them do something.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/hidden.rs

index f47609100247c3741987ece2177015ec0b026b01..479d02f70e33d88b8daf6d2efb4b88fc1cd35d37 100644 (file)
@@ -54,3 +54,33 @@ impl PerPlayerIdMap {
 pub struct GameOccults {
   // todo
 }
+
+pub fn piece_pri(
+  _occults: &GameOccults, // xxx
+  gpl: &mut GPlayerState,
+  piece: PieceId,
+  pc: &PieceState,
+) -> PieceRenderInstructions {
+  let vpiece = gpl.idmap.fwd_or_insert(piece);
+  let angle = make_angle_visible(pc.angle);
+  PieceRenderInstructions { id: vpiece, angle, face: pc.face }
+}
+
+pub fn vpiece_decode(
+  _gs: &GameState, // xxx
+  gpl: &GPlayerState,
+  vis: VisiblePieceId
+) -> Option<PieceId> {
+  let piece = gpl.idmap.rev(vis)?;
+  // xxx check for occultation:
+  // check that this piece is visible at all to this player,
+  // or they might manipulate it despite not seeing it!
+  Some(piece)
+}
+
+pub fn massage_prep_piecestate(
+  _pri: &PieceRenderInstructions, // xxx
+  _ns: &mut PreparedPieceState, // xxx
+) {
+  // xxx hidden position involves adjusting pos and z and ??? here
+}