diff --git a/linuxdoom-1.10/r_bsp.cpp b/linuxdoom-1.10/r_bsp.cpp index f43e2bb..70883cb 100644 --- a/linuxdoom-1.10/r_bsp.cpp +++ b/linuxdoom-1.10/r_bsp.cpp @@ -24,7 +24,6 @@ #include "m_bbox.h" #include "r_main.h" -#include "r_plane.h" #include "r_things.h" // State. @@ -33,6 +32,7 @@ import system; import sky; import setup; +import plane; // diff --git a/linuxdoom-1.10/r_draw.h b/linuxdoom-1.10/r_draw.h index ab330d2..d0d438c 100644 --- a/linuxdoom-1.10/r_draw.h +++ b/linuxdoom-1.10/r_draw.h @@ -21,6 +21,10 @@ #pragma once +#include + +#include "m_fixed.h" + // This could be wider for >8 bit display. // Indeed, true color support is posibble // precalculating 24bpp lightmap/colormap LUT. diff --git a/linuxdoom-1.10/r_main.cpp b/linuxdoom-1.10/r_main.cpp index 7ad56e7..75be4af 100644 --- a/linuxdoom-1.10/r_main.cpp +++ b/linuxdoom-1.10/r_main.cpp @@ -33,7 +33,6 @@ #include "r_main.h" #include "r_draw.h" #include "r_things.h" -#include "r_plane.h" #include "r_bsp.h" import system; @@ -42,6 +41,7 @@ import sky; import setup; import main; import doom; +import plane; // Fineangles in the SCREENWIDTH wide window. #define FIELDOFVIEW 2048 @@ -647,8 +647,6 @@ void R_Init(void) { printf("\nR_InitTables"); R_SetViewSize(screenblocks, detailLevel); - R_InitPlanes(); - printf("\nR_InitPlanes"); R_InitLightTables(); printf("\nR_InitLightTables"); R_InitSkyMap(); diff --git a/linuxdoom-1.10/r_plane.h b/linuxdoom-1.10/r_plane.h deleted file mode 100644 index 9a8a30e..0000000 --- a/linuxdoom-1.10/r_plane.h +++ /dev/null @@ -1,52 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id:$ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// DESCRIPTION: -// Refresh, visplane stuff (floor, ceilings). -// -//----------------------------------------------------------------------------- - -#pragma once - -#include "r_data.h" - -// Visplane related. -extern short *lastopening; - -typedef void (*planefunction_t)(int top, int bottom); - -extern planefunction_t floorfunc; -extern planefunction_t ceilingfunc_t; - -extern short floorclip[SCREENWIDTH]; -extern short ceilingclip[SCREENWIDTH]; - -extern fixed_t yslope[SCREENHEIGHT]; -extern fixed_t distscale[SCREENWIDTH]; - -void R_InitPlanes(void); - -void R_ClearPlanes(void); - -void R_MapPlane(int y, int x1, int x2); - -void R_MakeSpans(int x, int t1, int b1, int t2, int b2); - -void R_DrawPlanes(void); - -visplane_t *R_FindPlane(fixed_t height, int picnum, int lightlevel); - -visplane_t *R_CheckPlane(visplane_t *pl, int start, int stop); diff --git a/linuxdoom-1.10/r_segs.cpp b/linuxdoom-1.10/r_segs.cpp index 98f3560..0d4b250 100644 --- a/linuxdoom-1.10/r_segs.cpp +++ b/linuxdoom-1.10/r_segs.cpp @@ -28,10 +28,10 @@ #include "r_main.h" #include "r_things.h" #include "r_draw.h" -#include "r_plane.h" import system; import sky; +import plane; // OPTIMIZE: closed two sided lines as single sided diff --git a/src/doom/doom.ixx b/src/doom/doom.ixx index 86713ad..7a593ca 100644 --- a/src/doom/doom.ixx +++ b/src/doom/doom.ixx @@ -7,4 +7,4 @@ export import :ticcmd; export import :player; export import :event; export import :tables; -export import :strings; \ No newline at end of file +export import :strings; diff --git a/linuxdoom-1.10/r_plane.cpp b/src/doom/plane.ixx similarity index 91% rename from linuxdoom-1.10/r_plane.cpp rename to src/doom/plane.ixx index 24c5229..86092be 100644 --- a/linuxdoom-1.10/r_plane.cpp +++ b/src/doom/plane.ixx @@ -22,20 +22,36 @@ // Moreover, the sky areas have to be determined. // //----------------------------------------------------------------------------- - +module; #include - - -#include "r_plane.h" #include "r_draw.h" #include "r_main.h" #include "r_things.h" - +export module plane; import system; import wad; import sky; +// Visplane related. +export inline short *lastopening; + +typedef void (*planefunction_t)(int top, int bottom); + +extern planefunction_t floorfunc; +extern planefunction_t ceilingfunc_t; + +// +// Clip values are the solid pixel bounding the range. +// floorclip starts out SCREENHEIGHT +// ceilingclip starts out -1 +// +export inline short floorclip[SCREENWIDTH]; +export inline short ceilingclip[SCREENWIDTH]; + +export inline fixed_t yslope[SCREENHEIGHT]; +export inline fixed_t distscale[SCREENWIDTH]; + planefunction_t floorfunc; planefunction_t ceilingfunc; @@ -47,21 +63,12 @@ planefunction_t ceilingfunc; #define MAXVISPLANES 128 visplane_t visplanes[MAXVISPLANES]; visplane_t *lastvisplane; -visplane_t *floorplane; -visplane_t *ceilingplane; +export visplane_t *floorplane; +export visplane_t *ceilingplane; // ? #define MAXOPENINGS SCREENWIDTH * 64 short openings[MAXOPENINGS]; -short *lastopening; - -// -// Clip values are the solid pixel bounding the range. -// floorclip starts out SCREENHEIGHT -// ceilingclip starts out -1 -// -short floorclip[SCREENWIDTH]; -short ceilingclip[SCREENWIDTH]; // // spanstart holds the start of a plane span @@ -76,8 +83,6 @@ int spanstop[SCREENHEIGHT]; lighttable_t **planezlight; fixed_t planeheight; -fixed_t yslope[SCREENHEIGHT]; -fixed_t distscale[SCREENWIDTH]; fixed_t basexscale; fixed_t baseyscale; @@ -86,14 +91,6 @@ fixed_t cacheddistance[SCREENHEIGHT]; fixed_t cachedxstep[SCREENHEIGHT]; fixed_t cachedystep[SCREENHEIGHT]; -// -// R_InitPlanes -// Only at game startup. -// -void R_InitPlanes(void) { - // Doh! -} - // // R_MapPlane // @@ -158,7 +155,7 @@ void R_MapPlane(int y, int x1, int x2) { // R_ClearPlanes // At begining of frame. // -void R_ClearPlanes(void) { +export void R_ClearPlanes(void) { int i; angle_t angle; @@ -185,7 +182,7 @@ void R_ClearPlanes(void) { // // R_FindPlane // -visplane_t *R_FindPlane(fixed_t height, int picnum, int lightlevel) { +export visplane_t *R_FindPlane(fixed_t height, int picnum, int lightlevel) { visplane_t *check; if (picnum == skyflatnum) { @@ -222,7 +219,7 @@ visplane_t *R_FindPlane(fixed_t height, int picnum, int lightlevel) { // // R_CheckPlane // -visplane_t *R_CheckPlane(visplane_t *pl, int start, int stop) { +export visplane_t *R_CheckPlane(visplane_t *pl, int start, int stop) { int intrl; int intrh; int unionl; @@ -298,7 +295,7 @@ void R_MakeSpans(int x, int t1, int b1, int t2, int b2) { // R_DrawPlanes // At the end of each frame. // -void R_DrawPlanes(void) { +export void R_DrawPlanes(void) { visplane_t *pl; int light; int x;