Merge branch 'master' into master

This commit is contained in:
fgsfds
2020-05-16 22:47:39 +03:00
committed by GitHub
70 changed files with 1877 additions and 1014 deletions
+50 -19
View File
@@ -28,6 +28,12 @@ TARGET_RPI ?= 0
# Disable better camera by default
BETTERCAMERA ?= 0
# Disable no drawing distance by default
NODRAWINGDISTANCE ?= 0
# Disable texture fixes by default (helps with them purists)
TEXTURE_FIX ?= 0
# Enable extended options menu by default
EXT_OPTIONS_MENU ?= 1
# Build for Emscripten/WebGL
TARGET_WEB ?= 0
@@ -42,8 +48,6 @@ else
endif
# Automatic settings for PC port(s)
# WINDOWS_BUILD IS NOT FOR COMPILING A WINDOWS EXECUTABLE UNDER LINUX OR WSL!
# USE THE WIKI GUIDE WITH MSYS2 FOR COMPILING A WINDOWS EXECUTABLE!
NON_MATCHING := 1
GRUCODE := f3dex2e
@@ -420,9 +424,14 @@ else
LD := $(CC)
endif
CPP := $(CROSS)cpp -P
ifeq ($(WINDOWS_BUILD),1) # fixes compilation in MXE on Linux and WSL
CPP := cpp -P
OBJCOPY := objcopy
else
CPP := $(CROSS)cpp -P
OBJCOPY := $(CROSS)objcopy
endif
OBJDUMP := $(CROSS)objdump
OBJCOPY := $(CROSS)objcopy
PYTHON := python3
SDLCONFIG := $(CROSS)sdl2-config
@@ -440,33 +449,53 @@ CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) -Wall -Wextra -W
CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fno-strict-aliasing -fwrapv `$(SDLCONFIG) --cflags`
endif
# Check for better camera option
# Check for enhancement options
# Check for Puppycam option
ifeq ($(BETTERCAMERA),1)
CC_CHECK += -DBETTERCAMERA
CFLAGS += -DBETTERCAMERA
CC_CHECK += -DBETTERCAMERA
CFLAGS += -DBETTERCAMERA
EXT_OPTIONS_MENU := 1
endif
# Check for no drawing distance option
ifeq ($(NODRAWINGDISTANCE),1)
CC_CHECK += -DNODRAWINGDISTANCE
CFLAGS += -DNODRAWINGDISTANCE
endif
# Check for texture fix option
ifeq ($(TEXTURE_FIX),1)
CC_CHECK += -DTEXTURE_FIX
CFLAGS += -DTEXTURE_FIX
endif
# Check for extended options menu option
ifeq ($(EXT_OPTIONS_MENU),1)
CC_CHECK += -DEXT_OPTIONS_MENU
CFLAGS += -DEXT_OPTIONS_MENU
endif
ASFLAGS := -I include -I $(BUILD_DIR) $(VERSION_ASFLAGS)
ifeq ($(TARGET_WEB),1)
LDFLAGS := -lm -lGL -lSDL2 -no-pie -s TOTAL_MEMORY=20MB -g4 --source-map-base http://localhost:8080/ -s "EXTRA_EXPORTED_RUNTIME_METHODS=['callMain']"
else
ifeq ($(WINDOWS_BUILD),1)
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -Llib -lpthread -lglew32 `$(SDLCONFIG) --static-libs` -lm -lglu32 -lsetupapi -ldinput8 -luser32 -lgdi32 -limm32 -lole32 -loleaut32 -lshell32 -lwinmm -lversion -luuid -lopengl32 -no-pie -static
ifeq ($(WINDOWS_CONSOLE),1)
LDFLAGS += -mconsole
endif
else
else ifeq ($(WINDOWS_BUILD),1)
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -Llib -lpthread -lglew32 `$(SDLCONFIG) --static-libs` -lm -lglu32 -lsetupapi -ldinput8 -luser32 -lgdi32 -limm32 -lole32 -loleaut32 -lshell32 -lwinmm -lversion -luuid -lopengl32 -static
ifneq ($(CROSS),i686-w64-mingw32.static-)
ifneq ($(CROSS),x86_64-w64-mingw32.static-)
LDFLAGS += -no-pie
endif
endif
ifeq ($(WINDOWS_CONSOLE),1)
LDFLAGS += -mconsole
endif
else ifeq ($(TARGET_RPI),1)
# Linux / Other builds below
ifeq ($(TARGET_RPI),1)
LDFLAGS := $(OPT_FLAGS) -lm -lGLESv2 `$(SDLCONFIG) --libs` -no-pie
else
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -lm -lGL `$(SDLCONFIG) --libs` -no-pie -lpthread
endif
endif
endif #Added for Pi ifeq
# Prevent a crash with -sopt
@@ -576,11 +605,13 @@ ifeq ($(VERSION),eu)
$(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o
$(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o
$(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o
$(BUILD_DIR)/src/game/options_menu.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o
O_FILES += $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o
else
$(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/game/options_menu.o: $(BUILD_DIR)/include/text_strings.h
endif
################################################################
+6 -1
View File
@@ -2,7 +2,9 @@
OpenGL adaptation of [n64decomp/sm64](https://github.com/n64decomp/sm64).
Feel free to report bugs and contribute, but remember, there must be **no upload of any copyrighted asset**.
Run `./extract-assets.py --clean && make clean` or `make distclean` to remove ROM-originated content. This port has been made possible thanks to [n64-fast32-engine](https://github.com/Emill/n64-fast3d-engine/) by [Emill](https://github.com/Emill).
Run `./extract_assets.py --clean && make clean` or `make distclean` to remove ROM-originated content. This port has been made possible mostly thanks to [Emill](https://github.com/Emill) and his [n64-fast32-engine](https://github.com/Emill/n64-fast3d-engine/) renderer.
*Read this in other languages: [Español](README_es_ES.md) [简体中文](README_zh_CN.md).*
## Features
@@ -10,6 +12,9 @@ Run `./extract-assets.py --clean && make clean` or `make distclean` to remove RO
* Variable aspect ratio and resolution. The game can now correctly render at basically any window size.
* Native xinput controller support. On Linux, DualShock 4 has been confirmed to work plug-and-play.
* Analog camera control and mouse look. (Activate with `make BETTERCAMERA=1`.)
* An option to disable drawing distances. (Activate with `make NODRAWINGDISTANCE=1`.)
* In-game control binding, currently available on the `testing` branch.
* Skip introductory Peach & Lakitu cutscenes with the `--skip-intro` CLI option
## Building
For building instructions, please refer to the [wiki](https://github.com/sm64pc/sm64pc/wiki).
+204
View File
@@ -0,0 +1,204 @@
# sm64pc
Adaptación a OpenGL de [n64decomp/sm64](https://github.com/n64decomp/sm64).
No dudes en contribuir o reportar bugs, pero recuerda: **no se debe subir nada con copyright**.
Ejecuta `./extract_assets.py --clean && make clean` o `make distclean` para borrar todo el contenido proveniente de la ROM. Este port es posible gracias a [n64-fast32-engine](https://github.com/Emill/n64-fast3d-engine/) creado por [Emill](https://github.com/Emill).
## Funcionalidades
* Renderizado nativo. Podrás jugar a Super Mario 64 sin necesidad de un emulador.
* Resolución y relación de aspecto variables. Puedes jugar a Super Mario 64 a básicamente cualquier resolución o tamaño de ventana.
* Soporte nativo para mandos XInput. En Linux, se ha confirmado que el DualShock 4 funciona sin más.
* Cámara analógica y cámara controlada con el ratón. (Se activa con `make BETTERCAMERA=1`.)
* Opción para desactivar el límite de distancia de renderizado. (Se activa con `make NODRAWINGDISTANCE=1`.)
* Configurar los controles desde el juego, actualmente solo en la rama `testing`.
* Posibilidad de saltarte la intro con la opción de línea de comandos `--skip-intro`, actualmente solo en las ramas `testing` y `skip-intro`.
## Compilar en Windows
**No intentes compilar ejecutables para Windows bajo Linux usando `WINDOWS_BUILD=1`. No va a funcionar. Sigue la guía.**
#### 1. Instalación y configuración de MSYS2.
1. Descarga [msys2-x86_64-latest.exe](http://repo.msys2.org/distrib/msys2-x86_64-latest.exe) y ejecútalo. Si tu sistema operativo es de 32 bits (¿por qué?) descarga [msys2-i686-latest.exe](http://repo.msys2.org/distrib/msys2-i686-latest.exe) en su lugar. Asegúrate de que lo instalas en `C:\dev\msys64` (o `C:\dev\msys32` para 32 bits...). Ejecuta MSYS2.
2. En la ventana de comandos de MSYS2, ejecuta el siguiente comando:
```
pacman -Syuu
```
3. Abre "MSYS2 MinGW 64-Bit". Ejecuta este comando __repetidamente__ hasta que MSYS diga que ya no hay más actualizaciones. Es posible que tengas que volver a cerrar y abrir MSYS2.
```
pacman -Syuu
```
5. Ejecuta este comando y cuando te pida confirmación pulsa intro:
```
pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain \
git subversion mercurial \
mingw-w64-i686-cmake mingw-w64-x86_64-cmake
```
6. Listo.
#### Instala las dependencias
```
pacman -S mingw-w64-i686-glew mingw-w64-x86_64-glew mingw-w64-i686-SDL2 mingw-w64-x86_64-SDL2 python3
```
### Crea el directorio en el que preparar todo
Desde el explorador de Windows, navega a `C:\msys64\home\(nombre de usuario)\` y crea una carpeta con el nombre que te apetezca. Aquí es donde vamos a preparar todo.
### Clona el repositorio
En MSYS2, introduce el siguiente comando:
```
git clone https://github.com/sm64pc/sm64pc/
```
(Si no funciona, prueba a escribirlo manualmente, en lugar de copiar y pegar)
#### Copia la ROM base al directorio correspondiente
El paso anterior tiene que haber creado una carpeta llamada sm64pc. Dentro de esa carpeta, y para cada version de la ROM (jp/us/eu) de la cual quieras compilar un ejecutable, coloca la ROM con el nombre `baserom.<version>.z64` para extraer sus assets. Por ejemplo, `baserom.us.z64` para la versión americana, o `baserom.eu.z64` para la versión europea.
#### En MSYS2, vamos a navegar a la carpeta `./tools/audiofile-0.3.6/` y ejecutar el `autoreconf-i`. Introduce los siguientes comandos, en orden, uno a uno:
```
cd sm64pc/tools/audiofile-0.3.6/
autoreconf -i
```
No te vayas de este directorio hasta el paso 9.
#### Ejecuta el script `configure`
```
PATH=/mingw64/bin:/mingw32/bin:$PATH LIBS=-lstdc++ ./configure --disable-docs
```
#### Ejecuta el script `make`
```
PATH=/mingw64/bin:/mingw32/bin:$PATH make
```
#### Crea un directorio `lib` en `tools/`
```
mkdir ../lib
```
#### Acabas de compilar `libaudiofile`. Ahora cópialo a `tools/lib/`
```
cp libaudiofile/.libs/libaudiofile.a ../lib/
cp libaudiofile/.libs/libaudiofile.la ../lib/
```
#### Ahora toca hacer algo desde Windows.
En el explorador de Windows, ve a sm64pc\tools y edita el archivo Makefile desde un editor de texto (es recomendable usar un editor decente como Notepad++ o Sublime Text, en lugar del bloc de notas, para asegurarte de que no rompes el formato del texto) Busca la línea que contiene esto:
```tabledesign_CFLAGS := -Wno-uninitialized -laudiofile```
Y añade ` -lstdc++` al final, de manera que quede así (¡no olvides el espacio!)
```tabledesign_CFLAGS := -Wno-uninitialized -laudiofile -lstdc++```
Guarda el archivo.
#### Vuelve a la carpeta tools y ejecuta `make` con los siguientes comandos.
```
cd ..
PATH=/mingw64/bin:/mingw32/bin:$PATH make
```
#### Vuelve al directorio sm64pc
```
cd ..
```
#### Finalmente, ejecuta ```make``` de nuevo.
(Ten en cuenta que mingw32 y mingw64 han sido intercambiados. Esto es para que puedas compilar la versión de 32 bits si quieres.)
Aquí pones las opciones que quieras según la versión que quieras compilar. Por ejemplo, si quieres activar la cámara analógica, añade al final BETTERCAMERA=1. Si quieres la opción de distancia de renderizado ilimitada, añade NODRAWINGDISTANCE=1.
Por ejemplo:
```
PATH=/mingw32/bin:/mingw64/bin:$PATH make BETTERCAMERA=1 NODRAWINGDISTANCE=1
```
Listo. El .exe estará en sm64pc\build\. Disfruta.
## Compilar en Linux
### Nota para usuarios de Windows
No intentes compilar un ejecutable para Windows desde Linux o WSL. No funciona. Sigue la guía para Windows.
#### Copia la(s) ROM(s) base para la extracción de assets.
Por cada versión de la cual quieras compilar un ejecutable, copia la ROM en `./baserom.<versión>.z64` para extraer los assets.
#### Instala las dependencias.
Para compilar necesitas las sigueintes dependencias.
* python3 >= 3.6
* libsdl2-dev
* [audiofile](https://audiofile.68k.org/)
* libglew-dev
* git
Puedes instalarlas con este comando:
##### Debian / Ubuntu - (compilando para 32 bits)
```
sudo apt install build-essential git python3 libaudiofile-dev libglew-dev:i386 libsdl2-dev:i386
```
##### Debian / Ubuntu - (compilando para 64 bits)
```
sudo apt install build-essential git python3 libaudiofile-dev libglew-dev libsdl2-dev
```
##### Arch Linux
Hay un paquete AUR (cortesía de @narukeh) disponible bajo el nombre [sm64pc-git](https://aur.archlinux.org/packages/sm64pc-git/). Instálalo con tu gestor de AURs preferido.
Si quieres compilarlo por tu cuenta:
```
sudo pacman -S base-devel python audiofile sdl2 glew
```
##### Void Linux - (compilando para 64 bits)
```
sudo xbps-install -S base-devel python3 audiofile-devel SDL2-devel glew-devel
```
##### Void Linux - (compilando para 32 bits)
```
sudo xbps-install -S base-devel python3 audiofile-devel-32bit SDL2-devel-32bit glew-devel-32bit
```
#### Compila el ejecutable.
Ejecuta `make` para compilar (por defecto `VERSION=us`)
```
make VERSION=jp -j6 # Compila la versión (J) usando 6 hilos
make VERSION=us MARCH=i686 TARGET_BITS=32 # Compila un ejecutable de la versión (U) de 32 bits
make TARGET_RPI=1 # Compila un ejecutable para Raspberry Pi
```
## Compilar para la web
Puedes compilar el juego para navegadores que admitan WebGL usando [Emscripten](https://github.com/emscripten-core). Para hacerlo, instala [emsdk](https://github.com/emscripten-core/emsdk) y ejecuta `make TARGET_WEB=1`.
## Script para compilar para Raspberry Pi
[Hyenadae](https://github.com/Hyenadae/) ha creado un script que ayuda a compilar el juego para Raspberry Pi. Estos son los pasos que hace el script:
* Instala las dependencias;
* Cambia VC4_DRM en la RPi de 0 a 3;
* Cambia ajustes en la memoria de las RPis 0 y 1 para que se pueda completar la compilación;
* Permite la instalación de un SDL2 con KMS, lo que elimina la necesidad de usar X11 y garantiza el máximo rendimiento de cualquier RPi que ejecute VC4;
* Clona sm64pc si no encuentra los archivos necesarios;
* Comprueba si existen los assets y la ROM base necesaria (baserom.*.z64);
* Compila sm64pc.
El script está incluído en la rama master, pero también puede descargarse [aquí](https://raw.githubusercontent.com/sm64pc/sm64pc/master/pisetup.sh).
# Problemas conocidos
### Problemas ya conocidos:
* La versión EU tiene bugs en los textos y no tiene audio.
* El movimiento analógico horizontal de la cámara vuelve al estilo antiguo en el nivel Bowser in the Dark World (#72)
* La cámara con el ratón falla cuando disparas a Mario hacia un árbol o un tubo. (#71)
* "make: Nothing to be done for 'default'" al compilar para web. (#67)
### Estos problemas están marcados como solucionados. Por favor, contacta si sigues teniendo estos problemas.
* El juego se llena de flags aleatorias en las builds de 64 bits para Windows
* Hazy Maze Cave se cuelga en pantalla completa (#57)
* La pantalla de título no tiene el cursor para manipular a Mario en pantalla completa. (#28)
## Parches
En la carpeta `./enhancements` hay varios archivos `patch`, que pueden aplicarse de la siguiente manera:
```
git apply fps.patch --ignore-whitespace --reject
```
Si ocurre un rechazo, puedes buscarlo con el comando `find | grep .rej`.
Intenta resolver los rechazos a través de [wiggle](https://github.com/neilbrown/wiggle).
```
wiggle rejection.rej --replace
```
+21
View File
@@ -0,0 +1,21 @@
# sm64pc
本项目是 [n64decomp/sm64](https://github.com/n64decomp/sm64) 的 OpenGL 移植版本。
我们欢迎贡献代码与 bug 报告,但请切记,**不得上传任何被版权保护(来自 ROM 文件)的资源**。
提交前请运行 `./extract_assets.py --clean && make clean``make distclean` 来清除所有从 ROM 文件中提取的内容。
本移植是基于 [Emill](https://github.com/Emill) 的工作 [n64-fast32-engine](https://github.com/Emill/n64-fast3d-engine/) 才得以实现的。
## 主要功能
* 原生渲染。现在不用任何模拟器就可以运行 马力欧64 了。
* 长宽比和分辨率可以自由改变。本游戏目前可以在几乎任何窗口尺寸下正确渲染。
* 原生 xinput 手柄支持。在 Linux 下,已经确认 PS4 手柄可以即插即用。
* 支持模拟量视点控制、鼠标控制视点。(请使用 `make BETTERCAMERA=1` 编译)
* 可取消可视距离限制。(请使用 `make NODRAWINGDISTANCE=1` 编译)
* 游戏内操作设定功能,目前在 `testing` 分支下可用。
* 使用 `--skip-intro` 命令行选项跳过碧奇公主与 Lakitu 的片头剧情。目前在 `testing``skip-intro` 分支下可用。
## 编译方法
关于如何编译,请参考 [wiki](https://github.com/sm64pc/sm64pc/wiki)。
**请勿在 Linux 或者 WSL 下使用 `WINDOWS_BUILD=1` 参数尝试编译 Windows 版本,这样无法编译成功。请参考 Wiki。
+7
View File
@@ -11,6 +11,9 @@ static const Vtx burn_smoke_seg4_vertex_040217C0[] = {
// //! Wrong texture format. Called as rgba16, which makes the burn smoke appear
// as a transparent black burn smoke. Probably meant to show up as white-ish
// burn smoke, but mistakened for being intended as black smoke.
// Due to debate in the Koopa shorts PR surrounding the fix to a similar bug,
// said fix is on a compile-time variable. Use TEXTURE_FIX=1 at compile time
// to fix this.
// 0x04021800
ALIGNED8 static const u8 burn_smoke_seg4_texture_04021800[] = {
#include "actors/burn_smoke/burn_smoke.ia16.inc.c"
@@ -44,7 +47,11 @@ const Gfx burn_smoke_seg4_dl_04022048[] = {
// 0x04022070 - 0x040220C8
const Gfx burn_smoke_seg4_dl_04022070[] = {
gsSPDisplayList(burn_smoke_seg4_dl_04022000),
#ifdef TEXTURE_FIX
gsDPLoadTextureBlock(burn_smoke_seg4_texture_04021800, G_IM_FMT_IA, G_IM_SIZ_16b, 32, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
#else
gsDPLoadTextureBlock(burn_smoke_seg4_texture_04021800, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
#endif
gsSPDisplayList(burn_smoke_seg4_dl_04022028),
gsSPDisplayList(burn_smoke_seg4_dl_04022048),
gsSPEndDisplayList(),
+7
View File
@@ -54,6 +54,8 @@ static const Lights1 koopa_seg6_lights_06002630 = gdSPDefLights1(
// beneath its shell, despite the fact it was intended to be white like
// the rest of its body. This is evident because once the mistake is corrected
// it turns back to being white like the other polygons.
// Due to debate in the PR surrounding the fix to this, said fix is on
// a compile-time variable. Use TEXTURE_FIX=1 at compile time to fix this.
// 0x06002648
ALIGNED8 static const u8 koopa_seg6_texture_06002648[] = {
#include "actors/koopa/koopa_shell_front.rgba16.inc.c"
@@ -2077,8 +2079,13 @@ const Gfx koopa_seg6_dl_0600C498[] = {
gsSPVertex(koopa_seg6_vertex_0600B560, 9, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP1Triangle( 6, 7, 8, 0x0),
#ifdef TEXTURE_FIX
gsSPLight(&koopa_seg6_lights_06002630.l, 1),
gsSPLight(&koopa_seg6_lights_06002630.a, 2),
#else
gsSPLight(koopa_seg6_texture_06002648 + 0x20, 1), // this malformed light results in a
gsSPLight(koopa_seg6_texture_06002648 + 0x18, 2), // koopa appearing to wear pink shorts.
#endif
gsSPVertex(koopa_seg6_vertex_0600B5F0, 15, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 6, 7, 0, 0x0, 8, 5, 9, 0x0),
+141
View File
@@ -0,0 +1,141 @@
"""
This module attempts to parse the ``model.inc.c`` files and extract the
3D models within as standard Wavefront OBJ files.
Example:
Specify the path to the ``.inc.c`` file and a directory where to save
the extracted ``.obj`` files.
$ python c2obj.py ./actors/mario/model.inc.c ./actors/mario/obj/
This is a work in progress and it currently has some serious limitations:
* It only extracts geometry information, so no textures or any other info
* It makes assumptions about the layout of the code in the C source
* It hasn't been properly tested.
"""
def parse(filename, output_directory):
from os import path, mkdir
if not path.isdir(output_directory):
try:
mkdir(output_directory)
except OSError:
print(f'Could not use output directory {output_directory}.')
vtx_def = 'static const Vtx '
vtx_data = {}
reading_vtx = False
current_vtx_name = ''
current_vtx_data = []
current_vtx_vertices = 0
gfx_def = 'const Gfx '
reading_gfx = False
current_gfx_vertices = 0
current_gfx_faces = 0
insert_vert_call = 'gsSPVertex('
insert_1tri_call = 'gsSP1Triangle('
insert_2tri_call = 'gsSP2Triangles('
gfx_count = 0
end_of_block = '};'
with open(filename, 'r') as f:
for line in f:
line = line.strip()
if line.startswith(vtx_def):
vtx_name = line.split(' ')[3][:-2]
current_vtx_name = vtx_name
current_vtx_data = []
reading_vtx = True
continue
if line.startswith(gfx_def):
from datetime import datetime
current_gfx_name = line.split(' ')[2][:-2]
current_gfx_file = open(path.join(output_directory, current_gfx_name + '.obj'), 'w')
current_gfx_file.write("# Armando Arredondo's SM64 Wavefront OBJ Geometry Converter\n")
current_gfx_file.write('# File Created: {}\n\n'.format(datetime.now()))
reading_gfx = True
continue
if line == end_of_block:
if reading_vtx:
vtx_data[current_vtx_name] = current_vtx_data
reading_vtx = False
elif reading_gfx:
current_gfx_file.write(f'# {current_gfx_faces} faces\n\n')
current_gfx_file.close()
current_gfx_vertices = 0
reading_gfx = False
gfx_count += 1
continue
if reading_vtx:
line = line.replace('{', '[').replace('}', ']')
tri = eval(line[:-1])[0]
current_vtx_data.append(tri)
continue
if reading_gfx:
if line.startswith(insert_vert_call):
args = line[len(insert_vert_call):].split(',')
current_vtx_name = args[0]
if current_gfx_vertices > 0:
current_gfx_file.write(f'# {current_gfx_faces} faces\n\n')
current_gfx_faces = 0
current_vtx_vertices = len(vtx_data[current_vtx_name])
current_gfx_vertices += current_vtx_vertices
current_gfx_file.write(f'#\n# object {current_vtx_name}\n#\n\n')
current_vtx_data = vtx_data[current_vtx_name]
for tri in current_vtx_data:
v = tri[0]
current_gfx_file.write('v {:.3f} {:.3f} {:.3f}\n'.format(*v))
current_gfx_file.write(f'# {current_vtx_vertices} vertices\n\n')
for tri in current_vtx_data:
n = [_decode_normal(u) for u in tri[3][:3]]
current_gfx_file.write('vn {:.3f} {:.3f} {:.3f}\n'.format(*n))
current_gfx_file.write(f'# {current_vtx_vertices} vertex normals\n\n')
current_gfx_file.write(f'g {current_vtx_name}\n\n')
elif line.startswith(insert_2tri_call):
args = line[len(insert_2tri_call):].split(',')
correction = current_gfx_vertices - current_vtx_vertices + 1
indexes = [eval(args[i]) + correction for i in [0, 1, 2, 4, 5, 6]]
current_gfx_file.write('f {0}//{0} {1}//{1} {2}//{2}\n'.format(*indexes[:3]))
current_gfx_file.write('f {0}//{0} {1}//{1} {2}//{2}\n'.format(*indexes[3:]))
current_gfx_faces += 2
elif line.startswith(insert_1tri_call):
args = line[len(insert_1tri_call):].split(',')
correction = current_gfx_vertices - current_vtx_vertices + 1
indexes = [eval(args[i]) + correction for i in [0, 1, 2]]
current_gfx_file.write('f {0}//{0} {1}//{1} {2}//{2}\n'.format(*indexes))
current_gfx_faces += 1
continue
print(f'{gfx_count} models extracted.')
def _decode_normal(x):
y = x if x <= 127 else x - 255
return y / 127
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('filename', help = 'filename of the .inc.c source file')
parser.add_argument('output_directory', help = 'directory where to put the extracted .obj files')
args = parser.parse_args()
parse(args.filename, args.output_directory)
+8 -7
View File
@@ -114,7 +114,7 @@
// Often used to end behavior scripts that do not contain an infinite loop.
#define BREAK() \
BC_B(0x0A)
// Exits the behavior script, unused.
#define BREAK_UNUSED() \
BC_B(0x0B)
@@ -175,15 +175,15 @@
#define ADD_INT_RAND_RSHIFT(field, min, rshift) \
BC_BBH(0x17, field, min), \
BC_H(rshift)
// No operation. Unused.
#define CMD_NOP_1(field) \
BC_BB(0x18, field)
// No operation. Unused.
#define CMD_NOP_2(field) \
BC_BB(0x19, field)
// No operation. Unused.
#define CMD_NOP_3(field) \
BC_BB(0x1A, field)
@@ -219,6 +219,9 @@
#define BILLBOARD() \
BC_B(0x21)
#define CYLBOARD() \
BC_B(0x38)
// Hides the current object.
#define HIDE() \
BC_B(0x22)
@@ -3180,7 +3183,7 @@ const BehaviorScript bhvFloorTrapInCastle[] = {
const BehaviorScript bhvTree[] = {
BEGIN(OBJ_LIST_POLELIKE),
BILLBOARD(),
CYLBOARD(),
OR_INT(oFlags, OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE),
SET_INT(oInteractType, INTERACT_POLE),
SET_HITBOX(/*Radius*/ 80, /*Height*/ 500),
@@ -6105,5 +6108,3 @@ const BehaviorScript bhvIntroScene[] = {
CALL_NATIVE(bhv_intro_scene_loop),
END_LOOP(),
};
-10
View File
@@ -1,10 +0,0 @@
# No Draw Distances
This is a work-in-progress by [wabberz](https://github.com/wabberz) that disables the drawing distance for most objects and enemies.
**This will crash some levels in the 32-bit version**.
[Related Push Request](https://github.com/sm64pc/sm64pc/pull/75).
For instructions on how to apply patches, please refer to [the Wiki](https://github.com/sm64pc/sm64pc/wiki/Patches).
@@ -1,406 +0,0 @@
From c98a263cf40520bf0d131eb2d1a2f90240787c98 Mon Sep 17 00:00:00 2001
From: uwabami <uwabami@localhost>
Date: Tue, 12 May 2020 09:26:16 +0200
Subject: [PATCH] adding option to disable draw distance
---
Makefile | 8 ++++++++
src/engine/behavior_script.c | 4 ++++
src/engine/surface_load.c | 4 ++++
src/game/behaviors/butterfly.inc.c | 3 ++-
src/game/behaviors/chain_chomp.inc.c | 8 ++++++++
src/game/behaviors/coin.inc.c | 6 ++++++
src/game/behaviors/fish.inc.c | 4 ++++
src/game/behaviors/goomba.inc.c | 4 ++++
src/game/behaviors/heave_ho.inc.c | 4 ++++
src/game/behaviors/king_bobomb.inc.c | 4 ++++
src/game/behaviors/pokey.inc.c | 6 ++++++
src/game/behaviors/snufit.inc.c | 4 ++++
src/game/behaviors/triplet_butterfly.inc.c | 4 ++++
src/game/behaviors/water_bomb_cannon.inc.c | 8 ++++++++
src/game/behaviors/whirlpool.inc.c | 4 ++++
15 files changed, 74 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index d4bd284..efeb63e 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,8 @@ COMPILER ?= ido
# Disable better camera by default
BETTERCAMERA ?= 0
+# Disable no drawing distance by default
+NODRAWINGDISTANCE ?= 0
# Build for Emscripten/WebGL
TARGET_WEB ?= 0
@@ -449,6 +451,12 @@ CC_CHECK += -DBETTERCAMERA
CFLAGS += -DBETTERCAMERA
endif
+# Check for no drawing distance option
+ifeq ($(NODRAWINGDISTANCE),1)
+CC_CHECK += -DNODRAWINGDISTANCE
+CFLAGS += -DNODRAWINGDISTANCE
+endif
+
ASFLAGS := -I include -I $(BUILD_DIR) $(VERSION_ASFLAGS)
ifeq ($(TARGET_WEB),1)
diff --git a/src/engine/behavior_script.c b/src/engine/behavior_script.c
index edd5247..feb6fef 100644
--- a/src/engine/behavior_script.c
+++ b/src/engine/behavior_script.c
@@ -987,11 +987,15 @@ void cur_obj_update(void) {
} else if ((objFlags & OBJ_FLAG_COMPUTE_DIST_TO_MARIO) && gCurrentObject->collisionData == NULL) {
if (!(objFlags & OBJ_FLAG_ACTIVE_FROM_AFAR)) {
// If the object has a render distance, check if it should be shown.
+#ifndef NODRAWINGDISTANCE
if (distanceFromMario > gCurrentObject->oDrawingDistance) {
// Out of render distance, hide the object.
gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
gCurrentObject->activeFlags |= ACTIVE_FLAG_FAR_AWAY;
} else if (gCurrentObject->oHeldState == HELD_FREE) {
+#else
+ if (distanceFromMario <= gCurrentObject->oDrawingDistance && gCurrentObject->oHeldState == HELD_FREE) {
+#endif
// In render distance (and not being held), show the object.
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
gCurrentObject->activeFlags &= ~ACTIVE_FLAG_FAR_AWAY;
diff --git a/src/engine/surface_load.c b/src/engine/surface_load.c
index 363f9af..498fae0 100644
--- a/src/engine/surface_load.c
+++ b/src/engine/surface_load.c
@@ -789,9 +789,13 @@ void load_object_collision_model(void) {
}
}
+#ifndef NODRAWINGDISTANCE
if (marioDist < gCurrentObject->oDrawingDistance) {
+#endif
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
+#ifndef NODRAWINGDISTANCE
} else {
gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
}
+#endif
}
diff --git a/src/game/behaviors/butterfly.inc.c b/src/game/behaviors/butterfly.inc.c
index d435d8d..9296ed5 100644
--- a/src/game/behaviors/butterfly.inc.c
+++ b/src/game/behaviors/butterfly.inc.c
@@ -107,6 +107,7 @@ void bhv_butterfly_loop(void) {
butterfly_act_return_home();
break;
}
-
+#ifndef NODRAWINGDISTANCE
set_object_visibility(o, 3000);
+#endif
}
diff --git a/src/game/behaviors/chain_chomp.inc.c b/src/game/behaviors/chain_chomp.inc.c
index a77c5d5..9b9c342 100644
--- a/src/game/behaviors/chain_chomp.inc.c
+++ b/src/game/behaviors/chain_chomp.inc.c
@@ -53,7 +53,9 @@ static void chain_chomp_act_uninitialized(void) {
struct ChainSegment *segments;
s32 i;
+#ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 3000.0f) {
+#endif
segments = mem_pool_alloc(gObjectMemoryPool, 5 * sizeof(struct ChainSegment));
if (segments != NULL) {
// Each segment represents the offset of a chain part to the pivot.
@@ -81,7 +83,9 @@ static void chain_chomp_act_uninitialized(void) {
cur_obj_unhide();
}
}
+#ifndef NODRAWINGDISTANCE
}
+#endif
}
/**
@@ -359,10 +363,12 @@ static void chain_chomp_act_move(void) {
f32 maxDistToPivot;
// Unload chain if mario is far enough
+#ifndef NODRAWINGDISTANCE
if (o->oChainChompReleaseStatus == CHAIN_CHOMP_NOT_RELEASED && o->oDistanceToMario > 4000.0f) {
o->oAction = CHAIN_CHOMP_ACT_UNLOAD_CHAIN;
o->oForwardVel = o->oVelY = 0.0f;
} else {
+#endif
cur_obj_update_floor_and_walls();
switch (o->oChainChompReleaseStatus) {
@@ -446,7 +452,9 @@ static void chain_chomp_act_move(void) {
o->oGravity = -4.0f;
o->oChainChompTargetPitch = -0x3000;
}
+#ifndef NODRAWINGDISTANCE
}
+#endif
}
/**
diff --git a/src/game/behaviors/coin.inc.c b/src/game/behaviors/coin.inc.c
index 913c583..05619b9 100644
--- a/src/game/behaviors/coin.inc.c
+++ b/src/game/behaviors/coin.inc.c
@@ -184,17 +184,23 @@ void bhv_coin_formation_loop(void) {
s32 bitIndex;
switch (o->oAction) {
case 0:
+#ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 2000.0f) {
+#endif
for (bitIndex = 0; bitIndex < 8; bitIndex++) {
if (!(o->oCoinUnkF4 & (1 << bitIndex)))
spawn_coin_in_formation(bitIndex, o->oBehParams2ndByte);
}
o->oAction++;
+#ifndef NODRAWINGDISTANCE
}
+#endif
break;
case 1:
+#ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario > 2100.0f)
o->oAction++;
+#endif
break;
case 2:
o->oAction = 0;
diff --git a/src/game/behaviors/fish.inc.c b/src/game/behaviors/fish.inc.c
index 839ab8d..f652ef4 100644
--- a/src/game/behaviors/fish.inc.c
+++ b/src/game/behaviors/fish.inc.c
@@ -42,7 +42,9 @@ void fish_act_spawn(void) {
* If the current level is Secret Aquarium, ignore this requirement.
* Fish moves at random with a max-range of 700.0f.
*/
+#ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < minDistToMario || gCurrLevelNum == LEVEL_SA) {
+#endif
for (i = 0; i < schoolQuantity; i++) {
fishObject = spawn_object(o, model, bhvFish);
fishObject->oBehParams2ndByte = o->oBehParams2ndByte;
@@ -50,7 +52,9 @@ void fish_act_spawn(void) {
obj_translate_xyz_random(fishObject, 700.0f);
}
o->oAction = FISH_ACT_ACTIVE;
+#ifndef NODRAWINGDISTANCE
}
+#endif
}
/**
diff --git a/src/game/behaviors/goomba.inc.c b/src/game/behaviors/goomba.inc.c
index 2dab2fe..bf47dda 100644
--- a/src/game/behaviors/goomba.inc.c
+++ b/src/game/behaviors/goomba.inc.c
@@ -78,7 +78,9 @@ void bhv_goomba_triplet_spawner_update(void) {
// If mario is close enough and the goombas aren't currently loaded, then
// spawn them
if (o->oAction == GOOMBA_TRIPLET_SPAWNER_ACT_UNLOADED) {
+#ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 3000.0f) {
+#endif
// The spawner is capable of spawning more than 3 goombas, but this
// is not used in the game
dAngle =
@@ -98,11 +100,13 @@ void bhv_goomba_triplet_spawner_update(void) {
}
o->oAction += 1;
+#ifndef NODRAWINGDISTANCE
}
} else if (o->oDistanceToMario > 4000.0f) {
// If mario is too far away, enter the unloaded action. The goombas
// will detect this and unload themselves
o->oAction = GOOMBA_TRIPLET_SPAWNER_ACT_UNLOADED;
+#endif
}
}
diff --git a/src/game/behaviors/heave_ho.inc.c b/src/game/behaviors/heave_ho.inc.c
index 662bb0b..2f9da86 100644
--- a/src/game/behaviors/heave_ho.inc.c
+++ b/src/game/behaviors/heave_ho.inc.c
@@ -73,14 +73,18 @@ void heave_ho_act_3(void) {
void heave_ho_act_0(void) {
cur_obj_set_pos_to_home();
+#ifndef NODRAWINGDISTANCE
if (find_water_level(o->oPosX, o->oPosZ) < o->oPosY && o->oDistanceToMario < 4000.0f) {
+#endif
cur_obj_become_tangible();
cur_obj_unhide();
o->oAction = 1;
+#ifndef NODRAWINGDISTANCE
} else {
cur_obj_become_intangible();
cur_obj_hide();
}
+#endif
}
void (*sHeaveHoActions[])(void) = { heave_ho_act_0, heave_ho_act_1, heave_ho_act_2, heave_ho_act_3 };
diff --git a/src/game/behaviors/king_bobomb.inc.c b/src/game/behaviors/king_bobomb.inc.c
index 63a7575..af1cb0a 100644
--- a/src/game/behaviors/king_bobomb.inc.c
+++ b/src/game/behaviors/king_bobomb.inc.c
@@ -295,10 +295,14 @@ void king_bobomb_move(void) {
cur_obj_move_using_fvel_and_gravity();
cur_obj_call_action_function(sKingBobombActions);
exec_anim_sound_state(sKingBobombSoundStates);
+#ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 5000.0f)
+#endif
cur_obj_enable_rendering();
+#ifndef NODRAWINGDISTANCE
else
cur_obj_disable_rendering();
+#endif
}
void bhv_king_bobomb_loop(void) {
diff --git a/src/game/behaviors/pokey.inc.c b/src/game/behaviors/pokey.inc.c
index df5d11f..cfcc92c 100644
--- a/src/game/behaviors/pokey.inc.c
+++ b/src/game/behaviors/pokey.inc.c
@@ -151,7 +151,9 @@ static void pokey_act_uninitialized(void) {
s32 i;
s16 partModel;
+#ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 2000.0f) {
+#endif
partModel = MODEL_POKEY_HEAD;
for (i = 0; i < 5; i++) {
@@ -170,7 +172,9 @@ static void pokey_act_uninitialized(void) {
o->oPokeyNumAliveBodyParts = 5;
o->oPokeyBottomBodyPartSize = 1.0f;
o->oAction = POKEY_ACT_WANDER;
+#ifndef NODRAWINGDISTANCE
}
+#endif
}
/**
@@ -185,9 +189,11 @@ static void pokey_act_wander(void) {
if (o->oPokeyNumAliveBodyParts == 0) {
obj_mark_for_deletion(o);
+#ifndef NODRAWINGDISTANCE
} else if (o->oDistanceToMario > 2500.0f) {
o->oAction = POKEY_ACT_UNLOAD_PARTS;
o->oForwardVel = 0.0f;
+#endif
} else {
treat_far_home_as_mario(1000.0f);
cur_obj_update_floor_and_walls();
diff --git a/src/game/behaviors/snufit.inc.c b/src/game/behaviors/snufit.inc.c
index f3a0c9e..76e78c0 100644
--- a/src/game/behaviors/snufit.inc.c
+++ b/src/game/behaviors/snufit.inc.c
@@ -180,7 +180,11 @@ void bhv_snufit_loop(void) {
void bhv_snufit_balls_loop(void) {
// If far from Mario or in a different room, despawn.
if ((o->activeFlags & ACTIVE_FLAG_IN_DIFFERENT_ROOM)
+#ifndef NODRAWINGDISTANCE
|| (o->oTimer != 0 && o->oDistanceToMario > 1500.0f)) {
+#else
+ || (o->oTimer != 0)) {
+#endif
obj_mark_for_deletion(o);
}
diff --git a/src/game/behaviors/triplet_butterfly.inc.c b/src/game/behaviors/triplet_butterfly.inc.c
index 1c2b926..3d16a9d 100644
--- a/src/game/behaviors/triplet_butterfly.inc.c
+++ b/src/game/behaviors/triplet_butterfly.inc.c
@@ -54,9 +54,11 @@ static void triplet_butterfly_act_init(void) {
}
static void triplet_butterfly_act_wander(void) {
+#ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario > 1500.0f) {
obj_mark_for_deletion(o);
} else {
+#endif
approach_f32_ptr(&o->oTripletButterflySpeed, 8.0f, 0.5f);
if (o->oTimer < 60) {
o->oTripletButterflyTargetYaw = cur_obj_angle_to_home();
@@ -82,7 +84,9 @@ static void triplet_butterfly_act_wander(void) {
obj_move_pitch_approach(o->oTripletButterflyTargetPitch, 400);
cur_obj_rotate_yaw_toward(o->oTripletButterflyTargetYaw, random_linear_offset(400, 800));
+#ifndef NODRAWINGDISTANCE
}
+#endif
}
static void triplet_butterfly_act_activate(void) {
diff --git a/src/game/behaviors/water_bomb_cannon.inc.c b/src/game/behaviors/water_bomb_cannon.inc.c
index 8e9ba33..fb82e43 100644
--- a/src/game/behaviors/water_bomb_cannon.inc.c
+++ b/src/game/behaviors/water_bomb_cannon.inc.c
@@ -38,19 +38,27 @@ void bhv_bubble_cannon_barrel_loop(void) {
}
void water_bomb_cannon_act_0(void) {
+#ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 2000.0f) {
+#endif
spawn_object(o, MODEL_CANNON_BARREL, bhvCannonBarrelBubbles);
cur_obj_unhide();
o->oAction = 1;
o->oMoveAnglePitch = o->oWaterCannonUnkFC = 0x1C00;
+#ifndef NODRAWINGDISTANCE
}
+#endif
}
void water_bomb_cannon_act_1(void) {
+#ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario > 2500.0f) {
o->oAction = 2;
} else if (o->oBehParams2ndByte == 0) {
+#else
+ if (o->oBehParams2ndByte == 0) {
+#endif
if (o->oWaterCannonUnkF4 != 0) {
o->oWaterCannonUnkF4 -= 1;
} else {
diff --git a/src/game/behaviors/whirlpool.inc.c b/src/game/behaviors/whirlpool.inc.c
index 405e051..5aebebd 100644
--- a/src/game/behaviors/whirlpool.inc.c
+++ b/src/game/behaviors/whirlpool.inc.c
@@ -35,7 +35,9 @@ void whirpool_orient_graph(void) {
}
void bhv_whirlpool_loop(void) {
+#ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 5000.0f) {
+#endif
o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE;
// not sure if actually an array
@@ -52,10 +54,12 @@ void bhv_whirlpool_loop(void) {
whirpool_orient_graph();
o->oFaceAngleYaw += 0x1F40;
+#ifndef NODRAWINGDISTANCE
} else {
o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
gEnvFxBubbleConfig[ENVFX_STATE_PARTICLECOUNT] = 0;
}
+#endif
cur_obj_play_sound_1(SOUND_ENV_WATER);
+41 -14
View File
@@ -3,20 +3,47 @@
#include "text_menu_strings.h"
#define NC_CAMX _("Camera X Sensitivity")
#define NC_CAMY _("Camera Y Sensitivity")
#define NC_INVERTX _("Invert X Axis")
#define NC_INVERTY _("Invert Y Axis")
#define NC_CAMC _("Camera Centre Aggression")
#define NC_CAMP _("Camera Pan Level")
#define NC_ENABLED _("Enabled")
#define NC_DISABLED _("Disabled")
#define NC_BUTTON _("[R]: Options")
#define NC_BUTTON2 _("[R]: Return")
#define NC_OPTION _("OPTIONS")
#define NC_HIGHLIGHT _("O")
#define NC_ANALOGUE _("Analogue Camera")
#define NC_MOUSE _("Mouse Look")
#define TEXT_OPT_CAMX _("Camera X Sensitivity")
#define TEXT_OPT_CAMY _("Camera Y Sensitivity")
#define TEXT_OPT_INVERTX _("Invert X Axis")
#define TEXT_OPT_INVERTY _("Invert Y Axis")
#define TEXT_OPT_CAMC _("Camera Centre Aggression")
#define TEXT_OPT_CAMP _("Camera Pan Level")
#define TEXT_OPT_CAMD _("Camera Deceleration")
#define TEXT_OPT_ENABLED _("Enabled")
#define TEXT_OPT_DISABLED _("Disabled")
#define TEXT_OPT_BUTTON1 _("[R]: Options")
#define TEXT_OPT_BUTTON2 _("[R]: Return")
#define TEXT_OPT_OPTIONS _("OPTIONS")
#define TEXT_OPT_CAMERA _("CAMERA")
#define TEXT_OPT_CONTROLS _("CONTROLS")
#define TEXT_OPT_VIDEO _("DISPLAY")
#define TEXT_OPT_AUDIO _("SOUND")
#define TEXT_OPT_HIGHLIGHT _("O")
#define TEXT_OPT_ANALOGUE _("Analogue Camera")
#define TEXT_OPT_MOUSE _("Mouse Look")
#define TEXT_OPT_TEXFILTER _("Texture Filtering")
#define TEXT_OPT_FSCREEN _("Fullscreen")
#define TEXT_OPT_NEAREST _("Nearest")
#define TEXT_OPT_LINEAR _("Linear")
#define TEXT_OPT_MVOLUME _("Master Volume")
#define TEXT_OPT_UNBOUND _("NONE")
#define TEXT_OPT_PRESSKEY _("...")
#define TEXT_BIND_A _("A Button")
#define TEXT_BIND_B _("B Button")
#define TEXT_BIND_START _("Start Button")
#define TEXT_BIND_L _("L Trigger")
#define TEXT_BIND_R _("R Trigger")
#define TEXT_BIND_Z _("Z Trigger")
#define TEXT_BIND_C_UP _("C-Up")
#define TEXT_BIND_C_DOWN _("C-Down")
#define TEXT_BIND_C_LEFT _("C-Left")
#define TEXT_BIND_C_RIGHT _("C-Right")
#define TEXT_BIND_UP _("Stick Up")
#define TEXT_BIND_DOWN _("Stick Down")
#define TEXT_BIND_LEFT _("Stick Left")
#define TEXT_BIND_RIGHT _("Stick Right")
/**
* Global Symbols
+107
View File
@@ -0,0 +1,107 @@
"""
This module generates a fragment of C code, in the style of that found in
the ``model.inc.c`` files, that encodes the geometry of the model specified
by the Wavefront OBJ file.
Example:
Specify the path to the ``.obj`` file and pipe the output of the script
into the desired destination ``.c`` file.
$ python obj2c.py left_hand_closed.obj > left_hand_closed.inc.c
This is a work in progress and it currently has some serious limitations:
* It only encodes the geometry information of the OBJ file, so no
texture mapping or any other info.
* The generated fragment of C code has to be manually pasted into the
desired source file. Make sure that the name of the Gfx structure
you're pasting matches the one you're replacing.
* It hasn't been properly tested.
"""
def parse(filename):
from os.path import basename, splitext
from re import sub
# WARNIGN!
# `gfx_name` is just a guess. You have to manually check that the name
# of the Gfx structure you're pasting matches the one you're replacing.
clean = lambda fn: sub('\W|^(?=\d)','_', fn)
gfx_name = clean(splitext(basename(filename))[0])
gfx_vertices = []
gfx_normals = []
vertex_to_normal = {}
gfx_v_count = 0
vtx_name = ''
vtx_faces = []
vtx_v_count = 0
output_upper = []
output_lower = [f'const Gfx {gfx_name}[] = {{']
with open(filename, 'r') as obj:
for line in obj:
line = line.strip()
if line.startswith('v '):
coordinates = [eval(x) for x in line.split()[1:4]]
gfx_vertices.append(coordinates)
vtx_v_count += 1
gfx_v_count += 1
if line.startswith('vn '):
coordinates = [eval(x) for x in line.split()[1:4]]
gfx_normals.append([_encode_normal(x) for x in coordinates])
if line.startswith('g '):
vtx_name = line.split()[1]
if line.startswith('f '):
pairs = [pair.split('//') for pair in line.split()[1:4]]
vtx_faces.append([int(pair[0]) for pair in pairs])
for (x, y) in pairs:
vertex_to_normal[int(x) - 1] = int(y) - 1
if line.startswith('# ') and line.endswith('faces'):
output_upper.append(f'static const Vtx {vtx_name}[] = {{')
for i in range(gfx_v_count - vtx_v_count, gfx_v_count):
v_string = '[{}, {}, {}]'.format(*gfx_vertices[i])
n_string = '[{}, {}, {}, 0x00]'.format(*gfx_normals[vertex_to_normal[i]])
combined = f' [[{v_string}, 0, [0, 0], {n_string}]],'
output_upper.append(combined.replace('[', '{').replace(']', '}'))
output_upper.append('};\n')
output_lower.append(f' gsSPVertex({vtx_name}, {vtx_v_count}, 0),')
n = len(vtx_faces)
correction = vtx_v_count - gfx_v_count - 1
for i in range(int(n / 2)):
f1 = [vtx_faces[2 * i][j] + correction for j in range(3)]
f2 = [vtx_faces[2 * i + 1][j] + correction for j in range(3)]
output_lower.append(' gsSP2Triangles({}, {}, {}, 0x0, {}, {}, {}, 0x0),'.format(*f1, *f2))
if n % 2 != 0:
f3 = [vtx_faces[-1][j] + correction for j in range(3)]
output_lower.append(' gsSP1Triangle({}, {}, {}, 0x0),'.format(*f3))
vtx_v_count = 0
vtx_faces = []
output_lower.append(' gsSPEndDisplayList(),')
output_lower.append('};')
for line in output_upper + output_lower:
print(line)
def _encode_normal(x):
x *= 127
if x <= 0: x += 255
return hex(int(x))
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('filename', help = 'filename of the .obj file to parse')
args = parser.parse_args()
parse(args.filename)
+32 -18
View File
@@ -1,4 +1,8 @@
#!/bin/bash
# Super Mario 64 PC on Raspberry Pi
# Find latest updates and code on https://www.github.com/sm64pc/sm64pc
# ToDo: Test on more Pi models with fresh Raspbian and allow existing src folders to be updated.
#
clear
echo "This script will assist with compiling Super Mario 64 on Raspbian 10"
echo "Note that accelerated OpenGL (vc4_drm) is required for maximum performance"
@@ -65,7 +69,8 @@ clear
echo "Super Mario 64 RPi Initial Setup"
if [[ $pi != 4 ]]
then #Dumb idea, but quick hack. We CANNOT enable VC4 for Pi4.
then #Dumb idea, but quick hack.
#We CANNOT enable VC4 for Pi4 as it uses VC6
inxinf=$(inxi -Gx)
echo "Checking for pre-enabled VC4 acceleration (inxi -Gx)"
@@ -119,24 +124,24 @@ fixmem=$(cat /boot/cmdline.txt | grep cma=128M)
else
echo ""
echo "Warning: VC4 enabled, but your Rasp Pi has 512MB or less RAM"
echo "Warning: VC4 enabled, but your RasPi has 512MB or less RAM"
echo "To ensure VC4_DRM and game compilation is succesful, video memory will be reduced"
echo "gpu_mem=48M (config.txt) | cma=128M (cmdline.txt) will be written to /boot "
echo ""
read -p "Fix mem? (Y/N): " fixmem
if [[ $fixmem =~ "Y" ]]
then
sudo sh -c "echo 'gpu_mem=48' >> /boot/config.txt"
sudo sh -c "echo 'cma=128M' >> /boot/cmdline.txt"
sync
echo "Wrote configuration changes to SD card."
sleep 2
else
echo ""
echo "Warning: Compilation freezes & errors are likely to occur on your Pi"
echo ""
sleep 3
if [[ $fixmem =~ "Y" ]]
then
sudo sh -c "echo 'gpu_mem=48' >> /boot/config.txt"
sudo sh -c "echo 'cma=128M' >> /boot/cmdline.txt"
sync
echo "Wrote configuration changes to SD card."
sleep 2
else
echo ""
echo "Warning: Compilation freezes & errors are likely to occur on your Pi"
echo ""
sleep 3
fi
fi
fi
@@ -149,11 +154,12 @@ read -p "Reboot to enable changes? (Y/N): " fixstart
if [[ $fixstart =~ "Y" ]]
then
echo ""
echo "Rebooting RasPi!"
echo "Rebooting RasPi in 4 seconds! Press Control-C to cancel."
sleep 4
sudo reboot
fi
fi
fi #This should never run on a Pi 4
fi
fi # "Should never run on a Pi 4" part ends here
#--------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@@ -182,7 +188,7 @@ fi
#-------------------------------------------------------------------------------------
clear
echo "Optional: Compile SDL2 with 'KMSDRM' for enhanced performance?"
echo "KMSDRM allows Super Mario 64 to be run without GUI/Desktop enabled on boot."
echo "KMSDRM allows Super Mario 64 to be run without GUI/Desktop (Xorg) enabled on boot"
echo ""
echo "Warning: Compile could take up to an hour on older Raspberry Pi models"
read -p "Proceed? (Y/N): " sdlcomp
@@ -293,7 +299,12 @@ echo ""
echo "Step 3. Compiling Super Mario 64 for the Raspberry Pi"
echo ""
echo "Warning: Super Mario 64 assets are required in order to compile"
if [[ $curdir ==1 ]]
then
echo "Assets will be extracted from "$PWD" "
else
echo "Assets will be extracted from $HOME/src/sm64pi/sm64pc/baserom.(us/eu/jp).z64 "
fi
if [[ $curdir == 1 ]]
then
@@ -312,12 +323,15 @@ else
echo ""
echo "Please satisfy this requirement before continuing."
echo "Exiting Super Mario 64 RasPi setup and compilation script."
echo ""
echo "Note: Re-run script once baserom(s) are inserted into"
if [[ $curdir == 1 ]]
then
echo $PWD
echo ""
else
echo ""
echo $HOME/src/sm64pi/sm64pc/
fi
+88 -75
View File
@@ -98,10 +98,10 @@ static void cur_obj_bhv_stack_push(uintptr_t bhvAddr) {
// Retrieve the last behavior command address from the object's behavior stack.
static uintptr_t cur_obj_bhv_stack_pop(void) {
uintptr_t bhvAddr;
gCurrentObject->bhvStackIndex--;
bhvAddr = gCurrentObject->bhvStack[gCurrentObject->bhvStackIndex];
return bhvAddr;
}
@@ -115,7 +115,7 @@ static void stub_behavior_script_1(void) {
// Usage: HIDE()
static s32 bhv_cmd_hide(void) {
cur_obj_hide();
gCurBhvCommand++;
return BHV_PROC_CONTINUE;
}
@@ -124,7 +124,7 @@ static s32 bhv_cmd_hide(void) {
// Usage: DISABLE_RENDERING()
static s32 bhv_cmd_disable_rendering(void) {
gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
gCurBhvCommand++;
return BHV_PROC_CONTINUE;
}
@@ -133,7 +133,15 @@ static s32 bhv_cmd_disable_rendering(void) {
// Usage: BILLBOARD()
static s32 bhv_cmd_billboard(void) {
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_BILLBOARD;
gCurBhvCommand++;
return BHV_PROC_CONTINUE;
}
// Command 0x
static s32 bhv_cmd_cylboard(void) {
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_CYLBOARD;
gCurBhvCommand++;
return BHV_PROC_CONTINUE;
}
@@ -142,9 +150,9 @@ static s32 bhv_cmd_billboard(void) {
// Usage: SET_MODEL(modelID)
static s32 bhv_cmd_set_model(void) {
s32 modelID = BHV_CMD_GET_2ND_S16(0);
gCurrentObject->header.gfx.sharedChild = gLoadedGraphNodes[modelID];
gCurBhvCommand++;
return BHV_PROC_CONTINUE;
}
@@ -216,7 +224,7 @@ static s32 bhv_cmd_break_unused(void) {
static s32 bhv_cmd_call(void) {
const BehaviorScript *jumpAddress;
gCurBhvCommand++;
cur_obj_bhv_stack_push(BHV_CMD_GET_ADDR_OF_CMD(1)); // Store address of the next bhv command in the stack.
jumpAddress = segmented_to_virtual(BHV_CMD_GET_VPTR(0));
gCurBhvCommand = jumpAddress; // Jump to the new address.
@@ -300,7 +308,7 @@ static s32 bhv_cmd_begin_repeat(void) {
static s32 bhv_cmd_end_repeat(void) {
u32 count = cur_obj_bhv_stack_pop(); // Retrieve loop count from the stack.
count--;
if (count != 0) {
gCurBhvCommand = (const BehaviorScript *) cur_obj_bhv_stack_pop(); // Jump back to the first command in the loop
// Save address and count to the stack again
@@ -320,7 +328,7 @@ static s32 bhv_cmd_end_repeat(void) {
static s32 bhv_cmd_end_repeat_continue(void) {
u32 count = cur_obj_bhv_stack_pop();
count--;
if (count != 0) {
gCurBhvCommand = (const BehaviorScript *) cur_obj_bhv_stack_pop(); // Jump back to the first command in the loop
// Save address and count to the stack again
@@ -546,7 +554,7 @@ static s32 bhv_cmd_drop_to_floor(void) {
f32 x = gCurrentObject->oPosX;
f32 y = gCurrentObject->oPosY;
f32 z = gCurrentObject->oPosZ;
f32 floor = find_floor_height(x, y + 200.0f, z);
gCurrentObject->oPosY = floor;
gCurrentObject->oMoveFlags |= OBJ_MOVE_ON_GROUND;
@@ -665,7 +673,7 @@ static s32 bhv_cmd_nop_4(void) {
static s32 bhv_cmd_begin(void) {
// These objects were likely very early objects, which is why this code is here
// instead of in the respective behavior scripts.
// Initiate the room if the object is a haunted chair or the mad piano.
if (cur_obj_has_behavior(bhvHauntedChair)) {
bhv_init_room();
@@ -696,7 +704,7 @@ static void bhv_cmd_set_int_random_from_table(s32 tableSize) {
}
cur_obj_set_int(field, table[(s32)(tableSize * random_float())]);
// Does not increment gCurBhvCommand or return a bhv status
}
@@ -719,7 +727,7 @@ static s32 bhv_cmd_set_int_random_from_table(void) {
// Set the field to a random entry of the table.
cur_obj_set_int(field, table[(s32)(tableSize * random_float())]);
gCurBhvCommand += (tableSize / 2) + 1;
return BHV_PROC_CONTINUE;
}
@@ -729,9 +737,9 @@ static s32 bhv_cmd_set_int_random_from_table(void) {
// Usage: LOAD_COLLISION_DATA(collisionData)
static s32 bhv_cmd_load_collision_data(void) {
u32 *collisionData = segmented_to_virtual(BHV_CMD_GET_VPTR(1));
gCurrentObject->collisionData = collisionData;
gCurBhvCommand += 2;
return BHV_PROC_CONTINUE;
}
@@ -742,7 +750,7 @@ static s32 bhv_cmd_set_home(void) {
gCurrentObject->oHomeX = gCurrentObject->oPosX;
gCurrentObject->oHomeY = gCurrentObject->oPosY;
gCurrentObject->oHomeZ = gCurrentObject->oPosZ;
gCurBhvCommand++;
return BHV_PROC_CONTINUE;
}
@@ -815,9 +823,9 @@ static s32 bhv_cmd_parent_bit_clear(void) {
// Usage: SPAWN_WATER_DROPLET(dropletParams)
static s32 bhv_cmd_spawn_water_droplet(void) {
struct WaterDropletParams *dropletParams = BHV_CMD_GET_VPTR(1);
spawn_water_droplet(gCurrentObject, dropletParams);
gCurBhvCommand += 2;
return BHV_PROC_CONTINUE;
}
@@ -842,62 +850,63 @@ void stub_behavior_script_2(void) {
typedef s32 (*BhvCommandProc)(void);
static BhvCommandProc BehaviorCmdTable[] = {
bhv_cmd_begin,
bhv_cmd_delay,
bhv_cmd_call,
bhv_cmd_return,
bhv_cmd_goto,
bhv_cmd_begin_repeat,
bhv_cmd_end_repeat,
bhv_cmd_end_repeat_continue,
bhv_cmd_begin_loop,
bhv_cmd_end_loop,
bhv_cmd_break,
bhv_cmd_break_unused,
bhv_cmd_call_native,
bhv_cmd_add_float,
bhv_cmd_set_float,
bhv_cmd_add_int,
bhv_cmd_set_int,
bhv_cmd_or_int,
bhv_cmd_bit_clear,
bhv_cmd_set_int_rand_rshift,
bhv_cmd_set_random_float,
bhv_cmd_set_random_int,
bhv_cmd_add_random_float,
bhv_cmd_add_int_rand_rshift,
bhv_cmd_nop_1,
bhv_cmd_nop_2,
bhv_cmd_nop_3,
bhv_cmd_set_model,
bhv_cmd_spawn_child,
bhv_cmd_deactivate,
bhv_cmd_drop_to_floor,
bhv_cmd_sum_float,
bhv_cmd_sum_int,
bhv_cmd_billboard,
bhv_cmd_hide,
bhv_cmd_set_hitbox,
bhv_cmd_nop_4,
bhv_cmd_delay_var,
bhv_cmd_begin_repeat_unused,
bhv_cmd_load_animations,
bhv_cmd_animate,
bhv_cmd_spawn_child_with_param,
bhv_cmd_load_collision_data,
bhv_cmd_set_hitbox_with_offset,
bhv_cmd_spawn_obj,
bhv_cmd_set_home,
bhv_cmd_set_hurtbox,
bhv_cmd_set_interact_type,
bhv_cmd_set_obj_physics,
bhv_cmd_set_interact_subtype,
bhv_cmd_scale,
bhv_cmd_parent_bit_clear,
bhv_cmd_animate_texture,
bhv_cmd_disable_rendering,
bhv_cmd_set_int_unused,
bhv_cmd_spawn_water_droplet,
bhv_cmd_begin, //00
bhv_cmd_delay, //01
bhv_cmd_call, //02
bhv_cmd_return, //03
bhv_cmd_goto, //04
bhv_cmd_begin_repeat, //05
bhv_cmd_end_repeat, //06
bhv_cmd_end_repeat_continue, //07
bhv_cmd_begin_loop, //08
bhv_cmd_end_loop, //09
bhv_cmd_break, //0A
bhv_cmd_break_unused, //0B
bhv_cmd_call_native, //0C
bhv_cmd_add_float, //0D
bhv_cmd_set_float, //0E
bhv_cmd_add_int, //0F
bhv_cmd_set_int, //10
bhv_cmd_or_int, //11
bhv_cmd_bit_clear, //12
bhv_cmd_set_int_rand_rshift, //13
bhv_cmd_set_random_float, //14
bhv_cmd_set_random_int, //15
bhv_cmd_add_random_float, //16
bhv_cmd_add_int_rand_rshift, //17
bhv_cmd_nop_1, //18
bhv_cmd_nop_2, //19
bhv_cmd_nop_3, //1A
bhv_cmd_set_model, //1B
bhv_cmd_spawn_child, //1C
bhv_cmd_deactivate, //1D
bhv_cmd_drop_to_floor, //1E
bhv_cmd_sum_float, //1F
bhv_cmd_sum_int, //20
bhv_cmd_billboard, //21
bhv_cmd_hide, //22
bhv_cmd_set_hitbox, //23
bhv_cmd_nop_4, //24
bhv_cmd_delay_var, //25
bhv_cmd_begin_repeat_unused, //26
bhv_cmd_load_animations, //27
bhv_cmd_animate, //28
bhv_cmd_spawn_child_with_param, //29
bhv_cmd_load_collision_data, //2A
bhv_cmd_set_hitbox_with_offset, //2B
bhv_cmd_spawn_obj, //2C
bhv_cmd_set_home, //2D
bhv_cmd_set_hurtbox, //2E
bhv_cmd_set_interact_type, //2F
bhv_cmd_set_obj_physics, //30
bhv_cmd_set_interact_subtype, //31
bhv_cmd_scale, //32
bhv_cmd_parent_bit_clear, //33
bhv_cmd_animate_texture, //34
bhv_cmd_disable_rendering, //35
bhv_cmd_set_int_unused, //36
bhv_cmd_spawn_water_droplet, //37
bhv_cmd_cylboard //38
};
// Execute the behavior script of the current object, process the object flags, and other miscellaneous code for updating objects.
@@ -987,11 +996,15 @@ void cur_obj_update(void) {
} else if ((objFlags & OBJ_FLAG_COMPUTE_DIST_TO_MARIO) && gCurrentObject->collisionData == NULL) {
if (!(objFlags & OBJ_FLAG_ACTIVE_FROM_AFAR)) {
// If the object has a render distance, check if it should be shown.
#ifndef NODRAWINGDISTANCE
if (distanceFromMario > gCurrentObject->oDrawingDistance) {
// Out of render distance, hide the object.
gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
gCurrentObject->activeFlags |= ACTIVE_FLAG_FAR_AWAY;
} else if (gCurrentObject->oHeldState == HELD_FREE) {
#else
if (distanceFromMario <= gCurrentObject->oDrawingDistance && gCurrentObject->oHeldState == HELD_FREE) {
#endif
// In render distance (and not being held), show the object.
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
gCurrentObject->activeFlags &= ~ACTIVE_FLAG_FAR_AWAY;
+2 -1
View File
@@ -30,12 +30,13 @@ extern Vec3s gVec3sOne;
#define GRAPH_RENDER_Z_BUFFER (1 << 3)
#define GRAPH_RENDER_INVISIBLE (1 << 4)
#define GRAPH_RENDER_HAS_ANIMATION (1 << 5)
#define GRAPH_RENDER_CYLBOARD (1 << 6)
// Whether the node type has a function pointer of type GraphNodeFunc
#define GRAPH_NODE_TYPE_FUNCTIONAL 0x100
// Type used for Bowser and an unused geo function in obj_behaviors.c
#define GRAPH_NODE_TYPE_400 0x400
#define GRAPH_NODE_TYPE_400 0x400
// The discriminant for different types of geo nodes
#define GRAPH_NODE_TYPE_ROOT 0x001
+25
View File
@@ -377,6 +377,31 @@ void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle) {
dest[3][3] = 1;
}
void mtxf_cylboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle) { //straight up mtxf_billboard but minus the dest[1][n] lines. transform for cylindrical billboards
dest[0][0] = coss(angle);
dest[0][1] = sins(angle);
dest[0][2] = 0;
dest[0][3] = 0;
dest[1][0] = mtx[1][0];
dest[1][1] = mtx[1][1];
dest[1][2] = mtx[1][2];
dest[1][3] = 0;
dest[2][0] = 0;
dest[2][1] = 0;
dest[2][2] = 1;
dest[2][3] = 0;
dest[3][0] =
mtx[0][0] * position[0] + mtx[1][0] * position[1] + mtx[2][0] * position[2] + mtx[3][0];
dest[3][1] =
mtx[0][1] * position[0] + mtx[1][1] * position[1] + mtx[2][1] * position[2] + mtx[3][1];
dest[3][2] =
mtx[0][2] * position[0] + mtx[1][2] * position[1] + mtx[2][2] * position[2] + mtx[3][2];
dest[3][3] = 1;
}
/**
* Set 'dest' to a transformation matrix that aligns an object with the terrain
* based on the normal. Used for enemies.
+1
View File
@@ -56,6 +56,7 @@ void mtxf_lookat(f32 mtx[4][4], Vec3f b, Vec3f c, s16 d);
void mtxf_rotate_zxy_and_translate(f32 mtx[4][4], Vec3f b, Vec3s c);
void mtxf_rotate_xyz_and_translate(f32 mtx[4][4], Vec3f b, Vec3s c);
void mtxf_billboard(f32 mtx1[4][4], f32 mtx2[4][4], Vec3f c, s16 d);
void mtxf_cylboard(f32 mtx1[4][4], f32 mtx2[4][4], Vec3f c, s16 d);
void mtxf_align_terrain_normal(f32 mtx[4][4], Vec3f b, Vec3f c, s16 d);
void mtxf_align_terrain_triangle(f32 mtx[4][4], Vec3f b, s16 c, f32 d);
void mtxf_mul(f32 dest[4][4], f32 a[4][4], f32 b[4][4]);
+4
View File
@@ -786,9 +786,13 @@ void load_object_collision_model(void) {
}
}
#ifndef NODRAWINGDISTANCE
if (marioDist < gCurrentObject->oDrawingDistance) {
#endif
gCurrentObject->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE;
#ifndef NODRAWINGDISTANCE
} else {
gCurrentObject->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
}
#endif
}
+4
View File
@@ -8,11 +8,15 @@
void bub_spawner_act_0(void) {
s32 i;
s32 sp18 = o->oBirdChirpChirpUnkF4;
#ifndef NODRAWINGDISTANCE
if (o->oDistanceToMario < 1500.0f) {
#endif
for (i = 0; i < sp18; i++)
spawn_object(o, MODEL_BUB, bhvBub);
o->oAction = 1;
#ifndef NODRAWINGDISTANCE
}
#endif
}
void bub_spawner_act_1(void) {
+6 -4
View File
@@ -17,9 +17,11 @@ void opened_cannon_act_0(void) {
cur_obj_enable_rendering();
cur_obj_become_tangible();
}
cur_obj_become_tangible();
cur_obj_enable_rendering();
if (o->oDistanceToMario < 500.0f) {
cur_obj_become_tangible();
cur_obj_enable_rendering();
//cur_obj_become_tangible();
//cur_obj_enable_rendering();
if (o->oInteractStatus & INT_STATUS_INTERACTED
&& (!(o->oInteractStatus
& INT_STATUS_TOUCHED_BOB_OMB))) // bob-omb explodes when it gets into a cannon
@@ -30,8 +32,8 @@ void opened_cannon_act_0(void) {
} else
o->oInteractStatus = 0;
} else {
cur_obj_become_intangible();
cur_obj_disable_rendering();
//cur_obj_become_intangible();
//cur_obj_disable_rendering();
o->oCannonUnk10C = 0;
}
}

Some files were not shown because too many files have changed in this diff Show More