diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 240dfa843..000000000
--- a/Android.mk
+++ /dev/null
@@ -1,6 +0,0 @@
-# Build both the native piece of SRB2 for Android, and the Java frontend.
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/android/.classpath b/android/.classpath
deleted file mode 100644
index 609aa00eb..000000000
--- a/android/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/android/.project b/android/.project
deleted file mode 100644
index 2654493b0..000000000
--- a/android/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- SRB2
-
-
-
-
-
- com.android.ide.eclipse.adt.ResourceManagerBuilder
-
-
-
-
- com.android.ide.eclipse.adt.PreCompilerBuilder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.android.ide.eclipse.adt.ApkBuilder
-
-
-
-
-
- com.android.ide.eclipse.adt.AndroidNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/android/.settings/org.eclipse.jdt.core.prefs b/android/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index eda3d91ae..000000000
--- a/android/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,5 +0,0 @@
-#Mon Nov 09 14:38:16 EST 2009
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/android/Android.mk b/android/Android.mk
deleted file mode 100644
index 650337e5c..000000000
--- a/android/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := user
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := SRB2
-LOCAL_CERTIFICATE := media
-
-LOCAL_REQUIRED_MODULES := libsrb2
-LOCAL_JNI_SHARED_LIBRARIES := libsrb2
-
-include $(BUILD_PACKAGE)
-
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
deleted file mode 100644
index cc6a1db1c..000000000
--- a/android/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/android/default.properties b/android/default.properties
deleted file mode 100644
index 5dad0b51a..000000000
--- a/android/default.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=android-4
-# Indicates whether an apk should be generated for each density.
-split.density=false
diff --git a/android/gen/org/srb2/R.java b/android/gen/org/srb2/R.java
deleted file mode 100644
index 8db10bde5..000000000
--- a/android/gen/org/srb2/R.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/* AUTO-GENERATED FILE. DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found. It
- * should not be modified by hand.
- */
-
-package org.srb2;
-
-public final class R {
- public static final class attr {
- }
- public static final class drawable {
- public static final int icon=0x7f020000;
- }
- public static final class id {
- public static final int SoftwareRendererDisplay=0x7f050000;
- }
- public static final class layout {
- public static final int main=0x7f030000;
- }
- public static final class string {
- public static final int app_name=0x7f040001;
- public static final int hello=0x7f040000;
- }
-}
diff --git a/android/res/drawable-hdpi/icon.png b/android/res/drawable-hdpi/icon.png
deleted file mode 100644
index 8074c4c57..000000000
Binary files a/android/res/drawable-hdpi/icon.png and /dev/null differ
diff --git a/android/res/drawable-ldpi/icon.png b/android/res/drawable-ldpi/icon.png
deleted file mode 100644
index 1095584ec..000000000
Binary files a/android/res/drawable-ldpi/icon.png and /dev/null differ
diff --git a/android/res/drawable-mdpi/icon.png b/android/res/drawable-mdpi/icon.png
deleted file mode 100644
index a07c69fa5..000000000
Binary files a/android/res/drawable-mdpi/icon.png and /dev/null differ
diff --git a/android/res/layout/main.xml b/android/res/layout/main.xml
deleted file mode 100644
index 32f3b483e..000000000
--- a/android/res/layout/main.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
deleted file mode 100644
index 20f67d16f..000000000
--- a/android/res/values/strings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- Hello World, SRB2Game!
- SRB2
-
diff --git a/android/src/org/srb2/GameThread.java b/android/src/org/srb2/GameThread.java
deleted file mode 100644
index 6aecdac74..000000000
--- a/android/src/org/srb2/GameThread.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.srb2;
-
-import org.srb2.nativecode.SRB2;
-
-import android.graphics.Canvas;
-import android.util.Log;
-import android.view.SurfaceHolder;
-
-public class GameThread extends Thread {
- public static String TAG = "SRB2-GameThread";
- private SurfaceHolder sh;
- private SRB2 srb2;
-
- public GameThread(SurfaceHolder h) {
- super();
- this.srb2 = new SRB2(h);
- this.sh = h;
- }
-
- @Override
- public void run() {
- Log.d(TAG, "Starting thread!");
- this.srb2.run();
- }
-}
diff --git a/android/src/org/srb2/SRB2Game.java b/android/src/org/srb2/SRB2Game.java
deleted file mode 100644
index ae9f43b2a..000000000
--- a/android/src/org/srb2/SRB2Game.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.srb2;
-
-import android.util.Log;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.SurfaceHolder.Callback;
-import android.app.Activity;
-import android.os.Bundle;
-
-public class SRB2Game extends Activity implements Callback {
- public static String TAG = "SRB2-Activity";
- private SurfaceView sv;
- private GameThread thread;
-
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setContentView(R.layout.main);
-
- sv = (SurfaceView) findViewById(R.id.SoftwareRendererDisplay);
- sv.getHolder().addCallback(this);
- }
-
- public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) {
- Log.e(TAG, "Output surface changed? OHSHI-");
- }
-
- public void surfaceCreated(SurfaceHolder arg0) {
- Log.d(TAG, "Output surface ready! Instantiating and starting game...");
- thread = new GameThread(sv.getHolder());
- thread.start();
- }
-
- public void surfaceDestroyed(SurfaceHolder arg0) {
- // TODO shutdown SRB2 as cleanly as possible.
- }
-}
diff --git a/android/src/org/srb2/nativecode/Main.java b/android/src/org/srb2/nativecode/Main.java
deleted file mode 100644
index 1a2dc200a..000000000
--- a/android/src/org/srb2/nativecode/Main.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.srb2.nativecode;
-
-import java.nio.ByteBuffer;
-
-public class Main {
- private SRB2 srb2;
-
- public Main(SRB2 srb2) {
- this.srb2 = srb2;
- }
-
- public native int main(Video v);
-}
diff --git a/android/src/org/srb2/nativecode/SRB2.java b/android/src/org/srb2/nativecode/SRB2.java
deleted file mode 100644
index 0f18f1eaf..000000000
--- a/android/src/org/srb2/nativecode/SRB2.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.srb2.nativecode;
-
-import android.util.Log;
-import android.view.SurfaceHolder;
-
-/// Wraps the entire native game. This object should be wholly owned
-/// by the thread it's going to run in.
-public class SRB2 {
- public static String TAG = "SRB2-Wrapper";
- private Main main;
- public Video video;
-
- public SRB2(SurfaceHolder videoOut) {
- try {
- Log.i(TAG, "Loading native SRB2 shared object from package...");
- System.load("/data/data/org.srb2/lib/libsrb2.so");
-
- } catch (UnsatisfiedLinkError ule) {
- Log.i(TAG, "... it doesn't appear to be installed in the package. Looking for native library in the global search path.");
- try {
- System.load("libsrb2.so");
-
- } catch (UnsatisfiedLinkError ule2) {
- Log.e("JNI", "... no luck. Could not load libsrb2.so!");
- return;
- }
- }
- this.video = new Video(this, videoOut);
- this.main = new Main(this);
- }
-
- public void run() {
- this.main.main(this.video);
- }
-}
diff --git a/android/src/org/srb2/nativecode/Video.java b/android/src/org/srb2/nativecode/Video.java
deleted file mode 100644
index d7256ee1e..000000000
--- a/android/src/org/srb2/nativecode/Video.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.srb2.nativecode;
-
-import java.nio.ByteBuffer;
-
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.view.SurfaceHolder;
-
-public class Video {
- public static int width = 340;
- public static int height = 240;
- private SurfaceHolder sh;
- public ByteBuffer fb;
- public Bitmap bmp;
-
- public Video(SRB2 srb2, SurfaceHolder sh) {
- this.sh = sh;
- fb = ByteBuffer.allocateDirect(fbSize());
- bmp = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
- }
-
- private int fbSize() {
- // naively assuming RGBA8888 now, even though that is entirely wrong.
- // ... well, at least, that's what the Canvas/Bitmap will expect.
- return width * height * 4;
- }
-
- public void gotFrame() {
-
- Canvas canvas = sh.lockCanvas();
- canvas.drawARGB(0xff, 0, 0, 0);
- // ugh, an extra copy. the only way to avoid this, I suppose,
- // is to use the surface in native code directly.
- bmp.copyPixelsFromBuffer(fb);
- canvas.drawBitmap(bmp, 0, 0, null);
- sh.unlockCanvasAndPost(canvas);
-
- }
-}
diff --git a/src/Android.mk b/src/Android.mk
deleted file mode 100644
index 035d48887..000000000
--- a/src/Android.mk
+++ /dev/null
@@ -1,90 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-srb_module_tags := eng user
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := am_map.c \
- command.c \
- comptime.c \
- console.c \
- d_clisrv.c \
- d_main.c \
- d_net.c \
- d_netcmd.c \
- d_netfil.c \
- dehacked.c \
- f_finale.c \
- f_wipe.c \
- filesrch.c \
- g_game.c \
- g_input.c \
- hu_stuff.c \
- i_tcp.c \
- info.c \
- lzf.c \
- m_argv.c \
- m_bbox.c \
- m_cheat.c \
- m_fixed.c \
- m_menu.c \
- m_misc.c \
- m_queue.c \
- m_random.c \
- md5.c \
- mserv.c \
- p_ceilng.c \
- p_enemy.c \
- p_fab.c \
- p_floor.c \
- p_inter.c \
- p_lights.c \
- p_map.c \
- p_maputl.c \
- p_mobj.c \
- p_polyobj.c \
- p_saveg.c \
- p_setup.c \
- p_sight.c \
- p_spec.c \
- p_telept.c \
- p_tick.c \
- p_user.c \
- r_bsp.c \
- r_data.c \
- r_draw.c \
- r_main.c \
- r_plane.c \
- r_segs.c \
- r_sky.c \
- r_splats.c \
- r_things.c \
- s_sound.c \
- screen.c \
- sounds.c \
- st_stuff.c \
- string.c \
- tables.c \
- v_video.c \
- w_wad.c \
- y_inter.c \
- z_zone.c \
- android/i_cdmus.c \
- android/i_main.c \
- android/i_net.c \
- android/i_sound.c \
- android/i_system.c \
- android/i_video.c
-
-LOCAL_CFLAGS += -DPLATFORM_ANDROID -DNONX86 -DLINUX -DDEBUGMODE -DNOPIX -DUNIXCOMMON -DNOTERMIOS
-
-LOCAL_MODULE := libsrb2
-
-# we live in an APK, so no prelink for us!
-LOCAL_PRELINK_MODULE := false
-
-LOCAL_SHARED_LIBRARIES += liblog libdl
-
-LOCAL_CFLAGS += -Idalvik/libnativehelper/include/nativehelper
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/src/android/README b/src/android/README
deleted file mode 100644
index a8d35b598..000000000
--- a/src/android/README
+++ /dev/null
@@ -1,43 +0,0 @@
-SRB2 for Google Android!
-
-SYNOPSIS
-
-Port of SRB2 to Android, tested against version 1.6 (donut).
-
-I did this with a full Android tree, rather than the NDK thing.
-
-BUILDING
-
-Assuming a pretty standard Android tree, at $REPO, and the SRB2
-tree at $REPO/packages/apps/srb2 (that is, the *whole* SRB2
-tree, not just this android/ directory):
-
- cd $REPO
- source build/envsetup.sh # this gives us the mm command,
- # which is useful for selectively
- # building only one component.
- cd packages/apps/srb2
- mm
-
-An APK is dumped out at (or similar):
-out/target/product/generic/system/app/SRB2.apk
-
-Naturally, an SRB2 APK is architecture specific. Since most
-Android devices are currently ARMEL, this is pretty okay.
-
-NB. It appears that the Java app (the thing that becomes the APK)
-is *not* rebuilt if changes are only made to libsrb2. Grr.
-
-REGENERATION OF JNI HEADERS
-
-Whenever the Java classes in org.srb2.nativecode change,
-the C header files that describe the JNI interface to them
-need to be regnererated. Make sure you have the project
-built (so that the jar files are up to date), and then:
-
- cd $REPO/out/target/common/obj/APPS/SRB2_intermediates
-
- javah -classpath classes.jar -o $REPO/packages/apps/srb2/src/android/jni_main.h org.srb2.nativecode.Main
-
-# ... and no, I don't know how to mash all that into the
-# Android.mk build system...
diff --git a/src/android/i_cdmus.c b/src/android/i_cdmus.c
deleted file mode 100644
index 12063745b..000000000
--- a/src/android/i_cdmus.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "../command.h"
-#include "../s_sound.h"
-#include "../i_sound.h"
-
-//
-// CD MUSIC I/O
-//
-
-UINT8 cdaudio_started = 0;
-
-consvar_t cd_volume = CVAR_INIT ("cd_volume","18",CV_SAVE,soundvolume_cons_t, NULL);
-consvar_t cdUpdate = CVAR_INIT ("cd_update","1",CV_SAVE, NULL, NULL);
-
-
-void I_InitCD(void){}
-
-void I_StopCD(void){}
-
-void I_PauseCD(void){}
-
-void I_ResumeCD(void){}
-
-void I_ShutdownCD(void){}
-
-void I_UpdateCD(void){}
-
-void I_PlayCD(UINT8 track, UINT8 looping)
-{
- (void)track;
- (void)looping;
-}
-
-boolean I_SetVolumeCD(INT32 volume)
-{
- (void)volume;
- return false;
-}
diff --git a/src/android/i_main.c b/src/android/i_main.c
deleted file mode 100644
index 8696f3fc7..000000000
--- a/src/android/i_main.c
+++ /dev/null
@@ -1,53 +0,0 @@
-#define LOG_TAG "SRB2-main"
-#include "utils/Log.h"
-
-#include "../doomdef.h"
-#include "../d_main.h"
-#include "../m_argv.h"
-
-#include "i_video.h"
-
-#include "jni_main.h"
-
-int srb2_main()
-{
- // startup SRB2
- CONS_Printf ("Setting up SRB2Kart (fo' real)...");
- D_SRB2Main();
- CONS_Printf ("Entering main game loop...");
- // never return
- D_SRB2Loop();
- LOGD("Control left SRB2Kart. Good bye.");
-
- // return to OS
- return 0;
-}
-
-JNIEXPORT jint JNICALL Java_org_srb2_nativecode_Main_main
-(JNIEnv * env, jobject self, jobject video) {
- jobject fbBuf;
- jfieldID fbBufField;
-
- // a global reference to JNI Env, so my callbacks can use it:
- jni_env = env;
- androidVideo = video;
-
- jclass videoClass = (*env)->FindClass(env, "org/srb2/nativecode/Video");
- if(videoClass == NULL) {
- LOGE("Could not find Video class from JNI!");
- return -1;
- }
- fbBufField = (*env)->GetFieldID(env, videoClass, "fb", "Ljava/nio/ByteBuffer;");
- fbBuf = (*env)->GetObjectField(env, video, fbBufField);
- if(fbBuf == NULL) {
- LOGE("Couldn't get Video object from JNI!");
- return -1;
- }
- videoFrameCB = (*env)->GetMethodID(env, videoClass, "gotFrame", "()V");
- if(videoFrameCB == NULL) {
- LOGE("Couldn't get method ID of Video#gotFrame() callback!");
- return -1;
- }
- android_surface = (UINT8*) (*env)->GetDirectBufferAddress(env, fbBuf);
- return srb2_main();
-}
diff --git a/src/android/i_net.c b/src/android/i_net.c
deleted file mode 100644
index f6e642022..000000000
--- a/src/android/i_net.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "../i_net.h"
-
-boolean I_InitNetwork(void)
-{
- return false;
-}
diff --git a/src/android/i_sound.c b/src/android/i_sound.c
deleted file mode 100644
index b5a1c3646..000000000
--- a/src/android/i_sound.c
+++ /dev/null
@@ -1,214 +0,0 @@
-#include "../i_sound.h"
-
-UINT8 sound_started = 0;
-
-void *I_GetSfx(sfxinfo_t *sfx)
-{
- (void)sfx;
- return NULL;
-}
-
-void I_FreeSfx(sfxinfo_t *sfx)
-{
- (void)sfx;
-}
-
-void I_StartupSound(void){}
-
-void I_ShutdownSound(void){}
-
-//
-// SFX I/O
-//
-
-INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority, INT32 channel)
-{
- (void)id;
- (void)vol;
- (void)sep;
- (void)pitch;
- (void)priority;
- (void)channel;
- return -1;
-}
-
-void I_StopSound(INT32 handle)
-{
- (void)handle;
-}
-
-INT32 I_SoundIsPlaying(INT32 handle)
-{
- (void)handle;
- return false;
-}
-
-void I_UpdateSoundParams(INT32 handle, INT32 vol, INT32 sep, INT32 pitch)
-{
- (void)handle;
- (void)vol;
- (void)sep;
- (void)pitch;
-}
-
-void I_SetSfxVolume(INT32 volume)
-{
- (void)volume;
-}
-
-/// ------------------------
-// MUSIC SYSTEM
-/// ------------------------
-
-UINT8 music_started = 0;
-UINT8 digmusic_started = 0;
-
-void I_InitMusic(void){}
-
-void I_ShutdownMusic(void){}
-
-/// ------------------------
-// MUSIC PROPERTIES
-/// ------------------------
-
-musictype_t I_SongType(void)
-{
- return MU_NONE;
-}
-
-boolean I_SongPlaying(void)
-{
- return false;
-}
-
-boolean I_SongPaused(void)
-{
- return false;
-}
-
-/// ------------------------
-// MUSIC EFFECTS
-/// ------------------------
-
-boolean I_SetSongSpeed(float speed)
-{
- (void)speed;
- return false;
-}
-
-/// ------------------------
-// MUSIC SEEKING
-/// ------------------------
-
-UINT32 I_GetSongLength(void)
-{
- return 0;
-}
-
-boolean I_SetSongLoopPoint(UINT32 looppoint)
-{
- (void)looppoint;
- return false;
-}
-
-UINT32 I_GetSongLoopPoint(void)
-{
- return 0;
-}
-
-boolean I_SetSongPosition(UINT32 position)
-{
- (void)position;
- return false;
-}
-
-UINT32 I_GetSongPosition(void)
-{
- return 0;
-}
-
-/// ------------------------
-// MUSIC PLAYBACK
-/// ------------------------
-
-UINT8 midimusic_started = 0;
-
-boolean I_LoadSong(char *data, size_t len)
-{
- (void)data;
- (void)len;
- return -1;
-}
-
-void I_UnloadSong()
-{
-
-}
-
-boolean I_PlaySong(boolean looping)
-{
- (void)handle;
- (void)looping;
- return false;
-}
-
-void I_StopSong(void)
-{
- (void)handle;
-}
-
-void I_PauseSong(void)
-{
- (void)handle;
-}
-
-void I_ResumeSong(void)
-{
- (void)handle;
-}
-
-void I_SetMusicVolume(INT32 volume)
-{
- (void)volume;
-}
-
-/// ------------------------
-// MUSIC FADING
-/// ------------------------
-
-void I_SetInternalMusicVolume(UINT8 volume)
-{
- (void)volume;
-}
-
-void I_StopFadingSong(void)
-{
-}
-
-boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void));
-{
- (void)target_volume;
- (void)source_volume;
- (void)ms;
- return false;
-}
-
-boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void));
-{
- (void)target_volume;
- (void)ms;
- return false;
-}
-
-boolean I_FadeOutStopSong(UINT32 ms)
-{
- (void)ms;
- return false;
-}
-
-boolean I_FadeInPlaySong(UINT32 ms, boolean looping)
-{
- (void)ms;
- (void)looping;
- return false;
-}
diff --git a/src/android/i_system.c b/src/android/i_system.c
deleted file mode 100644
index fe7fa863d..000000000
--- a/src/android/i_system.c
+++ /dev/null
@@ -1,276 +0,0 @@
-#define LOG_TAG "SRB2"
-
-#include "../doomdef.h"
-#include "../i_system.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#define MEMINFO_FILE "/proc/meminfo"
-#define MEMTOTAL "MemTotal:"
-#define MEMFREE "MemFree:"
-
-UINT8 graphics_started = 0;
-
-UINT8 keyboard_started = 0;
-
-static INT64 start_time; // as microseconds since the epoch
-
-// I should probably return how much memory is remaining
-// for this process, considering Android's process memory limit.
-UINT32 I_GetFreeMem(UINT32 *total)
-{
- // what the heck? sysinfo() is partially missing in bionic?
- /* struct sysinfo si; */
- /* if(sysinfo(&si) != 0) { */
- /* I_Error("Couldn't invoke sysinfo()...?"); */
- /* } */
- /* return si.freeram; */
- char buf[1024];
- char *memTag;
- UINT32 freeKBytes;
- UINT32 totalKBytes;
- INT32 n;
- INT32 meminfo_fd = -1;
-
- meminfo_fd = open(MEMINFO_FILE, O_RDONLY);
- n = read(meminfo_fd, buf, 1023);
- close(meminfo_fd);
-
- if (n < 0)
- {
- // Error
- *total = 0L;
- return 0;
- }
-
- buf[n] = '\0';
- if (NULL == (memTag = strstr(buf, MEMTOTAL)))
- {
- // Error
- *total = 0L;
- return 0;
- }
-
- memTag += sizeof (MEMTOTAL);
- totalKBytes = atoi(memTag);
-
- if (NULL == (memTag = strstr(buf, MEMFREE)))
- {
- // Error
- *total = 0L;
- return 0;
- }
-
- memTag += sizeof (MEMFREE);
- freeKBytes = atoi(memTag);
-
- if (total)
- *total = totalKBytes << 10;
- return freeKBytes << 10;
-}
-
-INT64 current_time_in_ps() {
- struct timeval t;
- gettimeofday(&t, NULL);
- return (t.tv_sec * (INT64)1000000) + t.tv_usec;
-}
-
-void I_Sleep(UINT32 ms){}
-
-precise_t I_GetPreciseTime(void)
-{
- return 0;
-}
-
-UINT64 I_GetPrecisePrecision(void)
-{
- return 1000000;
-}
-
-void I_GetEvent(void){}
-
-void I_OsPolling(void){}
-
-ticcmd_t *I_BaseTiccmd(void)
-{
- return NULL;
-}
-
-ticcmd_t *I_BaseTiccmd2(void)
-{
- return NULL;
-}
-
-void I_Quit(void)
-{
- LOGD("SRB2Kart quitting!");
- exit(0);
-}
-
-void I_Error(const char *error, ...)
-{
- va_list argptr;
- char logbuf[8192];
-
- va_start(argptr, error);
- vsprintf(logbuf, error, argptr);
- va_end(argptr);
-
- LOGE(logbuf);
- exit(-1);
-}
-
-void I_Tactile(FFType Type, const JoyFF_t *Effect)
-{
- (void)Type;
- (void)Effect;
-}
-
-void I_Tactile2(FFType Type, const JoyFF_t *Effect)
-{
- (void)Type;
- (void)Effect;
-}
-
-void I_JoyScale(void){}
-
-void I_JoyScale2(void){}
-
-void I_InitJoystick(void){}
-
-void I_InitJoystick2(void){}
-
-INT32 I_NumJoys(void)
-{
- return 0;
-}
-
-const char *I_GetJoyName(INT32 joyindex)
-{
- (void)joyindex;
- return NULL;
-}
-
-void I_SetupMumble(void)
-{
-}
-
-#ifndef NOMUMBLE
-void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
-{
- (void)mobj;
- (void)listener;
-}
-#endif
-
-void I_OutputMsg(const char *fmt, ...)
-{
- va_list argptr;
- char logbuf[8192];
-
- va_start(argptr, fmt);
- vsprintf(logbuf, fmt, argptr);
- va_end(argptr);
-
- LOGD(logbuf);
-}
-
-void I_StartupMouse(void){}
-
-void I_StartupMouse2(void){}
-
-void I_StartupKeyboard(void){}
-
-INT32 I_GetKey(void)
-{
- return 0;
-}
-
-void I_StartupTimer(void) {
- struct timeval t;
- gettimeofday(&t, NULL);
- start_time = (t.tv_sec * 1000000) + t.tv_usec;
-}
-
-void I_AddExitFunc(void (*func)())
-{
- (void)func;
-}
-
-void I_RemoveExitFunc(void (*func)())
-{
- (void)func;
-}
-
-INT32 I_StartupSystem(void)
-{
- return -1;
-}
-
-void I_ShutdownSystem(void){}
-
-void I_GetDiskFreeSpace(INT64* freespace)
-{
- *freespace = 0;
-}
-
-char *I_GetUserName(void)
-{
- return "Android";
-}
-
-INT32 I_mkdir(const char *dirname, INT32 unixright)
-{
- (void)dirname;
- (void)unixright;
- return -1;
-}
-
-const char *I_LocateWad(void)
-{
- return "/sdcard/srb2";
-}
-
-void I_GetJoystickEvents(void){}
-
-void I_GetJoystick2Events(void){}
-
-void I_GetMouseEvents(void){}
-
-void I_UpdateMouseGrab(void){}
-
-char *I_GetEnv(const char *name)
-{
- LOGW("I_GetEnv() called?!");
- (void)name;
- return NULL;
-}
-
-INT32 I_PutEnv(char *variable)
-{
- (void)variable;
- return -1;
-}
-
-INT32 I_ClipboardCopy(const char *data, size_t size)
-{
- (void)data;
- (void)size;
- return -1;
-}
-
-char *I_ClipboardPaste(void)
-{
- return NULL;
-}
-
-void I_RegisterSysCommands(void) {}
-
-#include "../sdl/dosstr.c"
diff --git a/src/android/i_video.c b/src/android/i_video.c
deleted file mode 100644
index bf0decb74..000000000
--- a/src/android/i_video.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "../doomdef.h"
-#include "../command.h"
-#include "../i_video.h"
-#include "../v_video.h"
-#include "../screen.h"
-
-#include "i_video.h"
-
-#include "utils/Log.h"
-
-rendermode_t rendermode = render_soft;
-rendermode_t chosenrendermode = render_none;
-
-boolean highcolor = false;
-
-boolean allow_fullscreen = false;
-
-
-
-consvar_t cv_vidwait = CVAR_INIT ("vid_wait", "On", CV_SAVE, CV_OnOff, NULL);
-
-void I_StartupGraphics(void){}
-void I_ShutdownGraphics(void){}
-
-void VID_StartupOpenGL(void){}
-
-void I_SetPalette(RGBA_t *palette)
-{
- (void)palette;
-}
-
-INT32 VID_NumModes(void)
-{
- return 1;
-}
-
-INT32 VID_GetModeForSize(INT32 w, INT32 h)
-{
- (void)w;
- (void)h;
- return 0;
-}
-
-void VID_PrepareModeList(void){}
-
-INT32 VID_SetMode(INT32 modenum)
-{
- vid.modenum = 0;
- vid.width = 320;
- vid.height = 240;
- vid.bpp = 1;
- vid.buffer = android_surface;
- return 0;
-}
-
-boolean VID_CheckRenderer(void)
-{
- return false;
-}
-
-void VID_CheckGLLoaded(rendermode_t oldrender)
-{
- (void)oldrender;
-}
-
-const char *VID_GetModeName(INT32 modenum)
-{
- return "A320x240";
-}
-
-void I_UpdateNoBlit(void){}
-
-void I_FinishUpdate(void) {
- LOGD("FRAME!");
- (*jni_env)->CallVoidMethod(jni_env, androidVideo, videoFrameCB);
-}
-
-void I_UpdateNoVsync(void) {}
-
-void I_WaitVBL(INT32 count)
-{
- (void)count;
-}
-
-void I_ReadScreen(UINT8 *scr)
-{
- (void)scr;
-}
-
-void I_BeginRead(void){}
-
-void I_EndRead(void){}
diff --git a/src/android/i_video.h b/src/android/i_video.h
deleted file mode 100644
index aa0e78f3d..000000000
--- a/src/android/i_video.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _SRB2_ANDROID_VIDEO_
-#define _SRB2_ANDROID_VIDEO_
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-UINT8 *android_surface;
-
-JNIEnv* jni_env;
-jobject androidVideo;
-jmethodID videoFrameCB;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif
diff --git a/src/android/jni_main.h b/src/android/jni_main.h
deleted file mode 100644
index da7f70331..000000000
--- a/src/android/jni_main.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include
-/* Header for class org_srb2_nativecode_Main */
-
-#ifndef _Included_org_srb2_nativecode_Main
-#define _Included_org_srb2_nativecode_Main
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: org_srb2_nativecode_Main
- * Method: main
- * Signature: (Lorg/srb2/nativecode/Video;)I
- */
-JNIEXPORT jint JNICALL Java_org_srb2_nativecode_Main_main
- (JNIEnv *, jobject, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/src/d_main.cpp b/src/d_main.cpp
index 004f33f64..a446cd8ae 100644
--- a/src/d_main.cpp
+++ b/src/d_main.cpp
@@ -86,7 +86,7 @@
#define ASSET_HASH_TEXTURES_KART 0xb4211b2f32b6a291
#define ASSET_HASH_CHARS_KART 0x1e68a3e01aa5c68b
#define ASSET_HASH_MAPS_KART 0x38558ed00da41ce9
-#define ASSET_HASH_MAIN_PK3 0x90bc93435f9aa4c4
+#define ASSET_HASH_MAIN_PK3 0x3bbd056a4ce5e993
#define ASSET_HASH_MAPPATCH_PK3 0x6a8f4d3080d40af3
#ifdef USE_PATCH_FILE
#define ASSET_HASH_PATCH_PK3 0x0000000000000000
@@ -1922,10 +1922,6 @@ const char *D_Home(void)
{
const char *userhome = NULL;
-#ifdef ANDROID
- return "/data/data/org.srb2/";
-#endif
-
if (M_CheckParm("-home") && M_IsNextParm())
userhome = M_GetNextParm();
else
diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index 08fc58835..d48a4e0c9 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -1899,7 +1899,7 @@ void WeaponPref_Parse(UINT8 **cp, INT32 playernum)
UINT8 prefs = READUINT8(*cp);
- player->pflags &= ~(PF_KICKSTARTACCEL|PF_SHRINKME);
+ player->pflags &= ~(PF_KICKSTARTACCEL|PF_SHRINKME|PF_FLIPCAM);
if (prefs & WP_KICKSTARTACCEL)
player->pflags |= PF_KICKSTARTACCEL;
diff --git a/src/doomdef.h b/src/doomdef.h
index da551b5b2..489302e48 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -515,9 +515,6 @@ extern int compuncommitted;
#define NO_PNG_LUMPS
#endif
-/// Render flats on walls
-#define WALLFLATS
-
/// Divide volume of music and sounds by this much (loudest sounds on earth)
#define VOLUME_DIVIDER 4
#define USER_VOLUME_SCALE 2
diff --git a/src/g_game.c b/src/g_game.c
index dbdfdd6a1..a8f46b4f7 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1625,7 +1625,7 @@ boolean G_Responder(event_t *ev)
// allow spy mode changes even during the demo
if (gamestate == GS_LEVEL && ev->type == ev_keydown
- && G_ControlBoundToKey(0, gc_viewpoint, ev->data1, true))
+ && G_ControlBoundToKey(0, gc_viewpoint, ev->data1, false))
{
if (!demo.playback && (r_splitscreen))
g_localplayers[0] = consoleplayer;
@@ -2474,7 +2474,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
bumper = ((gametyperules & GTR_BUMPERS) ? K_StartingBumperCount() : 0);
karmapoints = 0;
wanted = 0;
- rings = 10;
+ rings = 5;
kickstartaccel = 0;
lastsafelap = 0;
lastsafestarpost = 0;
@@ -2545,9 +2545,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
starposttime = players[player].starposttime;
prevcheck = players[player].prevcheck;
prevcheck = players[player].nextcheck;
-
- pflags |= (players[player].pflags & (PF_STASIS|PF_ELIMINATED|PF_NOCONTEST|PF_LOSTLIFE|PF_FLIPCAM));
-
lastsafelap = players[player].lastsafelap;
lastsafestarpost = players[player].lastsafestarpost;
bigwaypointgap = players[player].bigwaypointgap;
diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c
index 4b9da2616..54676f2f4 100644
--- a/src/hardware/hw_cache.c
+++ b/src/hardware/hw_cache.c
@@ -521,7 +521,6 @@ static void HWR_GenerateTexture(GLMapTexture_t *grtex, INT32 texnum, boolean noe
realpatch = (softwarepatch_t *)Picture_PNGConvert(pdata, PICFMT_DOOMPATCH, NULL, NULL, NULL, NULL, lumplength, NULL, 0);
else
#endif
-#ifdef WALLFLATS
if (texture->type == TEXTURETYPE_FLAT)
{
if (doremap)
@@ -529,7 +528,6 @@ static void HWR_GenerateTexture(GLMapTexture_t *grtex, INT32 texnum, boolean noe
realpatch = (softwarepatch_t *)Picture_Convert(PICFMT_FLAT, pdata, PICFMT_DOOMPATCH, 0, NULL, texture->width, texture->height, 0, 0, 0);
}
else
-#endif
{
dealloc = false;
if (doremap)
@@ -767,7 +765,7 @@ void HWR_LoadMapTextures(size_t pnumtextures)
gl_textures = calloc(gl_numtextures, sizeof(*gl_textures));
gl_flats = calloc(gl_numtextures, sizeof(*gl_flats));
- if ((gl_textures == NULL) || (gl_flats == NULL))
+ if (gl_textures == NULL || gl_flats == NULL)
I_Error("HWR_LoadMapTextures: ran out of memory for OpenGL textures");
gl_maptexturesloaded = true;
@@ -896,36 +894,6 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
flat[steppy] = grMipmap->colormap->source[flat[steppy]];
}
-static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum, boolean noencoremap)
-{
- UINT8 *flat;
- UINT8 *converted;
- size_t size;
- size_t i;
- UINT8 *colormap = colormaps;
-
- if (!noencoremap && encoremap)
- {
- colormap += COLORMAP_REMAPOFFSET;
- }
-
- // setup the texture info
- grMipmap->format = GL_TEXFMT_P_8;
- grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
-
- grMipmap->width = (UINT16)textures[texturenum]->width;
- grMipmap->height = (UINT16)textures[texturenum]->height;
- size = (grMipmap->width * grMipmap->height);
-
- flat = Z_Malloc(size, PU_HWRCACHE, &grMipmap->data);
- converted = (UINT8 *)Picture_TextureToFlat(texturenum);
- for (i = 0; i < size; i++)
- {
- flat[i] = colormap[converted[i]];
- }
- Z_Free(converted);
-}
-
// Download a Doom 'flat' to the hardware cache and make it ready for use
void HWR_GetRawFlat(lumpnum_t flatlumpnum, boolean noencoremap)
{
@@ -966,125 +934,84 @@ void HWR_GetRawFlat(lumpnum_t flatlumpnum, boolean noencoremap)
void HWR_GetLevelFlat(levelflat_t *levelflat, boolean noencoremap)
{
- // Who knows?
- if (levelflat == NULL)
- return;
-
- if (levelflat->type == LEVELFLAT_FLAT)
- HWR_GetRawFlat(levelflat->u.flat.lumpnum, noencoremap);
- else if (levelflat->type == LEVELFLAT_TEXTURE)
+ if (levelflat->type == LEVELFLAT_NONE)
{
- GLMapTexture_t *grtex;
- INT32 texturenum = levelflat->u.texture.num;
-#ifdef PARANOIA
- if ((unsigned)texturenum >= gl_numtextures)
- I_Error("HWR_GetLevelFlat: texturenum >= numtextures");
-#endif
+ HWR_SetCurrentTexture(NULL);
+ return;
+ }
- // Who knows?
- if (texturenum == 0 || texturenum == -1)
- return;
+ INT32 texturenum = texturetranslation[levelflat->texture_id];
+ INT32 brightmapnum = R_GetTextureBrightmap(texturenum);
+ if (texturenum <= 0)
+ {
+ HWR_SetCurrentTexture(NULL);
+ return;
+ }
- // Every texture in memory, stored as a 8-bit flat. Wow!
- grtex = &gl_flats[texturenum];
+ GLMapTexture_t *grtex = &gl_flats[texturenum];
+ GLMipmap_t *grMipmap = &grtex->mipmap;
- // Generate flat if missing from the cache
- if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
+ if (!grMipmap->data && !grMipmap->downloaded)
+ {
+ UINT8 *flat;
+ UINT8 *colormap = colormaps;
+
+ grMipmap->format = GL_TEXFMT_P_8;
+ grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
+
+ grMipmap->width = (UINT16)textures[texturenum]->width;
+ grMipmap->height = (UINT16)textures[texturenum]->height;
+
+ size_t size = grMipmap->width * grMipmap->height;
+ flat = Picture_TextureToFlat(texturenum);
+ Z_ChangeTag(flat, PU_HWRCACHE);
+ Z_SetUser(flat, &grMipmap->data);
+
+ if (!noencoremap && encoremap)
+ colormap += COLORMAP_REMAPOFFSET;
+
+ grtex->mipmap.colormap = Z_Calloc(sizeof(*grtex->mipmap.colormap), PU_HWRPATCHCOLMIPMAP, NULL);
+ grtex->mipmap.colormap->source = colormap;
+ M_Memcpy(grtex->mipmap.colormap->data, colormap, 256);
+
+ for (size_t steppy = 0; steppy < size; steppy++)
+ if (flat[steppy] != HWR_PATCHES_CHROMAKEY_COLORINDEX)
+ flat[steppy] = grtex->mipmap.colormap->source[flat[steppy]];
+ }
+
+ if (!grMipmap->downloaded)
+ HWD.pfnSetTexture(&grtex->mipmap);
+
+ HWR_SetCurrentTexture(&grtex->mipmap);
+
+ Z_ChangeTag(grMipmap->data, PU_HWRCACHE_UNLOCKED);
+
+ if (brightmapnum)
+ {
+ grtex = &gl_flats[brightmapnum];
+ grMipmap = &grtex->mipmap;
+
+ if (!grMipmap->data && !grMipmap->downloaded)
{
- HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum, noencoremap);
+ grMipmap->format = GL_TEXFMT_P_8;
+ grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
- if (!noencoremap && encoremap)
- {
- grtex->mipmap.colormap = Z_Calloc(sizeof(*grtex->mipmap.colormap), PU_HWRPATCHCOLMIPMAP, NULL);
- grtex->mipmap.colormap->source = colormaps + COLORMAP_REMAPOFFSET;
- M_Memcpy(grtex->mipmap.colormap->data, colormaps + COLORMAP_REMAPOFFSET, 256);
- }
+ grMipmap->width = (UINT16)textures[brightmapnum]->width;
+ grMipmap->height = (UINT16)textures[brightmapnum]->height;
+
+ size_t size = grMipmap->width * grMipmap->height;
+ memcpy(Z_Malloc(size, PU_HWRCACHE, &grMipmap->data), R_GetFlatForTexture(brightmapnum), size);
}
- // If hardware does not have the texture, then call pfnSetTexture to upload it
- if (!grtex->mipmap.downloaded)
+ grtex->mipmap.flags |= TF_BRIGHTMAP;
+
+ if (!grMipmap->downloaded)
HWD.pfnSetTexture(&grtex->mipmap);
+
HWR_SetCurrentTexture(&grtex->mipmap);
- // The system-memory data can be purged now.
- Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
-
- if ((texturenum = R_GetTextureBrightmap(texturenum)))
- {
- // Every texture in memory, stored as a 8-bit flat. Wow!
- grtex = &gl_flats[texturenum];
-
- // Generate flat if missing from the cache
- if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
- HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum, true);
-
- grtex->mipmap.flags |= TF_BRIGHTMAP;
-
- // If hardware does not have the texture, then call pfnSetTexture to upload it
- if (!grtex->mipmap.downloaded)
- HWD.pfnSetTexture(&grtex->mipmap);
- HWR_SetCurrentTexture(&grtex->mipmap);
-
- // The system-memory data can be purged now.
- Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
- }
+ Z_ChangeTag(grMipmap->data, PU_HWRCACHE_UNLOCKED);
}
- else if (levelflat->type == LEVELFLAT_PATCH)
- {
- patch_t *patch = W_CachePatchNum(levelflat->u.flat.lumpnum, PU_CACHE);
- levelflat->width = (UINT16)(patch->width);
- levelflat->height = (UINT16)(patch->height);
- HWR_GetPatch(patch);
- }
-#ifndef NO_PNG_LUMPS
- else if (levelflat->type == LEVELFLAT_PNG)
- {
- GLMipmap_t *mipmap = levelflat->mipmap;
-
- // Cache the picture.
- if (!levelflat->mippic)
- {
- INT32 pngwidth = 0, pngheight = 0;
- void *pic = Picture_PNGConvert(W_CacheLumpNum(levelflat->u.flat.lumpnum, PU_CACHE), PICFMT_FLAT, &pngwidth, &pngheight, NULL, NULL, W_LumpLength(levelflat->u.flat.lumpnum), NULL, 0);
-
- Z_ChangeTag(pic, PU_LEVEL);
- Z_SetUser(pic, &levelflat->mippic);
-
- levelflat->width = (UINT16)pngwidth;
- levelflat->height = (UINT16)pngheight;
- }
-
- // Make the mipmap.
- if (mipmap == NULL)
- {
- mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_STATIC, NULL);
- mipmap->format = GL_TEXFMT_P_8;
- mipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
- levelflat->mipmap = mipmap;
- }
-
- if (!mipmap->data && !mipmap->downloaded)
- {
- UINT8 *flat;
- size_t size;
-
- if (levelflat->mippic == NULL)
- I_Error("HWR_GetLevelFlat: levelflat->mippic == NULL");
-
- mipmap->width = levelflat->width;
- mipmap->height = levelflat->height;
-
- size = (mipmap->width * mipmap->height);
- flat = Z_Malloc(size, PU_LEVEL, &mipmap->data);
- M_Memcpy(flat, levelflat->mippic, size);
- }
-
- // Tell the hardware driver to bind the current texture to the flat's mipmap
- HWR_SetCurrentTexture(mipmap);
- }
-#endif
- else // set no texture
- HWR_SetCurrentTexture(NULL);
}
// --------------------+
diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 24e5897fd..6a06bc4e8 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -396,8 +396,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
INT32 i;
float flatxref,flatyref;
float fflatwidth = 64.0f, fflatheight = 64.0f;
- INT32 flatflag = 63;
- boolean texflat = false;
float scrollx = 0.0f, scrolly = 0.0f, anglef = 0.0f;
angle_t angle = 0;
FSurfaceInfo Surf;
@@ -452,34 +450,16 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
// set texture for polygon
if (levelflat != NULL)
{
- if (levelflat->type == LEVELFLAT_FLAT)
- {
- size_t len = W_LumpLength(levelflat->u.flat.lumpnum);
- size_t sflatsize = R_FlatDimensionsFromLumpSize(len);
- fflatwidth = fflatheight = (double)sflatsize;
- flatflag = sflatsize-1;
- }
- else
- {
- if (levelflat->type == LEVELFLAT_TEXTURE)
- {
- fflatwidth = textures[levelflat->u.texture.num]->width;
- fflatheight = textures[levelflat->u.texture.num]->height;
- }
- else if (levelflat->type == LEVELFLAT_PATCH || levelflat->type == LEVELFLAT_PNG)
- {
- fflatwidth = levelflat->width;
- fflatheight = levelflat->height;
- }
- texflat = true;
- }
+ texture_t *texture = textures[R_GetTextureNumForFlat(levelflat)];
+ fflatwidth = texture->width;
+ fflatheight = texture->height;
}
else // set no texture
HWR_SetCurrentTexture(NULL);
// reference point for flat texture coord for each vertex around the polygon
- flatxref = (float)(((fixed_t)pv->x & (~flatflag)) / fflatwidth);
- flatyref = (float)(((fixed_t)pv->y & (~flatflag)) / fflatheight);
+ flatxref = 0.0;
+ flatyref = 0.0;
// transform
if (FOFsector != NULL)
@@ -514,30 +494,13 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
}
- if (angle) // Only needs to be done if there's an altered angle
- {
- tempxsow = flatxref;
- tempytow = flatyref;
-
- anglef = ANG2RAD(InvAngle(angle));
-
- flatxref = (tempxsow * cos(anglef)) - (tempytow * sin(anglef));
- flatyref = (tempxsow * sin(anglef)) + (tempytow * cos(anglef));
- }
+ anglef = ANG2RAD(InvAngle(angle));
#define SETUP3DVERT(vert, vx, vy) {\
- /* Hurdler: add scrolling texture on floor/ceiling */\
- if (texflat)\
- {\
- vert->s = (float)((vx) / fflatwidth) + scrollx;\
- vert->t = -(float)((vy) / fflatheight) + scrolly;\
- }\
- else\
- {\
- vert->s = (float)(((vx) / fflatwidth) - flatxref + scrollx);\
- vert->t = (float)(flatyref - ((vy) / fflatheight) + scrolly);\
- }\
-\
+ /* Hurdler: add scrolling texture on floor/ceiling */ \
+ vert->s = (float)(((vx) / fflatwidth) - flatxref + scrollx);\
+ vert->t = (float)(flatyref - ((vy) / fflatheight) + scrolly);\
+ \
/* Need to rotate before translate */\
if (angle) /* Only needs to be done if there's an altered angle */\
{\
@@ -2479,9 +2442,6 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
float height = FIXED_TO_FLOAT(fixedheight); // constant y for all points on the convex flat polygon
float flatxref, flatyref;
float fflatwidth = 64.0f, fflatheight = 64.0f;
- INT32 flatflag = 63;
-
- boolean texflat = false;
float scrollx = 0.0f, scrolly = 0.0f;
angle_t angle = 0;
@@ -2509,37 +2469,16 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
// set texture for polygon
if (levelflat != NULL)
{
- if (levelflat->type == LEVELFLAT_FLAT)
- {
- size_t len = W_LumpLength(levelflat->u.flat.lumpnum);
- size_t sflatsize = R_FlatDimensionsFromLumpSize(len);
- fflatwidth = fflatheight = (double)sflatsize;
- flatflag = sflatsize-1;
- }
- else
- {
- if (levelflat->type == LEVELFLAT_TEXTURE)
- {
- fflatwidth = textures[levelflat->u.texture.num]->width;
- fflatheight = textures[levelflat->u.texture.num]->height;
- }
- else if (levelflat->type == LEVELFLAT_PATCH || levelflat->type == LEVELFLAT_PNG)
- {
- fflatwidth = levelflat->width;
- fflatheight = levelflat->height;
- }
- texflat = true;
- }
+ texture_t *texture = textures[R_GetTextureNumForFlat(levelflat)];
+ fflatwidth = texture->width;
+ fflatheight = texture->height;
}
else // set no texture
HWR_SetCurrentTexture(NULL);
// reference point for flat texture coord for each vertex around the polygon
- flatxref = FIXED_TO_FLOAT(polysector->origVerts[0].x);
- flatyref = FIXED_TO_FLOAT(polysector->origVerts[0].y);
-
- flatxref = (float)(((fixed_t)flatxref & (~flatflag)) / fflatwidth);
- flatyref = (float)(((fixed_t)flatyref & (~flatflag)) / fflatheight);
+ flatxref = 0.0;
+ flatyref = 0.0;
// transform
v3d = planeVerts;
@@ -2575,44 +2514,19 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
}
}
- if (angle) // Only needs to be done if there's an altered angle
- {
- angle = (InvAngle(angle))>>ANGLETOFINESHIFT;
-
- // This needs to be done so that it scrolls in a different direction after rotation like software
- /*tempxs = FLOAT_TO_FIXED(scrollx);
- tempyt = FLOAT_TO_FIXED(scrolly);
- scrollx = (FIXED_TO_FLOAT(FixedMul(tempxs, FINECOSINE(angle)) - FixedMul(tempyt, FINESINE(angle))));
- scrolly = (FIXED_TO_FLOAT(FixedMul(tempxs, FINESINE(angle)) + FixedMul(tempyt, FINECOSINE(angle))));*/
-
- // This needs to be done so everything aligns after rotation
- // It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
- tempxs = FLOAT_TO_FIXED(flatxref);
- tempyt = FLOAT_TO_FIXED(flatyref);
- flatxref = (FIXED_TO_FLOAT(FixedMul(tempxs, FINECOSINE(angle)) - FixedMul(tempyt, FINESINE(angle))));
- flatyref = (FIXED_TO_FLOAT(FixedMul(tempxs, FINESINE(angle)) + FixedMul(tempyt, FINECOSINE(angle))));
- }
-
for (i = 0; i < (INT32)nrPlaneVerts; i++,v3d++)
{
// Go from the polysector's original vertex locations
// Means the flat is offset based on the original vertex locations
- if (texflat)
- {
- v3d->s = (float)(FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatwidth) + scrollx;
- v3d->t = -(float)(FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatheight) + scrolly;
- }
- else
- {
- v3d->s = (float)((FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatwidth) - flatxref + scrollx);
- v3d->t = (float)(flatyref - (FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatheight) + scrolly);
- }
+ v3d->s = (float)((FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatwidth) - flatxref + scrollx);
+ v3d->t = (float)(flatyref - (FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatheight) + scrolly);
// Need to rotate before translate
if (angle) // Only needs to be done if there's an altered angle
{
tempxs = FLOAT_TO_FIXED(v3d->s);
tempyt = FLOAT_TO_FIXED(v3d->t);
+ angle = ANG2RAD(InvAngle(angle));
v3d->s = (FIXED_TO_FLOAT(FixedMul(tempxs, FINECOSINE(angle)) - FixedMul(tempyt, FINESINE(angle))));
v3d->t = (FIXED_TO_FLOAT(FixedMul(tempxs, FINESINE(angle)) + FixedMul(tempyt, FINECOSINE(angle))));
}
diff --git a/src/info/sounds.h b/src/info/sounds.h
index f3e786126..25d8694aa 100644
--- a/src/info/sounds.h
+++ b/src/info/sounds.h
@@ -850,6 +850,9 @@ _(eggspr)
// Chaining Sound
_(bstchn)
+// Low Ring Sound
+_(ringlw)
+
// Shout message sound effect
_(sysmsg)
diff --git a/src/k_bot.cpp b/src/k_bot.cpp
index e04b2f6c7..2d531725f 100644
--- a/src/k_bot.cpp
+++ b/src/k_bot.cpp
@@ -1585,12 +1585,17 @@ static void K_BuildBotTiccmdNormal(player_t *player, ticcmd_t *cmd)
destangle = R_PointToAngle2(player->mo->x, player->mo->y, predict->x, predict->y);
turnamt = K_HandleBotTrack(player, cmd, predict, destangle);
}
- else if (leveltime <= starttime )
+ else if (leveltime <= starttime)
{
- if (leveltime >= starttime-TICRATE-TICRATE/7)
+ UINT8 timing = P_RandomRange(0, 5);
+ UINT8 finaltiming = (MAXBOTDIFFICULTY/2)-(player->botvars.difficulty/2)+timing;
+ if (player->botvars.difficulty > 4)
{
- cmd->buttons |= BT_ACCELERATE;
- cmd->forwardmove = MAXPLMOVE;
+ if (leveltime >= starttime-TICRATE-TICRATE/7+finaltiming)
+ {
+ cmd->buttons |= BT_ACCELERATE;
+ cmd->forwardmove = MAXPLMOVE;
+ }
}
}
else
diff --git a/src/k_kart.c b/src/k_kart.c
index fc5867070..fd4018fcb 100644
--- a/src/k_kart.c
+++ b/src/k_kart.c
@@ -3604,7 +3604,12 @@ static void K_GetKartBoostPower(player_t *player)
for (i = 0; i < numsneakers; i++)
{
- K_DoBoost(player, sneakerspeedboost, SNEAKERACCELBOOST, SNEAKERSTACKABLE, SNEAKERSTACKABLE); // + ???% top speed, + 800% acceleration
+ K_DoBoost(player, sneakerspeedboost, ACCELSTACK ? 0 : SNEAKERACCELBOOST, SNEAKERSTACKABLE, SNEAKERSTACKABLE); // + ???% top speed, + 800% acceleration
+ }
+
+ if (ACCELSTACK)
+ {
+ K_DoBoost(player, 0, SNEAKERACCELBOOST, true, false); // + 800% acceleration
}
}
@@ -8780,7 +8785,7 @@ void K_SetRespawnAtNextWaypoint(player_t * player)
oopisepoint = K_GetClosestWaypointToMobj(player->mo);
}
- if (oopisepoint->numnextwaypoints > 0)
+ if (oopisepoint && oopisepoint->numnextwaypoints > 0)
{
for (i = 0; i < oopisepoint->numnextwaypoints; i++)
{
@@ -8824,10 +8829,14 @@ void K_SetRespawnAtNextWaypoint(player_t * player)
safewaypoint = oopisepoint->nextwaypoints[i];
break;
}
- oopisepoint = safewaypoint;
+
+ if (safewaypoint)
+ {
+ oopisepoint = safewaypoint;
+ }
}
- if (oopisepoint->numprevwaypoints > 0)
+ if (oopisepoint && oopisepoint->numprevwaypoints > 0)
{
for (i = 0; i < oopisepoint->numprevwaypoints; i++)
{
@@ -8860,7 +8869,6 @@ void K_SetRespawnAtNextWaypoint(player_t * player)
}
}
-
CONS_Debug(DBG_GAMELOGIC, M_GetText("Tried to respawn at invalid waypoint! Setting respawn to closest waypoint\n"));
}
else
@@ -10884,7 +10892,7 @@ void K_CheckSpectateStatus(boolean considermapreset)
return;
// Organize by spectate wait timer (if there's more than one to sort)
- if (cv_maxplayers.value && numjoiners > 1)
+ if (cv_ingamecap.value && numjoiners > 1)
{
UINT8 oldrespawnlist[MAXPLAYERS];
memcpy(oldrespawnlist, respawnlist, numjoiners);
@@ -10915,7 +10923,7 @@ void K_CheckSpectateStatus(boolean considermapreset)
for (i = 0; i < numjoiners; i++)
{
// Hit the in-game player cap while adding people?
- if (cv_maxplayers.value && numingame >= cv_maxplayers.value)
+ if (cv_ingamecap.value && numingame >= cv_ingamecap.value)
{
if (numbots > 0)
{
diff --git a/src/k_kart.h b/src/k_kart.h
index 59e001bdd..f1a839a03 100644
--- a/src/k_kart.h
+++ b/src/k_kart.h
@@ -43,6 +43,7 @@ Make sure this matches the actual number of states
#define MAXVANILLABOOST K_RAGuard(cv_kartstacking_maxvanillaboost)
#define SPEEDBOOSTDROPOFF K_RAGuard(cv_kartstacking_speedboostdropoff)
#define SPEEDBOOSTDROPOFF_BRAKE K_RAGuard(cv_kartstacking_speedboostdropoff_brake)
+#define ACCELSTACK K_RAGuard(cv_kartstacking_accelstack)
// Vanilla Boosts
#define EASYSNEAKERSPEEDBOOST K_RAGuard(cv_kartstacking_sneaker_easyspeedboost)
diff --git a/src/p_enemy.c b/src/p_enemy.c
index d45b3fbb6..8dd71470d 100644
--- a/src/p_enemy.c
+++ b/src/p_enemy.c
@@ -3174,6 +3174,11 @@ void A_AttractChase(mobj_t *actor)
actor->target->player->ringboost += K_GetKartRingPower(actor->target->player, true) + 3;
S_StartSoundAtVolume(actor->target, sfx_s1b5, actor->target->player->ringvolume);
+ if (actor->target->player->rings <= 10)
+ {
+ S_StartSoundAtVolume(actor->target, sfx_ringlw, 255 - actor->target->player->rings*10);
+ }
+
if (actor->target->player->ringboost > (4*TICRATE + TICRATE/2))
actor->target->player->ringboost = (4*TICRATE + TICRATE/2);
diff --git a/src/p_inter.c b/src/p_inter.c
index 5a816d52f..83eb50777 100644
--- a/src/p_inter.c
+++ b/src/p_inter.c
@@ -2158,7 +2158,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (player->exiting)
{
- K_DoInstashield(player);
+ if (inflictor)
+ K_DoInstashield(player);
return false;
}
diff --git a/src/p_mobj.c b/src/p_mobj.c
index cba5d3d58..0e1d1273c 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -3558,7 +3558,7 @@ void P_DestroyRobots(void)
// the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person
void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
{
- const boolean flipcam = (player->pflags & PF_FLIPCAM && player->mo->eflags & MFE_VERTICALFLIP);
+ const boolean flipcam = ((player->pflags & PF_FLIPCAM) && (player->mo->eflags & MFE_VERTICALFLIP));
UINT8 postimgtype = 0;
// This can happen when joining
diff --git a/src/p_saveg.c b/src/p_saveg.c
index 5a739562b..7dcb868d3 100644
--- a/src/p_saveg.c
+++ b/src/p_saveg.c
@@ -3968,6 +3968,7 @@ static thinker_t* LoadThwompThinker(savebuffer_t *save, actionf_p1 thinker)
ht->delay = READINT32(save->p);
ht->tag = READINT16(save->p);
ht->sound = READUINT16(save->p);
+ ht->initDelay = READINT32(save->p);
if (ht->sector)
{
diff --git a/src/p_setup.c b/src/p_setup.c
index 7585be750..234f8460d 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -532,20 +532,14 @@ levelflat_t *foundflats;
//SoM: Other files want this info.
size_t P_PrecacheLevelFlats(void)
{
- lumpnum_t lump;
size_t i;
//SoM: 4/18/2000: New flat code to make use of levelflats.
flatmemory = 0;
for (i = 0; i < numlevelflats; i++)
{
- if (levelflats[i].type == LEVELFLAT_FLAT)
- {
- lump = levelflats[i].u.flat.lumpnum;
- if (devparm)
- flatmemory += W_LumpLength(lump);
- R_GetFlat(lump);
- }
+ if (levelflats[i].type != LEVELFLAT_NONE)
+ R_GetFlat(&levelflats[i]);
}
return flatmemory;
}
@@ -557,18 +551,8 @@ or NULL if we want to allocate it now.
static INT32
Ploadflat (levelflat_t *levelflat, const char *flatname, boolean resize)
{
-#ifndef NO_PNG_LUMPS
- UINT8 buffer[8];
-#endif
-
- lumpnum_t flatnum;
- int texturenum;
- UINT8 *flatpatch;
- size_t lumplength;
- size_t i;
-
// Scan through the already found flats, return if it matches.
- for (i = 0; i < numlevelflats; i++)
+ for (size_t i = 0; i < numlevelflats; i++)
{
if (strnicmp(levelflat[i].name, flatname, 8) == 0)
return i;
@@ -592,65 +576,38 @@ Ploadflat (levelflat_t *levelflat, const char *flatname, boolean resize)
strlcpy(levelflat->name, flatname, sizeof (levelflat->name));
strupr(levelflat->name);
- /* If we can't find a flat, try looking for a texture! */
- if (( flatnum = R_GetFlatNumForName(levelflat->name) ) == LUMPERROR)
- {
- if (( texturenum = R_CheckTextureNumForName(levelflat->name) ) == -1)
- {
- // check for REDWALL
- if (( texturenum = R_CheckTextureNumForName(MISSING_TEXTURE) ) != -1)
- goto texturefound;
- // check for REDFLR
- else if (( flatnum = R_GetFlatNumForName(MISSING_TEXTURE) ) != LUMPERROR)
- goto flatfound;
- // nevermind
- levelflat->type = LEVELFLAT_NONE;
- }
- else
- {
-texturefound:
- levelflat->type = LEVELFLAT_TEXTURE;
- levelflat->u.texture. num = texturenum;
- levelflat->u.texture.lastnum = texturenum;
- /* start out unanimated */
- levelflat->u.texture.basenum = -1;
- }
- }
- else
- {
-flatfound:
- /* This could be a flat, patch, or PNG. */
- flatpatch = W_CacheLumpNum(flatnum, PU_CACHE);
- lumplength = W_LumpLength(flatnum);
- if (Picture_CheckIfDoomPatch((softwarepatch_t *)flatpatch, lumplength))
- levelflat->type = LEVELFLAT_PATCH;
- else
- {
-#ifndef NO_PNG_LUMPS
- /*
- Only need eight bytes for PNG headers.
- FIXME: Put this elsewhere.
- */
- W_ReadLumpHeader(flatnum, buffer, 8, 0);
- if (Picture_IsLumpPNG(buffer, lumplength))
- levelflat->type = LEVELFLAT_PNG;
- else
-#endif/*NO_PNG_LUMPS*/
- levelflat->type = LEVELFLAT_FLAT;/* phew */
- }
- if (flatpatch)
- Z_Free(flatpatch);
+ levelflat->type = LEVELFLAT_TEXTURE;
- levelflat->u.flat. lumpnum = flatnum;
- levelflat->u.flat.baselumpnum = LUMPERROR;
+ // Look for a flat
+ int texturenum = R_CheckFlatNumForName(levelflat->name);
+ if (texturenum <= 0)
+ {
+ // If we can't find a flat, try looking for a texture!
+ texturenum = R_CheckTextureNumForName(levelflat->name);
+ if (texturenum <= 0)
+ {
+ // Use "not found" texture
+ texturenum = R_CheckTextureNumForName(MISSING_TEXTURE);
+
+ // Give up?
+ if (texturenum <= 0)
+ {
+ levelflat->type = LEVELFLAT_NONE;
+ texturenum = -1;
+ }
+ }
}
+ levelflat->texture_id = texturenum;
+
levelflat->terrain =
K_GetTerrainForTextureName(levelflat->name);
+#ifndef ZDEBUG
CONS_Debug(DBG_SETUP, "flat #%03d: %s\n", atoi(sizeu1(numlevelflats)), levelflat->name);
+#endif
- return ( numlevelflats++ );
+ return numlevelflats++;
}
// Auxiliary function. Find a flat in the active wad files,
@@ -3784,9 +3741,6 @@ static boolean P_LoadMapData(const virtres_t *virt)
levelflats = M_Memcpy(Z_Calloc(numlevelflats * sizeof (*levelflats), PU_LEVEL, NULL), foundflats, numlevelflats * sizeof (levelflat_t));
free(foundflats);
- // search for animated flats and set up
- P_SetupLevelFlatAnims();
-
TracyCZoneEnd(__zone);
return true;
}
@@ -7272,7 +7226,7 @@ static void P_ConvertBinaryThingTypes(void)
if (mapthings[i].options & MTF_EXTRA)
mapthings[i].args[2] |= TMSF_RETRACTED;
}
- if (mapthings[i].options & MTF_AMBUSH)
+ if (!(mapthings[i].options & MTF_AMBUSH))
mapthings[i].args[2] |= TMSF_INTANGIBLE;
break;
case 523: //Spike
@@ -7283,7 +7237,7 @@ static void P_ConvertBinaryThingTypes(void)
if (mapthings[i].options & MTF_EXTRA)
mapthings[i].args[2] |= TMSF_RETRACTED;
}
- if (mapthings[i].options & MTF_AMBUSH)
+ if (!(mapthings[i].options & MTF_AMBUSH))
mapthings[i].args[2] |= TMSF_INTANGIBLE;
break;
case 540: //Fan
diff --git a/src/p_setup.h b/src/p_setup.h
index 3b1f5ae29..c7c438d3d 100644
--- a/src/p_setup.h
+++ b/src/p_setup.h
@@ -54,9 +54,6 @@ extern mapnamespace_t mapnamespace;
enum
{
LEVELFLAT_NONE,/* HOM time my friend */
- LEVELFLAT_FLAT,
- LEVELFLAT_PATCH,
- LEVELFLAT_PNG,
LEVELFLAT_TEXTURE,
};
@@ -66,43 +63,9 @@ enum
struct levelflat_t
{
char name[9]; // resource name from wad
-
- UINT8 type;
- union
- {
- struct
- {
- lumpnum_t lumpnum; // lump number of the flat
- // for flat animation
- lumpnum_t baselumpnum;
- }
- flat;
- struct
- {
- INT32 num;
- INT32 lastnum; // texture number of the flat
- // for flat animation
- INT32 basenum;
- }
- texture;
- }
- u;
-
- UINT16 width, height;
-
terrain_t *terrain;
-
- // for flat animation
- INT32 animseq; // start pos. in the anim sequence
- INT32 numpics;
- INT32 speed;
-
- // for textures
- UINT8 *picture;
-#ifdef HWRENDER
- void *mipmap;
- void *mippic;
-#endif
+ UINT8 type;
+ INT32 texture_id;
};
extern size_t numlevelflats;
diff --git a/src/p_spec.c b/src/p_spec.c
index 564bd5d61..c993fa684 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -66,17 +66,12 @@ mobj_t *skyboxcenterpnts[16]; // array of MT_SKYBOX centerpoint mobjs
*/
typedef struct
{
- SINT8 istexture; ///< ::true for a texture, ::false for a flat
INT32 picnum; ///< The end flat number
INT32 basepic; ///< The start flat number
INT32 numpics; ///< Number of frames in the animation
tic_t speed; ///< Number of tics for which each frame is shown
} anim_t;
-#if defined(_MSC_VER)
-#pragma pack(1)
-#endif
-
/** Animated texture definition.
* Used for loading an ANIMDEFS lump from a wad.
*
@@ -91,13 +86,9 @@ typedef struct
SINT8 istexture; ///< True for a texture, false for a flat.
char endname[9]; ///< Name of the last frame, null-terminated.
char startname[9]; ///< Name of the first frame, null-terminated.
- INT32 speed ; ///< Number of tics for which each frame is shown.
+ INT32 speed; ///< Number of tics for which each frame is shown.
} ATTRPACK animdef_t;
-#if defined(_MSC_VER)
-#pragma pack()
-#endif
-
typedef struct
{
UINT32 count;
@@ -142,16 +133,31 @@ static size_t maxanims;
static animdef_t *animdefs = NULL;
-// Increase the size of animdefs to make room for a new animation definition
-static void GrowAnimDefs(void)
-{
- maxanims++;
- animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
-}
-
// A prototype; here instead of p_spec.h, so they're "private"
void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum);
-void P_ParseAnimationDefintion(SINT8 istexture);
+void P_ParseAnimationDefintion(SINT8 istexture, boolean compat);
+
+static boolean P_FindTextureForAnimation(anim_t *anim, animdef_t *animdef)
+{
+ if (R_CheckTextureNumForName(animdef->startname) == -1)
+ return false;
+
+ anim->picnum = R_TextureNumForName(animdef->endname);
+ anim->basepic = R_TextureNumForName(animdef->startname);
+
+ return true;
+}
+
+static boolean P_FindFlatForAnimation(anim_t *anim, animdef_t *animdef)
+{
+ if (R_CheckFlatNumForName(animdef->startname) == -1)
+ return false;
+
+ anim->picnum = R_CheckFlatNumForName(animdef->endname);
+ anim->basepic = R_CheckFlatNumForName(animdef->startname);
+
+ return true;
+}
/** Sets up texture and flat animations.
*
@@ -207,37 +213,38 @@ void P_InitPicAnims(void)
lastanim = anims;
for (i = 0; animdefs[i].istexture != -1; i++)
{
- if (animdefs[i].istexture == 1)
- {
- if (R_CheckTextureNumForName(animdefs[i].startname) == -1)
- continue;
+ animdef_t *animdef = &animdefs[i];
- lastanim->picnum = R_TextureNumForName(animdefs[i].endname);
- lastanim->basepic = R_TextureNumForName(animdefs[i].startname);
+ // If this animation is for a texture, look for one first, THEN look for a flat
+ if (animdefs[i].istexture)
+ {
+ if (!P_FindTextureForAnimation(lastanim, animdef))
+ {
+ if (!P_FindFlatForAnimation(lastanim, animdef))
+ continue;
+ }
}
else
{
- if ((W_CheckNumForName(animdefs[i].startname)) == LUMPERROR)
- continue;
-
- lastanim->picnum = R_GetFlatNumForName(animdefs[i].endname);
- lastanim->basepic = R_GetFlatNumForName(animdefs[i].startname);
+ if (!P_FindFlatForAnimation(lastanim, animdef))
+ {
+ if (!P_FindTextureForAnimation(lastanim, animdef))
+ continue;
+ }
}
- lastanim->istexture = animdefs[i].istexture;
lastanim->numpics = lastanim->picnum - lastanim->basepic + 1;
if (lastanim->numpics < 2)
{
free(anims);
I_Error("P_InitPicAnims: bad cycle from %s to %s",
- animdefs[i].startname, animdefs[i].endname);
+ animdef->startname, animdef->endname);
}
- lastanim->speed = LONG(animdefs[i].speed);
+ lastanim->speed = animdef->speed;
lastanim++;
}
- lastanim->istexture = -1;
R_ClearTextureNumCache(false);
// Clear animdefs now that we're done with it.
@@ -253,6 +260,7 @@ void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum)
char *animdefsText;
char *animdefsToken;
char *p;
+ boolean compat = wadfiles[wadNum]->compatmode;
// Since lumps AREN'T \0-terminated like I'd assumed they should be, I'll
// need to make a space of memory where I can ensure that it will terminate
@@ -279,12 +287,12 @@ void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum)
if (stricmp(animdefsToken, "TEXTURE") == 0)
{
Z_Free(animdefsToken);
- P_ParseAnimationDefintion(1);
+ P_ParseAnimationDefintion(1, compat);
}
else if (stricmp(animdefsToken, "FLAT") == 0)
{
Z_Free(animdefsToken);
- P_ParseAnimationDefintion(0);
+ P_ParseAnimationDefintion(0, compat);
}
else if (stricmp(animdefsToken, "OSCILLATE") == 0)
{
@@ -304,7 +312,7 @@ void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum)
Z_Free((void *)animdefsText);
}
-void P_ParseAnimationDefintion(SINT8 istexture)
+void P_ParseAnimationDefintion(SINT8 istexture, boolean compat)
{
char *animdefsToken;
size_t animdefsTokenLength;
@@ -347,7 +355,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
// Search for existing animdef
for (i = 0; i < maxanims; i++)
- if (animdefs[i].istexture == istexture // Check if it's the same type!
+ if ((compat || animdefs[i].istexture == istexture) // Check if it's the same type!
&& stricmp(animdefsToken, animdefs[i].startname) == 0)
{
//CONS_Alert(CONS_NOTICE, "Duplicate animation: %s\n", animdefsToken);
@@ -362,7 +370,8 @@ void P_ParseAnimationDefintion(SINT8 istexture)
if (i == maxanims)
{
// Increase the size to make room for the new animation definition
- GrowAnimDefs();
+ maxanims++;
+ animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
strncpy(animdefs[i].startname, animdefsToken, 9);
}
@@ -448,83 +457,6 @@ void P_ParseAnimationDefintion(SINT8 istexture)
}
animdefs[i].speed = animSpeed;
Z_Free(animdefsToken);
-
-#ifdef WALLFLATS
- // hehe... uhh.....
- if (!istexture)
- {
- GrowAnimDefs();
- M_Memcpy(&animdefs[maxanims-1], &animdefs[i], sizeof(animdef_t));
- animdefs[maxanims-1].istexture = 1;
- }
-#endif
-}
-
-/** Checks for flats in levelflats that are part of a flat animation sequence
- * and sets them up for animation.
- *
- * \param animnum Index into ::anims to find flats for.
- * \sa P_SetupLevelFlatAnims
- */
-static inline void P_FindAnimatedFlat(INT32 animnum)
-{
- size_t i;
- lumpnum_t startflatnum, endflatnum;
- levelflat_t *foundflats;
-
- foundflats = levelflats;
- startflatnum = anims[animnum].basepic;
- endflatnum = anims[animnum].picnum;
-
- // note: high word of lumpnum is the wad number
- if ((startflatnum>>16) != (endflatnum>>16))
- I_Error("AnimatedFlat start %s not in same wad as end %s\n",
- animdefs[animnum].startname, animdefs[animnum].endname);
-
- //
- // now search through the levelflats if this anim flat sequence is used
- //
- for (i = 0; i < numlevelflats; i++, foundflats++)
- {
- // is that levelflat from the flat anim sequence ?
- if ((anims[animnum].istexture) && (foundflats->type == LEVELFLAT_TEXTURE)
- && ((UINT16)foundflats->u.texture.num >= startflatnum && (UINT16)foundflats->u.texture.num <= endflatnum))
- {
- foundflats->u.texture.basenum = startflatnum;
- foundflats->animseq = foundflats->u.texture.num - startflatnum;
- foundflats->numpics = endflatnum - startflatnum + 1;
- foundflats->speed = anims[animnum].speed;
-
- CONS_Debug(DBG_SETUP, "animflat: #%03d name:%.8s animseq:%d numpics:%d speed:%d\n",
- atoi(sizeu1(i)), foundflats->name, foundflats->animseq,
- foundflats->numpics,foundflats->speed);
- }
- else if ((!anims[animnum].istexture) && (foundflats->type == LEVELFLAT_FLAT)
- && (foundflats->u.flat.lumpnum >= startflatnum && foundflats->u.flat.lumpnum <= endflatnum))
- {
- foundflats->u.flat.baselumpnum = startflatnum;
- foundflats->animseq = foundflats->u.flat.lumpnum - startflatnum;
- foundflats->numpics = endflatnum - startflatnum + 1;
- foundflats->speed = anims[animnum].speed;
-
- CONS_Debug(DBG_SETUP, "animflat: #%03d name:%.8s animseq:%d numpics:%d speed:%d\n",
- atoi(sizeu1(i)), foundflats->name, foundflats->animseq,
- foundflats->numpics,foundflats->speed);
- }
- }
-}
-
-/** Sets up all flats used in a level.
- *
- * \sa P_InitPicAnims, P_FindAnimatedFlat
- */
-void P_SetupLevelFlatAnims(void)
-{
- INT32 i;
-
- // the original game flat anim sequences
- for (i = 0; anims[i].istexture != -1; i++)
- P_FindAnimatedFlat(i);
}
//
@@ -2725,15 +2657,6 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
return false;
}
- if (mapnamespace == MNS_SRB2KART)
- {
- if (line->args[2] != TMP_CEILING)
- EV_DoFloor(line->args[1], line, moveFloorByFrontSector);
- if (line->args[2] != TMP_FLOOR)
- EV_DoCeiling(line->args[1], line, moveCeilingByFrontSector);
- break;
- }
-
copySector = line->frontsector;
}
else
@@ -5545,12 +5468,12 @@ static void P_EvaluateLinedefExecutorTrigger(player_t *player, sector_t *sector,
static void P_EvaluateOldSectorSpecial(player_t *player, sector_t *sector, sector_t *roversector, boolean isTouching)
{
- switch (GETSECSPECIAL(sector->special, 1))
+ /*switch (GETSECSPECIAL(sector->special, 1))
{
case 9: // Ring Drainer (Floor Touch)
if (!isTouching)
break;
- /* FALLTHRU */
+ // FALLTHRU
case 10: // Ring Drainer (No Floor Touch)
if (leveltime % (TICRATE/2) == 0 && player->rings > 0)
{
@@ -5558,7 +5481,7 @@ static void P_EvaluateOldSectorSpecial(player_t *player, sector_t *sector, secto
S_StartSound(player->mo, sfx_antiri);
}
break;
- }
+ }*/
switch (GETSECSPECIAL(sector->special, 2))
{
@@ -6164,13 +6087,6 @@ void P_CheckMobjTouchingSectorActions(mobj_t *mobj, boolean continuous, boolean
*/
void P_UpdateSpecials(void)
{
- anim_t *anim;
- INT32 i;
- INT32 pic;
- size_t j;
-
- levelflat_t *foundflats; // for flat animation
-
// LEVEL TIMER
P_CheckTimeLimit();
@@ -6178,37 +6094,18 @@ void P_UpdateSpecials(void)
P_CheckPointLimit();
// ANIMATE TEXTURES
- for (anim = anims; anim < lastanim; anim++)
+ for (anim_t *anim = anims; anim < lastanim; anim++)
{
- for (i = 0; i < anim->numpics; i++)
+ for (INT32 i = 0; i < anim->numpics; i++)
{
- pic = anim->basepic + ((leveltime/anim->speed + i) % anim->numpics);
- if (anim->istexture)
- texturetranslation[anim->basepic+i] = pic;
- }
- }
-
- // ANIMATE FLATS
- /// \todo do not check the non-animate flat.. link the animated ones?
- /// \note its faster than the original anywaysince it animates only
- /// flats used in the level, and there's usually very few of them
- foundflats = levelflats;
- for (j = 0; j < numlevelflats; j++, foundflats++)
- {
- if (foundflats->speed) // it is an animated flat
- {
- // update the levelflat texture number
- if ((foundflats->type == LEVELFLAT_TEXTURE) && (foundflats->u.texture.basenum != -1))
- foundflats->u.texture.num = foundflats->u.texture.basenum + ((leveltime/foundflats->speed + foundflats->animseq) % foundflats->numpics);
- // update the levelflat lump number
- else if ((foundflats->type == LEVELFLAT_FLAT) && (foundflats->u.flat.baselumpnum != LUMPERROR))
- foundflats->u.flat.lumpnum = foundflats->u.flat.baselumpnum + ((leveltime/foundflats->speed + foundflats->animseq) % foundflats->numpics);
+ INT32 pic = anim->basepic + ((leveltime/anim->speed + i) % anim->numpics);
+ texturetranslation[anim->basepic+i] = pic;
}
}
}
//
-// Floor over floors (FOFs), 3Dfloors, 3Dblocks, fake floors (ffloors), rovers, or whatever you want to call them
+// 3D floors
//
/** Gets the ID number for a 3Dfloor in its target sector.
diff --git a/src/p_spec.h b/src/p_spec.h
index 9b247ab7f..a3fba69ab 100644
--- a/src/p_spec.h
+++ b/src/p_spec.h
@@ -526,9 +526,6 @@ void P_StartQuake(fixed_t intensity, tic_t time);
// at game start
void P_InitPicAnims(void);
-// at map load (sectors)
-void P_SetupLevelFlatAnims(void);
-
// at map load
void P_InitSpecials(void);
void P_ApplyFlatAlignment(sector_t* sector, angle_t flatangle, fixed_t xoffs, fixed_t yoffs, boolean floor, boolean ceiling);
diff --git a/src/p_user.c b/src/p_user.c
index 886692000..cfdb53d23 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -1364,7 +1364,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean fromAir)
clipmomz = !(P_CheckDeathPitCollide(player->mo));
- if (player->prevonground == false && fromAir == true && clipmomz == true)
+ if (player->airtime > 10 && player->prevonground == false && fromAir == true && clipmomz == true)
{
K_SpawnSplashForMobj(player->mo, abs(player->mo->momz));
}
@@ -1616,6 +1616,17 @@ static void P_CheckBouncySectors(player_t *player)
if (abs(momentum.z) < (rover->bouncestrength*2))
goto bouncydone;
+ if ((mapnamespace == MNS_SRB2KART) && !(rover->master->flags & ML_NOTBOUNCY))
+ {
+ if (momentum.z > 0)
+ {
+ if (momentum.z < 8*FRACUNIT)
+ momentum.z = 8*FRACUNIT;
+ }
+ else if (momentum.z > -8*FRACUNIT && momentum.z != 0)
+ momentum.z = -8*FRACUNIT;
+ }
+
if (momentum.z > FixedMul(24*FRACUNIT, player->mo->scale)) //half of the default player height
momentum.z = FixedMul(24*FRACUNIT, player->mo->scale);
else if (momentum.z < -FixedMul(24*FRACUNIT, player->mo->scale))
@@ -3372,9 +3383,7 @@ boolean P_SpectatorJoinGame(player_t *player)
static boolean P_CameraCheckHeatFirstperson(player_t *player, sector_t *sector, fixed_t pviewheight)
{
- mtag_t sectag = Tag_FGet(§or->tags);
-
- if (Tag_FindLineSpecial(13, sectag))
+ if (sector->flags & MSF_HEATWAVE)
return true;
if (sector->ffloors)
@@ -3388,13 +3397,10 @@ static boolean P_CameraCheckHeatFirstperson(player_t *player, sector_t *sector,
if (pviewheight >= P_GetFFloorTopZAt(rover, player->mo->x, player->mo->y))
continue;
-
if (pviewheight <= P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y))
continue;
- sectag = Tag_FGet(&rover->master->frontsector->tags);
-
- if (Tag_FindLineSpecial(13, sectag))
+ if (rover->master->frontsector->flags & MSF_HEATWAVE)
return true;
}
}
@@ -3415,7 +3421,6 @@ static boolean P_CameraCheckWaterFirstperson(player_t *player, sector_t *sector,
if (pviewheight >= P_GetFFloorTopZAt(rover, player->mo->x, player->mo->y))
continue;
-
if (pviewheight <= P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y))
continue;
@@ -3645,7 +3650,7 @@ Quaketilt (player_t *player)
delta = (INT32)(( moma + ANGLE_180 ) - player->mo->angle );
if (P_IsObjectOnGround(player->mo))
{
- if (sliptiding)
+ if (sliptiding && cv_sliptidetilt.value)
{
tilt = ANGLE_45;
lowb = 20*FRACUNIT;
@@ -3987,16 +3992,21 @@ void P_PlayerThink(player_t *player)
if (netgame && cv_antigrief.value != 0 && (gametyperules & GTR_CIRCUIT))
{
- if (!player->spectator && !player->exiting && !(player->pflags & PF_NOCONTEST))
+ INT32 i;
+ for (i = 0; i < MAXPLAYERS; i++)
+ {
+ if (!playeringame[i] || players[i].spectator)
+ continue;
+ if (&players[i] == player)
+ continue;
+ break;
+ }
+
+ if (i < MAXPLAYERS && !player->spectator && !player->exiting && !(player->pflags & PF_NOCONTEST))
{
const tic_t griefval = cv_antigrief.value * TICRATE;
const UINT8 n = player - players;
- if (n != serverplayer
-#ifndef DEVELOP
- && !IsPlayerAdmin(n)
-#endif
- )
{
if (player->grieftime > griefval)
{
@@ -4005,7 +4015,11 @@ void P_PlayerThink(player_t *player)
if (server)
{
- if (player->griefstrikes > 2)
+ if ((player->griefstrikes > 2)
+#ifndef DEVELOP
+ && !IsPlayerAdmin(n)
+#endif
+ && !P_IsLocalPlayer(player)) // P_IsMachineLocalPlayer for DRRR
{
// Send kick
SendKick(n, KICK_MSG_GRIEF);
diff --git a/src/r_main.cpp b/src/r_main.cpp
index 77191978b..7cc6c7d83 100644
--- a/src/r_main.cpp
+++ b/src/r_main.cpp
@@ -196,6 +196,8 @@ consvar_t cv_renderstats = CVAR_INIT ("renderstats", "Off", 0, CV_OnOff, NULL);
consvar_t cv_sloperoll = CVAR_INIT ("spritesloperoll", "On", CV_SAVE, CV_OnOff, NULL);
+consvar_t cv_sliptidetilt = CVAR_INIT ("sliptidetilt", "On", CV_SAVE, CV_OnOff, NULL);
+
void SplitScreen_OnChange(void)
{
UINT8 i;
@@ -1836,6 +1838,7 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_tilting);
CV_RegisterVar(&cv_actionmovie);
CV_RegisterVar(&cv_sloperoll);
+ CV_RegisterVar(&cv_sliptidetilt);
CV_RegisterVar(&cv_showhud);
CV_RegisterVar(&cv_translucenthud);
diff --git a/src/r_main.h b/src/r_main.h
index b5c4e0968..aea3e6550 100644
--- a/src/r_main.h
+++ b/src/r_main.h
@@ -159,6 +159,7 @@ extern consvar_t cv_tailspickup;
extern consvar_t cv_debugfinishline;
extern consvar_t cv_sloperoll;
+extern consvar_t cv_sliptidetilt;
// debugging
diff --git a/src/r_patchrotation.c b/src/r_patchrotation.c
index 2bb1c1a58..7b88d792b 100644
--- a/src/r_patchrotation.c
+++ b/src/r_patchrotation.c
@@ -62,7 +62,7 @@ static angle_t R_PlayerSpriteRotation(player_t *player, player_t *viewPlayer)
angle_t rollAngle = 0;
- if (sliptideLift)
+ if (sliptideLift && cv_sliptidetilt.value)
{
/* (from side) tilt downward if turning
toward camera, upward if away. */
diff --git a/src/r_picformats.c b/src/r_picformats.c
index c382bcbc0..db33c33d6 100644
--- a/src/r_picformats.c
+++ b/src/r_picformats.c
@@ -764,7 +764,7 @@ void *Picture_TextureToFlat(size_t trickytex)
R_CheckTextureCache(tex);
// Allocate the flat
- flatsize = (texture->width * texture->height);
+ flatsize = texture->width * texture->height;
converted = Z_Malloc(flatsize, PU_STATIC, NULL);
memset(converted, TRANSPARENTPIXEL, flatsize);
diff --git a/src/r_plane.cpp b/src/r_plane.cpp
index 87a4fd308..cc9088256 100644
--- a/src/r_plane.cpp
+++ b/src/r_plane.cpp
@@ -1118,39 +1118,31 @@ void R_DrawSinglePlane(drawspandata_t *ds, visplane_t *pl, boolean allow_paralle
ds->currentplane = pl;
levelflat = &levelflats[pl->picnum];
- /* :james: */
- type = levelflat->type;
- switch (type)
- {
- case LEVELFLAT_NONE:
- return;
- case LEVELFLAT_FLAT:
- ds->source = (UINT8 *)R_GetFlat(levelflat->u.flat.lumpnum);
- R_CheckFlatLength(ds, W_LumpLength(levelflat->u.flat.lumpnum));
- // Raw flats always have dimensions that are powers-of-two numbers.
- ds->powersoftwo = true;
- break;
- default:
- ds->source = (UINT8 *)R_GetLevelFlat(ds, levelflat);
- if (!ds->source)
- return;
- // Check if this texture or patch has power-of-two dimensions.
- if (R_CheckPowersOfTwo(ds))
- R_CheckFlatLength(ds, ds->flatwidth * ds->flatheight);
- }
+ // Get the texture
+ ds->source = (UINT8 *)R_GetFlat(levelflat);
+ if (ds->source == NULL)
+ return;
- if (type == LEVELFLAT_TEXTURE)
+ texture_t *texture = textures[R_GetTextureNumForFlat(levelflat)];
+ ds->flatwidth = texture->width;
+ ds->flatheight = texture->height;
+
+ /*(if (R_CheckSolidColorFlat())
+ ds->solidcolor = true;
+ else if (R_CheckPowersOfTwo())
{
- // Get the span's brightmap.
- // FLATS not supported, SORRY!!
- INT32 bmNum = R_GetTextureBrightmap(levelflat->u.texture.num);
- if (bmNum != 0)
- {
- // FIXME: This has the potential to read out of
- // bounds if the brightmap texture is not as
- // large as the flat.
- ds->brightmap = (UINT8 *)R_GenerateTextureAsFlat(bmNum);
- }
+ R_SetFlatVars(ds_flatwidth * ds_flatheight);
+ ds->powersoftwo = true;
+ }*/
+
+ // Get the span's brightmap.
+ INT32 bmNum = R_GetTextureBrightmap(levelflat->texture_id);
+ if (bmNum != 0)
+ {
+ // FIXME: This has the potential to read out of
+ // bounds if the brightmap texture is not as
+ // large as the flat.
+ ds->brightmap = (UINT8 *)R_GetFlatForTexture(bmNum);
}
if (!pl->slope // Don't mess with angle on slopes! We'll handle this ourselves later
diff --git a/src/r_textures.c b/src/r_textures.c
index 7232216d9..d8c57b49d 100644
--- a/src/r_textures.c
+++ b/src/r_textures.c
@@ -66,6 +66,7 @@ static struct {
char name[9];
UINT32 hash;
INT32 id;
+ UINT8 type;
} *tidcache = NULL;
static INT32 tidcachelen = 0;
@@ -361,7 +362,8 @@ UINT8 *R_GenerateTexture(size_t texnum)
texture = textures[texnum];
I_Assert(texture != NULL);
- // allocate texture column offset lookup
+ if (texture->type == TEXTURETYPE_FLAT)
+ goto multipatch;
// single-patch textures can have holes in them and may be used on
// 2sided lines so they need to be kept in 'packed' format
@@ -390,11 +392,8 @@ UINT8 *R_GenerateTexture(size_t texnum)
realpatch = (softwarepatch_t *)pdata;
#ifndef NO_PNG_LUMPS
- if (Picture_IsLumpPNG((UINT8 *)realpatch, lumplength))
- goto multipatch;
-#endif
-#ifdef WALLFLATS
- if (texture->type == TEXTURETYPE_FLAT)
+ // TODO: Is it worth converting those?
+ if (Picture_IsLumpPNG(pdata, lumplength))
goto multipatch;
#endif
@@ -495,7 +494,6 @@ UINT8 *R_GenerateTexture(size_t texnum)
realpatch = (softwarepatch_t *)Picture_PNGConvert((UINT8 *)realpatch, PICFMT_DOOMPATCH, NULL, NULL, NULL, NULL, lumplength, NULL, 0);
else
#endif
-#ifdef WALLFLATS
if (texture->type == TEXTURETYPE_FLAT)
{
if (doremap)
@@ -503,7 +501,6 @@ UINT8 *R_GenerateTexture(size_t texnum)
realpatch = (softwarepatch_t *)Picture_Convert(PICFMT_FLAT, pdata, PICFMT_DOOMPATCH, 0, NULL, texture->width, texture->height, 0, 0, 0);
}
else
-#endif
{
dealloc = false;
if (doremap)
@@ -562,28 +559,46 @@ done:
return blocktex;
}
-//
-// R_GenerateTextureAsFlat
-//
-// Generates a flat picture for a texture.
-//
-UINT8 *R_GenerateTextureAsFlat(size_t texnum)
+UINT8 *R_GetFlatForTexture(size_t texnum)
{
+ if (texnum >= (unsigned)numtextures)
+ return NULL;
+
texture_t *texture = textures[texnum];
- UINT8 *converted = NULL;
- size_t size = (texture->width * texture->height);
+ if (texture->flat != NULL)
+ return texture->flat;
- // The flat picture for this texture was not generated yet.
- if (!texture->flat)
+ // Special case: Textures that are flats don't need to be converted FROM a texture INTO a flat.
+ if (texture->type == TEXTURETYPE_FLAT)
{
- // Well, let's do it now, then.
- Z_Malloc(size, PU_LEVEL, &texture->flat);
+ texpatch_t *patch = &texture->patches[0];
+ UINT16 wadnum = patch->wad;
+ lumpnum_t lumpnum = patch->lump;
+ boolean doremap = W_NeedPaletteRemapPwad(wadnum, lumpnum, false);
+ UINT8 *pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
+ size_t lumplength = W_LumpLengthPwad(wadnum, lumpnum);
- // Picture_TextureToFlat handles everything for us.
- converted = (UINT8 *)Picture_TextureToFlat(texnum);
- M_Memcpy(texture->flat, converted, size);
- Z_Free(converted);
+#ifndef NO_PNG_LUMPS
+ if (Picture_IsLumpPNG(pdata, lumplength))
+ texture->flat = Picture_PNGConvert(pdata, PICFMT_FLAT, NULL, NULL, NULL, NULL, lumplength, NULL, 0);
+ else
+#endif
+ {
+ texture->flat = Z_Malloc(lumplength, PU_STATIC, NULL);
+ memcpy(texture->flat, pdata, lumplength);
+ }
+
+ if (doremap)
+ R_DoPaletteRemapFlat(texture->flat, lumplength);
+
+ Z_SetUser(texture->flat, &texture->flat);
+
+ Z_Free(pdata);
}
+ else
+ texture->flat = (UINT8 *)Picture_TextureToFlat(texnum);
+
+ flatmemory += texture->width * texture->height;
return texture->flat;
}
@@ -935,96 +950,17 @@ UINT8 *R_GetBrightmapColumn(fixed_t tex, INT32 col)
return texturebrightmapcache[tex] + LONG(texturecolumnofs[tex][wrap_column(tex, col)]);
}
-void *R_GetFlat(lumpnum_t flatlumpnum)
+INT32 R_GetTextureNumForFlat(levelflat_t *levelflat)
{
- // FIXME: checking this every time a flat is fetched for drawing is stupid...
- // sadly they are not cached anywhere else so i have no choice
- boolean doremap = W_NeedPaletteRemap(flatlumpnum, false);
- void *flat = W_CacheLumpNum(flatlumpnum, PU_LEVEL);
- if (doremap)
- R_DoPaletteRemapFlat(flat, W_LumpLength(flatlumpnum));
- return flat;
+ return texturetranslation[levelflat->texture_id];
}
-//
-// R_GetLevelFlat
-//
-// If needed, convert a texture or patch to a flat.
-//
-void *R_GetLevelFlat(drawspandata_t* ds, levelflat_t *levelflat)
+void *R_GetFlat(levelflat_t *levelflat)
{
- boolean isleveltexture = (levelflat->type == LEVELFLAT_TEXTURE);
- texture_t *texture = (isleveltexture ? textures[levelflat->u.texture.num] : NULL);
- boolean texturechanged = (isleveltexture ? (levelflat->u.texture.num != levelflat->u.texture.lastnum) : false);
- UINT8 *flatdata = NULL;
+ if (levelflat->type == LEVELFLAT_NONE)
+ return NULL;
- // Check if the texture changed.
- if (isleveltexture && (!texturechanged))
- {
- if (texture->flat)
- {
- flatdata = texture->flat;
- ds->flatwidth = texture->width;
- ds->flatheight = texture->height;
- texturechanged = false;
- }
- else
- texturechanged = true;
- }
-
- // If the texture changed, or the flat wasn't generated, convert.
- if (levelflat->picture == NULL || texturechanged)
- {
- // Level texture
- if (isleveltexture)
- {
- levelflat->picture = R_GenerateTextureAsFlat(levelflat->u.texture.num);
- ds->flatwidth = levelflat->width = texture->width;
- ds->flatheight = levelflat->height = texture->height;
- }
- else
- {
-#ifndef NO_PNG_LUMPS
- if (levelflat->type == LEVELFLAT_PNG)
- {
- INT32 pngwidth, pngheight;
-
- levelflat->picture = Picture_PNGConvert(W_CacheLumpNum(levelflat->u.flat.lumpnum, PU_LEVEL), PICFMT_FLAT, &pngwidth, &pngheight, NULL, NULL, W_LumpLength(levelflat->u.flat.lumpnum), NULL, 0);
- levelflat->width = (UINT16)pngwidth;
- levelflat->height = (UINT16)pngheight;
-
- ds->flatwidth = levelflat->width;
- ds->flatheight = levelflat->height;
- }
- else
-#endif
- if (levelflat->type == LEVELFLAT_PATCH)
- {
- UINT8 *converted;
- size_t size;
- softwarepatch_t *patch = W_CacheLumpNum(levelflat->u.flat.lumpnum, PU_LEVEL);
-
- levelflat->width = ds->flatwidth = SHORT(patch->width);
- levelflat->height = ds->flatheight = SHORT(patch->height);
-
- levelflat->picture = Z_Malloc(levelflat->width * levelflat->height, PU_LEVEL, NULL);
- converted = Picture_FlatConvert(PICFMT_DOOMPATCH, patch, PICFMT_FLAT, 0, &size, levelflat->width, levelflat->height, SHORT(patch->topoffset), SHORT(patch->leftoffset), 0);
- M_Memcpy(levelflat->picture, converted, size);
- Z_Free(converted);
- }
- }
- }
- else
- {
- ds->flatwidth = levelflat->width;
- ds->flatheight = levelflat->height;
- }
-
- levelflat->u.texture.lastnum = levelflat->u.texture.num;
-
- if (flatdata == NULL)
- flatdata = levelflat->picture;
- return flatdata;
+ return R_GetFlatForTexture(R_GetTextureNumForFlat(levelflat));
}
//
@@ -1171,14 +1107,16 @@ void R_FlushTextureCache(void)
if (numtextures)
for (i = 0; i < numtextures; i++)
+ {
+ Z_Free(textures[i]->flat);
Z_Free(texturecache[i]);
+ }
}
// Need these prototypes for later; defining them here instead of r_textures.h so they're "private"
int R_CountTexturesInTEXTURESLump(UINT16 wadNum, UINT16 lumpNum);
void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *index);
-#ifdef WALLFLATS
static INT32
Rloadflats (INT32 i, INT32 w)
{
@@ -1188,7 +1126,6 @@ Rloadflats (INT32 i, INT32 w)
texpatch_t *patch;
UINT8 header[PNG_HEADER_SIZE];
- // Yes
if (wadfiles[w]->type == RET_PK3)
{
texstart = W_CheckNumForFolderStartPK3("flats/", (UINT16)w, 0);
@@ -1207,8 +1144,6 @@ Rloadflats (INT32 i, INT32 w)
{
UINT16 wadnum = (UINT16)w;
lumpnum_t lumpnum = texstart + j;
- size_t lumplength;
- size_t flatsize = 0;
if (wadfiles[w]->type == RET_PK3)
{
@@ -1216,10 +1151,8 @@ Rloadflats (INT32 i, INT32 w)
continue; // If it is then SKIP IT
}
- W_ReadLumpHeaderPwad(wadnum, lumpnum, header, sizeof header, 0);
- lumplength = W_LumpLengthPwad(wadnum, lumpnum);
-
- flatsize = R_FlatDimensionsFromLumpSize(lumplength);
+ size_t lumplength = W_LumpLengthPwad(wadnum, lumpnum);
+ size_t flatsize = R_FlatDimensionsFromLumpSize(lumplength);
//CONS_Printf("\n\"%s\" is a flat, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),flatsize,flatsize);
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
@@ -1229,6 +1162,8 @@ Rloadflats (INT32 i, INT32 w)
texture->hash = quickncasehash(texture->name, 8);
#ifndef NO_PNG_LUMPS
+ W_ReadLumpHeaderPwad(wadnum, lumpnum, header, sizeof header, 0);
+
if (Picture_IsLumpPNG(header, lumplength))
{
UINT8 *flatlump = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE);
@@ -1264,7 +1199,6 @@ Rloadflats (INT32 i, INT32 w)
return i;
}
-#endif/*WALLFLATS*/
#define TX_START "TX_START"
#define TX_END "TX_END"
@@ -1424,9 +1358,7 @@ static INT32 R_CountTextures(UINT16 wadnum)
// This system will allocate memory for all duplicate/patched textures even if it never uses them,
// but the alternative is to spend a ton of time checking and re-checking all previous entries just to skip any potentially patched textures.
-#ifdef WALLFLATS
count += count_range("F_START", "F_END", "flats/", wadnum);
-#endif
// Count the textures from TEXTURES lumps
texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", wadnum, 0);
@@ -1508,9 +1440,7 @@ void R_UpdateTextureBrightmap(INT32 tx, INT32 bm)
static INT32 R_DefineTextures(INT32 i, UINT16 w)
{
-#ifdef WALLFLATS
i = Rloadflats(i, w);
-#endif
return Rloadtextures(i, w);
}
@@ -2044,56 +1974,6 @@ static void PaletteTextureHack(const char **name)
}
}
-// Search for flat name.
-lumpnum_t R_GetFlatNumForName(const char *name)
-{
- INT32 i;
- lumpnum_t lump;
- lumpnum_t start;
- lumpnum_t end;
-
- PaletteTextureHack(&name);
-
- // Scan wad files backwards so patched flats take preference.
- for (i = numwadfiles - 1; i >= 0; i--)
- {
- switch (wadfiles[i]->type)
- {
- case RET_WAD:
- if ((start = W_CheckNumForMarkerStartPwad("F_START", (UINT16)i, 0)) == INT16_MAX)
- {
- if ((start = W_CheckNumForMarkerStartPwad("FF_START", (UINT16)i, 0)) == INT16_MAX)
- continue;
- else if ((end = W_CheckNumForNamePwad("FF_END", (UINT16)i, start)) == INT16_MAX)
- continue;
- }
- else
- if ((end = W_CheckNumForNamePwad("F_END", (UINT16)i, start)) == INT16_MAX)
- continue;
- break;
- case RET_PK3:
- if ((start = W_CheckNumForFolderStartPK3("Flats/", i, 0)) == INT16_MAX)
- continue;
- if ((end = W_CheckNumForFolderEndPK3("Flats/", i, start)) == INT16_MAX)
- continue;
- break;
- default:
- continue;
- }
-
- // Now find lump with specified name in that range.
- lump = W_CheckNumForNamePwad(name, (UINT16)i, start);
- if (lump < end)
- {
- lump += (i<<16); // found it, in our constraints
- break;
- }
- lump = LUMPERROR;
- }
-
- return lump;
-}
-
void R_ClearTextureNumCache(boolean btell)
{
if (tidcache)
@@ -2104,6 +1984,20 @@ void R_ClearTextureNumCache(boolean btell)
tidcachelen = 0;
}
+static void AddTextureToCache(const char *name, UINT32 hash, INT32 id, UINT8 type)
+{
+ tidcachelen++;
+ Z_Realloc(tidcache, tidcachelen * sizeof(*tidcache), PU_STATIC, &tidcache);
+ strncpy(tidcache[tidcachelen-1].name, name, 8);
+ tidcache[tidcachelen-1].name[8] = '\0';
+#ifndef ZDEBUG
+ CONS_Debug(DBG_SETUP, "texture #%s: %s\n", sizeu1(tidcachelen), tidcache[tidcachelen-1].name);
+#endif
+ tidcache[tidcachelen-1].hash = hash;
+ tidcache[tidcachelen-1].id = id;
+ tidcache[tidcachelen-1].type = type;
+}
+
//
// R_CheckTextureNumForName
//
@@ -2126,18 +2020,10 @@ INT32 R_CheckTextureNumForName(const char *name)
if (tidcache[i].hash == hash && !strncasecmp(tidcache[i].name, name, 8))
return tidcache[i].id;
- // Need to parse the list backwards, so textures loaded more recently are used in lieu of ones loaded earlier
- //for (i = 0; i < numtextures; i++) <- old
- for (i = (numtextures - 1); i >= 0; i--) // <- new
+ for (i = numtextures - 1; i >= 0; i--)
if (textures[i]->hash == hash && !strncasecmp(textures[i]->name, name, 8))
{
- tidcachelen++;
- Z_Realloc(tidcache, tidcachelen * sizeof(*tidcache), PU_STATIC, &tidcache);
- strncpy(tidcache[tidcachelen-1].name, name, 8);
- tidcache[tidcachelen-1].name[8] = '\0';
- CONS_Debug(DBG_SETUP, "texture #%s: %s\n", sizeu1(tidcachelen), tidcache[tidcachelen-1].name);
- tidcache[tidcachelen-1].hash = hash;
- tidcache[tidcachelen-1].id = i;
+ AddTextureToCache(name, hash, i, textures[i]->type);
return i;
}
@@ -2170,3 +2056,31 @@ INT32 R_TextureNumForName(const char *name)
}
return i;
}
+
+// Like R_CheckTextureNumForName, but only looks in the flat namespace specifically.
+INT32 R_CheckFlatNumForName(const char *name)
+{
+ INT32 i;
+ UINT32 hash;
+
+ // "NoTexture" marker.
+ if (name[0] == '-')
+ return 0;
+
+ PaletteTextureHack(&name);
+
+ hash = quickncasehash(name, 8);
+
+ for (i = 0; i < tidcachelen; i++)
+ if (tidcache[i].type == TEXTURETYPE_FLAT && tidcache[i].hash == hash && !strncasecmp(tidcache[i].name, name, 8))
+ return tidcache[i].id;
+
+ for (i = numtextures - 1; i >= 0; i--)
+ if (textures[i]->hash == hash && !strncasecmp(textures[i]->name, name, 8) && textures[i]->type == TEXTURETYPE_FLAT)
+ {
+ AddTextureToCache(name, hash, i, TEXTURETYPE_FLAT);
+ return i;
+ }
+
+ return -1;
+}
diff --git a/src/r_textures.h b/src/r_textures.h
index 44f1b3d61..650cb523c 100644
--- a/src/r_textures.h
+++ b/src/r_textures.h
@@ -44,9 +44,7 @@ enum
TEXTURETYPE_UNKNOWN,
TEXTURETYPE_SINGLEPATCH,
TEXTURETYPE_COMPOSITE,
-#ifdef WALLFLATS
TEXTURETYPE_FLAT,
-#endif
};
// A texture_t describes a rectangular texture,
@@ -86,7 +84,7 @@ void R_FlushTextureCache(void);
// Texture generation
UINT8 *R_GenerateTexture(size_t texnum);
-UINT8 *R_GenerateTextureAsFlat(size_t texnum);
+UINT8 *R_GetFlatForTexture(size_t texnum);
UINT8 *R_GenerateTextureBrightmap(size_t texnum);
INT32 R_GetTextureNum(INT32 texnum);
INT32 R_GetTextureBrightmap(INT32 texnum);
@@ -98,10 +96,11 @@ void R_DoPaletteRemapPatch(softwarepatch_t *patch, size_t size);
void R_DoPaletteRemapFlat(UINT8 *data, size_t size);
// Retrieve texture data.
-void *R_GetLevelFlat(drawspandata_t* ds, levelflat_t *levelflat);
UINT8 *R_GetColumn(fixed_t tex, INT32 col);
UINT8 *R_GetBrightmapColumn(fixed_t tex, INT32 col);
-void *R_GetFlat(lumpnum_t flatnum);
+void *R_GetFlat(levelflat_t *levelflat);
+
+INT32 R_GetTextureNumForFlat(levelflat_t *levelflat);
boolean R_CheckPowersOfTwo(drawspandata_t* ds);
void R_CheckFlatLength(drawspandata_t* ds, size_t size);
@@ -111,7 +110,7 @@ void R_UpdateTextureBrightmap(INT32 tx, INT32 bm);
// Returns the texture number for the texture name.
INT32 R_TextureNumForName(const char *name);
INT32 R_CheckTextureNumForName(const char *name);
-lumpnum_t R_GetFlatNumForName(const char *name);
+INT32 R_CheckFlatNumForName(const char *name);
extern INT32 numtextures;
diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp
index d26831bb1..d5fde7000 100644
--- a/src/sdl/i_system.cpp
+++ b/src/sdl/i_system.cpp
@@ -355,15 +355,15 @@ static void I_ShowErrorMessageBox(const char *messagefordevelopers, boolean dump
finalmessage,
sizeof(finalmessage),
"\"SRB2Kart V2\" has encountered an unrecoverable error and needs to close.\n"
- "The %s log file is located at (%s).\n"
+ "The %slog file is located at (%s).\n"
"\n"
"\n"
"%s",
dumpmade ?
#if defined (UNIXBACKTRACE)
- "crash-log.txt"
+ "crash-log.txt "
#elif defined (_WIN32)
- ".rpt crash dump"
+ ".rpt crash dump "
#endif
: "",
logfilename,