From b6db88bc97c704c695045319ecb1bb58a76c9bf5 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Tue, 4 Dec 2018 18:35:19 -0500 Subject: [PATCH] vector: split draw_wireframe_ortho() so that --oldralloc works --- presets/vector-z80color/game.c | 10 +++++++--- presets/vector-z80color/threed.c | 12 +++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/presets/vector-z80color/game.c b/presets/vector-z80color/game.c index fcad4288..2ddf77c9 100644 --- a/presets/vector-z80color/game.c +++ b/presets/vector-z80color/game.c @@ -337,13 +337,11 @@ void xform_vertices(Vector16* dest, const Vector8* src, const Matrix* m, byte nv } } -void draw_wireframe_ortho(const Wireframe* wf, const Matrix* m) { +void draw_wireframe(const Wireframe* wf, Vector16* scrnverts) { const char* e = wf->edges; byte bright = 0; int x1 = 0; int y1 = 0; - Vector16 scrnverts[16]; - xform_vertices(scrnverts, wf->verts, m, wf->numverts); do { sbyte i = *e++; if (i == -1) @@ -361,6 +359,12 @@ void draw_wireframe_ortho(const Wireframe* wf, const Matrix* m) { } while (1); } +void draw_wireframe_ortho(const Wireframe* wf, const Matrix* m) { + Vector16 scrnverts[16]; + xform_vertices(scrnverts, wf->verts, m, wf->numverts); + draw_wireframe(wf, scrnverts); +} + // SHAPE CACHE const Vector8 tetra_v[] = { {0,-86,86},{86,86,86},{-86,86,86},{0,0,-86} }; diff --git a/presets/vector-z80color/threed.c b/presets/vector-z80color/threed.c index 38cee5f2..ec395244 100644 --- a/presets/vector-z80color/threed.c +++ b/presets/vector-z80color/threed.c @@ -108,6 +108,8 @@ typedef struct { const sbyte* edges; // array of vertex indices (edges) } Wireframe; +const Matrix IDENTITY = {{{127,0,0},{0,127,0},{0,0,127}}}; + void mat_identity(Matrix* m) { memset(m, 0, sizeof(*m)); m->m[0][0] = 127; @@ -200,13 +202,11 @@ void xform_vertices(Vector16* dest, const Vector8* src, const Matrix* m, byte nv } } -void draw_wireframe_ortho(const Wireframe* wf, const Matrix* m) { +void draw_wireframe(const Wireframe* wf, Vector16* scrnverts) { const char* e = wf->edges; byte bright = 0; int x1 = 0; int y1 = 0; - Vector16 scrnverts[16]; - xform_vertices(scrnverts, wf->verts, m, wf->numverts); do { sbyte i = *e++; if (i == -1) @@ -224,6 +224,12 @@ void draw_wireframe_ortho(const Wireframe* wf, const Matrix* m) { } while (1); } +void draw_wireframe_ortho(const Wireframe* wf, const Matrix* m) { + Vector16 scrnverts[16]; + xform_vertices(scrnverts, wf->verts, m, wf->numverts); + draw_wireframe(wf, scrnverts); +} + /// word frame;