Skip to content

Commit

Permalink
Plane module
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyPtn committed Nov 26, 2024
1 parent 6d0d133 commit 19160a7
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 88 deletions.
2 changes: 1 addition & 1 deletion linuxdoom-1.10/r_bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "m_bbox.h"

#include "r_main.h"
#include "r_plane.h"
#include "r_things.h"

// State.
Expand All @@ -33,6 +32,7 @@
import system;
import sky;
import setup;
import plane;

//

Expand Down
4 changes: 4 additions & 0 deletions linuxdoom-1.10/r_draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#pragma once

#include <cstddef>

#include "m_fixed.h"

// This could be wider for >8 bit display.
// Indeed, true color support is posibble
// precalculating 24bpp lightmap/colormap LUT.
Expand Down
4 changes: 1 addition & 3 deletions linuxdoom-1.10/r_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -42,6 +41,7 @@ import sky;
import setup;
import main;
import doom;
import plane;

// Fineangles in the SCREENWIDTH wide window.
#define FIELDOFVIEW 2048
Expand Down Expand Up @@ -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();
Expand Down
52 changes: 0 additions & 52 deletions linuxdoom-1.10/r_plane.h

This file was deleted.

2 changes: 1 addition & 1 deletion linuxdoom-1.10/r_segs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/doom/doom.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export import :ticcmd;
export import :player;
export import :event;
export import :tables;
export import :strings;
export import :strings;
57 changes: 27 additions & 30 deletions linuxdoom-1.10/r_plane.cpp → src/doom/plane.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,36 @@
// Moreover, the sky areas have to be determined.
//
//-----------------------------------------------------------------------------

module;
#include <stdlib.h>


#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;

Expand All @@ -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
Expand All @@ -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;

Expand All @@ -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
//
Expand Down Expand Up @@ -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;

Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 19160a7

Please sign in to comment.