mirror of
https://github.com/DrBeef/DVR.git
synced 2025-02-12 23:05:50 +00:00
Restored sounds
This commit is contained in:
parent
21cc2a3a67
commit
9470d19e61
5 changed files with 17 additions and 47 deletions
BIN
app/src/main/assets/sounds.zip
Normal file
BIN
app/src/main/assets/sounds.zip
Normal file
Binary file not shown.
|
@ -29,6 +29,7 @@ import com.google.vrtoolkit.cardboard.Viewport;
|
|||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
|
@ -176,6 +177,19 @@ public class MainActivity
|
|||
copy_asset("DVR.cfg", DoomTools.GetDVRFolder() + File.separator);
|
||||
copy_asset("prboom.wad", DoomTools.GetDVRFolder() + File.separator);
|
||||
copy_asset("extraparams.txt", DoomTools.GetDVRFolder() + File.separator);
|
||||
copy_asset("sounds.zip", DoomTools.GetDVRFolder() + File.separator);
|
||||
|
||||
try {
|
||||
File folder = new File(DoomTools.GetDVRFolder() + File.separator + "sound" + File.separator);
|
||||
if(!folder.exists())
|
||||
if ( !folder.mkdirs() )
|
||||
throw new IOException("Unable to create local folder " + folder);
|
||||
DoomTools.unzip(new FileInputStream(DoomTools.GetDVRFolder() + File.separator + "sounds.zip"),
|
||||
folder);
|
||||
}
|
||||
catch (IOException f)
|
||||
{
|
||||
}
|
||||
|
||||
//See if user is trying to use command line params
|
||||
BufferedReader br;
|
||||
|
@ -252,6 +266,7 @@ public class MainActivity
|
|||
Log.i(TAG, "onSurfaceCreated");
|
||||
|
||||
openGL.onSurfaceCreated(config);
|
||||
openGL.SetupUVCoords();
|
||||
|
||||
//Start intro music
|
||||
mPlayer = MediaPlayer.create(this, R.raw.m010912339);
|
||||
|
@ -296,11 +311,6 @@ public class MainActivity
|
|||
if (!mSurfaceChanged)
|
||||
return;
|
||||
|
||||
openGL.SetupUVCoords();
|
||||
|
||||
//Reset our orientation
|
||||
cardboardView.resetHeadTracker();
|
||||
|
||||
if (!mShowingSpashScreen) {
|
||||
final String[] argv;
|
||||
String args = new String();
|
||||
|
|
|
@ -149,6 +149,7 @@ public class OpenGL {
|
|||
|
||||
public float screenDistance = 8f;
|
||||
public float screenScale = 4f;
|
||||
public float wadChooserScale = 2.5f;
|
||||
|
||||
public static final String vs_Image =
|
||||
"uniform mat4 u_MVPMatrix;" +
|
||||
|
|
|
@ -115,18 +115,11 @@ public class WADChooser {
|
|||
|
||||
}
|
||||
|
||||
// get a background image from resources
|
||||
// note the image format must match the bitmap format
|
||||
// Drawable background = context.getResources().getDrawable(R.drawable.background);
|
||||
// background.setBounds(0, 0, 256, 256);
|
||||
// background.draw(canvas); // draw the background to our bitmap
|
||||
|
||||
// Draw the text
|
||||
paint.setTextSize(20);
|
||||
|
||||
paint.setAntiAlias(true);
|
||||
paint.setARGB(0xff, 0xff, 0x20, 0x00);
|
||||
// draw the text centered
|
||||
canvas.drawText("<- " + GetChosenWAD() + " ->", 16, 220, paint);
|
||||
|
||||
openGL.CopyBitmapToTexture(bitmap, openGL.fbo.ColorTexture[0]);
|
||||
|
@ -168,7 +161,7 @@ public class WADChooser {
|
|||
// Object first appears directly in front of user.
|
||||
Matrix.setIdentityM(openGL.modelScreen, 0);
|
||||
Matrix.translateM(openGL.modelScreen, 0, 0, 0, -openGL.screenDistance);
|
||||
Matrix.scaleM(openGL.modelScreen, 0, openGL.screenScale, openGL.screenScale, 1.0f);
|
||||
Matrix.scaleM(openGL.modelScreen, 0, openGL.wadChooserScale, openGL.wadChooserScale, 1.0f);
|
||||
Matrix.multiplyMM(openGL.modelView, 0, openGL.view, 0, openGL.modelScreen, 0);
|
||||
Matrix.multiplyMM(openGL.modelViewProjection, 0, perspective, 0, openGL.modelView, 0);
|
||||
GLES20.glVertexAttribPointer(openGL.positionParam, 3, GLES20.GL_FLOAT, false, 0, openGL.screenVertices);
|
||||
|
|
|
@ -178,38 +178,6 @@ public class DoomTools {
|
|||
return key;
|
||||
}
|
||||
|
||||
public static void downloadFile (String url, File dest, String type, File folder, boolean force) throws Exception
|
||||
{
|
||||
Log.d(TAG, "Download " + url + " -> " + dest + " type: " + type + " folder=" + folder + " force:" + force);
|
||||
|
||||
if ( ! dest.exists() || force)
|
||||
{
|
||||
if ( force )
|
||||
Log.d(TAG, "Forcing download!");
|
||||
|
||||
WebDownload wd = new WebDownload(url);
|
||||
wd.doGet(new FileOutputStream(dest), type.equalsIgnoreCase("gzip"));
|
||||
|
||||
// If ZIP file unzip into folder
|
||||
if ( type.equalsIgnoreCase("zip")) {
|
||||
if ( folder == null)
|
||||
throw new Exception("Invalid destination folder for ZIP " + dest);
|
||||
|
||||
if ( ! folder.mkdirs() )
|
||||
throw new IOException("Unable to create local folder " + folder);
|
||||
|
||||
unzip(new FileInputStream(dest), folder);
|
||||
|
||||
// cleanup
|
||||
dest.delete();
|
||||
}
|
||||
}
|
||||
else {
|
||||
Log.d(TAG, "Not fetching " + dest + " already exists.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public boolean wadExists (int idx) {
|
||||
final String path = GetDVRFolder() + File.separator + DOOM_WADS[idx];
|
||||
return new File(path).exists();
|
||||
|
@ -268,8 +236,6 @@ public class DoomTools {
|
|||
final String path = dest.getAbsolutePath()
|
||||
+ File.separator + ze.getName();
|
||||
|
||||
//System.out.println(path);
|
||||
|
||||
FileOutputStream fout = new FileOutputStream(path);
|
||||
byte[] bytes = new byte[1024];
|
||||
|
||||
|
|
Loading…
Reference in a new issue