From: Ian Jackson Date: Sun, 31 Jan 2021 18:48:52 +0000 (+0000) Subject: hidden: New PieceRenderInstructions etc. API X-Git-Tag: otter-0.4.0~584 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=11a88b9e701871cc801c3099e5ab3f9517277def;p=otter.git hidden: New PieceRenderInstructions etc. API This is how things are going to be. We need to call these everywhere, and make them do something. Signed-off-by: Ian Jackson --- diff --git a/src/hidden.rs b/src/hidden.rs index f4760910..479d02f7 100644 --- a/src/hidden.rs +++ b/src/hidden.rs @@ -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 { + 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 +}