Skip to content

Commit

Permalink
collisions++, pickup, skybox,
Browse files Browse the repository at this point in the history
  • Loading branch information
connect committed May 1, 2016
1 parent cf4d724 commit fe212a6
Show file tree
Hide file tree
Showing 6 changed files with 235 additions and 100 deletions.
3 changes: 2 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ var cfg = {
83 : '+back', // s
39 : '+right', // right
68 : '+right', // d
32 : '+jump', // space


187 : 'zoomin',
189 : 'zoomout',

69 : '+use', // e
32 : '+use', // space

mouse1 : '+attack'
}
Expand Down
19 changes: 3 additions & 16 deletions doom.wad/sound.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,15 @@
* @author kod.connect
*/

/*
s_.load([
// effects
'DSPSTOP.ogg',
'DSPISTOL.ogg',
'DSSWTCHN.ogg',
'DSSWTCHX.ogg',
// music
'D_INTRO.mp3',
'D_E1M8.mp3'
]);
*/

s_.menuopen = 'DSSWTCHN.ogg';
s_.menunext = 'DSPSTOP.ogg';
s_.menuback = 'DSSWTCHX.ogg';
s_.menuselect = 'DSPISTOL.ogg';

s_.opendoor = 'DSDOROPN.ogg';

s_.getweapon = 'DSSGCOCK.ogg';
s_.getitem = 'DSITEMUP.ogg';
s_.ugh = 'DSNOWAY.ogg';

s_.play('D_INTRO.mp3');
s_.positInit();
Expand Down
3 changes: 2 additions & 1 deletion doom.wad/things.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ o_.things = {
sprite: 'SPOS',
sequence: '+',
class: 'MO',
label: 'Former Human Sergeant'
label: 'Former Human Sergeant',
death: s_.death
},
10: {
radius: 16,
Expand Down
8 changes: 8 additions & 0 deletions doom.wad/weapons.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ o_.wpn.data = {
cache : 'ABCDE',
fire : 'BCDE',
flash : 'A',
hitwall : {
sprite : 'PUFF',
sequence: 'ABCD',
},
hitflesh : {
sprite : 'BLUD',
sequence: 'ABC'
},
onFire : {

}
Expand Down
63 changes: 55 additions & 8 deletions engine/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ o_.map = new function(){

var o = t.thing[i];

if (!o.single) continue; // skip multiplayer things
if (o.dm) continue; // skip multiplayer things

//floorheight = r_.findFloor( -o.x, o.y );
//floorheight = (floorheight != false) ? floorheight.object.position.y : 0;
Expand All @@ -722,7 +722,7 @@ o_.map = new function(){
if (o.type == 1) { // setup start spot

i_.controls.getObject().position.set( -o.x, floorheight + cfg.playerHeight, o.y );
//i_.controls.getObject().rotateY( o.angle * Math.PI / -90 );
i_.controls.getObject().rotation.set(0, (o.angle + 90) * Math.PI / 180 , 0 );

} else if ( o_.things[ o.type ] != undefined ) {

Expand All @@ -739,6 +739,53 @@ o_.map = new function(){
}
}

createSkyBox = function(){

function createMaterial( path, repeat, color ) {

if (path != undefined) {
var texture = THREE.ImageUtils.loadTexture(path);
var material = new THREE.MeshBasicMaterial( { map: texture, overdraw: 0.5 } );

if (repeat != undefined){
material.map.wrapS = material.map.wrapT = THREE.RepeatWrapping;
material.map.repeat.set(repeat, repeat);
}
} else if ( color != undefined){

var material = new THREE.MeshBasicMaterial({ color: new THREE.Color(color) })
}


return material;
}

// Load the skybox images and create list of materials
var materials = [
createMaterial( 'doom.wad/gra/SKY1.png' ), // right
createMaterial( 'doom.wad/gra/SKY1.png' ), // left
createMaterial( undefined, undefined, 'rgb(190,190,190)' ), // top
createMaterial( 'doom.wad/gra/F_SKY1.png' ), // bottom
createMaterial( 'doom.wad/gra/SKY1.png' ), // back
createMaterial( 'doom.wad/gra/SKY1.png' ) // front
];

// Create a large cube
var mesh = new THREE.Mesh(
new THREE.BoxGeometry( 10000, 8000, 10000, 1, 1, 1 ),
new THREE.MeshFaceMaterial( materials )
);

mesh.position.copy( i_.controls.getObject().position );
mesh.position.y += 2000;

// Set the x scale to be -1, this will turn the cube inside out
mesh.scale.set(-1,1,1);
r_.scene.add( mesh );

//r_.scene.fog = new THREE.Fog( 0xcccccc, 5000, 7000 );
};
createSkyBox();
};

t.loadWalls = function(){
Expand Down Expand Up @@ -939,12 +986,12 @@ o_.map = new function(){

// Load the skybox images and create list of materials
var materials = [
createMaterial( 'doom.wad/gra/SKY4.png' ), // right
createMaterial( 'doom.wad/gra/SKY4.png' ), // left
createMaterial( 'doom.wad/gra/SKY4.png' ), // top
createMaterial( 'doom.wad/gra/SKY1.png' ), // right
createMaterial( 'doom.wad/gra/SKY1.png' ), // left
createMaterial( 'doom.wad/gra/SKY1.png' ), // top
createMaterial( 'doom.wad/gra/F_SKY1.png' ), // bottom
createMaterial( 'doom.wad/gra/SKY4.png' ), // back
createMaterial( 'doom.wad/gra/SKY4.png' ) // front
createMaterial( 'doom.wad/gra/SKY1.png' ), // back
createMaterial( 'doom.wad/gra/SKY1.png' ) // front
];

// Create a large cube
Expand Down Expand Up @@ -972,7 +1019,7 @@ o_.map = new function(){
r_.scene.add(mesh);
};

createSkySphere();
//createSkySphere();


//scene.fog = new THREE.FogExp2( 0x9999ff, 0.00025 );
Expand Down
Loading

0 comments on commit fe212a6

Please sign in to comment.