Skip to content

Commit dd49b12

Browse files
committed
r_init practically done
1 parent ea6b728 commit dd49b12

File tree

10 files changed

+698
-16
lines changed

10 files changed

+698
-16
lines changed

d_main.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ function D_DoomMain()
196196
console.log("M_LoadDefaults: Load system defaults.");
197197
M_LoadDefaults();
198198

199-
console.log("Z_Init: Init zone memory allocation daemon. "); // false. this also does not exist, this must be coded in in order to have the true dos experience
199+
console.log("Z_Init: Init zone memory allocation daemon. "); // false. this also does not exist, but this must be coded in in order to have the true dos experience
200200

201201
console.log("M_LoadDefaults: Load system defaults.");
202202

@@ -249,4 +249,10 @@ function D_DoomMain()
249249
// Ouch.
250250
break;
251251
}
252+
253+
console.log("M_Init: Init miscellaneous info.");
254+
M_Init();
255+
256+
console.log("R_Init: Init DOOM refresh daemon - ")
257+
R_Init();
252258
}

i_system.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
function I_Error(error)
22
{
3+
alert(error);
34
throw new Error(error); // makes sure the javascript stops
45
}

jsdoom.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,11 @@ body#jsdoom-body
1515
iframe
1616
{
1717
border: none;
18+
}
19+
canvas#jsdoom-canvas
20+
{
21+
position: fixed;
22+
top: 50%;
23+
left: 50%;
24+
transform: translate(-50%, -50%);
1825
}

jsdoom.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
<script src="doomdef.js"></script>
1313
<script src="i_system.js"></script>
1414
<script src="m_argv.js"></script>
15+
<script src="m_fixed.js"></script>
16+
<script src="m_menu.js"></script>
1517
<script src="m_misc.js"></script>
18+
<script src="r_data.js"></script>
19+
<script src="r_main.js"></script>
1620
<script src="w_wad.js"></script>
1721

1822
<script src="jsdoom.js"></script>

jsdoom.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,68 @@ function CorrectInt32Endianness(value, endian)
6969
return r;
7070
}
7171

72+
function GetUint8(buffer, position)
73+
{
74+
return new Uint8Array(buffer, position, 1)[0];
75+
}
76+
function GetInt8(buffer, position)
77+
{
78+
return new Int8Array(buffer, position, 1)[0];
79+
}
80+
81+
function GetUint16(buffer, position, endian)
82+
{
83+
try
84+
{
85+
return CorrectUint16Endianness(new Uint16Array(buffer, position, 1)[0], endian);
86+
}
87+
catch(e)
88+
{
89+
return CorrectUint16Endianness(new Uint16Array(buffer.slice(position, position+2), 0, 1)[0], endian);
90+
}
91+
}
92+
function GetInt16(buffer, position, endian)
93+
{
94+
try
95+
{
96+
return CorrectInt16Endianness(new Int16Array(buffer, position, 1)[0], endian);
97+
}
98+
catch(e)
99+
{
100+
return CorrectInt16Endianness(new Int16Array(buffer.slice(position, position+2), 0, 1)[0], endian);
101+
}
102+
}
103+
104+
function GetUint32(buffer, position, endian)
105+
{
106+
try
107+
{
108+
return CorrectUint16Endianness(new Uint32Array(buffer, position, 1)[0], endian);
109+
}
110+
catch(e)
111+
{
112+
return CorrectUint16Endianness(new Uint32Array(buffer.slice(position, position+4), 0, 1)[0], endian);
113+
}
114+
}
115+
function GetInt32(buffer, position, endian)
116+
{
117+
try
118+
{
119+
return CorrectInt16Endianness(new Int32Array(buffer, position, 1)[0], endian);
120+
}
121+
catch(e)
122+
{
123+
return CorrectInt16Endianness(new Int32Array(buffer.slice(position, position+4), 0, 1)[0], endian);
124+
}
125+
}
126+
127+
function GetUint8Array(buffer, position, length)
128+
{
129+
return new Uint8Array(buffer, position, length);
130+
}
131+
function GetString(buffer, position, length)
132+
{
133+
return decoder.decode(GetUint8Array(buffer, position, length)).replace(/\0.*$/g,'');
134+
}
135+
72136
D_DoomMain();

m_fixed.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const FRACBITS = 16
2+
const FRACUNIT = (1<<FRACBITS)

0 commit comments

Comments
 (0)