mirror of
https://gitlab.com/shinovon/re3-symbian.git
synced 2026-05-22 17:47:20 +03:00
Symbian^3 port
This commit is contained in:
parent
77cdaaf97e
commit
3eb71f2cc5
106 changed files with 2098 additions and 745 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -1,3 +1,8 @@
|
|||
.cproject
|
||||
.project
|
||||
*.bat
|
||||
*.sis
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
|
|
|
|||
24
README.md
Normal file
24
README.md
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# re3-symbian
|
||||
|
||||
Work-in-progress port of GTA III for Symbian^3 using GLES 2.0
|
||||
|
||||
Based on re3, uses some code from [Dreamcast](https://gitlab.com/skmp/dca3-game) and [Vita](https://github.com/Rinnegatamante/librw-vita) ports.
|
||||
|
||||
## State
|
||||
|
||||
Currently compiles and runs normally on Nokia 700 (Belle FP1), and with texture glitches on Nokia N8 (Symbian Anna) and Nokia E7 (Belle Refresh).
|
||||
|
||||
See [TODO.md](/TODO.md) for more details on project state
|
||||
|
||||
## Building
|
||||
|
||||
Import bld.inf in Carbide.c++ with Symbian^3 or newer SDK, add PKG file to SIS Builder and build the project.
|
||||
|
||||
I use Carbide.c++ 3.2, Symbian Belle SDK with sbsv2 from QtSDK and RVCT 4.0, but it should also work with GCCE 4.4.1.
|
||||
|
||||
## License <small>(copied from original README)</small>
|
||||
|
||||
We don't feel like we're in a position to give this code a license.\
|
||||
The code should only be used for educational, documentation and modding purposes.\
|
||||
We do not encourage piracy or commercial use.\
|
||||
Please keep derivate work open source and give proper credit.
|
||||
15
TODO.md
Normal file
15
TODO.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
- [x] Make it compile
|
||||
- [x] Window implementation
|
||||
- [x] Fix shader compilation
|
||||
- [x] Downscale textures
|
||||
- [x] Optimize to always run 10+ fps
|
||||
- [x] Fit in 32MB VRAM to run on N8, E7, E6, etc.
|
||||
- [ ] Optimize to always run 20+ fps
|
||||
- [ ] Fix skinning shader (cutscene heads require it)
|
||||
- [ ] Use etc1 compression
|
||||
- [ ] Touch controls
|
||||
- [ ] Keyboard controls
|
||||
|
||||
S60v3 (?):
|
||||
- [ ] Backport to STLport v4
|
||||
- [ ] GLES 1.1 engine
|
||||
47
group/Icons_scalable_dc.mk
Normal file
47
group/Icons_scalable_dc.mk
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
ifeq (WINS,$(findstring WINS, $(PLATFORM)))
|
||||
ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z
|
||||
else
|
||||
ZDIR=$(EPOCROOT)epoc32\data\z
|
||||
endif
|
||||
|
||||
TARGETDIR=$(ZDIR)\resource\apps
|
||||
ICONTARGETFILENAME=$(TARGETDIR)\re3_icon.mif
|
||||
|
||||
ICONDIR=.
|
||||
|
||||
do_nothing :
|
||||
@rem do_nothing
|
||||
|
||||
MAKMAKE : do_nothing
|
||||
|
||||
BLD : do_nothing
|
||||
|
||||
CLEAN :
|
||||
@echo ...Deleting $(ICONTARGETFILENAME)
|
||||
del /q /f $(ICONTARGETFILENAME)
|
||||
|
||||
LIB : do_nothing
|
||||
|
||||
CLEANLIB : do_nothing
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# NOTE: if you have JUSTINTIME enabled for your S60 3rd FP1 or newer SDK
|
||||
# and this command crashes, consider adding "/X" to the command line.
|
||||
# See <http://forum.nokia.com/document/Forum_Nokia_Technical_Library_v1_35/contents/FNTL/Build_process_fails_at_mif_file_creation_in_S60_3rd_Ed_FP1_SDK.htm>
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
RESOURCE : $(ICONTARGETFILENAME)
|
||||
|
||||
$(ICONTARGETFILENAME) : $(ICONDIR)\qgn_menu_re3.svg
|
||||
mifconv $(ICONTARGETFILENAME) \
|
||||
/c32 $(ICONDIR)\qgn_menu_re3.svg
|
||||
|
||||
FREEZE : do_nothing
|
||||
|
||||
SAVESPACE : do_nothing
|
||||
|
||||
RELEASABLES :
|
||||
@echo $(ICONTARGETFILENAME)
|
||||
|
||||
FINAL : do_nothing
|
||||
|
||||
8
group/bld.inf
Normal file
8
group/bld.inf
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
PRJ_PLATFORMS
|
||||
DEFAULT ARMV6
|
||||
|
||||
PRJ_MMPFILES
|
||||
gnumakefile Icons_scalable_dc.mk
|
||||
gnumakefile shaders.mk
|
||||
librw.mmp
|
||||
re3.mmp
|
||||
28
group/common.mmh
Normal file
28
group/common.mmh
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
SYSTEMINCLUDE /epoc32/include
|
||||
SYSTEMINCLUDE /epoc32/include/stdapis/stlportv5
|
||||
SYSTEMINCLUDE /epoc32/include/stdapis
|
||||
SYSTEMINCLUDE /epoc32/include/mw
|
||||
SYSTEMINCLUDE /epoc32/include/platform
|
||||
SYSTEMINCLUDE /epoc32/include/platform/mw
|
||||
SYSTEMINCLUDE /epoc32/include/gles
|
||||
|
||||
USERINCLUDE .
|
||||
|
||||
MACRO LIBRW
|
||||
MACRO RW_GL3
|
||||
MACRO MASTER
|
||||
|
||||
DEBUGGABLE
|
||||
#ifdef _DEBUG
|
||||
SRCDBG
|
||||
#endif
|
||||
|
||||
OPTION ARMCC --gnu -Otime --diag_suppress 1,68,111,174,381,1293
|
||||
OPTION_REPLACE ARMCC --cpu 6
|
||||
OPTION_REPLACE ARMCC --fpu softvfp+vfpv2 --fpmode fast
|
||||
OPTION_REPLACE ARMCC -O2 -O3
|
||||
#ifdef ARMCC
|
||||
ALWAYS_BUILD_AS_ARM
|
||||
#endif
|
||||
|
||||
STDCPP
|
||||
28
group/librw.mmp
Normal file
28
group/librw.mmp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "common.mmh"
|
||||
|
||||
TARGET librw.lib
|
||||
TARGETTYPE lib
|
||||
|
||||
|
||||
USERINCLUDE ../vendor/librw
|
||||
USERINCLUDE ../vendor/librw/src
|
||||
|
||||
SOURCEPATH ../vendor/librw/src
|
||||
SOURCE anim.cpp base.cpp bmp.cpp camera.cpp charset.cpp clump.cpp
|
||||
SOURCEPATH ../vendor/librw/src/d3d
|
||||
SOURCE d3d.cpp d3d8.cpp d3d8matfx.cpp d3d8render.cpp d3d8skin.cpp d3d9.cpp d3d9matfx.cpp d3d9render.cpp d3d9skin.cpp d3ddevice.cpp d3dimmed.cpp d3drender.cpp xbox.cpp xboxmatfx.cpp xboxskin.cpp xboxvfmt.cpp
|
||||
SOURCEPATH ../vendor/librw/src
|
||||
SOURCE engine.cpp error.cpp frame.cpp geometry.cpp geoplg.cpp
|
||||
SOURCEPATH ../vendor/librw/src/gl
|
||||
SOURCE gl3.cpp gl3device.cpp gl3immed.cpp gl3matfx.cpp gl3pipe.cpp gl3raster.cpp gl3render.cpp gl3shader.cpp gl3skin.cpp wdgl.cpp
|
||||
SOURCEPATH ../vendor/librw/src
|
||||
SOURCE hanim.cpp image.cpp light.cpp
|
||||
SOURCEPATH ../vendor/librw/src/lodepng
|
||||
SOURCE lodepng.cpp
|
||||
SOURCEPATH ../vendor/librw/src
|
||||
SOURCE matfx.cpp pipeline.cpp plg.cpp png.cpp prim.cpp
|
||||
SOURCEPATH ../vendor/librw/src/ps2
|
||||
SOURCE pds.cpp ps2.cpp ps2device.cpp ps2matfx.cpp ps2raster.cpp ps2skin.cpp
|
||||
SOURCEPATH ../vendor/librw/src
|
||||
SOURCE raster.cpp render.cpp skin.cpp texture.cpp tga.cpp tristrip.cpp userdata.cpp uvanim.cpp world.cpp
|
||||
SOURCE assert.cpp
|
||||
10
group/qgn_menu_re3.svg
Normal file
10
group/qgn_menu_re3.svg
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="100%" height="100%" version="1.1" viewBox="0 0 270.93 270.93" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="matrix(2.1131 0 0 2.1131 14.956 63.501)" shape-rendering="auto">
|
||||
<path d="m0.918 0.918v53.183h17.043v2.3301c0 2.9545 1.3475 6.3843 3.9119 8.3323s5.5141 2.4334 8.5003 2.4334h46.367v-14.546c2.172 1.1348 4.5481 1.4506 6.9484 1.4506h17.043c2.9861 0 5.9358-0.48548 8.5002-2.4334 2.5644-1.948 3.9119-5.3773 3.9119-8.3318v-12.371c0-1.0941-0.25094-2.2962-0.70487-3.4572 0.45593-1.162 0.70487-2.3636 0.70487-3.453v-12.238c0-2.9682-1.2968-6.3966-3.8571-8.3907s-5.551-2.5079-8.555-2.5079h-16.912c-3.004 0-5.9921 0.51377-8.5524 2.5079-0.4348 0.33865-0.8304 0.72117-1.1922 1.1333-0.36176-0.41207-0.75739-0.79464-1.1922-1.1333-2.5603-1.9941-5.5505-2.5079-8.5545-2.5079h-17.043c-2.9767 0-5.9379 0.51343-8.4827 2.4629-2.5271-1.9438-5.4765-2.4629-8.4295-2.4629z" color="#000000" fill="#fff" stroke="#000" stroke-width="1.836"/>
|
||||
<g transform="translate(-51.548 -77.439)">
|
||||
<path transform="translate(-2.6458)" d="m84.567 139.07c-4.5624 0-6.8437-1.7328-6.8437-5.1986v-24.611c0-0.0877-0.04387-0.13161-0.13161-0.13161h-3.2244v16.846h-13.687v-42.049h23.887c4.5186 0 6.7779 1.7767 6.7779 5.3302v12.24c0 2.018-1.1187 3.1586-3.356 3.4218 2.2812 0.30709 3.4218 1.4696 3.4218 3.4876v20.07c0 0.0877 0.04387 0.13161 0.13161 0.13161h33.824v10.463zm-6.8437-44.484c0-0.08774-0.04387-0.13161-0.13161-0.13161h-3.2244v6.3172h3.2244c0.08774 0 0.13161-0.0439 0.13161-0.13161zm33.955 0c0-0.08774-0.0439-0.13161-0.13161-0.13161h-3.0928c-0.0877 0-0.13161 0.04387-0.13161 0.13161v5.8566h3.356zm-10.2 31.389c-4.5624 0-6.8437-1.7328-6.8437-5.1986v-31.52c0-3.5534 2.2812-5.3302 6.8437-5.3302h17.043c4.5624 0 6.8437 1.7767 6.8437 5.3302v20.992h-17.043v5.1328c0 0.0877 0.0439 0.13161 0.13161 0.13161h3.0928c0.0877 0 0.13161-0.0439 0.13161-0.13161v-2.5006h13.687v7.8965c0 3.4657-2.2812 5.1986-6.8437 5.1986z" color="#000000"/>
|
||||
<path d="m135.24 125.97c-4.5624 0-6.8437-1.7328-6.8437-5.1986v-7.8965h13.687v2.5006c0 0.0877 0.0439 0.13161 0.13161 0.13161h3.0928c0.0877 0 0.13161-0.0439 0.13161-0.13161v-6.1198c0-0.0877-0.0439-0.13161-0.13161-0.13161h-16.714v-8.3572h16.714c0.0877 0 0.13161-0.0439 0.13161-0.13161v-6.054c0-0.08774-0.0439-0.13161-0.13161-0.13161h-3.0928c-0.0877 0-0.13161 0.04387-0.13161 0.13161v2.4348h-13.556v-7.7649c0-3.5534 2.2812-5.3302 6.8437-5.3302h16.912c4.5624 0 6.8437 1.7767 6.8437 5.3302v12.24c0 2.018-1.1406 3.1586-3.4218 3.4218 2.2812 0.30709 3.4218 1.4696 3.4218 3.4876v12.371c0 3.4657-2.2812 5.1986-6.8437 5.1986z" fill="#c60000"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
113
group/re3.mmp
Normal file
113
group/re3.mmp
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
#include "common.mmh"
|
||||
|
||||
TARGET re3.exe
|
||||
TARGETTYPE exe
|
||||
UID 0 0xe0d67647
|
||||
|
||||
LIBRARY euser.lib
|
||||
LIBRARY libstdcppv5.lib
|
||||
LIBRARY libc.lib
|
||||
LIBRARY libm.lib
|
||||
LIBRARY libpthread.lib
|
||||
LIBRARY libglesv2.lib
|
||||
LIBRARY libegl.lib
|
||||
LIBRARY apparc.lib
|
||||
LIBRARY cone.lib
|
||||
LIBRARY eikcore.lib
|
||||
LIBRARY avkon.lib
|
||||
LIBRARY ws32.lib
|
||||
LIBRARY hal.lib
|
||||
|
||||
EPOCSTACKSIZE 0x14000
|
||||
EPOCHEAPSIZE 0x80000 0x4000000
|
||||
|
||||
STATICLIBRARY librw.lib
|
||||
|
||||
SYSTEMINCLUDE ../vendor/librw
|
||||
|
||||
SOURCEPATH .
|
||||
START RESOURCE re3.rss
|
||||
HEADER
|
||||
TARGETPATH \resource\apps
|
||||
LANG SC
|
||||
END
|
||||
|
||||
START RESOURCE re3_reg.rss
|
||||
TARGETPATH \private\10003a3f\import\apps
|
||||
END
|
||||
|
||||
CAPABILITY NetworkServices ReadUserData WriteUserData
|
||||
|
||||
USERINCLUDE ../src
|
||||
USERINCLUDE ../src/animation
|
||||
USERINCLUDE ../src/audio
|
||||
USERINCLUDE ../src/buildings
|
||||
USERINCLUDE ../src/collision
|
||||
USERINCLUDE ../src/control
|
||||
USERINCLUDE ../src/core
|
||||
USERINCLUDE ../src/entities
|
||||
USERINCLUDE ../src/extras
|
||||
USERINCLUDE ../src/fakerw
|
||||
USERINCLUDE ../src/math
|
||||
USERINCLUDE ../src/modelinfo
|
||||
USERINCLUDE ../src/objects
|
||||
USERINCLUDE ../src/peds
|
||||
USERINCLUDE ../src/renderer
|
||||
USERINCLUDE ../src/rw
|
||||
USERINCLUDE ../src/save
|
||||
USERINCLUDE ../src/skel
|
||||
USERINCLUDE ../src/text
|
||||
USERINCLUDE ../src/vehicles
|
||||
USERINCLUDE ../src/weapons
|
||||
|
||||
SOURCEPATH ../src/animation
|
||||
SOURCE AnimBlendAssocGroup.cpp AnimBlendAssociation.cpp AnimBlendClumpData.cpp AnimBlendHierarchy.cpp AnimBlendNode.cpp AnimBlendSequence.cpp AnimManager.cpp Bones.cpp CutsceneMgr.cpp FrameUpdate.cpp RpAnimBlend.cpp
|
||||
SOURCEPATH ../src/audio
|
||||
SOURCE AudioCollision.cpp AudioLogic.cpp AudioManager.cpp AudioScriptObject.cpp DMAudio.cpp MusicManager.cpp PolRadio.cpp
|
||||
SOURCEPATH ../src/audio/oal
|
||||
SOURCE aldlist.cpp channel.cpp oal_utils.cpp stream.cpp
|
||||
SOURCEPATH ../src/audio
|
||||
SOURCE sampman_miles.cpp sampman_null.cpp sampman_oal.cpp
|
||||
SOURCEPATH ../src/buildings
|
||||
SOURCE Building.cpp Treadable.cpp
|
||||
SOURCEPATH ../src/collision
|
||||
SOURCE ColBox.cpp ColLine.cpp ColModel.cpp ColPoint.cpp ColSphere.cpp ColTriangle.cpp Collision.cpp TempColModels.cpp VuCollision.cpp
|
||||
SOURCEPATH ../src/control
|
||||
SOURCE AutoPilot.cpp Bridge.cpp CarAI.cpp CarCtrl.cpp Curves.cpp Darkel.cpp GameLogic.cpp Garages.cpp NameGrid.cpp OnscreenTimer.cpp PathFind.cpp Phones.cpp Pickups.cpp PowerPoints.cpp Record.cpp Remote.cpp Replay.cpp Restart.cpp RoadBlocks.cpp SceneEdit.cpp Script.cpp Script2.cpp Script3.cpp Script4.cpp Script5.cpp Script6.cpp ScriptDebug.cpp TrafficLights.cpp
|
||||
SOURCEPATH ../src/core
|
||||
SOURCE Accident.cpp AnimViewer.cpp Cam.cpp Camera.cpp CdStream.cpp CdStreamPosix.cpp Clock.cpp ControllerConfig.cpp Debug.cpp Directory.cpp EventList.cpp FileLoader.cpp FileMgr.cpp Fire.cpp FrontEndControls.cpp Frontend.cpp Frontend_PS2.cpp Game.cpp IniFile.cpp Lists.cpp MenuScreens.cpp MenuScreensCustom.cpp Pad.cpp Placeable.cpp PlayerInfo.cpp Pools.cpp Profile.cpp Radar.cpp Range2D.cpp Range3D.cpp References.cpp Stats.cpp Streaming.cpp SurfaceTable.cpp TimeStep.cpp Timer.cpp User.cpp Wanted.cpp World.cpp ZoneCull.cpp Zones.cpp main.cpp obrstr.cpp re3.cpp timebars.cpp
|
||||
SOURCEPATH ../src/entities
|
||||
SOURCE Dummy.cpp Entity.cpp Physical.cpp
|
||||
SOURCEPATH ../src/extras
|
||||
SOURCE custompipes.cpp custompipes_d3d9.cpp custompipes_gl.cpp debugmenu.cpp frontendoption.cpp postfx.cpp screendroplets.cpp
|
||||
SOURCEPATH ../src/fakerw
|
||||
SOURCE fake.cpp
|
||||
SOURCEPATH ../src/math
|
||||
SOURCE Matrix.cpp Quaternion.cpp Rect.cpp Vector.cpp math.cpp
|
||||
SOURCEPATH ../src/modelinfo
|
||||
SOURCE BaseModelInfo.cpp ClumpModelInfo.cpp MloModelInfo.cpp ModelIndices.cpp ModelInfo.cpp PedModelInfo.cpp SimpleModelInfo.cpp TimeModelInfo.cpp VehicleModelInfo.cpp
|
||||
SOURCEPATH ../src/objects
|
||||
SOURCE CutsceneHead.cpp CutsceneObject.cpp DummyObject.cpp Object.cpp ObjectData.cpp ParticleObject.cpp Projectile.cpp
|
||||
SOURCEPATH ../src/peds
|
||||
SOURCE CivilianPed.cpp CopPed.cpp EmergencyPed.cpp Gangs.cpp Ped.cpp PedAI.cpp PedChat.cpp PedDebug.cpp PedFight.cpp PedIK.cpp PedPlacement.cpp PedRoutes.cpp PedType.cpp PlayerPed.cpp Population.cpp
|
||||
SOURCEPATH ../src/renderer
|
||||
SOURCE Antennas.cpp Clouds.cpp Console.cpp Coronas.cpp Credits.cpp Draw.cpp Fluff.cpp Font.cpp Glass.cpp Hud.cpp Instance.cpp Lines.cpp MBlur.cpp Particle.cpp ParticleMgr.cpp PlayerSkin.cpp PointLights.cpp RenderBuffer.cpp Renderer.cpp Rubbish.cpp Shadows.cpp Skidmarks.cpp SpecialFX.cpp Sprite.cpp Sprite2d.cpp TexList.cpp Timecycle.cpp WaterCannon.cpp WaterLevel.cpp Weather.cpp
|
||||
SOURCEPATH ../src/rw
|
||||
SOURCE ClumpRead.cpp Lights.cpp MemoryHeap.cpp MemoryMgr.cpp NodeName.cpp RwHelper.cpp RwMatFX.cpp RwPS2AlphaTest.cpp TexRead.cpp TexturePools.cpp TxdStore.cpp VisibilityPlugins.cpp
|
||||
SOURCEPATH ../src/save
|
||||
SOURCE Date.cpp GenericGameStorage.cpp MemoryCard.cpp PCSave.cpp
|
||||
SOURCEPATH ../src/skel
|
||||
SOURCE crossplatform.cpp events.cpp
|
||||
SOURCEPATH ../src/skel
|
||||
SOURCE skeleton.cpp
|
||||
SOURCEPATH ../src/skel/symbian
|
||||
SOURCE symbian.cpp
|
||||
SOURCEPATH ../src/text
|
||||
SOURCE Messages.cpp Pager.cpp Text.cpp
|
||||
SOURCEPATH ../src/vehicles
|
||||
SOURCE Automobile.cpp Boat.cpp CarGen.cpp Cranes.cpp DamageManager.cpp Door.cpp Floater.cpp HandlingMgr.cpp Heli.cpp Plane.cpp Train.cpp Transmission.cpp Vehicle.cpp
|
||||
SOURCEPATH ../src/weapons
|
||||
SOURCE BulletInfo.cpp Explosion.cpp ProjectileInfo.cpp ShotInfo.cpp Weapon.cpp WeaponEffects.cpp WeaponInfo.cpp
|
||||
|
||||
SOURCEPATH ../vendor/librw/src
|
||||
SOURCE assert.cpp
|
||||
78
group/re3.rss
Normal file
78
group/re3.rss
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
NAME GTA3
|
||||
|
||||
#include <eikon.rh>
|
||||
#include <avkon.rsg>
|
||||
#include <avkon.rh>
|
||||
#include <avkon.mbg>
|
||||
#include <appinfo.rh>
|
||||
|
||||
RESOURCE RSS_SIGNATURE { }
|
||||
RESOURCE TBUF { buf="gta3"; }
|
||||
|
||||
RESOURCE EIK_APP_INFO { }
|
||||
|
||||
rls_string STRING_app_caption_string "GTA III"
|
||||
rls_string STRING_app_short_caption_string "GTA III"
|
||||
|
||||
RESOURCE LOCALISABLE_APP_INFO r_RE3_localisable_app_info
|
||||
{
|
||||
short_caption = STRING_app_short_caption_string;
|
||||
caption_and_icon = CAPTION_AND_ICON_INFO
|
||||
{
|
||||
caption = STRING_app_caption_string;
|
||||
number_of_icons = 1;
|
||||
icon_file = "\\resource\\apps\\re3_icon.mif";
|
||||
};
|
||||
}
|
||||
|
||||
RESOURCE DIALOG r_query_dialog
|
||||
{
|
||||
flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
|
||||
buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
|
||||
items =
|
||||
{
|
||||
DLG_LINE
|
||||
{
|
||||
type = EAknCtPopupHeadingPane;
|
||||
id = EAknMessageQueryHeaderId;
|
||||
itemflags = EEikDlgItemNonFocusing;
|
||||
control = AVKON_HEADING
|
||||
{
|
||||
};
|
||||
},
|
||||
DLG_LINE
|
||||
{
|
||||
type = EAknCtMessageQuery;
|
||||
id = EAknMessageQueryContentId;
|
||||
control = AVKON_MESSAGE_QUERY
|
||||
{
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
RESOURCE DIALOG r_text_query
|
||||
{
|
||||
flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | EEikDialogFlagCbaButtons;
|
||||
buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
|
||||
items =
|
||||
{
|
||||
DLG_LINE
|
||||
{
|
||||
type = EAknCtQuery;
|
||||
id = EGeneralQuery;
|
||||
control = AVKON_DATA_QUERY
|
||||
{
|
||||
layout = EDataLayout;
|
||||
control = EDWIN
|
||||
{
|
||||
width = 128;
|
||||
lines = 1;
|
||||
maxlength = 510;
|
||||
default_case = EAknEditorLowerCase;
|
||||
allowed_case_modes = EAknEditorAllCaseModes;
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
17
group/re3_reg.rss
Normal file
17
group/re3_reg.rss
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include <appinfo.rh>
|
||||
#include <re3.rsg>
|
||||
|
||||
UID2 KUidAppRegistrationResourceFile
|
||||
UID3 0xe0d67647
|
||||
|
||||
RESOURCE APP_REGISTRATION_INFO
|
||||
{
|
||||
app_file="re3";
|
||||
|
||||
localisable_resource_file="\\resource\\apps\\re3";
|
||||
localisable_resource_id=R_RE3_LOCALISABLE_APP_INFO;
|
||||
|
||||
embeddability=KAppNotEmbeddable;
|
||||
newfile=KAppDoesNotSupportNewFile;
|
||||
}
|
||||
|
||||
26
group/shaders.mk
Normal file
26
group/shaders.mk
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
MAKE = G:\Progs\MinGW\bin\mingw32-make
|
||||
|
||||
do_nothing :
|
||||
@rem do_nothing
|
||||
|
||||
MAKMAKE: do_nothing
|
||||
|
||||
BLD: do_nothing
|
||||
|
||||
CLEAN:
|
||||
rm ../vendor/librw/src/gl/shaders/*.inc
|
||||
|
||||
LIB: do_nothing
|
||||
|
||||
CLEANLIB: do_nothing
|
||||
|
||||
RESOURCE:
|
||||
$(MAKE) -C ../vendor/librw/src/gl/shaders/ -f Makefile all
|
||||
|
||||
FREEZE: do_nothing
|
||||
|
||||
SAVESPACE: do_nothing
|
||||
|
||||
RELEASABLES: do_nothing
|
||||
|
||||
FINAL: do_nothing
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
sodipodi:docname="re3_final.svg"
|
||||
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
|
||||
id="svg8"
|
||||
version="1.1"
|
||||
viewBox="0 0 270.93331 270.93334"
|
||||
height="1024"
|
||||
width="1024"
|
||||
inkscape:export-filename="/home/hazelnot/Design/re3_red.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-height="1359"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:snap-page="true"
|
||||
inkscape:showpageshadow="false"
|
||||
inkscape:pagecheckerboard="false"
|
||||
showgrid="false"
|
||||
inkscape:document-rotation="0"
|
||||
inkscape:current-layer="g837"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:cy="544.84615"
|
||||
inkscape:cx="415.73725"
|
||||
inkscape:zoom="0.7"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0"
|
||||
borderopacity="1"
|
||||
bordercolor="#000000"
|
||||
pagecolor="#606060"
|
||||
id="base"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
lock-margins="false"
|
||||
units="px" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="g837"
|
||||
transform="matrix(2.1130708,0,0,2.1130708,14.956432,63.50059)">
|
||||
<path
|
||||
id="path1450"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:1.25;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.836;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
|
||||
d="M 0.91799998,0.91799998 V 54.101316 H 17.960888 v 2.33009 c 0,2.95453 1.347497,6.384348 3.911905,8.332308 2.564408,1.947971 5.514112,2.433445 8.500257,2.433445 h 46.367194 v -14.5464 c 2.171993,1.134845 4.548071,1.450557 6.948413,1.450557 h 17.042893 c 2.98614,0 5.93584,-0.485482 8.50025,-2.433442 2.5644,-1.94796 3.91191,-5.377273 3.91191,-8.331793 V 30.964744 c 0,-1.094128 -0.25094,-2.296243 -0.70487,-3.457153 0.45593,-1.16196 0.70487,-2.363609 0.70487,-3.453019 V 11.81656 c 0,-2.9682265 -1.29681,-6.3966108 -3.85713,-8.3907028 -2.56031,-1.9940909 -5.55104,-2.50785722 -8.55503,-2.50785722 H 83.819398 c -3.003989,0 -5.99213,0.51376632 -8.55245,2.50785722 C 74.832145,3.7645045 74.436551,4.1470248 74.074773,4.5591214 73.713016,4.1470532 73.317379,3.7644843 72.8826,3.4258572 70.322288,1.4317663 67.332073,0.91799998 64.328081,0.91799998 H 47.285195 c -2.976748,0 -5.937909,0.51342982 -8.482687,2.46289872 C 36.275393,1.4370808 33.325985,0.91799998 30.37305,0.91799998 Z"
|
||||
inkscape:label="Border" />
|
||||
<g
|
||||
id="g1475"
|
||||
inkscape:label="Text"
|
||||
style="display:inline"
|
||||
transform="translate(-51.547657,-77.439255)">
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:1.25;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:11.136;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
|
||||
d="m 84.566726,139.06892 c -4.562445,0 -6.843668,-1.73285 -6.843668,-5.19856 v -24.61088 c 0,-0.0877 -0.04387,-0.13161 -0.131609,-0.13161 h -3.22442 v 16.84595 H 60.679694 V 83.92475 h 23.887032 c 4.518575,0 6.777863,1.776721 6.777863,5.330164 v 12.239636 c 0,2.01801 -1.118676,3.15862 -3.356029,3.42183 2.281223,0.30709 3.421834,1.46964 3.421834,3.48764 v 20.07037 c 0,0.0877 0.04387,0.13161 0.131609,0.13161 h 33.823507 v 10.46292 z M 77.723058,94.585079 c 0,-0.08774 -0.04387,-0.131609 -0.131609,-0.131609 h -3.22442 v 6.31723 h 3.22442 c 0.08774,0 0.131609,-0.0439 0.131609,-0.13161 z m 33.955122,0 c 0,-0.08774 -0.0439,-0.131609 -0.13161,-0.131609 h -3.09281 c -0.0877,0 -0.13161,0.04387 -0.13161,0.131609 v 5.856601 h 3.35603 z m -10.1997,31.388741 c -4.562444,0 -6.843666,-1.73285 -6.843666,-5.19855 V 89.254914 c 0,-3.553443 2.281222,-5.330164 6.843666,-5.330164 h 17.04337 c 4.56244,0 6.84366,1.776721 6.84366,5.330164 v 20.991636 h -17.04336 v 5.13275 c 0,0.0877 0.0439,0.13161 0.13161,0.13161 h 3.09281 c 0.0877,0 0.13161,-0.0439 0.13161,-0.13161 v -2.50057 h 13.68733 v 7.89654 c 0,3.4657 -2.28122,5.19855 -6.84366,5.19855 z"
|
||||
id="path1452"
|
||||
transform="translate(-2.6458322)"
|
||||
inkscape:label="re" />
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:1.25;font-family:Pricedown;-inkscape-font-specification:Pricedown;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#c60000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:11.136;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
|
||||
d="m 135.23613,125.97382 c -4.56245,0 -6.84367,-1.73285 -6.84367,-5.19855 v -7.89654 h 13.68733 v 2.50057 c 0,0.0877 0.0439,0.13161 0.13161,0.13161 h 3.09281 c 0.0877,0 0.13161,-0.0439 0.13161,-0.13161 v -6.11982 c 0,-0.0877 -0.0439,-0.13161 -0.13161,-0.13161 h -16.71434 v -8.35717 h 16.71434 c 0.0877,0 0.13161,-0.0439 0.13161,-0.13161 v -6.054011 c 0,-0.08774 -0.0439,-0.131609 -0.13161,-0.131609 h -3.09281 c -0.0877,0 -0.13161,0.04387 -0.13161,0.131609 v 2.434766 h -13.55572 v -7.764931 c 0,-3.553443 2.28122,-5.330164 6.84366,-5.330164 h 16.91176 c 4.56245,0 6.84367,1.776721 6.84367,5.330164 v 12.239636 c 0,2.01801 -1.14061,3.15862 -3.42184,3.42183 2.28123,0.30709 3.42184,1.46964 3.42184,3.48764 v 12.37125 c 0,3.4657 -2.28122,5.19855 -6.84367,5.19855 z"
|
||||
id="path1458"
|
||||
inkscape:label="3" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 9.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB |
11
sis/re3.pkg
Normal file
11
sis/re3.pkg
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#{"GTA III"},(0xe0d67647),1,0,0
|
||||
|
||||
[0x20022E6D], 0, 0, 0, {"S60ProductID"}
|
||||
|
||||
%{"nnproject"}
|
||||
:"nnproject"
|
||||
|
||||
"$(EPOCROOT)epoc32\release\$(PLATFORM)\$(TARGET)\re3.exe"-"!:\sys\bin\re3.exe"
|
||||
"$(EPOCROOT)\epoc32\data\z\private\10003a3f\import\apps\re3_reg.rsc" - "!:\private\10003a3f\import\apps\re3_reg.rsc"
|
||||
"$(EPOCROOT)\epoc32\data\z\resource\apps\re3.rsc" - "!:\resource\apps\re3.rsc"
|
||||
"$(EPOCROOT)\epoc32\data\z\resource\apps\re3_icon.mif" - "!:\resource\apps\re3_icon.mif"
|
||||
|
|
@ -29,11 +29,11 @@ void
|
|||
CColModel::RemoveCollisionVolumes(void)
|
||||
{
|
||||
if(ownsCollisionVolumes){
|
||||
RwFree(spheres);
|
||||
RwFree(lines);
|
||||
RwFree(boxes);
|
||||
RwFree(vertices);
|
||||
RwFree(triangles);
|
||||
if (spheres) RwFree(spheres);
|
||||
if (lines) RwFree(lines);
|
||||
if (boxes) RwFree(boxes);
|
||||
if (vertices) RwFree(vertices);
|
||||
if (triangles) RwFree(triangles);
|
||||
}
|
||||
numSpheres = 0;
|
||||
numLines = 0;
|
||||
|
|
@ -63,7 +63,7 @@ CColModel::CalculateTrianglePlanes(void)
|
|||
void
|
||||
CColModel::RemoveTrianglePlanes(void)
|
||||
{
|
||||
RwFree(trianglePlanes);
|
||||
if (trianglePlanes) RwFree(trianglePlanes);
|
||||
trianglePlanes = nil;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ class CReplay
|
|||
uint8 hours;
|
||||
uint8 minutes;
|
||||
private:
|
||||
uint8 __align;
|
||||
uint8 __align1;
|
||||
};
|
||||
VALIDATE_SIZE(tClockPacket, 4);
|
||||
|
||||
|
|
@ -148,7 +148,9 @@ class CReplay
|
|||
uint16 mi;
|
||||
uint8 pedtype;
|
||||
private:
|
||||
uint8 __align[3];
|
||||
uint8 __align1;
|
||||
uint8 __align2;
|
||||
uint8 __align3;
|
||||
};
|
||||
VALIDATE_SIZE(tPedHeaderPacket, 8);
|
||||
|
||||
|
|
@ -167,7 +169,9 @@ class CReplay
|
|||
{
|
||||
uint8 type;
|
||||
private:
|
||||
uint8 __align[3];
|
||||
uint8 __align1;
|
||||
uint8 __align2;
|
||||
uint8 __align3;
|
||||
};
|
||||
VALIDATE_SIZE(tEndOfFramePacket, 4);
|
||||
|
||||
|
|
|
|||
|
|
@ -3813,7 +3813,9 @@ CCam::Process_Debug(const CVector&, float, float, float)
|
|||
Front.Normalise();
|
||||
Source = Source + Front*Speed;
|
||||
|
||||
Up = CVector{ 0.0f, 0.0f, 1.0f };
|
||||
Up.x = 0.0f;
|
||||
Up.y = 0.0f;
|
||||
Up.z = 1.0f;
|
||||
CVector Right = CrossProduct(Front, Up);
|
||||
Up = CrossProduct(Right, Front);
|
||||
Source = Source + Up*PanSpeedY + Right*PanSpeedX;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#ifndef __SYMBIAN32__
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -38,7 +40,8 @@ re3_sem_open(void)
|
|||
{
|
||||
sem_t* sem = (sem_t*)malloc(sizeof(sem_t));
|
||||
if (sem_init(sem, 0, 1) == -1) {
|
||||
sem = SEM_FAILED;
|
||||
free(sem);
|
||||
sem = (sem_t*)SEM_FAILED;
|
||||
}
|
||||
|
||||
return sem;
|
||||
|
|
@ -135,7 +138,7 @@ CdStreamInitThread(void)
|
|||
gCdStreamSema = RE3_SEM_OPEN("/semaphore_cd_stream");
|
||||
|
||||
|
||||
if (gCdStreamSema == SEM_FAILED) {
|
||||
if (gCdStreamSema == (sem_t*)SEM_FAILED) {
|
||||
CDTRACE("failed to create stream semaphore");
|
||||
ASSERT(0);
|
||||
return;
|
||||
|
|
@ -148,7 +151,7 @@ CdStreamInitThread(void)
|
|||
{
|
||||
gpReadInfo[i].pDoneSemaphore = RE3_SEM_OPEN("/semaphore_done%d", i);
|
||||
|
||||
if (gpReadInfo[i].pDoneSemaphore == SEM_FAILED)
|
||||
if (gpReadInfo[i].pDoneSemaphore == (sem_t*)SEM_FAILED)
|
||||
{
|
||||
CDTRACE("failed to create sync semaphore");
|
||||
ASSERT(0);
|
||||
|
|
@ -158,7 +161,7 @@ CdStreamInitThread(void)
|
|||
#ifdef ONE_THREAD_PER_CHANNEL
|
||||
gpReadInfo[i].pStartSemaphore = RE3_SEM_OPEN("/semaphore_start%d", i);
|
||||
|
||||
if (gpReadInfo[i].pStartSemaphore == SEM_FAILED)
|
||||
if (gpReadInfo[i].pStartSemaphore == (sem_t*)SEM_FAILED)
|
||||
{
|
||||
CDTRACE("failed to create start semaphore");
|
||||
ASSERT(0);
|
||||
|
|
@ -198,6 +201,7 @@ CdStreamInitThread(void)
|
|||
void
|
||||
CdStreamInit(int32 numChannels)
|
||||
{
|
||||
#if !defined __SYMBIAN32__
|
||||
struct statvfs fsInfo;
|
||||
|
||||
if((statvfs("models/gta3.img", &fsInfo)) < 0)
|
||||
|
|
@ -206,6 +210,7 @@ CdStreamInit(int32 numChannels)
|
|||
ASSERT(0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
_gdwCdStreamFlags = O_RDONLY | O_NOATIME;
|
||||
#else
|
||||
|
|
@ -219,8 +224,10 @@ CdStreamInit(int32 numChannels)
|
|||
debug("Using no buffered loading for streaming\n");
|
||||
}
|
||||
*/
|
||||
#if !defined __SYMBIAN32__
|
||||
void *pBuffer = (void *)RwMallocAlign(CDSTREAM_SECTOR_SIZE, (RwUInt32)fsInfo.f_bsize);
|
||||
ASSERT( pBuffer != nil );
|
||||
#endif
|
||||
|
||||
gNumImages = 0;
|
||||
|
||||
|
|
@ -234,8 +241,10 @@ CdStreamInit(int32 numChannels)
|
|||
|
||||
CdStreamInitThread();
|
||||
|
||||
#if !defined __SYMBIAN32__
|
||||
ASSERT( pBuffer != nil );
|
||||
RwFreeAlign(pBuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32
|
||||
|
|
@ -531,6 +540,7 @@ void *CdStreamThread(void *param)
|
|||
free(gpReadInfo);
|
||||
gpReadInfo = nil;
|
||||
pthread_exit(nil);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ void CControllerConfigManager::MakeControllerActionsBlank()
|
|||
|
||||
#ifdef RW_GL3
|
||||
int MapIdToButtonId(int mapId) {
|
||||
#ifdef __SYMBIAN32__
|
||||
// TODO
|
||||
return mapId + 1;
|
||||
#else
|
||||
switch (mapId) {
|
||||
case GLFW_GAMEPAD_BUTTON_A: // Cross
|
||||
return 2;
|
||||
|
|
@ -82,6 +86,7 @@ int MapIdToButtonId(int mapId) {
|
|||
default:
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2771,8 +2776,10 @@ void CControllerConfigManager::UpdateJoyButtonState(int32 padnumber)
|
|||
#elif defined RW_GL3
|
||||
if (m_NewState.isGamepad) {
|
||||
for (int32 i = 0; i < MAX_BUTTONS; i++) {
|
||||
#if !defined __SYMBIAN32__
|
||||
if (i == GLFW_GAMEPAD_BUTTON_GUIDE)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
m_aButtonStates[MapIdToButtonId(i)-1] = m_NewState.mappedButtons[i];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1447,9 +1447,9 @@ CFileLoader::Load2dEffect(const char *line)
|
|||
sscanf(line, "%d %f %f %f %d %d %d %d %d %d %f %f %f %f",
|
||||
&id, &x, &y, &z, &r, &g, &b, &a, &type,
|
||||
&effect->particle.particleType,
|
||||
&effect->particle.dir.x,
|
||||
&effect->particle.dir.y,
|
||||
&effect->particle.dir.z,
|
||||
&effect->particle.dirX,
|
||||
&effect->particle.dirY,
|
||||
&effect->particle.dirZ,
|
||||
&effect->particle.scale);
|
||||
break;
|
||||
|
||||
|
|
@ -1457,9 +1457,9 @@ CFileLoader::Load2dEffect(const char *line)
|
|||
sscanf(line, "%d %f %f %f %d %d %d %d %d %d %f %f %f %d",
|
||||
&id, &x, &y, &z, &r, &g, &b, &a, &type,
|
||||
&flags,
|
||||
&effect->attractor.dir.x,
|
||||
&effect->attractor.dir.y,
|
||||
&effect->attractor.dir.z,
|
||||
&effect->attractor.dirX,
|
||||
&effect->attractor.dirY,
|
||||
&effect->attractor.dirZ,
|
||||
&probability);
|
||||
effect->attractor.type = flags;
|
||||
#ifdef FIX_BUGS
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "Messages.h"
|
||||
#include "FileLoader.h"
|
||||
#include "frontendoption.h"
|
||||
#include "inifile.h"
|
||||
|
||||
// Game has colors inlined in code.
|
||||
// For easier modification we collect them here:
|
||||
|
|
@ -802,6 +803,8 @@ CMenuManager::CentreMousePointer()
|
|||
Point.y = SCREEN_HEIGHT / 2;
|
||||
ClientToScreen(PSGLOBAL(window), &Point);
|
||||
SetCursorPos(Point.x, Point.y);
|
||||
#elif defined __SYMBIAN32__
|
||||
// TODO
|
||||
#elif defined RW_GL3
|
||||
glfwSetCursorPos(PSGLOBAL(window), SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
|
||||
#endif
|
||||
|
|
@ -908,10 +911,10 @@ CMenuManager::CheckSliderMovement(int value)
|
|||
break;
|
||||
case MENUACTION_DRAWDIST:
|
||||
if(value > 0)
|
||||
m_PrefsLOD += ((1.8f - 0.8f) / MENUSLIDER_LOGICAL_BARS);
|
||||
m_PrefsLOD += ((1.8f - 0.4f) / MENUSLIDER_LOGICAL_BARS);
|
||||
else
|
||||
m_PrefsLOD -= ((1.8f - 0.8f) / MENUSLIDER_LOGICAL_BARS);
|
||||
m_PrefsLOD = Clamp(m_PrefsLOD, 0.8f, 1.8f);
|
||||
m_PrefsLOD -= ((1.8f - 0.4f) / MENUSLIDER_LOGICAL_BARS);
|
||||
m_PrefsLOD = Clamp(m_PrefsLOD, 0.4f, 1.8f);
|
||||
CRenderer::ms_lodDistScale = m_PrefsLOD;
|
||||
break;
|
||||
case MENUACTION_MUSICVOLUME:
|
||||
|
|
@ -1807,7 +1810,7 @@ CMenuManager::Draw()
|
|||
ProcessSlider(m_PrefsBrightness / 512.0f, HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH);
|
||||
break;
|
||||
case MENUACTION_DRAWDIST:
|
||||
ProcessSlider((m_PrefsLOD - 0.8f) * 1.0f, HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH);
|
||||
ProcessSlider((m_PrefsLOD - 0.4f) * 1.0f, HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH);
|
||||
break;
|
||||
case MENUACTION_MUSICVOLUME:
|
||||
ProcessSlider(m_PrefsMusicVolume / 128.0f, HOVEROPTION_INCREASE_MUSICVOLUME, HOVEROPTION_DECREASE_MUSICVOLUME, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH);
|
||||
|
|
@ -3752,6 +3755,7 @@ CMenuManager::LoadSettings()
|
|||
#else
|
||||
CMBlur::BlurOn = true;
|
||||
#endif
|
||||
CMBlur::BlurOn = false;
|
||||
MousePointerStateHelper.bInvertVertically = true;
|
||||
|
||||
// 50 is silly
|
||||
|
|
@ -5099,9 +5103,11 @@ CMenuManager::ProcessButtonPresses(void)
|
|||
m_PrefsFrameLimiter = true;
|
||||
m_PrefsBrightness = 256;
|
||||
m_PrefsVsyncDisp = true;
|
||||
m_PrefsLOD = 1.2f;
|
||||
m_PrefsLOD = 0.7f;
|
||||
m_PrefsVsync = true;
|
||||
CRenderer::ms_lodDistScale = 1.2f;
|
||||
CRenderer::ms_lodDistScale = 0.7f;
|
||||
CIniFile::PedNumberMultiplier = 0.6f;
|
||||
CIniFile::CarNumberMultiplier = 0.6f;
|
||||
#ifdef ASPECT_RATIO_SCALE
|
||||
m_PrefsUseWideScreen = AR_AUTO;
|
||||
#else
|
||||
|
|
@ -5139,6 +5145,8 @@ CMenuManager::ProcessButtonPresses(void)
|
|||
PSGLOBAL(joy1)->GetCapabilities(&devCaps);
|
||||
ControlsManager.InitDefaultControlConfigJoyPad(devCaps.dwButtons);
|
||||
}
|
||||
#elif defined __SYMBIAN32__
|
||||
// TODO
|
||||
#else
|
||||
if (PSGLOBAL(joy1id) != -1 && glfwJoystickPresent(PSGLOBAL(joy1id))) {
|
||||
int count;
|
||||
|
|
@ -5649,7 +5657,7 @@ void
|
|||
CMenuManager::ShutdownJustMenu()
|
||||
{
|
||||
// In case we're windowed, keep mouse centered while in game. Done in main.cpp in other conditions.
|
||||
#if defined(RW_GL3) && defined(IMPROVED_VIDEOMODE)
|
||||
#if defined(RW_GL3) && defined(IMPROVED_VIDEOMODE) && !defined(__SYMBIAN32__)
|
||||
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
#endif
|
||||
m_bMenuActive = false;
|
||||
|
|
@ -5758,7 +5766,7 @@ CMenuManager::SwitchMenuOnAndOff()
|
|||
m_bMenuStateChanged = true;
|
||||
|
||||
// In case we're windowed, keep mouse centered while in game. Done in main.cpp in other conditions.
|
||||
#if defined(RW_GL3) && defined(IMPROVED_VIDEOMODE)
|
||||
#if defined(RW_GL3) && defined(IMPROVED_VIDEOMODE) && !defined(__SYMBIAN32__)
|
||||
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, m_bMenuActive && m_nPrefsWindowed ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_DISABLED);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -667,6 +667,13 @@ public:
|
|||
static int8 m_nPrefsMSAALevel;
|
||||
static int8 m_nDisplayMSAALevel;
|
||||
#endif
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#undef LANGUAGE_FRENCH
|
||||
#undef LANGUAGE_GERMAN
|
||||
#undef LANGUAGE_ITALIAN
|
||||
#undef LANGUAGE_SPANISH
|
||||
#endif
|
||||
|
||||
enum LANGUAGE
|
||||
{
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ CGame::InitialiseRenderWare(void)
|
|||
return (false);
|
||||
}
|
||||
|
||||
RwCameraSetFarClipPlane(Scene.camera, 2000.0f); // 250.0f on PS2 but who cares
|
||||
RwCameraSetFarClipPlane(Scene.camera, 250.0f); // 250.0f on PS2 but who cares
|
||||
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
|
||||
|
||||
CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@
|
|||
#include "main.h"
|
||||
#include "Population.h"
|
||||
|
||||
float CIniFile::PedNumberMultiplier = 1.0f;
|
||||
float CIniFile::CarNumberMultiplier = 1.0f;
|
||||
float CIniFile::PedNumberMultiplier = 0.6f;
|
||||
float CIniFile::CarNumberMultiplier = 0.6f;
|
||||
|
||||
void CIniFile::LoadIniFile()
|
||||
{
|
||||
CFileMgr::SetDir("");
|
||||
#if 0
|
||||
int f = CFileMgr::OpenFile("gta3.ini", "r");
|
||||
if (f){
|
||||
CFileMgr::ReadLine(f, gString, 200);
|
||||
|
|
@ -23,6 +24,7 @@ void CIniFile::LoadIniFile()
|
|||
CarNumberMultiplier = Min(3.0f, Max(0.5f, CarNumberMultiplier));
|
||||
CFileMgr::CloseFile(f);
|
||||
}
|
||||
#endif
|
||||
CPopulation::MaxNumberOfPedsInUse = DEFAULT_MAX_NUMBER_OF_PEDS * PedNumberMultiplier;
|
||||
CCarCtrl::MaxNumberOfCarsInUse = DEFAULT_MAX_NUMBER_OF_CARS * CarNumberMultiplier;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,12 +158,14 @@ void RestoreDefDisplay(int8 action) {
|
|||
TheCamera.bFreeCam = false;
|
||||
#endif
|
||||
#ifdef PED_CAR_DENSITY_SLIDERS
|
||||
CIniFile::PedNumberMultiplier = 0.6f;
|
||||
CIniFile::CarNumberMultiplier = 0.6f;
|
||||
CIniFile::LoadIniFile();
|
||||
#endif
|
||||
#ifdef GRAPHICS_MENU_OPTIONS // otherwise Frontend will handle those
|
||||
CMenuManager::m_PrefsBrightness = 256;
|
||||
CMenuManager::m_PrefsLOD = 1.2f;
|
||||
CRenderer::ms_lodDistScale = 1.2f;
|
||||
CMenuManager::m_PrefsLOD = 0.7f;
|
||||
CRenderer::ms_lodDistScale = 0.7f;
|
||||
CMenuManager::m_PrefsShowSubtitles = true;
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
#endif
|
||||
|
|
@ -395,6 +397,10 @@ void ControllerTypeAfterChange(int8 before, int8 after)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef GRAPHICS_MENU_OPTIONS
|
||||
CCustomScreenLayout graphicsSettingsLayout = {MENUSPRITE_MAINMENU, 50, 0, 20, FONT_HEADING, FESCREEN_LEFT_ALIGN, true, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE};
|
||||
#endif
|
||||
|
||||
CMenuScreenCustom aScreens[MENUPAGES] = {
|
||||
// MENUPAGE_NONE = 0
|
||||
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil, },
|
||||
|
|
@ -891,7 +897,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
|
|||
#ifdef GRAPHICS_MENU_OPTIONS
|
||||
// MENUPAGE_GRAPHICS_SETTINGS
|
||||
{ "FET_GFX", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS,
|
||||
new CCustomScreenLayout({MENUSPRITE_MAINMENU, 50, 0, 20, FONT_HEADING, FESCREEN_LEFT_ALIGN, true, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE}), GraphicsGoBack,
|
||||
new CCustomScreenLayout(graphicsSettingsLayout), GraphicsGoBack,
|
||||
|
||||
#ifndef GTA_HANDHELD
|
||||
MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },
|
||||
|
|
|
|||
|
|
@ -526,11 +526,16 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
|
|||
state.WHEELUP = true;
|
||||
}
|
||||
}
|
||||
#elif defined __SYMBIAN32__
|
||||
// TODO
|
||||
state.LMB = true;
|
||||
#else
|
||||
// It seems there is no way to get number of buttons on mouse, so assign all buttons if we have mouse.
|
||||
double xpos = 1.0f, ypos;
|
||||
#ifndef __SYMBIAN32__
|
||||
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
|
||||
|
||||
#endif
|
||||
|
||||
if (xpos != 0.f) {
|
||||
state.MMB = true;
|
||||
state.RMB = true;
|
||||
|
|
@ -585,11 +590,17 @@ void CPad::UpdateMouse()
|
|||
NewMouseControllerState = PCTempMouseControllerState;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#if defined __SYMBIAN32__
|
||||
if ( IsForegroundApp() /*&& PSGLOBAL(cursorIsInWindow)*/ )
|
||||
#else
|
||||
if ( IsForegroundApp() && PSGLOBAL(cursorIsInWindow) )
|
||||
#endif
|
||||
{
|
||||
double xpos = 1.0f, ypos;
|
||||
#ifndef __SYMBIAN32__
|
||||
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
|
||||
#endif
|
||||
if (xpos == 0.f)
|
||||
return;
|
||||
|
||||
|
|
@ -608,12 +619,14 @@ void CPad::UpdateMouse()
|
|||
|
||||
PCTempMouseControllerState.x = (float)(signX * (xpos - PSGLOBAL(lastMousePos.x)));
|
||||
PCTempMouseControllerState.y = (float)(signy * (ypos - PSGLOBAL(lastMousePos.y)));
|
||||
#ifndef __SYMBIAN32__
|
||||
PCTempMouseControllerState.LMB = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_LEFT);
|
||||
PCTempMouseControllerState.RMB = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_RIGHT);
|
||||
PCTempMouseControllerState.MMB = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_MIDDLE);
|
||||
PCTempMouseControllerState.MXB1 = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_4);
|
||||
PCTempMouseControllerState.MXB2 = glfwGetMouseButton(PSGLOBAL(window), GLFW_MOUSE_BUTTON_5);
|
||||
|
||||
#endif
|
||||
|
||||
if (PSGLOBAL(mouseWheel) > 0)
|
||||
PCTempMouseControllerState.WHEELUP = 1;
|
||||
else if (PSGLOBAL(mouseWheel) < 0)
|
||||
|
|
|
|||
|
|
@ -412,6 +412,8 @@ FindPlayerCoors(void)
|
|||
return TheCamera.GetPosition();
|
||||
#endif
|
||||
CPlayerPed *ped = FindPlayerPed();
|
||||
if (!ped)
|
||||
return TheCamera.GetPosition();
|
||||
if(ped->InVehicle())
|
||||
return ped->m_pMyVehicle->GetPosition();
|
||||
else
|
||||
|
|
@ -659,4 +661,4 @@ CPlayerInfo::DeletePlayerSkin()
|
|||
m_pSkinTexture = nil;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -85,6 +85,8 @@ int32 islandLODcomSub;
|
|||
int32 islandLODsubInd;
|
||||
int32 islandLODsubCom;
|
||||
|
||||
#define STREAMING_MEM_SIZE (10 * 1024 * 1024)
|
||||
|
||||
bool
|
||||
CStreamingInfo::GetCdPosnAndSize(uint32 &posn, uint32 &size)
|
||||
{
|
||||
|
|
@ -219,11 +221,13 @@ CStreaming::Init2(void)
|
|||
#ifdef GTA_PC
|
||||
#define MB (1024*1024)
|
||||
|
||||
extern size_t _dwMemAvailPhys;
|
||||
ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2;
|
||||
if(ms_memoryAvailable < 50*MB)
|
||||
ms_memoryAvailable = 50*MB;
|
||||
desiredNumVehiclesLoaded = (int32)((ms_memoryAvailable / MB - 50) / 3 + 12);
|
||||
// extern size_t _dwMemAvailPhys;
|
||||
// ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2;
|
||||
// if(ms_memoryAvailable < 50*MB)
|
||||
// ms_memoryAvailable = 50*MB;
|
||||
// desiredNumVehiclesLoaded = (int32)((ms_memoryAvailable / MB - 50) / 3 + 12);
|
||||
ms_memoryAvailable = STREAMING_MEM_SIZE;
|
||||
desiredNumVehiclesLoaded = 12;
|
||||
if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED)
|
||||
desiredNumVehiclesLoaded = MAXVEHICLESLOADED;
|
||||
debug("Memory allocated to Streaming is %zuMB", ms_memoryAvailable/MB); // original modifier was %d
|
||||
|
|
@ -2687,9 +2691,10 @@ CStreaming::MakeSpaceFor(int32 size)
|
|||
#ifdef FIX_BUGS
|
||||
#define MB (1024 * 1024)
|
||||
if(ms_memoryAvailable == 0) {
|
||||
extern size_t _dwMemAvailPhys;
|
||||
ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2;
|
||||
if(ms_memoryAvailable < 50 * MB) ms_memoryAvailable = 50 * MB;
|
||||
// extern size_t _dwMemAvailPhys;
|
||||
// ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2;
|
||||
// if(ms_memoryAvailable < 50 * MB) ms_memoryAvailable = 50 * MB;
|
||||
ms_memoryAvailable = STREAMING_MEM_SIZE;
|
||||
}
|
||||
#undef MB
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -278,6 +278,7 @@ void CTimer::Resume(void)
|
|||
oldPcTimer += RsTimer() - suspendPcTimer;
|
||||
}
|
||||
|
||||
#ifndef __SYMBIAN32__
|
||||
uint32 CTimer::GetCyclesPerMillisecond(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
@ -287,6 +288,7 @@ uint32 CTimer::GetCyclesPerMillisecond(void)
|
|||
#endif
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32 CTimer::GetCurrentTimeInCycles(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#define CTimer CTimer2
|
||||
class CTimer2
|
||||
#else
|
||||
class CTimer
|
||||
#endif
|
||||
{
|
||||
|
||||
static uint32 m_snTimeInMilliseconds;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@
|
|||
#include "Debug.h"
|
||||
#include "Renderer.h"
|
||||
|
||||
#if defined __ARMCC_VERSION && !defined _DEBUG
|
||||
#pragma O2
|
||||
#endif
|
||||
|
||||
int32 CCullZones::NumCullZones;
|
||||
CCullZone CCullZones::aZones[NUMCULLZONES];
|
||||
int32 CCullZones::NumAttributeZones;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#pragma warning(disable: 4838) // narrowing conversion
|
||||
#pragma warning(disable: 4996) // POSIX names
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#if defined __MWERKS__ || defined __SYMBIAN32__
|
||||
#define __STDC_LIMIT_MACROS // so we get UINT32_MAX etc
|
||||
#endif
|
||||
|
||||
|
|
@ -363,6 +363,10 @@ __inline__ void TRACE(char *f, ...) { } // this is re3 only, and so the function
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#undef ASSERT
|
||||
#endif
|
||||
|
||||
#ifndef MASTER
|
||||
#define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) )
|
||||
#else
|
||||
|
|
@ -370,7 +374,7 @@ __inline__ void TRACE(char *f, ...) { } // this is re3 only, and so the function
|
|||
#endif
|
||||
#define ASSERT assert
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#if defined __MWERKS__ || defined __SYMBIAN32__
|
||||
#define static_assert(bool_constexpr, message)
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ enum Config {
|
|||
EXTRADIRSIZE = 128,
|
||||
CUTSCENEDIRSIZE = 512,
|
||||
|
||||
SIMPLEMODELSIZE = 5000, // 2910 on PS2
|
||||
SIMPLEMODELSIZE = 2916, // 2910 on PS2
|
||||
MLOMODELSIZE = 1,
|
||||
MLOINSTANCESIZE = 1,
|
||||
TIMEMODELSIZE = 30,
|
||||
|
|
@ -31,15 +31,15 @@ enum Config {
|
|||
XTRACOMPSMODELSIZE = 2,
|
||||
TWODFXSIZE = 2000, // 1210 on PS2
|
||||
|
||||
MAXVEHICLESLOADED = 50, // 70 on mobile
|
||||
MAXVEHICLESLOADED = 35, // 70 on mobile
|
||||
|
||||
NUMOBJECTINFO = 168, // object.dat
|
||||
|
||||
// Pool sizes
|
||||
NUMPTRNODES = 30000, // 26000 on PS2
|
||||
NUMENTRYINFOS = 5400, // 3200 on PS2
|
||||
NUMPEDS = 140, // 90 on PS2
|
||||
NUMVEHICLES = 110, // 70 on PS2
|
||||
NUMPEDS = 110, // 90 on PS2
|
||||
NUMVEHICLES = 90, // 70 on PS2
|
||||
NUMBUILDINGS = 5500, // 4915 on PS2
|
||||
NUMTREADABLES = 1214,
|
||||
NUMOBJECTS = 450,
|
||||
|
|
@ -157,7 +157,7 @@ enum Config {
|
|||
#define GTA_VERSION GTA3_PC_11
|
||||
|
||||
// Enable configuration for handheld console ports
|
||||
#if defined(__SWITCH__) || defined(PSP2)
|
||||
#if defined(__SWITCH__) || defined(PSP2) || defined(__SYMBIAN32__)
|
||||
#define GTA_HANDHELD
|
||||
#endif
|
||||
|
||||
|
|
@ -170,11 +170,11 @@ enum Config {
|
|||
# define PS2_MENU
|
||||
#elif defined GTA_PC
|
||||
# define EXTERNAL_3D_SOUND
|
||||
# define AUDIO_REFLECTIONS
|
||||
//# define AUDIO_REFLECTIONS
|
||||
# ifndef GTA_HANDHELD
|
||||
# define PC_PLAYER_CONTROLS // mouse player/cam mode
|
||||
# endif
|
||||
# define GTA_REPLAY
|
||||
//# define GTA_REPLAY
|
||||
# define GTA_SCENE_EDIT
|
||||
# define PC_MENU
|
||||
#elif defined GTA_XBOX
|
||||
|
|
@ -238,7 +238,7 @@ enum Config {
|
|||
#if defined GTA_PC && defined GTA_PS2_STUFF
|
||||
# define USE_PS2_RAND
|
||||
# define RANDOMSPLASH // use random splash as on PS2
|
||||
# define PS2_MATFX
|
||||
//# define PS2_MATFX
|
||||
#endif
|
||||
|
||||
#ifdef VU_COLLISION
|
||||
|
|
@ -263,12 +263,13 @@ enum Config {
|
|||
# define CHATTYSPLASH // print what the game is loading
|
||||
# define TIMEBARS // print debug timers
|
||||
#endif
|
||||
#define TIMEBARS
|
||||
|
||||
#define FIX_BUGS // fixes bugs that we've came across during reversing. You can undefine this only on release builds.
|
||||
#define MORE_LANGUAGES // Add more translations to the game
|
||||
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible, and keeps saves compatible between platforms, needs to be enabled on 64bit builds!
|
||||
//#define MORE_LANGUAGES // Add more translations to the game
|
||||
//#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible, and keeps saves compatible between platforms, needs to be enabled on 64bit builds!
|
||||
#define FIX_INCOMPATIBLE_SAVES // try to fix incompatible saves, requires COMPATIBLE_SAVES
|
||||
#define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS
|
||||
//#define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS
|
||||
|
||||
#define NO_MOVIES // add option to disable intro videos
|
||||
|
||||
|
|
@ -291,28 +292,28 @@ enum Config {
|
|||
#endif
|
||||
|
||||
// Rendering/display
|
||||
//#define EXTRA_MODEL_FLAGS // from mobile to optimize rendering
|
||||
//# define HARDCODED_MODEL_FLAGS // sets the flags enabled above from hardcoded model names.
|
||||
#define EXTRA_MODEL_FLAGS // from mobile to optimize rendering
|
||||
# define HARDCODED_MODEL_FLAGS // sets the flags enabled above from hardcoded model names.
|
||||
// NB: keep this enabled unless your map IDEs have these flags baked in
|
||||
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
|
||||
#define PROPER_SCALING // use original DEFAULT_SCREEN_WIDTH/DEFAULT_SCREEN_HEIGHT from PS2 instead of PC(R* changed HEIGHT here to make radar look better, but broke other hud elements aspect ratio).
|
||||
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
|
||||
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
|
||||
#define PS2_ALPHA_TEST // emulate ps2 alpha test
|
||||
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
|
||||
//#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
|
||||
#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time
|
||||
#ifdef DISABLE_LOADING_SCREEN
|
||||
// enable the PC splash
|
||||
#undef RANDOMSPLASH
|
||||
#endif
|
||||
#define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync
|
||||
#define ANISOTROPIC_FILTERING // set all textures to max anisotropic filtering
|
||||
//#define ANISOTROPIC_FILTERING // set all textures to max anisotropic filtering
|
||||
//#define USE_TEXTURE_POOL
|
||||
#ifdef LIBRW
|
||||
#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
|
||||
#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
|
||||
#define SCREEN_DROPLETS // neo water droplets
|
||||
#define NEW_RENDERER // leeds-like world rendering, needs librw
|
||||
//#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
|
||||
//#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
|
||||
//#define SCREEN_DROPLETS // neo water droplets
|
||||
//#define NEW_RENDERER // leeds-like world rendering, needs librw
|
||||
#endif
|
||||
|
||||
#define FIX_SPRITES // fix sprites aspect ratio(moon, coronas, particle etc)
|
||||
|
|
@ -382,7 +383,7 @@ enum Config {
|
|||
#define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script
|
||||
#define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely
|
||||
#ifdef PC_MENU
|
||||
# define MISSION_REPLAY // mobile feature
|
||||
//# define MISSION_REPLAY // mobile feature
|
||||
#endif
|
||||
//#define SIMPLIER_MISSIONS // apply simplifications from mobile
|
||||
#define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||
|
|
@ -427,19 +428,19 @@ enum Config {
|
|||
#define FREE_CAM // Rotating cam
|
||||
|
||||
// Audio
|
||||
#define EXTERNAL_3D_SOUND // use external engine to simulate 3d audio spatialization. OpenAL would not work without it (because it works in a 3d space
|
||||
//#define EXTERNAL_3D_SOUND // use external engine to simulate 3d audio spatialization. OpenAL would not work without it (because it works in a 3d space
|
||||
// originally and making it work in 2d only requires more resource). Will not work on PS2
|
||||
#define AUDIO_REFLECTIONS // Enable audio reflections. Disabled on mobile, didn't exist yet on PS2.
|
||||
//#define AUDIO_REFLECTIONS // Enable audio reflections. Disabled on mobile, didn't exist yet on PS2.
|
||||
#define RADIO_SCROLL_TO_PREV_STATION
|
||||
#define AUDIO_CACHE
|
||||
//#define AUDIO_CACHE
|
||||
#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 44 (PC has 28 originally)
|
||||
#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
|
||||
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
|
||||
#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
|
||||
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files
|
||||
#define PAUSE_RADIO_IN_FRONTEND // pause radio when game is paused
|
||||
#define ATTACH_RELEASING_SOUNDS_TO_ENTITIES // sounds would follow ped and vehicles coordinates if not being queued otherwise
|
||||
#define USE_TIME_SCALE_FOR_AUDIO // slow down/speed up sounds according to the speed of the game
|
||||
#define MULTITHREADED_AUDIO // for streams. requires C++11 or later
|
||||
//#define MULTITHREADED_AUDIO // for streams. requires C++11 or later
|
||||
|
||||
#ifdef AUDIO_OPUS
|
||||
#define AUDIO_OAL_USE_OPUS // enable support of opus files
|
||||
|
|
@ -454,13 +455,13 @@ enum Config {
|
|||
#endif
|
||||
|
||||
// Streaming
|
||||
#if !defined(_WIN32) && !defined(__SWITCH__)
|
||||
#if !defined(_WIN32) && !defined(__SWITCH__) && !defined __SYMBIAN32__
|
||||
//#define ONE_THREAD_PER_CHANNEL // Don't use if you're not on SSD/Flash - also not utilized too much right now(see commented LoadAllRequestedModels in Streaming.cpp)
|
||||
#define FLUSHABLE_STREAMING // Make it possible to interrupt reading when processing file isn't needed anymore.
|
||||
#endif
|
||||
#define BIG_IMG // Not complete - allows to read larger img files
|
||||
|
||||
//#define SQUEEZE_PERFORMANCE
|
||||
#define SQUEEZE_PERFORMANCE
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
#undef PS2_ALPHA_TEST
|
||||
#undef NO_ISLAND_LOADING
|
||||
|
|
@ -481,7 +482,7 @@ enum Config {
|
|||
#define IGNORE_MOUSE_KEYBOARD // ignore mouse & keyboard input
|
||||
#endif
|
||||
|
||||
#ifdef __SWITCH__
|
||||
#if defined __SWITCH__ || defined __SYMBIAN32__
|
||||
#define USE_UNNAMED_SEM // named semaphores are unsupported on the switch
|
||||
#endif
|
||||
|
||||
|
|
@ -495,4 +496,4 @@ enum Config {
|
|||
#endif
|
||||
#if defined(AUDIO_REFLECTIONS) && GTA_VERSION < GTA3_PC_10
|
||||
#error AUDIO_REFLECTIONS cannot work with versions below GTA3_PC_10
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ float FramesPerSecond = 30.0f;
|
|||
bool gbPrintShite = false;
|
||||
bool gbModelViewer;
|
||||
#ifdef TIMEBARS
|
||||
bool gbShowTimebars;
|
||||
bool gbShowTimebars = true;
|
||||
#endif
|
||||
#ifdef DRAW_GAME_VERSION_TEXT
|
||||
bool gbDrawVersionText; // Our addition, we think it was always enabled on !MASTER builds
|
||||
|
|
@ -1401,10 +1401,10 @@ RenderScene(void)
|
|||
}
|
||||
#endif
|
||||
PUSH_RENDERGROUP("RenderScene");
|
||||
CClouds::Render();
|
||||
// CClouds::Render();
|
||||
DoRWRenderHorizon();
|
||||
CRenderer::RenderRoads();
|
||||
CCoronas::RenderReflections();
|
||||
// CCoronas::RenderReflections();
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
|
||||
CRenderer::RenderEverythingBarRoads();
|
||||
CRenderer::RenderBoats();
|
||||
|
|
@ -1414,7 +1414,7 @@ RenderScene(void)
|
|||
#ifndef SQUEEZE_PERFORMANCE
|
||||
CRenderer::RenderVehiclesButNotBoats();
|
||||
#endif
|
||||
CWeather::RenderRainStreaks();
|
||||
// CWeather::RenderRainStreaks();
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
|
||||
|
|
@ -1446,17 +1446,17 @@ RenderEffects(void)
|
|||
CGlass::Render();
|
||||
CWaterCannons::Render();
|
||||
CSpecialFX::Render();
|
||||
CShadows::RenderStaticShadows();
|
||||
CShadows::RenderStoredShadows();
|
||||
CSkidmarks::Render();
|
||||
CAntennas::Render();
|
||||
CRubbish::Render();
|
||||
CCoronas::Render();
|
||||
CParticle::Render();
|
||||
// CShadows::RenderStaticShadows();
|
||||
// CShadows::RenderStoredShadows();
|
||||
// CSkidmarks::Render();
|
||||
// CAntennas::Render();
|
||||
// CRubbish::Render();
|
||||
// CCoronas::Render();
|
||||
// CParticle::Render();
|
||||
CPacManPickups::Render();
|
||||
CWeaponEffects::Render();
|
||||
CPointLights::RenderFogEffect();
|
||||
CMovingThings::Render();
|
||||
// CWeaponEffects::Render();
|
||||
// CPointLights::RenderFogEffect();
|
||||
// CMovingThings::Render();
|
||||
CRenderer::RenderFirstPersonVehicle();
|
||||
POP_RENDERGROUP();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1160,7 +1160,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
|
|||
abort();
|
||||
#else
|
||||
// TODO
|
||||
printf("\nRE3 ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr);
|
||||
re3_debug("\nRE3 ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr);
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "common.h"
|
||||
#ifndef MASTER
|
||||
#ifdef TIMEBARS
|
||||
#include "Font.h"
|
||||
#include "Frontend.h"
|
||||
#include "Timer.h"
|
||||
|
|
@ -96,7 +96,10 @@ void tbDisplay()
|
|||
sprintf(temp, "FPS: %.2f", Diag_GetFPS());
|
||||
AsciiToUnicode(temp, wtemp);
|
||||
CFont::SetColor(CRGBA(255, 255, 255, 255));
|
||||
if (!CMenuManager::m_PrefsMarketing || !CMenuManager::m_PrefsDisableTutorials) {
|
||||
#ifndef MASTER
|
||||
if (!CMenuManager::m_PrefsMarketing || !CMenuManager::m_PrefsDisableTutorials)
|
||||
#endif
|
||||
{
|
||||
CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * (4.0f / DEFAULT_SCREEN_HEIGHT), wtemp);
|
||||
|
||||
#ifndef FINAL
|
||||
|
|
@ -105,7 +108,7 @@ void tbDisplay()
|
|||
MaxTimes[i] = Max(MaxTimes[i], TimerBar.Timers[i].endTime - TimerBar.Timers[i].startTime);
|
||||
sprintf(temp, "%s: %.2f", &TimerBar.Timers[i].name[0], MaxTimes[i]);
|
||||
AsciiToUnicode(temp, wtemp);
|
||||
CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (i + 2)) / DEFAULT_SCREEN_HEIGHT), wtemp);
|
||||
CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (i + 2)) / 200), wtemp);
|
||||
}
|
||||
|
||||
#ifdef FRAMETIME
|
||||
|
|
@ -113,9 +116,9 @@ void tbDisplay()
|
|||
sprintf(temp, "Frame Time: %.2f", MaxFrameTime);
|
||||
AsciiToUnicode(temp, wtemp);
|
||||
|
||||
CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (TimerBar.count + 4)) / DEFAULT_SCREEN_HEIGHT), wtemp);
|
||||
CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (TimerBar.count + 4)) / 200), wtemp);
|
||||
#endif // FRAMETIME
|
||||
#endif // !FINAL
|
||||
}
|
||||
}
|
||||
#endif // !MASTER
|
||||
#endif // !MASTER
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#pragma once
|
||||
#if defined(__ARMCC_VERSION)
|
||||
#pragma anon_unions
|
||||
#endif
|
||||
|
||||
class CMatrix
|
||||
{
|
||||
|
|
@ -128,4 +131,4 @@ public:
|
|||
class CCompressedMatrix : public CCompressedMatrixNotAligned
|
||||
{
|
||||
int _alignment; // no clue what would this align to
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7215,7 +7215,11 @@ CPed::LookForInterestingNodes(void)
|
|||
if (!found)
|
||||
return false;
|
||||
|
||||
CVector effectFrontLocal = Multiply3x3(*objMat, effect->attractor.dir);
|
||||
CVector dir;
|
||||
dir.x = effect->attractor.dirX;
|
||||
dir.y = effect->attractor.dirY;
|
||||
dir.z = effect->attractor.dirZ;
|
||||
CVector effectFrontLocal = Multiply3x3(*objMat, dir);
|
||||
float angleToFace = CGeneral::GetRadianAngleBetweenPoints(effectFrontLocal.x, effectFrontLocal.y, 0.0f, 0.0f);
|
||||
randVal = CGeneral::GetRandomNumber() % 256;
|
||||
if (randVal <= m_randomSeed % 256) {
|
||||
|
|
|
|||
|
|
@ -3694,7 +3694,9 @@ CPed::SetExitBoat(CVehicle *boat)
|
|||
RemoveInCarAnims();
|
||||
CColModel* boatCol = boat->GetColModel();
|
||||
if (boat->IsUpsideDown()) {
|
||||
newPos = { 0.0f, 0.0f, boatCol->boundingBox.min.z };
|
||||
newPos.x = 0.0f;
|
||||
newPos.y = 0.0f;
|
||||
newPos.z = boatCol->boundingBox.min.z;
|
||||
newPos = boat->GetMatrix() * newPos;
|
||||
newPos.z += 1.0f;
|
||||
m_vehDoor = CAR_DOOR_RF;
|
||||
|
|
@ -5401,4 +5403,4 @@ CPed::WarpPedToNearEntityOffScreen(CEntity *warpTo)
|
|||
}
|
||||
m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 3000;
|
||||
return teleported;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#pragma once
|
||||
#if defined(__ARMCC_VERSION)
|
||||
#pragma anon_unions
|
||||
#endif
|
||||
|
||||
enum {
|
||||
EFFECT_LIGHT,
|
||||
|
|
@ -55,11 +58,13 @@ public:
|
|||
};
|
||||
struct Particle {
|
||||
int particleType;
|
||||
CVector dir;
|
||||
// CVector dir;
|
||||
float dirX, dirY, dirZ;
|
||||
float scale;
|
||||
};
|
||||
struct Attractor {
|
||||
CVector dir;
|
||||
// CVector dir;
|
||||
float dirX, dirY, dirZ;
|
||||
int8 type;
|
||||
uint8 probability;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -470,9 +470,9 @@ CFont::Shutdown(void)
|
|||
void
|
||||
CFont::InitPerFrame(void)
|
||||
{
|
||||
Details.bank = CSprite2d::GetBank(30, Sprite[0].m_pTexture);
|
||||
CSprite2d::GetBank(15, Sprite[1].m_pTexture);
|
||||
CSprite2d::GetBank(15, Sprite[2].m_pTexture);
|
||||
Details.bank = CSprite2d::GetBank(300, Sprite[0].m_pTexture);
|
||||
CSprite2d::GetBank(100, Sprite[1].m_pTexture);
|
||||
CSprite2d::GetBank(100, Sprite[2].m_pTexture);
|
||||
#ifdef MORE_LANGUAGES
|
||||
if (IsJapanese())
|
||||
CSprite2d::GetBank(15, Sprite[3].m_pTexture);
|
||||
|
|
@ -1625,4 +1625,4 @@ CFont::character_code(uint8 c)
|
|||
if(c < 128)
|
||||
return c;
|
||||
return foreign_table[c-128];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ CMBlur::MotionBlurOpen(RwCamera *cam)
|
|||
debug("Available video memory %d\n", avaible);
|
||||
#endif
|
||||
|
||||
#ifndef __SYMBIAN32__
|
||||
if(BlurOn)
|
||||
{
|
||||
uint32 width = Pow(2.0f, int32(log2(RwRasterGetWidth (RwCameraGetRaster(cam))))+1);
|
||||
|
|
@ -123,6 +124,7 @@ CMBlur::MotionBlurOpen(RwCamera *cam)
|
|||
#endif
|
||||
CreateImmediateModeData(cam, &rect);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
rect.w = RwRasterGetWidth(RwCameraGetRaster(cam));
|
||||
|
|
@ -215,6 +217,8 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
|
|||
if( pFrontBuffer )
|
||||
OverlayRender(cam, pFrontBuffer, color, type, bluralpha);
|
||||
#else
|
||||
|
||||
#ifndef __SYMBIAN32__
|
||||
if(BlurOn){
|
||||
if(pFrontBuffer){
|
||||
if(ms_bJustInitialised)
|
||||
|
|
@ -228,6 +232,7 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
|
|||
}else{
|
||||
OverlayRender(cam, nil, color, type, bluralpha);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
POP_RENDERGROUP();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -601,22 +601,27 @@ CEntity::AddSteamsFromGround(CVector *unused)
|
|||
if(effect->type != EFFECT_PARTICLE)
|
||||
continue;
|
||||
|
||||
CVector dir;
|
||||
dir.x = effect->particle.dirX;
|
||||
dir.y = effect->particle.dirY;
|
||||
dir.z = effect->particle.dirZ;
|
||||
|
||||
pos = GetMatrix() * effect->pos;
|
||||
switch(effect->particle.particleType){
|
||||
case 0:
|
||||
CParticleObject::AddObject(POBJECT_PAVEMENT_STEAM, pos, effect->particle.dir, effect->particle.scale, false);
|
||||
CParticleObject::AddObject(POBJECT_PAVEMENT_STEAM, pos, dir, effect->particle.scale, false);
|
||||
break;
|
||||
case 1:
|
||||
CParticleObject::AddObject(POBJECT_WALL_STEAM, pos, effect->particle.dir, effect->particle.scale, false);
|
||||
CParticleObject::AddObject(POBJECT_WALL_STEAM, pos, dir, effect->particle.scale, false);
|
||||
break;
|
||||
case 2:
|
||||
CParticleObject::AddObject(POBJECT_DRY_ICE, pos, effect->particle.scale, false);
|
||||
break;
|
||||
case 3:
|
||||
CParticleObject::AddObject(POBJECT_SMALL_FIRE, pos, effect->particle.dir, effect->particle.scale, false);
|
||||
CParticleObject::AddObject(POBJECT_SMALL_FIRE, pos, dir, effect->particle.scale, false);
|
||||
break;
|
||||
case 4:
|
||||
CParticleObject::AddObject(POBJECT_DARK_SMOKE, pos, effect->particle.dir, effect->particle.scale, false);
|
||||
CParticleObject::AddObject(POBJECT_DARK_SMOKE, pos, dir, effect->particle.scale, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ CLinkList<EntityInfo> gSortedBuildings;
|
|||
CVector CRenderer::ms_vecCameraPosition;
|
||||
CVehicle *CRenderer::m_pFirstPersonVehicle;
|
||||
bool CRenderer::m_loadingPriority;
|
||||
float CRenderer::ms_lodDistScale = 1.2f;
|
||||
float CRenderer::ms_lodDistScale = 0.7f;
|
||||
|
||||
// unused
|
||||
BlockedRange CRenderer::aBlockedRanges[16];
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class CVehicle;
|
|||
enum {
|
||||
// NB: not all values are allowed, check the code
|
||||
#ifdef SQUEEZE_PERFORMANCE
|
||||
NUM_RUBBISH_SHEETS = 32
|
||||
NUM_RUBBISH_SHEETS = 16
|
||||
#else
|
||||
NUM_RUBBISH_SHEETS = 64
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#define MAX_STOREDSHADOWS 48
|
||||
#define MAX_STOREDSHADOWS 12
|
||||
#define MAX_POLYBUNCHES 300
|
||||
#define MAX_STATICSHADOWS 64
|
||||
#define MAX_PERMAMENTSHADOWS 48
|
||||
#define MAX_STATICSHADOWS 16
|
||||
#define MAX_PERMAMENTSHADOWS 12
|
||||
|
||||
|
||||
class CEntity;
|
||||
|
|
|
|||
|
|
@ -137,10 +137,10 @@ void
|
|||
CSpecialFX::Render(void)
|
||||
{
|
||||
PUSH_RENDERGROUP("CSpecialFX::Render");
|
||||
CMotionBlurStreaks::Render();
|
||||
CBulletTraces::Render();
|
||||
CBrightLights::Render();
|
||||
CShinyTexts::Render();
|
||||
// CMotionBlurStreaks::Render();
|
||||
// CBulletTraces::Render();
|
||||
// CBrightLights::Render();
|
||||
// CShinyTexts::Render();
|
||||
CMoneyMessages::Render();
|
||||
#ifdef NEW_RENDERER
|
||||
if(!(gbNewRenderer && FredIsInFirstPersonCam()))
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ int32 CSprite2d::mCurrentBank;
|
|||
RwTexture *CSprite2d::mpBankTextures[10];
|
||||
int32 CSprite2d::mCurrentSprite[10];
|
||||
int32 CSprite2d::mBankStart[10];
|
||||
RwIm2DVertex CSprite2d::maBankVertices[500];
|
||||
RwIm2DVertex CSprite2d::maBankVertices[3000];
|
||||
|
||||
void
|
||||
CSprite2d::SetRecipNearClip(void)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class CSprite2d
|
|||
static RwTexture *mpBankTextures[10];
|
||||
static int32 mCurrentSprite[10];
|
||||
static int32 mBankStart[10];
|
||||
static RwIm2DVertex maBankVertices[500];
|
||||
static RwIm2DVertex maBankVertices[3000];
|
||||
static RwIm2DVertex maVertices[8];
|
||||
public:
|
||||
RwTexture *m_pTexture;
|
||||
|
|
|
|||
|
|
@ -588,23 +588,24 @@ inline float
|
|||
_GetWaterDrawDist()
|
||||
{
|
||||
// if z less then 15.0f return 1200.0f
|
||||
if ( TheCamera.GetPosition().z < 15.0f )
|
||||
return 1200.0f;
|
||||
// if ( TheCamera.GetPosition().z < 15.0f )
|
||||
// return 1200.0f;
|
||||
|
||||
// if z greater then 60.0f return 2000.0f;
|
||||
if ( TheCamera.GetPosition().z > 60.0f )
|
||||
return 2000.0f;
|
||||
|
||||
return (TheCamera.GetPosition().z + -15.0f) * 800.0f / 45.0f + 1200.0f;
|
||||
return 700.0f;
|
||||
|
||||
return 4500.0f;
|
||||
// return (TheCamera.GetPosition().z + -15.0f) * 800.0f / 45.0f + 1200.0f;
|
||||
}
|
||||
|
||||
inline float
|
||||
_GetWavyDrawDist()
|
||||
{
|
||||
if ( FindPlayerVehicle() && FindPlayerVehicle()->IsBoat() )
|
||||
return 120.0f;
|
||||
return 80.0f;
|
||||
else
|
||||
return 70.0f;
|
||||
return 45.0f;
|
||||
}
|
||||
|
||||
inline void
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public:
|
|||
};
|
||||
|
||||
enum {
|
||||
NUM_RAIN_STREAKS = 35
|
||||
NUM_RAIN_STREAKS = 10
|
||||
};
|
||||
|
||||
struct tRainStreak
|
||||
|
|
@ -68,4 +68,4 @@ struct tRainStreak
|
|||
uint32 timer;
|
||||
};
|
||||
|
||||
extern RwTexture* gpRainDropTex[4];
|
||||
extern RwTexture* gpRainDropTex[4];
|
||||
|
|
|
|||
|
|
@ -28,6 +28,99 @@
|
|||
float texLoadTime;
|
||||
int32 texNumLoaded;
|
||||
|
||||
static RwImage* resizeImage(RwImage *image, int newWidth, int newHeight)
|
||||
{
|
||||
image->convertTo32();
|
||||
|
||||
RwImage *resized = RwImageCreate(newWidth, newHeight, 32);
|
||||
if (resized == nil) return nil;
|
||||
|
||||
RwImageAllocatePixels(resized);
|
||||
if (resized->pixels == nil) {
|
||||
RwImageDestroy(resized);
|
||||
return nil;
|
||||
}
|
||||
|
||||
for (int y = 0; y < newHeight; y++) {
|
||||
uint8 *dst = resized->pixels + y*resized->stride;
|
||||
int y0 = y*image->height/newHeight;
|
||||
int y1 = (y + 1)*image->height/newHeight;
|
||||
if (y1 <= y0)
|
||||
y1 = y0 + 1;
|
||||
|
||||
for (int x = 0; x < newWidth; x++) {
|
||||
int x0 = x*image->width/newWidth;
|
||||
int x1 = (x + 1)*image->width/newWidth;
|
||||
if (x1 <= x0)
|
||||
x1 = x0 + 1;
|
||||
|
||||
uint r = 0;
|
||||
uint g = 0;
|
||||
uint b = 0;
|
||||
uint a = 0;
|
||||
uint samples = 0;
|
||||
|
||||
for (int sy = y0; sy < y1; sy++) {
|
||||
const uint8 *src = image->pixels + sy*image->stride + x0*4;
|
||||
for (int sx = x0; sx < x1; sx++) {
|
||||
r += src[0];
|
||||
g += src[1];
|
||||
b += src[2];
|
||||
a += src[3];
|
||||
samples++;
|
||||
src += 4;
|
||||
}
|
||||
}
|
||||
|
||||
dst[0] = r / samples;
|
||||
dst[1] = g / samples;
|
||||
dst[2] = b / samples;
|
||||
dst[3] = a / samples;
|
||||
dst += 4;
|
||||
}
|
||||
}
|
||||
|
||||
return resized;
|
||||
}
|
||||
|
||||
|
||||
static int clamp(int32 size)
|
||||
{
|
||||
while (size > 32 && size > 1) {
|
||||
size = (size + 1) / 2;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
static void downscaleTexture(RwTexture *texture)
|
||||
{
|
||||
RwRaster *oldRaster = RwTextureGetRaster(texture);
|
||||
if (oldRaster == nil)
|
||||
return;
|
||||
|
||||
int oldWidth = RwRasterGetWidth(oldRaster);
|
||||
int oldHeight = RwRasterGetHeight(oldRaster);
|
||||
if (oldWidth <= 32 && oldHeight <= 32) return;
|
||||
|
||||
int newWidth = clamp(oldWidth);
|
||||
int newHeight = clamp(oldHeight);
|
||||
if (newWidth == oldWidth && newHeight == oldHeight) return;
|
||||
|
||||
RwImage *image = oldRaster->toImage();
|
||||
if (image == nil) return;
|
||||
|
||||
RwImage *resized = resizeImage(image, newWidth, newHeight);
|
||||
RwImageDestroy(image);
|
||||
if (resized == nil) return;
|
||||
|
||||
RwRaster *newRaster = rw::Raster::createFromImage(resized);
|
||||
RwImageDestroy(resized);
|
||||
if (newRaster == nil) return;
|
||||
|
||||
RwTextureSetRaster(texture, newRaster);
|
||||
RwRasterDestroy(oldRaster);
|
||||
}
|
||||
|
||||
#ifdef LIBRW
|
||||
#define READNATIVE(stream, tex, size) rwNativeTextureHackRead(stream, tex, size)
|
||||
#else
|
||||
|
|
@ -164,7 +257,7 @@ RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict)
|
|||
|
||||
#ifdef LIBRW
|
||||
|
||||
#define CAPSVERSION 0
|
||||
#define CAPSVERSION 1
|
||||
|
||||
struct GPUcaps
|
||||
{
|
||||
|
|
@ -397,7 +490,11 @@ CreateTxdImageForVideoCard()
|
|||
sprintf(filename, "%s.txd", CTxdStore::GetTxdName(i));
|
||||
|
||||
if (CTxdStore::GetSlot(i)->texDict) {
|
||||
|
||||
RwTexDictionary *texDict = CTxdStore::GetSlot(i)->texDict;
|
||||
FORLIST(lnk, texDict->textures){
|
||||
rw::Texture *texture = rw::Texture::fromDict(lnk);
|
||||
downscaleTexture(texture);
|
||||
}
|
||||
int32 pos = STREAMTELL(img);
|
||||
|
||||
if (RwTexDictionaryStreamWrite(CTxdStore::GetSlot(i)->texDict, img) == nil) {
|
||||
|
|
|
|||
|
|
@ -26,35 +26,19 @@ void GetLocalTime_CP(SYSTEMTIME *out) {
|
|||
// Compatible with Linux/POSIX and MinGW on Windows
|
||||
#ifndef _WIN32
|
||||
HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
|
||||
char pathCopy[MAX_PATH];
|
||||
strcpy(pathCopy, pathname);
|
||||
char newpathname[64];
|
||||
snprintf(newpathname, sizeof(newpathname), "E:/data/gta3/%s", pathname);
|
||||
char* path = strtok(newpathname, "\\*");
|
||||
strncpy(firstfile->folder, path, sizeof(firstfile->folder));
|
||||
|
||||
char *folder = strtok(pathCopy, "*");
|
||||
char *extension = strtok(NULL, "*");
|
||||
|
||||
// because I remember like strtok might not return NULL for last delimiter
|
||||
if (extension && extension - folder == strlen(pathname))
|
||||
extension = nil;
|
||||
|
||||
// Case-sensitivity and backslashes...
|
||||
// Will be freed at the bottom
|
||||
char *realFolder = casepath(folder);
|
||||
if (realFolder) {
|
||||
folder = realFolder;
|
||||
}
|
||||
|
||||
strncpy(firstfile->folder, folder, sizeof(firstfile->folder));
|
||||
|
||||
if (extension)
|
||||
strncpy(firstfile->extension, extension, sizeof(firstfile->extension));
|
||||
// Both w/ extension and w/o extension is ok
|
||||
if (strlen(path) + 2 != strlen(pathname))
|
||||
strncpy(firstfile->extension, strtok(NULL, "\\*"), sizeof(firstfile->extension));
|
||||
else
|
||||
firstfile->extension[0] = '\0';
|
||||
|
||||
if (realFolder)
|
||||
free(realFolder);
|
||||
strncpy(firstfile->extension, "", sizeof(firstfile->extension));
|
||||
|
||||
HANDLE d;
|
||||
if ((d = (HANDLE)opendir(firstfile->folder)) == NULL || !FindNextFile(d, firstfile))
|
||||
if ((d = (HANDLE)opendir(path)) == NULL || !FindNextFile(d, firstfile))
|
||||
return NULL;
|
||||
|
||||
return d;
|
||||
|
|
@ -67,12 +51,11 @@ bool FindNextFile(HANDLE d, WIN32_FIND_DATA* finddata) {
|
|||
int extensionLen = strlen(finddata->extension);
|
||||
while ((file = readdir((DIR*)d)) != NULL) {
|
||||
|
||||
// We only want "DT_REG"ular Files, but reportedly some FS and OSes gives DT_UNKNOWN as type.
|
||||
if ((file->d_type == DT_UNKNOWN || file->d_type == DT_REG || file->d_type == DT_LNK) &&
|
||||
(extensionLen == 0 || strncasecmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
|
||||
if ((extensionLen == 0 || strncmp(&file->d_name[strlen(file->d_name) - extensionLen], finddata->extension, extensionLen) == 0)) {
|
||||
|
||||
sprintf(relativepath, "%s/%s", finddata->folder, file->d_name);
|
||||
realpath(relativepath, path);
|
||||
// realpath(relativepath, path);
|
||||
strcpy(path, relativepath);
|
||||
stat(path, &fileStats);
|
||||
strncpy(finddata->cFileName, file->d_name, sizeof(finddata->cFileName));
|
||||
finddata->ftLastWriteTime = fileStats.st_mtime;
|
||||
|
|
@ -182,115 +165,26 @@ int _caserename(const char *old_filename, const char *new_filename)
|
|||
// Returned string should freed manually (if exists)
|
||||
char* casepath(char const* path, bool checkPathFirst)
|
||||
{
|
||||
if (checkPathFirst && access(path, F_OK) != -1) {
|
||||
// File path is correct
|
||||
return nil;
|
||||
}
|
||||
size_t l = strlen(path);
|
||||
char data_path[512];
|
||||
getcwd(data_path, sizeof(data_path));
|
||||
char* out = (char*)malloc(l + strlen(data_path) + 2);
|
||||
|
||||
size_t l = strlen(path);
|
||||
char* p = (char*)alloca(l + 1);
|
||||
char* out = (char*)malloc(l + 3); // for extra ./
|
||||
strcpy(p, path);
|
||||
if (strncmp(path, "E:", 2) == 0 || strncmp(path, "F:", 2) == 0) {
|
||||
strcpy(out, path);
|
||||
} else {
|
||||
sprintf(out, "%s/%s", data_path, path);
|
||||
}
|
||||
|
||||
// my addon: linux doesn't handle filenames with spaces at the end nicely
|
||||
p = trim(p);
|
||||
l = strlen(out);
|
||||
for (int i = l-1; i >= 0; i--) {
|
||||
if (out[i] == '\\' || out[i] == '/' || out[i] == ' ')
|
||||
out[i] = '\0';
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
size_t rl = 0;
|
||||
|
||||
DIR* d;
|
||||
char* c;
|
||||
|
||||
#if defined(__SWITCH__) || defined(PSP2)
|
||||
if( (c = strstr(p, ":/")) != NULL) // scheme used by some environments, eg. switch, vita
|
||||
{
|
||||
size_t deviceNameOffset = c - p + 3;
|
||||
char* deviceNamePath = (char*)alloca(deviceNameOffset + 1);
|
||||
strlcpy(deviceNamePath, p, deviceNameOffset);
|
||||
deviceNamePath[deviceNameOffset] = 0;
|
||||
d = opendir(deviceNamePath);
|
||||
p = c + 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (p[0] == '/' || p[0] == '\\')
|
||||
{
|
||||
d = opendir("/");
|
||||
}
|
||||
else
|
||||
{
|
||||
d = opendir(".");
|
||||
out[0] = '.';
|
||||
out[1] = 0;
|
||||
rl = 1;
|
||||
}
|
||||
|
||||
bool cantProceed = false; // just convert slashes in what's left in string, don't correct case of letters(because we can't)
|
||||
bool mayBeTrailingSlash = false;
|
||||
|
||||
while (c = strsep(&p, "/\\"))
|
||||
{
|
||||
// May be trailing slash(allow), slash at the start(avoid), or multiple slashes(avoid)
|
||||
if (*c == '\0')
|
||||
{
|
||||
mayBeTrailingSlash = true;
|
||||
continue;
|
||||
} else {
|
||||
mayBeTrailingSlash = false;
|
||||
}
|
||||
|
||||
out[rl] = '/';
|
||||
rl += 1;
|
||||
out[rl] = 0;
|
||||
|
||||
if (cantProceed)
|
||||
{
|
||||
strcpy(out + rl, c);
|
||||
rl += strlen(c);
|
||||
continue;
|
||||
}
|
||||
|
||||
struct dirent* e;
|
||||
while (e = readdir(d))
|
||||
{
|
||||
if (strcasecmp(c, e->d_name) == 0)
|
||||
{
|
||||
strcpy(out + rl, e->d_name);
|
||||
int reportedLen = (int)strlen(e->d_name);
|
||||
rl += reportedLen;
|
||||
assert(reportedLen == strlen(c) && "casepath: This is not good at all");
|
||||
|
||||
closedir(d);
|
||||
d = opendir(out);
|
||||
|
||||
// Either it wasn't a folder, or permission error, I/O error etc.
|
||||
if (!d) {
|
||||
cantProceed = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!e)
|
||||
{
|
||||
printf("casepath couldn't find dir/file \"%s\", full path was %s\n", c, path);
|
||||
// No match, add original name and continue converting further slashes.
|
||||
strcpy(out + rl, c);
|
||||
rl += strlen(c);
|
||||
cantProceed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (d) closedir(d);
|
||||
if (mayBeTrailingSlash) {
|
||||
out[rl] = '/'; rl += 1;
|
||||
out[rl] = '\0';
|
||||
}
|
||||
|
||||
if (rl > l + 2) {
|
||||
printf("\n\ncasepath: Corrected path length is longer then original+2:\n\tOriginal: %s (%zu chars)\n\tCorrected: %s (%zu chars)\n\n", path, l, out, rl);
|
||||
}
|
||||
return out;
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,9 @@ int _caserename(const char *old_filename, const char *new_filename);
|
|||
#ifdef RW_GL3
|
||||
typedef struct
|
||||
{
|
||||
#ifndef __SYMBIAN32__
|
||||
GLFWwindow* window;
|
||||
#endif
|
||||
RwBool fullScreen;
|
||||
RwV2d lastMousePos;
|
||||
double mouseWheel; // glfw doesn't cache it
|
||||
|
|
@ -96,6 +98,12 @@ extern RwUInt32 gGameState;
|
|||
|
||||
RwBool IsForegroundApp();
|
||||
|
||||
#if !defined PATH_MAX
|
||||
#define PATH_MAX 260
|
||||
#endif
|
||||
#if !defined NAME_MAX
|
||||
#define NAME_MAX 120
|
||||
#endif
|
||||
#ifndef MAX_PATH
|
||||
#if !defined _WIN32 || defined __MINGW32__
|
||||
#define MAX_PATH PATH_MAX
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ extern "C"
|
|||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) || defined(__SYMBIAN32__)
|
||||
extern RwUInt32 psTimer(void);
|
||||
#else
|
||||
extern double psTimer(void);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ static RwBool DefaultVideoMode = TRUE;
|
|||
|
||||
RsGlobalType RsGlobal;
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined _WIN32 || defined __SYMBIAN32__
|
||||
RwUInt32
|
||||
#else
|
||||
double
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ extern RwBool
|
|||
RsInputDeviceAttach(RsInputDeviceType inputDevice,
|
||||
RsInputEventHandler inputEventHandler);
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined _WIN32 || defined __SYMBIAN32__
|
||||
extern RwUInt32
|
||||
#else
|
||||
extern double
|
||||
|
|
|
|||
586
src/skel/symbian/symbian.cpp
Normal file
586
src/skel/symbian/symbian.cpp
Normal file
|
|
@ -0,0 +1,586 @@
|
|||
#include <e32base.h>
|
||||
#include <e32keys.h>
|
||||
#include <coemain.h>
|
||||
#include <w32std.h>
|
||||
#include <aknapp.h>
|
||||
#include <akndoc.h>
|
||||
#include <aknappui.h>
|
||||
#include <coecntrl.h>
|
||||
#include <eikstart.h>
|
||||
#include <hal.h>
|
||||
#include <pthread.h>
|
||||
#include <gles2/gl2.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "rwcore.h"
|
||||
#include "skel/skeleton.h"
|
||||
#include "platform.h"
|
||||
#include "crossplatform.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "FileMgr.h"
|
||||
#include "Pad.h"
|
||||
#include "DMAudio.h"
|
||||
#include "ControllerConfig.h"
|
||||
#include "Frontend.h"
|
||||
#include "Game.h"
|
||||
#include "PCSave.h"
|
||||
#include "MemoryCard.h"
|
||||
#include "Sprite2d.h"
|
||||
#include "AnimViewer.h"
|
||||
#include "MemoryMgr.h"
|
||||
#include "Text.h"
|
||||
#include "Timer.h"
|
||||
|
||||
psGlobalType psGlobal;
|
||||
|
||||
uint32 gGameState = 0;
|
||||
long _dwOperatingSystemVersion = 0;
|
||||
uint32 _dwMemAvailPhys = 0;
|
||||
|
||||
static EGLDisplay eglDisplay;
|
||||
static EGLContext eglContext;
|
||||
static EGLSurface eglSurface;
|
||||
static EGLConfig eglConfig;
|
||||
|
||||
rw::EngineOpenParams openParams;
|
||||
|
||||
const TUid KUidRE3 = {0xe0d67647};
|
||||
|
||||
#define JOY_A 0 // cross
|
||||
#define JOY_B 1 // circle
|
||||
#define JOY_X 2 // square
|
||||
#define JOY_Y 3 // triangle
|
||||
#define JOY_LB 6
|
||||
#define JOY_RB 7
|
||||
#define JOY_START 11
|
||||
#define JOY_DPAD_UP 12
|
||||
#define JOY_DPAD_RIGHT 13
|
||||
#define JOY_DPAD_DOWN 14
|
||||
#define JOY_DPAD_LEFT 15
|
||||
|
||||
static uint8 virtualButtons[17] = { 0 };
|
||||
static float virtualLeftStickX = 0.0f;
|
||||
static float virtualLeftStickY = 0.0f;
|
||||
static float virtualRightStickX = 0.0f;
|
||||
static float virtualRightStickY = 0.0f;
|
||||
|
||||
static TInt tickPeriod;
|
||||
static uint32 cyclesPerMS;
|
||||
|
||||
static psGlobalType PsGlobal;
|
||||
|
||||
static TBool foreground;
|
||||
|
||||
void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) {
|
||||
}
|
||||
|
||||
const char* _psGetUserFilesFolder() {
|
||||
return "E:\\Data\\gta3\\";
|
||||
}
|
||||
|
||||
void HandleExit() {
|
||||
}
|
||||
|
||||
RwInt32 _psGetNumVideModes() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
RwChar** _psGetVideoModeList() {
|
||||
static RwChar* modes[] = { (RwChar*)"Native" };
|
||||
return modes;
|
||||
}
|
||||
|
||||
void _psSelectScreenVM(RwInt32 videoMode) {
|
||||
RwTexDictionarySetCurrent( nil );
|
||||
FrontEndMenuManager.UnloadTextures();
|
||||
FrontEndMenuManager.LoadAllTextures();
|
||||
}
|
||||
|
||||
void CapturePad(int padID) {
|
||||
if (padID != 0) return;
|
||||
|
||||
if (!ControlsManager.m_bFirstCapture) {
|
||||
memcpy(&ControlsManager.m_OldState, &ControlsManager.m_NewState, sizeof(ControlsManager.m_NewState));
|
||||
} else {
|
||||
memset(&ControlsManager.m_OldState, 0, sizeof(ControlsManager.m_OldState));
|
||||
}
|
||||
|
||||
ControlsManager.m_NewState.buttons = virtualButtons;
|
||||
ControlsManager.m_NewState.numButtons = 17;
|
||||
ControlsManager.m_NewState.id = 0;
|
||||
ControlsManager.m_NewState.isGamepad = true;
|
||||
|
||||
memcpy(ControlsManager.m_NewState.mappedButtons, virtualButtons, 17);
|
||||
|
||||
if (ControlsManager.m_bFirstCapture) {
|
||||
memcpy(&ControlsManager.m_OldState, &ControlsManager.m_NewState, sizeof(ControlsManager.m_NewState));
|
||||
ControlsManager.m_bFirstCapture = false;
|
||||
}
|
||||
|
||||
RsPadButtonStatus bs;
|
||||
bs.padID = padID;
|
||||
|
||||
RsPadEventHandler(rsPADBUTTONUP, (void *)&bs);
|
||||
|
||||
{
|
||||
if (CPad::m_bMapPadOneToPadTwo)
|
||||
bs.padID = 1;
|
||||
|
||||
RsPadEventHandler(rsPADBUTTONUP, (void *)&bs);
|
||||
RsPadEventHandler(rsPADBUTTONDOWN, (void *)&bs);
|
||||
}
|
||||
|
||||
CPad *pad = CPad::GetPad(0);
|
||||
pad->PCTempJoyState.LeftStickX = (int32)(virtualLeftStickX * 128.0f);
|
||||
pad->PCTempJoyState.LeftStickY = (int32)(virtualLeftStickY * 128.0f);
|
||||
pad->PCTempJoyState.RightStickX = (int32)(virtualRightStickX * 128.0f);
|
||||
pad->PCTempJoyState.RightStickY = (int32)(virtualRightStickY * 128.0f);
|
||||
}
|
||||
|
||||
RwBool psCameraBeginUpdate(RwCamera *camera) {
|
||||
RwCameraBeginUpdate(camera);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void psCameraShowRaster(RwCamera *camera) {
|
||||
RwCameraShowRaster(camera, NULL, 0);
|
||||
}
|
||||
|
||||
RwMemoryFunctions* psGetMemoryFunctions(void) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
RwImage* psGrabScreen(RwCamera *camera) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RwBool psInstallFileSystem(void) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void psMouseSetPos(RwV2d *pos) {
|
||||
}
|
||||
|
||||
RwBool psNativeTextureSupport(void) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
RwBool psSelectDevice(void) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void psTerminate(void) {
|
||||
}
|
||||
|
||||
RwBool psInitialize(void) {
|
||||
CFileMgr::Initialise();
|
||||
TInt memFree = 0;
|
||||
if (HAL::Get(HALData::EMemoryRAMFree, memFree) == KErrNone) {
|
||||
if (memFree > 40 * 1024 * 1024) {
|
||||
_dwMemAvailPhys = 40 * 1024 * 1024;
|
||||
} else if (memFree <= 0) {
|
||||
_dwMemAvailPhys = 10 * 1024 * 1024;
|
||||
} else {
|
||||
_dwMemAvailPhys = memFree;
|
||||
}
|
||||
} else {
|
||||
_dwMemAvailPhys = 40 * 1024 * 1024;
|
||||
}
|
||||
|
||||
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
RwUInt32 psTimer(void) {
|
||||
// return (RwUInt32)User::NTickCount();
|
||||
TTime time;
|
||||
time.HomeTime();
|
||||
return (RwUInt32)(time.Int64() / 1000);
|
||||
}
|
||||
|
||||
namespace sk {
|
||||
void SetMousePosition(int x, int y) {}
|
||||
}
|
||||
|
||||
|
||||
extern "C" void RDebug_Printf(const char*, ...);
|
||||
void RDebug_Printf(const char* c, ...)
|
||||
{
|
||||
VA_LIST list;
|
||||
VA_START(list, c);
|
||||
TBuf8<0x100> buf;
|
||||
TPtrC8 des((const TUint8 *)c);
|
||||
buf.FormatList(des, list);
|
||||
RDebug::RawPrint(buf);
|
||||
}
|
||||
|
||||
uint32 CTimer::GetCyclesPerMillisecond(void) {
|
||||
// return cyclesPerMS;
|
||||
return 1;
|
||||
}
|
||||
|
||||
RwBool IsForegroundApp() {
|
||||
return foreground;
|
||||
}
|
||||
|
||||
class CCContainer : public CCoeControl {
|
||||
public:
|
||||
CAknAppUi* iAppUi;
|
||||
CPeriodic* iPeriodic;
|
||||
RwUInt32 gGameState;
|
||||
static TInt LoopCallBack(TAny* p) {
|
||||
CCContainer* container = (CCContainer*) p;
|
||||
if(RsGlobal.quit) {
|
||||
RsEventHandler(rsRWTERMINATE, nil);
|
||||
container->iAppUi->Exit();
|
||||
return EFalse;
|
||||
}
|
||||
|
||||
switch (container->gGameState) {
|
||||
case GS_START_UP:
|
||||
foreground = true;
|
||||
if (HAL::Get(HAL::ENanoTickPeriod, tickPeriod) != KErrNone) {
|
||||
User::Panic(_L("Could not init timer"), 0);
|
||||
}
|
||||
cyclesPerMS = 1000 / tickPeriod;
|
||||
if (cyclesPerMS < 1) cyclesPerMS = 1;
|
||||
container->gGameState = GS_INIT_ONCE;
|
||||
break;
|
||||
case GS_INIT_ONCE:
|
||||
LoadingScreen(nil, nil, "loadsc0");
|
||||
if ( !CGame::InitialiseOnceAfterRW() ) {
|
||||
RsGlobal.quit = TRUE;
|
||||
return ETrue;
|
||||
}
|
||||
// container->gGameState = GS_INIT_FRONTEND;
|
||||
container->gGameState = GS_INIT_PLAYING_GAME;
|
||||
break;
|
||||
case GS_INIT_FRONTEND:
|
||||
LoadingScreen(nil, nil, "loadsc0");
|
||||
|
||||
FrontEndMenuManager.m_bGameNotLoaded = true;
|
||||
|
||||
CMenuManager::m_bStartUpFrontEndRequested = true;
|
||||
|
||||
container->gGameState = GS_FRONTEND;
|
||||
|
||||
// container->gGameState = GS_INIT_PLAYING_GAME;
|
||||
break;
|
||||
case GS_FRONTEND:
|
||||
RsEventHandler(rsFRONTENDIDLE, nil);
|
||||
if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bWantToLoad )
|
||||
{
|
||||
container->gGameState = GS_INIT_PLAYING_GAME;
|
||||
TRACE("gGameState = GS_INIT_PLAYING_GAME;");
|
||||
}
|
||||
if ( FrontEndMenuManager.m_bWantToLoad )
|
||||
{
|
||||
InitialiseGame();
|
||||
FrontEndMenuManager.m_bGameNotLoaded = false;
|
||||
container->gGameState = GS_PLAYING_GAME;
|
||||
TRACE("gGameState = GS_PLAYING_GAME;");
|
||||
}
|
||||
break;
|
||||
case GS_INIT_PLAYING_GAME:
|
||||
InitialiseGame();
|
||||
|
||||
FrontEndMenuManager.m_bGameNotLoaded = false;
|
||||
container->gGameState = GS_PLAYING_GAME;
|
||||
TRACE("gGameState = GS_PLAYING_GAME;");
|
||||
break;
|
||||
case GS_PLAYING_GAME:
|
||||
// float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)tickPeriod; //(float)CTimer::GetCyclesPerMillisecond();
|
||||
// if ( RwInitialised )
|
||||
// {
|
||||
// if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms)
|
||||
RsEventHandler(rsIDLE, (void *)TRUE);
|
||||
// }
|
||||
break;
|
||||
}
|
||||
|
||||
if (IsForegroundApp()) {
|
||||
User::ResetInactivityTime();
|
||||
}
|
||||
|
||||
return ETrue;
|
||||
}
|
||||
|
||||
void RestartTimerL(TInt aInterval) {
|
||||
if (iPeriodic) iPeriodic->Cancel();
|
||||
else iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard);
|
||||
iPeriodic->Start(aInterval, aInterval, TCallBack(CCContainer::LoopCallBack, this));
|
||||
}
|
||||
|
||||
void ConstructL(const TRect& aRect, CAknAppUi* aAppUi) {
|
||||
iAppUi = aAppUi;
|
||||
CreateWindowL();
|
||||
SetExtentToWholeScreen();
|
||||
Window().EnableAdvancedPointers();
|
||||
EnableDragEvents();
|
||||
ActivateL();
|
||||
|
||||
TSize size = Size();
|
||||
RsGlobal.width = size.iWidth;
|
||||
RsGlobal.height = size.iHeight;
|
||||
|
||||
EGLint attribs[] = {
|
||||
EGL_BUFFER_SIZE, 16,
|
||||
EGL_DEPTH_SIZE, 16,
|
||||
EGL_STENCIL_SIZE, 0,
|
||||
EGL_SAMPLES, 0,
|
||||
EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
eglInitialize(eglDisplay, NULL, NULL);
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
EGLint numConfigs;
|
||||
eglChooseConfig(eglDisplay, attribs, &eglConfig, 1, &numConfigs);
|
||||
|
||||
EGLint contextAttribs[ 3 ] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
|
||||
eglContext = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, contextAttribs);
|
||||
|
||||
RWindow& window = Window();
|
||||
eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, &window, NULL);
|
||||
|
||||
eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
setlocale(LC_CTYPE, "C");
|
||||
setlocale(LC_COLLATE, "C");
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
|
||||
chdir("E:\\Data\\gta3\\");
|
||||
gGameState = GS_START_UP;
|
||||
FrontEndMenuManager.LoadSettings();
|
||||
CMenuManager::OS_Language = LANG_ENGLISH;
|
||||
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_AMERICAN;
|
||||
TheText.Unload();
|
||||
TheText.Load();
|
||||
|
||||
chdir("E:\\Data\\gta3\\");
|
||||
if(RsEventHandler(rsINITIALIZE, nil) == rsEVENTERROR) return;
|
||||
|
||||
openParams.width = RsGlobal.width;
|
||||
openParams.height = RsGlobal.height;
|
||||
openParams.windowtitle = RsGlobal.appName;
|
||||
|
||||
ControlsManager.MakeControllerActionsBlank();
|
||||
ControlsManager.InitDefaultControlConfiguration();
|
||||
|
||||
if(RsEventHandler(rsRWINITIALIZE, &openParams) == rsEVENTERROR) return;
|
||||
|
||||
CPad::GetPad(0)->Clear(true);
|
||||
CPad::GetPad(1)->Clear(true);
|
||||
|
||||
PsGlobal.lastMousePos.x = PsGlobal.lastMousePos.y = 0.0f;
|
||||
RsGlobal.ps = &PsGlobal;
|
||||
|
||||
ControlsManager.InitDefaultControlConfigJoyPad(15);
|
||||
ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp());
|
||||
|
||||
{
|
||||
RwRect r;
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
r.w = RsGlobal.maximumWidth;
|
||||
r.h = RsGlobal.maximumHeight;
|
||||
|
||||
RsEventHandler(rsCAMERASIZE, &r);
|
||||
}
|
||||
|
||||
RestartTimerL(10000);
|
||||
}
|
||||
|
||||
virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent) {
|
||||
int x = aPointerEvent.iPosition.iX;
|
||||
int y = aPointerEvent.iPosition.iY;
|
||||
int w = RsGlobal.width;
|
||||
int h = RsGlobal.height;
|
||||
|
||||
// if (FrontEndMenuManager.m_bMenuActive) {
|
||||
// PSGLOBAL(lastMousePos).x = x;
|
||||
// PSGLOBAL(lastMousePos).y = y;
|
||||
// FrontEndMenuManager.m_nMouseTempPosX = x;
|
||||
// FrontEndMenuManager.m_nMouseTempPosY = y;
|
||||
//
|
||||
// if (aPointerEvent.iType == TPointerEvent::EButton1Down) {
|
||||
// CPad::GetPad(0)->PCTempMouseControllerState.LMB = true;
|
||||
// } else if (aPointerEvent.iType == TPointerEvent::EButton1Up) {
|
||||
// CPad::GetPad(0)->PCTempMouseControllerState.RMB = false;
|
||||
// }
|
||||
// CCoeControl::HandlePointerEventL(aPointerEvent);
|
||||
// return;
|
||||
// }
|
||||
|
||||
const TAdvancedPointerEvent* advpointer = aPointerEvent.AdvancedPointerEvent();
|
||||
int i = advpointer != NULL ? advpointer->PointerNumber() : 0;
|
||||
|
||||
static int activeZone[10];
|
||||
static int stickCenterX[10];
|
||||
static int stickCenterY[10];
|
||||
|
||||
if (i > 9) {
|
||||
CCoeControl::HandlePointerEventL(aPointerEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aPointerEvent.iType == TPointerEvent::EButton1Down) {
|
||||
if (x < w / 3 && y > h / 4) {
|
||||
// bottom left: left stick
|
||||
activeZone[i] = 1;
|
||||
stickCenterX[i] = x;
|
||||
stickCenterY[i] = y;
|
||||
} else if (x > w * 2 / 3 && y > h / 4) {
|
||||
// bottom right: right stick
|
||||
activeZone[i] = 2;
|
||||
stickCenterX[i] = x;
|
||||
stickCenterY[i] = y;
|
||||
} else if (x > w - (w / 5) && y < h / 4) {
|
||||
// top right: enter/exit
|
||||
activeZone[i] = 3;
|
||||
virtualButtons[JOY_Y] = 1;
|
||||
} else if (x < w / 5 && y < h / 4) {
|
||||
// top left: brake
|
||||
activeZone[i] = 4;
|
||||
virtualButtons[JOY_X] = 1;
|
||||
} else {
|
||||
// gas
|
||||
activeZone[i] = 5;
|
||||
virtualButtons[JOY_B] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (aPointerEvent.iType == TPointerEvent::EDrag) {
|
||||
if (activeZone[i] == 1 || activeZone[i] == 2) {
|
||||
float dx = (float)(x - stickCenterX[i]) / (w / 8.0f);
|
||||
float dy = (float)(y - stickCenterY[i]) / (h / 6.0f);
|
||||
|
||||
if (dx < -1.0f) dx = -1.0f;
|
||||
if (dx > 1.0f) dx = 1.0f;
|
||||
if (dy < -1.0f) dy = -1.0f;
|
||||
if (dy > 1.0f) dy = 1.0f;
|
||||
|
||||
if (activeZone[i] == 1) {
|
||||
virtualLeftStickX = dx;
|
||||
virtualLeftStickY = dy;
|
||||
} else {
|
||||
virtualRightStickX = dx;
|
||||
virtualRightStickY = dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aPointerEvent.iType == TPointerEvent::EButton1Up) {
|
||||
if (activeZone[i] == 1) {
|
||||
virtualLeftStickX = 0.0f;
|
||||
virtualLeftStickY = 0.0f;
|
||||
} else if (activeZone[i] == 2) {
|
||||
virtualRightStickX = 0.0f;
|
||||
virtualRightStickY = 0.0f;
|
||||
} else if (activeZone[i] == 3) {
|
||||
virtualButtons[JOY_Y] = 0;
|
||||
} else if (activeZone[i] == 4) {
|
||||
virtualButtons[JOY_X] = 0;
|
||||
} else if (activeZone[i] == 5) {
|
||||
virtualButtons[JOY_B] = 0;
|
||||
}
|
||||
activeZone[i] = 0;
|
||||
}
|
||||
|
||||
CCoeControl::HandlePointerEventL(aPointerEvent);
|
||||
}
|
||||
};
|
||||
|
||||
class RE3AppUi : public CAknAppUi {
|
||||
CCContainer* iContainer;
|
||||
public:
|
||||
void ConstructL() {
|
||||
BaseConstructL(CAknAppUi::EAknEnableSkin);
|
||||
iContainer = new (ELeave) CCContainer;
|
||||
iContainer->SetMopParent(this);
|
||||
iContainer->ConstructL(ClientRect(), this);
|
||||
AddToStackL(iContainer);
|
||||
}
|
||||
void HandleForegroundEventL(TBool aForeground) {
|
||||
foreground = aForeground;
|
||||
}
|
||||
|
||||
~RE3AppUi() {
|
||||
if (iContainer) {
|
||||
RemoveFromStack(iContainer);
|
||||
delete iContainer;
|
||||
}
|
||||
}
|
||||
void HandleCommandL(TInt aCommand) {
|
||||
if (aCommand == EAknSoftkeyBack || aCommand == EEikCmdExit) {
|
||||
RsGlobal.quit = 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class RE3Document: public CAknDocument {
|
||||
public:
|
||||
static RE3Document* NewL(CEikApplication& aApp);
|
||||
virtual ~RE3Document();
|
||||
protected:
|
||||
void ConstructL();
|
||||
public:
|
||||
RE3Document(CEikApplication& aApp);
|
||||
private:
|
||||
CEikAppUi* CreateAppUiL();
|
||||
};
|
||||
|
||||
RE3Document::RE3Document(CEikApplication& aApp) : CAknDocument(aApp) {}
|
||||
|
||||
RE3Document::~RE3Document() {}
|
||||
|
||||
void RE3Document::ConstructL() {}
|
||||
|
||||
RE3Document* RE3Document::NewL(CEikApplication& aApp) {
|
||||
RE3Document* self = new (ELeave) RE3Document(aApp);
|
||||
CleanupStack::PushL(self);
|
||||
self->ConstructL();
|
||||
CleanupStack::Pop();
|
||||
return self;
|
||||
}
|
||||
|
||||
CEikAppUi* RE3Document::CreateAppUiL() {
|
||||
return new (ELeave) RE3AppUi;
|
||||
}
|
||||
|
||||
class RE3App: public CAknApplication {
|
||||
private:
|
||||
CApaDocument* CreateDocumentL();
|
||||
TUid AppDllUid() const;
|
||||
};
|
||||
|
||||
LOCAL_C CApaApplication* NewApplication();
|
||||
|
||||
GLDEF_C TInt E32Main();
|
||||
|
||||
TUid RE3App::AppDllUid() const {
|
||||
return KUidRE3;
|
||||
}
|
||||
|
||||
CApaDocument* RE3App::CreateDocumentL() {
|
||||
return RE3Document::NewL(*this);
|
||||
}
|
||||
|
||||
CApaApplication* NewApplication() {
|
||||
return new RE3App;
|
||||
}
|
||||
|
||||
TInt E32Main() {
|
||||
User::SetFloatingPointMode(EFpModeRunFast);
|
||||
return EikStart::RunApplication(NewApplication);
|
||||
}
|
||||
2
vendor/librw/rw.h
vendored
2
vendor/librw/rw.h
vendored
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
|
|
|||
4
vendor/librw/skeleton/imgui/imgui.h
vendored
4
vendor/librw/skeleton/imgui/imgui.h
vendored
|
|
@ -120,6 +120,8 @@ Index of this file:
|
|||
#if __has_warning("-Wzero-as-null-pointer-constant")
|
||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#endif
|
||||
#elif defined(__ARMCC_VERSION)
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
|
||||
|
|
@ -2836,6 +2838,8 @@ enum ImDrawCornerFlags_
|
|||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#elif defined(__ARMCC_VERSION)
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
9
vendor/librw/src/assert.cpp
vendored
Normal file
9
vendor/librw/src/assert.cpp
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifdef _DEBUG
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <e32std.h>
|
||||
|
||||
void __assert(const char *func, const char *file, int line, const char *message) {
|
||||
User::Panic(_L("assert"), 0);
|
||||
}
|
||||
#endif
|
||||
5
vendor/librw/src/base.cpp
vendored
5
vendor/librw/src/base.cpp
vendored
|
|
@ -18,6 +18,7 @@
|
|||
#include "rwpipeline.h"
|
||||
#include "rwobjects.h"
|
||||
#include "rwengine.h"
|
||||
#include "fcaseopen.h"
|
||||
|
||||
namespace rw {
|
||||
|
||||
|
|
@ -999,7 +1000,7 @@ StreamFile*
|
|||
StreamFile::open(const char *path, const char *mode)
|
||||
{
|
||||
assert(this->file == nil);
|
||||
this->file = fopen(path, mode);
|
||||
this->file = fcaseopen(path, mode);
|
||||
if(this->file == nil){
|
||||
RWERROR((ERR_FILE, path));
|
||||
return nil;
|
||||
|
|
@ -1106,7 +1107,7 @@ findPointer(void *p, void **list, int32 num)
|
|||
uint8*
|
||||
getFileContents(const char *name, uint32 *len)
|
||||
{
|
||||
FILE *cf = fopen(name, "rb");
|
||||
FILE *cf = fcaseopen(name, "rb");
|
||||
if(cf == nil)
|
||||
return nil;
|
||||
fseek(cf, 0, SEEK_END);
|
||||
|
|
|
|||
9
vendor/librw/src/engine.cpp
vendored
9
vendor/librw/src/engine.cpp
vendored
|
|
@ -40,6 +40,7 @@ const char *allocLocation;
|
|||
|
||||
void *malloc_h(size_t sz, uint32 hint) { if(sz == 0) return nil; return malloc(sz); }
|
||||
void *realloc_h(void *p, size_t sz, uint32 hint) { return realloc(p, sz); }
|
||||
void free_h(void *p) { free(p); }
|
||||
|
||||
struct MemoryBlock
|
||||
{
|
||||
|
|
@ -169,7 +170,7 @@ char *strdup_LOC(const char *s, uint32 hint, const char *here) {
|
|||
MemoryFunctions defaultMemfuncs = {
|
||||
malloc_h,
|
||||
realloc_h,
|
||||
free,
|
||||
free_h,
|
||||
nil,
|
||||
nil
|
||||
};
|
||||
|
|
@ -198,6 +199,12 @@ Engine::init(MemoryFunctions *memfuncs)
|
|||
Engine::memfuncs = *memfuncs;
|
||||
else
|
||||
Engine::memfuncs = defaultMemfuncs;
|
||||
if(Engine::memfuncs.rwmalloc == nil)
|
||||
Engine::memfuncs.rwmalloc = malloc_h;
|
||||
if(Engine::memfuncs.rwrealloc == nil)
|
||||
Engine::memfuncs.rwrealloc = realloc_h;
|
||||
if(Engine::memfuncs.rwfree == nil)
|
||||
Engine::memfuncs.rwfree = free_h;
|
||||
|
||||
if(Engine::memfuncs.rwmustmalloc == nil)
|
||||
Engine::memfuncs.rwmustmalloc = mustmalloc_h;
|
||||
|
|
|
|||
8
vendor/librw/src/fcaseopen.h
vendored
Normal file
8
vendor/librw/src/fcaseopen.h
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
FILE *_fcaseopen(char const *filename, char const *mode);
|
||||
#if defined(_WIN32)
|
||||
#define fcaseopen fopen
|
||||
#else
|
||||
#define fcaseopen _fcaseopen
|
||||
#endif
|
||||
210
vendor/librw/src/gl/gl3device.cpp
vendored
210
vendor/librw/src/gl/gl3device.cpp
vendored
|
|
@ -50,7 +50,7 @@ struct UniformScene
|
|||
float32 view[16];
|
||||
};
|
||||
|
||||
#define MAX_LIGHTS 8
|
||||
#define MAX_LIGHTS 4
|
||||
|
||||
struct UniformObject
|
||||
{
|
||||
|
|
@ -89,8 +89,8 @@ const char *shaderDecl100es =
|
|||
"#define VSOUT varying\n"
|
||||
"#define FSIN varying\n"
|
||||
"#define FRAGCOLOR(c) (gl_FragColor = c)\n"
|
||||
"precision highp float;\n"
|
||||
"precision highp int;\n";
|
||||
"precision mediump float;\n"
|
||||
"precision mediump int;\n";
|
||||
const char *shaderDecl310es =
|
||||
"#version 310 es\n"
|
||||
"#define VSIN(index) layout(location = index) in\n"
|
||||
|
|
@ -137,7 +137,7 @@ int32 u_matColor;
|
|||
int32 u_surfProps;
|
||||
|
||||
Shader *defaultShader, *defaultShader_noAT;
|
||||
Shader *defaultShader_fullLight, *defaultShader_fullLight_noAT;
|
||||
//Shader *defaultShader_fullLight, *defaultShader_fullLight_noAT;
|
||||
|
||||
static bool32 stateDirty = 1;
|
||||
static bool32 sceneDirty = 1;
|
||||
|
|
@ -511,7 +511,12 @@ static GLint filterConvMap_MIP[] = {
|
|||
|
||||
static GLint addressConvMap[] = {
|
||||
0, GL_REPEAT, GL_MIRRORED_REPEAT,
|
||||
#ifdef __SYMBIAN32__
|
||||
// TODO
|
||||
GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE
|
||||
#else
|
||||
GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER
|
||||
#endif
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
@ -524,10 +529,11 @@ setFilterMode(uint32 stage, int32 filter, int32 maxAniso = 1)
|
|||
Gl3Raster *natras = PLUGINOFFSET(Gl3Raster, rwStateCache.texstage[stage].raster, nativeRasterOffset);
|
||||
if(natras->filterMode != filter){
|
||||
setActiveTexture(stage);
|
||||
if(natras->autogenMipmap || natras->numLevels > 1){
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filterConvMap_MIP[filter]);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filterConvMap_NoMIP[filter]);
|
||||
}else{
|
||||
// if(natras->autogenMipmap || natras->numLevels > 1){
|
||||
// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filterConvMap_MIP[filter]);
|
||||
// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filterConvMap_NoMIP[filter]);
|
||||
// }else
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filterConvMap_NoMIP[filter]);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filterConvMap_NoMIP[filter]);
|
||||
}
|
||||
|
|
@ -625,10 +631,11 @@ setRasterStage(uint32 stage, Raster *raster)
|
|||
uint32 addrU = rwStateCache.texstage[stage].addressingU;
|
||||
uint32 addrV = rwStateCache.texstage[stage].addressingV;
|
||||
if(natras->filterMode != filter){
|
||||
if(natras->autogenMipmap || natras->numLevels > 1){
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filterConvMap_MIP[filter]);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filterConvMap_NoMIP[filter]);
|
||||
}else{
|
||||
// if(natras->autogenMipmap || natras->numLevels > 1){
|
||||
// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filterConvMap_MIP[filter]);
|
||||
// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filterConvMap_NoMIP[filter]);
|
||||
// }else
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filterConvMap_NoMIP[filter]);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filterConvMap_NoMIP[filter]);
|
||||
}
|
||||
|
|
@ -927,7 +934,10 @@ resetRenderState(void)
|
|||
uniformState.fogStart = 0.0f;
|
||||
uniformState.fogEnd = 0.0f;
|
||||
uniformState.fogRange = 0.0f;
|
||||
uniformState.fogColor = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
uniformState.fogColor.red = 1.0f;
|
||||
uniformState.fogColor.green = 1.0f;
|
||||
uniformState.fogColor.blue = 1.0f;
|
||||
uniformState.fogColor.alpha = 1.0f;
|
||||
rwStateCache.gsalpha = 0;
|
||||
rwStateCache.gsalpharef = 128;
|
||||
stateDirty = 1;
|
||||
|
|
@ -1205,6 +1215,17 @@ setFrameBuffer(Camera *cam)
|
|||
|
||||
// Have to make sure depth buffer is attached to FB's fbo
|
||||
bindFramebuffer(natfb->fbo);
|
||||
#ifdef __SYMBIAN32__
|
||||
if (zbuf) {
|
||||
if(natfb->fboMate != zbuf){
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, GETGL3RASTEREXT(zbuf)->texid);
|
||||
natfb->fboMate = zbuf;
|
||||
}
|
||||
} else if(natfb->fboMate) {
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
|
||||
natfb->fboMate = nil;
|
||||
}
|
||||
#else
|
||||
if(zbuf){
|
||||
if(natfb->fboMate == zbuf){
|
||||
// all good
|
||||
|
|
@ -1235,6 +1256,7 @@ setFrameBuffer(Camera *cam)
|
|||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
|
||||
natfb->fboMate = nil;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static Rect
|
||||
|
|
@ -1245,6 +1267,9 @@ getFramebufferRect(Raster *frameBuffer)
|
|||
if(fb->type == Raster::CAMERA){
|
||||
#ifdef LIBRW_SDL2
|
||||
SDL_GetWindowSize(glGlobals.window, &r.w, &r.h);
|
||||
#elif defined __SYMBIAN32__
|
||||
r.w = glGlobals.modes[0].width;
|
||||
r.h = glGlobals.modes[0].height;
|
||||
#else
|
||||
glfwGetFramebufferSize(glGlobals.window, &r.w, &r.h);
|
||||
#endif
|
||||
|
|
@ -1411,6 +1436,9 @@ showRaster(Raster *raster, uint32 flags)
|
|||
else
|
||||
SDL_GL_SetSwapInterval(0);
|
||||
SDL_GL_SwapWindow(glGlobals.window);
|
||||
#elif defined __SYMBIAN32__
|
||||
// TODO check if context is lost
|
||||
eglSwapBuffers(eglGetCurrentDisplay(), eglGetCurrentSurface(EGL_DRAW));
|
||||
#else
|
||||
if(flags & Raster::FLIPWAITVSYNCH)
|
||||
glfwSwapInterval(1);
|
||||
|
|
@ -1599,6 +1627,55 @@ stopSDL2(void)
|
|||
SDL_DestroyWindow(glGlobals.window);
|
||||
return 1;
|
||||
}
|
||||
#elif defined __SYMBIAN32__
|
||||
static int
|
||||
openSymbian(EngineOpenParams *openparams)
|
||||
{
|
||||
glGlobals.winWidth = openparams->width;
|
||||
glGlobals.winHeight = openparams->height;
|
||||
glGlobals.winTitle = openparams->windowtitle;
|
||||
|
||||
glGlobals.modes = (DisplayMode*)rwMalloc(sizeof(DisplayMode), ID_DRIVER | MEMDUR_EVENT);
|
||||
glGlobals.modes[0].width = openparams->width;
|
||||
glGlobals.modes[0].height = openparams->height;
|
||||
glGlobals.modes[0].depth = 32;
|
||||
glGlobals.modes[0].flags = VIDEOMODEEXCLUSIVE;
|
||||
|
||||
glGlobals.numModes = 1;
|
||||
glGlobals.currentMode = 0;
|
||||
|
||||
glGlobals.numMonitors = 1;
|
||||
glGlobals.currentMonitor = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
closeSymbian(void)
|
||||
{
|
||||
if(glGlobals.modes){
|
||||
rwFree(glGlobals.modes);
|
||||
glGlobals.modes = nil;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
startSymbian(void)
|
||||
{
|
||||
glGlobals.presentWidth = glGlobals.winWidth;
|
||||
glGlobals.presentHeight = glGlobals.winHeight;
|
||||
glGlobals.presentOffX = 0;
|
||||
glGlobals.presentOffY = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
stopSymbian(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
|
||||
static void
|
||||
|
|
@ -1784,10 +1861,19 @@ initOpenGL(void)
|
|||
// printf("%d %s\n", i, ext);
|
||||
}
|
||||
*/
|
||||
#ifdef __SYMBIAN32__
|
||||
gl3Caps.dxtSupported = false;
|
||||
gl3Caps.astcSupported = false;
|
||||
gl3Caps.gles = true;
|
||||
gl3Caps.glversion = 20;
|
||||
#else
|
||||
gl3Caps.dxtSupported = !!GLAD_GL_EXT_texture_compression_s3tc;
|
||||
gl3Caps.astcSupported = !!GLAD_GL_KHR_texture_compression_astc_ldr;
|
||||
#endif
|
||||
|
||||
#ifndef __SYMBIAN32__
|
||||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl3Caps.maxAnisotropy);
|
||||
#endif
|
||||
|
||||
if(gl3Caps.gles){
|
||||
if(gl3Caps.glversion >= 30)
|
||||
|
|
@ -1839,12 +1925,14 @@ initOpenGL(void)
|
|||
|
||||
resetRenderState();
|
||||
|
||||
#ifndef __SYMBIAN32__
|
||||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy);
|
||||
|
||||
if(gl3Caps.glversion >= 30){
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RW_GL_USE_UBOS
|
||||
glGenBuffers(1, &ubo_state);
|
||||
|
|
@ -1880,11 +1968,11 @@ initOpenGL(void)
|
|||
assert(defaultShader);
|
||||
defaultShader_noAT = Shader::create(vs, fs_noAT);
|
||||
assert(defaultShader_noAT);
|
||||
|
||||
defaultShader_fullLight = Shader::create(vs_fullLight, fs);
|
||||
assert(defaultShader_fullLight);
|
||||
defaultShader_fullLight_noAT = Shader::create(vs_fullLight, fs_noAT);
|
||||
assert(defaultShader_fullLight_noAT);
|
||||
//
|
||||
// defaultShader_fullLight = Shader::create(vs_fullLight, fs);
|
||||
// assert(defaultShader_fullLight);
|
||||
// defaultShader_fullLight_noAT = Shader::create(vs_fullLight, fs_noAT);
|
||||
// assert(defaultShader_fullLight_noAT);
|
||||
|
||||
openIm2D();
|
||||
openIm3D();
|
||||
|
|
@ -1902,10 +1990,10 @@ termOpenGL(void)
|
|||
defaultShader = nil;
|
||||
defaultShader_noAT->destroy();
|
||||
defaultShader_noAT = nil;
|
||||
defaultShader_fullLight->destroy();
|
||||
defaultShader_fullLight = nil;
|
||||
defaultShader_fullLight_noAT->destroy();
|
||||
defaultShader_fullLight_noAT = nil;
|
||||
// defaultShader_fullLight->destroy();
|
||||
// defaultShader_fullLight = nil;
|
||||
// defaultShader_fullLight_noAT->destroy();
|
||||
// defaultShader_fullLight_noAT = nil;
|
||||
|
||||
glDeleteTextures(1, &whitetex);
|
||||
whitetex = 0;
|
||||
|
|
@ -1983,6 +2071,82 @@ deviceSystemSDL2(DeviceReq req, void *arg, int32 n)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#elif defined __SYMBIAN32__
|
||||
static int
|
||||
deviceSystemSymbian(DeviceReq req, void *arg, int32 n)
|
||||
{
|
||||
VideoMode *rwmode;
|
||||
|
||||
switch(req){
|
||||
case DEVICEOPEN:
|
||||
return openSymbian((EngineOpenParams*)arg);
|
||||
|
||||
case DEVICECLOSE:
|
||||
return closeSymbian();
|
||||
|
||||
case DEVICEINIT:
|
||||
return startSymbian() && initOpenGL();
|
||||
|
||||
case DEVICETERM:
|
||||
return termOpenGL() && stopSymbian();
|
||||
|
||||
case DEVICEFINALIZE:
|
||||
return finalizeOpenGL();
|
||||
|
||||
case DEVICEGETNUMSUBSYSTEMS:
|
||||
return glGlobals.numMonitors;
|
||||
|
||||
case DEVICEGETCURRENTSUBSYSTEM:
|
||||
return glGlobals.currentMonitor;
|
||||
|
||||
case DEVICESETSUBSYSTEM:
|
||||
if(n >= glGlobals.numMonitors)
|
||||
return 0;
|
||||
glGlobals.currentMonitor = n;
|
||||
return 1;
|
||||
|
||||
case DEVICEGETSUBSSYSTEMINFO:
|
||||
if(n >= glGlobals.numMonitors)
|
||||
return 0;
|
||||
strncpy(((SubSystemInfo*)arg)->name, "Symbian Display", 80 /*sizeof(SubSystemInfo::name)*/);
|
||||
return 1;
|
||||
|
||||
case DEVICEGETNUMVIDEOMODES:
|
||||
return glGlobals.numModes;
|
||||
|
||||
case DEVICEGETCURRENTVIDEOMODE:
|
||||
return glGlobals.currentMode;
|
||||
|
||||
case DEVICESETVIDEOMODE:
|
||||
if(n >= glGlobals.numModes)
|
||||
return 0;
|
||||
glGlobals.currentMode = n;
|
||||
return 1;
|
||||
|
||||
case DEVICEGETVIDEOMODEINFO:
|
||||
rwmode = (VideoMode*)arg;
|
||||
rwmode->width = glGlobals.modes[n].width;
|
||||
rwmode->height = glGlobals.modes[n].height;
|
||||
rwmode->depth = glGlobals.modes[n].depth;
|
||||
rwmode->flags = glGlobals.modes[n].flags;
|
||||
return 1;
|
||||
|
||||
case DEVICEGETMAXMULTISAMPLINGLEVELS:
|
||||
return 1;
|
||||
|
||||
case DEVICEGETMULTISAMPLINGLEVELS:
|
||||
return 1;
|
||||
|
||||
case DEVICESETMULTISAMPLINGLEVELS:
|
||||
glGlobals.numSamples = 1;
|
||||
return 1;
|
||||
|
||||
default:
|
||||
assert(0 && "not implemented");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
|
||||
static int
|
||||
|
|
@ -2091,6 +2255,8 @@ Device renderdevice = {
|
|||
gl3::im3DEnd,
|
||||
#ifdef LIBRW_SDL2
|
||||
gl3::deviceSystemSDL2
|
||||
#elif defined __SYMBIAN32__
|
||||
gl3::deviceSystemSymbian
|
||||
#else
|
||||
gl3::deviceSystemGLFW
|
||||
#endif
|
||||
|
|
|
|||
177
vendor/librw/src/gl/gl3immed.cpp
vendored
177
vendor/librw/src/gl/gl3immed.cpp
vendored
|
|
@ -19,17 +19,11 @@ namespace rw {
|
|||
namespace gl3 {
|
||||
|
||||
uint32 im2DVbo, im2DIbo;
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
uint32 im2DVao;
|
||||
#endif
|
||||
|
||||
Shader *im2dOverrideShader;
|
||||
|
||||
static int32 u_xform;
|
||||
|
||||
#define STARTINDICES 10000
|
||||
#define STARTVERTICES 10000
|
||||
|
||||
static Shader *im2dShader;
|
||||
static AttribDesc im2dattribDesc[3] = {
|
||||
{ ATTRIB_POS, GL_FLOAT, GL_FALSE, 4,
|
||||
|
|
@ -62,30 +56,11 @@ openIm2D(void)
|
|||
const char *fs[] = { shaderDecl, header_frag_src, simple_frag_src, nil };
|
||||
im2dShader = Shader::create(vs, fs);
|
||||
assert(im2dShader);
|
||||
|
||||
glGenBuffers(1, &im2DIbo);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, im2DIbo);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, STARTINDICES*2, nil, GL_STREAM_DRAW);
|
||||
|
||||
glGenBuffers(1, &im2DVbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, im2DVbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, STARTVERTICES*sizeof(Im2DVertex), nil, GL_STREAM_DRAW);
|
||||
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glGenVertexArrays(1, &im2DVao);
|
||||
glBindVertexArray(im2DVao);
|
||||
setAttribPointers(im2dattribDesc, 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
closeIm2D(void)
|
||||
{
|
||||
glDeleteBuffers(1, &im2DIbo);
|
||||
glDeleteBuffers(1, &im2DVbo);
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glDeleteVertexArrays(1, &im2DVao);
|
||||
#endif
|
||||
im2dShader->destroy();
|
||||
im2dShader = nil;
|
||||
}
|
||||
|
|
@ -128,29 +103,30 @@ im2DSetXform(void)
|
|||
void
|
||||
im2DRenderPrimitive(PrimitiveType primType, void *vertices, int32 numVertices)
|
||||
{
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glBindVertexArray(im2DVao);
|
||||
#endif
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, im2DVbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, STARTVERTICES*sizeof(Im2DVertex), nil, GL_STREAM_DRAW);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, numVertices*sizeof(Im2DVertex), vertices);
|
||||
|
||||
if(im2dOverrideShader)
|
||||
im2dOverrideShader->use();
|
||||
else
|
||||
im2dShader->use();
|
||||
#ifndef RW_GL_USE_VAOS
|
||||
setAttribPointers(im2dattribDesc, 3);
|
||||
#endif
|
||||
|
||||
|
||||
im2DSetXform();
|
||||
|
||||
flushCache();
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_POS);
|
||||
glVertexAttribPointer(ATTRIB_POS, 4, GL_FLOAT, GL_FALSE, sizeof(Im2DVertex), (uint8*)vertices + 0);
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_COLOR);
|
||||
glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Im2DVertex), (uint8*)vertices + offsetof(Im2DVertex, r));
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_TEXCOORDS0);
|
||||
glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im2DVertex), (uint8*)vertices + offsetof(Im2DVertex, u));
|
||||
|
||||
glDrawArrays(primTypeMap[primType], 0, numVertices);
|
||||
#ifndef RW_GL_USE_VAOS
|
||||
disableAttribPointers(im2dattribDesc, 3);
|
||||
#endif
|
||||
|
||||
glDisableVertexAttribArray(ATTRIB_POS);
|
||||
glDisableVertexAttribArray(ATTRIB_COLOR);
|
||||
glDisableVertexAttribArray(ATTRIB_TEXCOORDS0);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -158,34 +134,31 @@ im2DRenderIndexedPrimitive(PrimitiveType primType,
|
|||
void *vertices, int32 numVertices,
|
||||
void *indices, int32 numIndices)
|
||||
{
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glBindVertexArray(im2DVao);
|
||||
#endif
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, im2DIbo);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, STARTINDICES*2, nil, GL_STREAM_DRAW);
|
||||
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, numIndices*2, indices);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, im2DVbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, STARTVERTICES*sizeof(Im2DVertex), nil, GL_STREAM_DRAW);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, numVertices*sizeof(Im2DVertex), vertices);
|
||||
|
||||
if(im2dOverrideShader)
|
||||
im2dOverrideShader->use();
|
||||
else
|
||||
im2dShader->use();
|
||||
#ifndef RW_GL_USE_VAOS
|
||||
setAttribPointers(im2dattribDesc, 3);
|
||||
#endif
|
||||
|
||||
im2DSetXform();
|
||||
|
||||
flushCache();
|
||||
glDrawElements(primTypeMap[primType], numIndices,
|
||||
GL_UNSIGNED_SHORT, nil);
|
||||
#ifndef RW_GL_USE_VAOS
|
||||
disableAttribPointers(im2dattribDesc, 3);
|
||||
#endif
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_POS);
|
||||
glVertexAttribPointer(ATTRIB_POS, 4, GL_FLOAT, GL_FALSE, sizeof(Im2DVertex), (uint8*)vertices + 0);
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_COLOR);
|
||||
glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Im2DVertex), (uint8*)vertices + offsetof(Im2DVertex, r));
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_TEXCOORDS0);
|
||||
glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im2DVertex), (uint8*)vertices + offsetof(Im2DVertex, u));
|
||||
|
||||
glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, indices);
|
||||
|
||||
glDisableVertexAttribArray(ATTRIB_POS);
|
||||
glDisableVertexAttribArray(ATTRIB_COLOR);
|
||||
glDisableVertexAttribArray(ATTRIB_TEXCOORDS0);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -202,10 +175,8 @@ static AttribDesc im3dattribDesc[3] = {
|
|||
sizeof(Im3DVertex), offsetof(Im3DVertex, u) },
|
||||
};
|
||||
static uint32 im3DVbo, im3DIbo;
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
static uint32 im3DVao;
|
||||
#endif
|
||||
static int32 num3DVertices; // not actually needed here
|
||||
static void* currentIm3dVertices;
|
||||
|
||||
void
|
||||
openIm3D(void)
|
||||
|
|
@ -216,30 +187,12 @@ openIm3D(void)
|
|||
const char *fs[] = { shaderDecl, header_frag_src, simple_frag_src, nil };
|
||||
im3dShader = Shader::create(vs, fs);
|
||||
assert(im3dShader);
|
||||
|
||||
glGenBuffers(1, &im3DIbo);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, im3DIbo);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, STARTINDICES*2, nil, GL_STREAM_DRAW);
|
||||
|
||||
glGenBuffers(1, &im3DVbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, im3DVbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, STARTVERTICES*sizeof(Im3DVertex), nil, GL_STREAM_DRAW);
|
||||
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glGenVertexArrays(1, &im3DVao);
|
||||
glBindVertexArray(im3DVao);
|
||||
setAttribPointers(im3dattribDesc, 3);
|
||||
#endif
|
||||
currentIm3dVertices = nil;
|
||||
}
|
||||
|
||||
void
|
||||
closeIm3D(void)
|
||||
{
|
||||
glDeleteBuffers(1, &im3DIbo);
|
||||
glDeleteBuffers(1, &im3DVbo);
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glDeleteVertexArrays(1, &im3DVao);
|
||||
#endif
|
||||
im3dShader->destroy();
|
||||
im3dShader = nil;
|
||||
}
|
||||
|
|
@ -258,46 +211,60 @@ im3DTransform(void *vertices, int32 numVertices, Matrix *world, uint32 flags)
|
|||
if((flags & im3d::VERTEXUV) == 0)
|
||||
SetRenderStatePtr(TEXTURERASTER, nil);
|
||||
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glBindVertexArray(im2DVao);
|
||||
#endif
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, im3DVbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, STARTVERTICES*sizeof(Im3DVertex), nil, GL_STREAM_DRAW);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, numVertices*sizeof(Im3DVertex), vertices);
|
||||
#ifndef RW_GL_USE_VAOS
|
||||
setAttribPointers(im3dattribDesc, 3);
|
||||
#endif
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
currentIm3dVertices = vertices;
|
||||
num3DVertices = numVertices;
|
||||
}
|
||||
|
||||
void
|
||||
im3DRenderPrimitive(PrimitiveType primType)
|
||||
{
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, im3DIbo);
|
||||
|
||||
flushCache();
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_POS);
|
||||
glVertexAttribPointer(ATTRIB_POS, 3, GL_FLOAT, GL_FALSE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + 0);
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_COLOR);
|
||||
glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + offsetof(Im3DVertex, r));
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_TEXCOORDS0);
|
||||
glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + offsetof(Im3DVertex, u));
|
||||
|
||||
glDrawArrays(primTypeMap[primType], 0, num3DVertices);
|
||||
|
||||
glDisableVertexAttribArray(ATTRIB_POS);
|
||||
glDisableVertexAttribArray(ATTRIB_COLOR);
|
||||
glDisableVertexAttribArray(ATTRIB_TEXCOORDS0);
|
||||
}
|
||||
|
||||
void
|
||||
im3DRenderIndexedPrimitive(PrimitiveType primType, void *indices, int32 numIndices)
|
||||
{
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, im3DIbo);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, STARTINDICES*2, nil, GL_STREAM_DRAW);
|
||||
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, numIndices*2, indices);
|
||||
|
||||
flushCache();
|
||||
glDrawElements(primTypeMap[primType], numIndices,
|
||||
GL_UNSIGNED_SHORT, nil);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_POS);
|
||||
glVertexAttribPointer(ATTRIB_POS, 3, GL_FLOAT, GL_FALSE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + 0);
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_COLOR);
|
||||
glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + offsetof(Im3DVertex, r));
|
||||
|
||||
glEnableVertexAttribArray(ATTRIB_TEXCOORDS0);
|
||||
glVertexAttribPointer(ATTRIB_TEXCOORDS0, 2, GL_FLOAT, GL_FALSE, sizeof(Im3DVertex), (uint8*)currentIm3dVertices + offsetof(Im3DVertex, u));
|
||||
|
||||
glDrawElements(primTypeMap[primType], numIndices, GL_UNSIGNED_SHORT, indices);
|
||||
|
||||
glDisableVertexAttribArray(ATTRIB_POS);
|
||||
glDisableVertexAttribArray(ATTRIB_COLOR);
|
||||
glDisableVertexAttribArray(ATTRIB_TEXCOORDS0);
|
||||
}
|
||||
|
||||
void
|
||||
im3DEnd(void)
|
||||
{
|
||||
#ifndef RW_GL_USE_VAOS
|
||||
disableAttribPointers(im3dattribDesc, 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
48
vendor/librw/src/gl/gl3matfx.cpp
vendored
48
vendor/librw/src/gl/gl3matfx.cpp
vendored
|
|
@ -25,7 +25,7 @@ namespace gl3 {
|
|||
#ifdef RW_OPENGL
|
||||
|
||||
static Shader *envShader, *envShader_noAT;
|
||||
static Shader *envShader_fullLight, *envShader_fullLight_noAT;
|
||||
//static Shader *envShader_fullLight, *envShader_fullLight_noAT;
|
||||
static int32 u_texMatrix;
|
||||
static int32 u_fxparams;
|
||||
static int32 u_colorClamp;
|
||||
|
|
@ -43,17 +43,17 @@ matfxDefaultRender(InstanceDataHeader *header, InstanceData *inst, int32 vsBits,
|
|||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
|
||||
if((vsBits & VSLIGHT_MASK) == 0){
|
||||
// if((vsBits & VSLIGHT_MASK) == 0){
|
||||
if(getAlphaTest())
|
||||
defaultShader->use();
|
||||
else
|
||||
defaultShader_noAT->use();
|
||||
}else{
|
||||
if(getAlphaTest())
|
||||
defaultShader_fullLight->use();
|
||||
else
|
||||
defaultShader_fullLight_noAT->use();
|
||||
}
|
||||
// }else{
|
||||
// if(getAlphaTest())
|
||||
// defaultShader_fullLight->use();
|
||||
// else
|
||||
// defaultShader_fullLight_noAT->use();
|
||||
// }
|
||||
|
||||
drawInst(header, inst);
|
||||
}
|
||||
|
|
@ -132,17 +132,17 @@ matfxEnvRender(InstanceDataHeader *header, InstanceData *inst, int32 vsBits, uin
|
|||
rw::SetRenderState(VERTEXALPHA, 1);
|
||||
rw::SetRenderState(SRCBLEND, BLENDONE);
|
||||
|
||||
if((vsBits & VSLIGHT_MASK) == 0){
|
||||
// if((vsBits & VSLIGHT_MASK) == 0){
|
||||
if(getAlphaTest())
|
||||
envShader->use();
|
||||
else
|
||||
envShader_noAT->use();
|
||||
}else{
|
||||
if(getAlphaTest())
|
||||
envShader_fullLight->use();
|
||||
else
|
||||
envShader_fullLight_noAT->use();
|
||||
}
|
||||
// }else{
|
||||
// if(getAlphaTest())
|
||||
// envShader_fullLight->use();
|
||||
// else
|
||||
// envShader_fullLight_noAT->use();
|
||||
// }
|
||||
|
||||
drawInst(header, inst);
|
||||
|
||||
|
|
@ -208,11 +208,11 @@ matfxOpen(void *o, int32, int32)
|
|||
assert(envShader);
|
||||
envShader_noAT = Shader::create(vs, fs_noAT);
|
||||
assert(envShader_noAT);
|
||||
|
||||
envShader_fullLight = Shader::create(vs_fullLight, fs);
|
||||
assert(envShader_fullLight);
|
||||
envShader_fullLight_noAT = Shader::create(vs_fullLight, fs_noAT);
|
||||
assert(envShader_fullLight_noAT);
|
||||
//
|
||||
// envShader_fullLight = Shader::create(vs_fullLight, fs);
|
||||
// assert(envShader_fullLight);
|
||||
// envShader_fullLight_noAT = Shader::create(vs_fullLight, fs_noAT);
|
||||
// assert(envShader_fullLight_noAT);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
|
@ -227,10 +227,10 @@ matfxClose(void *o, int32, int32)
|
|||
envShader = nil;
|
||||
envShader_noAT->destroy();
|
||||
envShader_noAT = nil;
|
||||
envShader_fullLight->destroy();
|
||||
envShader_fullLight = nil;
|
||||
envShader_fullLight_noAT->destroy();
|
||||
envShader_fullLight_noAT = nil;
|
||||
// envShader_fullLight->destroy();
|
||||
// envShader_fullLight = nil;
|
||||
// envShader_fullLight_noAT->destroy();
|
||||
// envShader_fullLight_noAT = nil;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
|
|
|||
214
vendor/librw/src/gl/gl3raster.cpp
vendored
214
vendor/librw/src/gl/gl3raster.cpp
vendored
|
|
@ -68,7 +68,7 @@ rasterCreateTexture(Raster *raster)
|
|||
Gl3Raster *natras = GETGL3RASTEREXT(raster);
|
||||
switch(raster->format & 0xF00){
|
||||
case Raster::C8888:
|
||||
natras->internalFormat = GL_RGBA8;
|
||||
natras->internalFormat = GL_RGBA;
|
||||
natras->format = GL_RGBA;
|
||||
natras->type = GL_UNSIGNED_BYTE;
|
||||
natras->hasAlpha = 1;
|
||||
|
|
@ -76,15 +76,32 @@ rasterCreateTexture(Raster *raster)
|
|||
raster->depth = 32;
|
||||
break;
|
||||
case Raster::C888:
|
||||
natras->internalFormat = GL_RGB8;
|
||||
natras->internalFormat = GL_RGB;
|
||||
natras->format = GL_RGB;
|
||||
natras->type = GL_UNSIGNED_BYTE;
|
||||
natras->hasAlpha = 0;
|
||||
natras->bpp = 3;
|
||||
raster->depth = 24;
|
||||
break;
|
||||
case Raster::C565:
|
||||
natras->internalFormat = GL_RGB;
|
||||
natras->format = GL_RGB;
|
||||
natras->type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
natras->hasAlpha = 0;
|
||||
natras->bpp = 2;
|
||||
raster->depth = 16;
|
||||
break;
|
||||
case Raster::C4444:
|
||||
natras->internalFormat = GL_RGBA;
|
||||
natras->format = GL_RGBA;
|
||||
natras->type = GL_UNSIGNED_SHORT_4_4_4_4;
|
||||
natras->hasAlpha = 1;
|
||||
natras->bpp = 2;
|
||||
raster->depth = 16;
|
||||
break;
|
||||
case Raster::C1555:
|
||||
natras->internalFormat = GL_RGB5_A1;
|
||||
// natras->internalFormat = GL_RGB5_A1;
|
||||
natras->internalFormat = GL_RGBA;
|
||||
natras->format = GL_RGBA;
|
||||
natras->type = GL_UNSIGNED_SHORT_5_5_5_1;
|
||||
natras->hasAlpha = 1;
|
||||
|
|
@ -97,11 +114,7 @@ rasterCreateTexture(Raster *raster)
|
|||
}
|
||||
|
||||
if(gl3Caps.gles){
|
||||
// glReadPixels only supports GL_RGBA
|
||||
natras->internalFormat = GL_RGBA8;
|
||||
natras->format = GL_RGBA;
|
||||
natras->type = GL_UNSIGNED_BYTE;
|
||||
natras->bpp = 4;
|
||||
natras->internalFormat = natras->format;
|
||||
}
|
||||
|
||||
raster->stride = raster->width*natras->bpp;
|
||||
|
|
@ -123,10 +136,13 @@ rasterCreateTexture(Raster *raster)
|
|||
glGenTextures(1, &natras->texid);
|
||||
uint32 prev = bindTexture(natras->texid);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, natras->internalFormat,
|
||||
raster->width, raster->height,
|
||||
// raster->width, raster->height,
|
||||
1,1,
|
||||
0, natras->format, natras->type, nil);
|
||||
// TODO: allocate other levels...probably
|
||||
#ifndef __SYMBIAN32__
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, natras->numLevels-1);
|
||||
#endif
|
||||
natras->filterMode = 0;
|
||||
natras->addressU = 0;
|
||||
natras->addressV = 0;
|
||||
|
|
@ -148,22 +164,37 @@ rasterCreateCameraTexture(Raster *raster)
|
|||
Gl3Raster *natras = GETGL3RASTEREXT(raster);
|
||||
switch(raster->format & 0xF00){
|
||||
case Raster::C8888:
|
||||
natras->internalFormat = GL_RGBA8;
|
||||
natras->internalFormat = GL_RGBA;
|
||||
natras->format = GL_RGBA;
|
||||
natras->type = GL_UNSIGNED_BYTE;
|
||||
natras->hasAlpha = 1;
|
||||
natras->bpp = 4;
|
||||
break;
|
||||
case Raster::C4444:
|
||||
natras->internalFormat = GL_RGBA;
|
||||
natras->format = GL_RGBA;
|
||||
natras->type = GL_UNSIGNED_SHORT_4_4_4_4;
|
||||
natras->hasAlpha = 1;
|
||||
natras->bpp = 2;
|
||||
break;
|
||||
case Raster::C888:
|
||||
default:
|
||||
natras->internalFormat = GL_RGB8;
|
||||
natras->internalFormat = GL_RGB;
|
||||
natras->format = GL_RGB;
|
||||
natras->type = GL_UNSIGNED_BYTE;
|
||||
natras->hasAlpha = 0;
|
||||
natras->bpp = 3;
|
||||
break;
|
||||
case Raster::C565:
|
||||
natras->internalFormat = GL_RGB;
|
||||
natras->format = GL_RGB;
|
||||
natras->type = GL_UNSIGNED_SHORT_5_6_5;
|
||||
natras->hasAlpha = 0;
|
||||
natras->bpp = 2;
|
||||
break;
|
||||
case Raster::C1555:
|
||||
natras->internalFormat = GL_RGB5_A1;
|
||||
// natras->internalFormat = GL_RGB5_A1;
|
||||
natras->internalFormat = GL_RGBA;
|
||||
natras->format = GL_RGBA;
|
||||
natras->type = GL_UNSIGNED_SHORT_5_5_5_1;
|
||||
natras->hasAlpha = 1;
|
||||
|
|
@ -173,11 +204,7 @@ rasterCreateCameraTexture(Raster *raster)
|
|||
|
||||
// i don't remember why this was once here...
|
||||
if(gl3Caps.gles){
|
||||
// glReadPixels only supports GL_RGBA
|
||||
// natras->internalFormat = GL_RGBA8;
|
||||
// natras->format = GL_RGBA;
|
||||
// natras->type = GL_UNSIGNED_BYTE;
|
||||
// natras->bpp = 4;
|
||||
natras->internalFormat = natras->format;
|
||||
}
|
||||
|
||||
raster->stride = raster->width*natras->bpp;
|
||||
|
|
@ -187,7 +214,8 @@ rasterCreateCameraTexture(Raster *raster)
|
|||
glGenTextures(1, &natras->texid);
|
||||
uint32 prev = bindTexture(natras->texid);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, natras->internalFormat,
|
||||
raster->width, raster->height,
|
||||
// raster->width, raster->height,
|
||||
1,1,
|
||||
0, natras->format, natras->type, nil);
|
||||
natras->filterMode = 0;
|
||||
natras->addressU = 0;
|
||||
|
|
@ -197,10 +225,10 @@ rasterCreateCameraTexture(Raster *raster)
|
|||
bindTexture(prev);
|
||||
|
||||
|
||||
glGenFramebuffers(1, &natras->fbo);
|
||||
bindFramebuffer(natras->fbo);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, natras->texid, 0);
|
||||
bindFramebuffer(0);
|
||||
// glGenFramebuffers(1, &natras->fbo);
|
||||
// bindFramebuffer(natras->fbo);
|
||||
// glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, natras->texid, 0);
|
||||
// bindFramebuffer(0);
|
||||
natras->fboMate = nil;
|
||||
|
||||
return raster;
|
||||
|
|
@ -214,14 +242,19 @@ rasterCreateCamera(Raster *raster)
|
|||
// TODO: set/check width, height, depth, format?
|
||||
|
||||
// used for locking right now
|
||||
raster->format = Raster::C888;
|
||||
natras->internalFormat = GL_RGB8;
|
||||
natras->format = GL_RGB;
|
||||
natras->type = GL_UNSIGNED_BYTE;
|
||||
natras->hasAlpha = 0;
|
||||
natras->bpp = 3;
|
||||
|
||||
natras->autogenMipmap = 0;
|
||||
// raster->format = Raster::C888;
|
||||
// natras->internalFormat = GL_RGB;
|
||||
// natras->format = GL_RGB;
|
||||
// natras->type = GL_UNSIGNED_BYTE;
|
||||
// natras->hasAlpha = 0;
|
||||
// natras->bpp = 3;
|
||||
//
|
||||
// natras->autogenMipmap = 0;
|
||||
|
||||
raster->originalWidth = raster->width;
|
||||
raster->originalHeight = raster->height;
|
||||
raster->stride = 0;
|
||||
raster->pixels = nil;
|
||||
|
||||
natras->texid = 0;
|
||||
natras->fbo = 0;
|
||||
|
|
@ -234,34 +267,45 @@ static Raster*
|
|||
rasterCreateZbuffer(Raster *raster)
|
||||
{
|
||||
Gl3Raster *natras = GETGL3RASTEREXT(raster);
|
||||
|
||||
raster->originalWidth = raster->width;
|
||||
raster->originalHeight = raster->height;
|
||||
raster->stride = 0;
|
||||
raster->pixels = nil;
|
||||
|
||||
if(gl3Caps.gles){
|
||||
// have to use RBO on GLES!!
|
||||
glGenRenderbuffers(1, &natras->texid);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, natras->texid);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, raster->width, raster->height);
|
||||
}else{
|
||||
// TODO: set/check width, height, depth, format?
|
||||
natras->internalFormat = GL_DEPTH_STENCIL;
|
||||
natras->format = GL_DEPTH_STENCIL;
|
||||
natras->type = GL_UNSIGNED_INT_24_8;
|
||||
|
||||
natras->autogenMipmap = 0;
|
||||
|
||||
glGenTextures(1, &natras->texid);
|
||||
uint32 prev = bindTexture(natras->texid);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, natras->internalFormat,
|
||||
raster->width, raster->height,
|
||||
0, natras->format, natras->type, nil);
|
||||
natras->filterMode = 0;
|
||||
natras->addressU = 0;
|
||||
natras->addressV = 0;
|
||||
natras->maxAnisotropy = 1;
|
||||
|
||||
bindTexture(prev);
|
||||
}
|
||||
natras->fbo = 0;
|
||||
natras->fboMate = nil;
|
||||
// if(gl3Caps.gles){
|
||||
// // have to use RBO on GLES!!
|
||||
// glGenRenderbuffers(1, &natras->texid);
|
||||
// glBindRenderbuffer(GL_RENDERBUFFER, natras->texid);
|
||||
//#ifdef __SYMBIAN32__
|
||||
// glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, raster->width, raster->height);
|
||||
//#else
|
||||
// glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, raster->width, raster->height);
|
||||
//#endif
|
||||
//#ifndef __SYMBIAN32__
|
||||
// }else{
|
||||
// // TODO: set/check width, height, depth, format?
|
||||
// natras->internalFormat = GL_DEPTH_STENCIL;
|
||||
// natras->format = GL_DEPTH_STENCIL;
|
||||
// natras->type = GL_UNSIGNED_INT_24_8;
|
||||
//
|
||||
// natras->autogenMipmap = 0;
|
||||
//
|
||||
// glGenTextures(1, &natras->texid);
|
||||
// uint32 prev = bindTexture(natras->texid);
|
||||
// glTexImage2D(GL_TEXTURE_2D, 0, natras->internalFormat,
|
||||
// raster->width, raster->height,
|
||||
// 0, natras->format, natras->type, nil);
|
||||
// natras->filterMode = 0;
|
||||
// natras->addressU = 0;
|
||||
// natras->addressV = 0;
|
||||
// natras->maxAnisotropy = 1;
|
||||
//
|
||||
// bindTexture(prev);
|
||||
//#endif
|
||||
// }
|
||||
// natras->fbo = 0;
|
||||
// natras->fboMate = nil;
|
||||
|
||||
return raster;
|
||||
}
|
||||
|
|
@ -311,6 +355,7 @@ allocateDXT(Raster *raster, int32 dxt, int32 numLevels, bool32 hasAlpha)
|
|||
raster->depth = 16;
|
||||
|
||||
natras->isCompressed = 1;
|
||||
|
||||
if(raster->format & Raster::MIPMAP)
|
||||
natras->numLevels = numLevels;
|
||||
natras->autogenMipmap = (raster->format & (Raster::MIPMAP|Raster::AUTOMIPMAP)) == (Raster::MIPMAP|Raster::AUTOMIPMAP);
|
||||
|
|
@ -323,7 +368,9 @@ allocateDXT(Raster *raster, int32 dxt, int32 numLevels, bool32 hasAlpha)
|
|||
raster->width, raster->height,
|
||||
0, natras->format, natras->type, nil);
|
||||
// TODO: allocate other levels...probably
|
||||
#ifndef __SYMBIAN32__
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, natras->numLevels-1);
|
||||
#endif
|
||||
natras->filterMode = 0;
|
||||
natras->addressU = 0;
|
||||
natras->addressV = 0;
|
||||
|
|
@ -471,26 +518,33 @@ rasterLock(Raster *raster, int32 level, int32 lockMode)
|
|||
memcpy(px, natras->backingStore->levels[level].data, allocSz);
|
||||
}else{
|
||||
// GLES is losing here
|
||||
#ifndef __SYMBIAN32__ // TODO
|
||||
uint32 prev = bindTexture(natras->texid);
|
||||
glGetCompressedTexImage(GL_TEXTURE_2D, level, px);
|
||||
bindTexture(prev);
|
||||
#endif
|
||||
}
|
||||
#ifdef __SYMBIAN32__
|
||||
} else {
|
||||
#else
|
||||
}else if(gl3Caps.gles){
|
||||
#endif
|
||||
GLuint fbo;
|
||||
glGenFramebuffers(1, &fbo);
|
||||
bindFramebuffer(fbo);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, natras->texid, 0);
|
||||
GLenum e = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
assert(natras->format == GL_RGBA);
|
||||
glReadPixels(0, 0, raster->width, raster->height, natras->format, natras->type, px);
|
||||
//e = glGetError(); printf("GL err4 %x (%x)\n", e, natras->format);
|
||||
bindFramebuffer(0);
|
||||
glDeleteFramebuffers(1, &fbo);
|
||||
#ifndef __SYMBIAN32__
|
||||
}else{
|
||||
uint32 prev = bindTexture(natras->texid);
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
glGetTexImage(GL_TEXTURE_2D, level, natras->format, natras->type, px);
|
||||
bindTexture(prev);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -508,7 +562,11 @@ assert(natras->format == GL_RGBA);
|
|||
px = (uint8*)rwMalloc(allocSz, MEMDUR_EVENT | ID_DRIVER);
|
||||
assert(raster->pixels == nil);
|
||||
raster->pixels = px;
|
||||
#ifdef __SYMBIAN32__
|
||||
memset(px, 0, allocSz);
|
||||
#else
|
||||
glReadBuffer(GL_BACK);
|
||||
#endif
|
||||
glReadPixels(0, 0, raster->width, raster->height, GL_RGB, GL_UNSIGNED_BYTE, px);
|
||||
|
||||
raster->privateFlags = lockMode;
|
||||
|
|
@ -538,6 +596,7 @@ rasterUnlock(Raster *raster, int32 level)
|
|||
case Raster::TEXTURE:
|
||||
case Raster::CAMERATEXTURE:
|
||||
if(raster->privateFlags & Raster::LOCKWRITE){
|
||||
if (level != 0) break;
|
||||
uint32 prev = bindTexture(natras->texid);
|
||||
if(natras->isCompressed){
|
||||
glCompressedTexImage2D(GL_TEXTURE_2D, level, natras->internalFormat,
|
||||
|
|
@ -550,10 +609,27 @@ rasterUnlock(Raster *raster, int32 level)
|
|||
natras->backingStore->levels[level].size);
|
||||
}
|
||||
}else{
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glTexImage2D(GL_TEXTURE_2D, level, natras->internalFormat,
|
||||
raster->width, raster->height,
|
||||
0, natras->format, natras->type, raster->pixels);
|
||||
// glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
if (raster->pixels != nil && natras->format == GL_RGBA && natras->type == GL_UNSIGNED_BYTE) {
|
||||
// convert to 16-bit
|
||||
uint16_t* pixels16 = (uint16_t*)malloc(raster->width * raster->height * sizeof(uint16_t));
|
||||
uint8_t* pixels8 = (uint8_t*)raster->pixels;
|
||||
|
||||
for (int i = 0; i < raster->width * raster->height; i++) {
|
||||
uint8_t r = pixels8[i * 4 + 0];
|
||||
uint8_t g = pixels8[i * 4 + 1];
|
||||
uint8_t b = pixels8[i * 4 + 2];
|
||||
uint8_t a = pixels8[i * 4 + 3];
|
||||
|
||||
pixels16[i] = ((r >> 4) << 12) | ((g >> 4) << 8) | ((b >> 4) << 4) | (a >> 4);
|
||||
}
|
||||
glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, raster->width, raster->height, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, pixels16);
|
||||
free(pixels16);
|
||||
} else {
|
||||
glTexImage2D(GL_TEXTURE_2D, level, natras->internalFormat,
|
||||
raster->width, raster->height,
|
||||
0, natras->format, natras->type, raster->pixels);
|
||||
}
|
||||
}
|
||||
if(level == 0 && natras->autogenMipmap)
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
|
|
@ -659,9 +735,7 @@ rasterFromImage(Raster *raster, Image *image)
|
|||
assert(!natras->isCompressed);
|
||||
switch(image->depth){
|
||||
case 32:
|
||||
if(gl3Caps.gles)
|
||||
conv = conv_RGBA8888_from_RGBA8888;
|
||||
else if(format == Raster::C8888)
|
||||
if(format == Raster::C8888)
|
||||
conv = conv_RGBA8888_from_RGBA8888;
|
||||
else if(format == Raster::C888)
|
||||
conv = conv_RGB888_from_RGB888;
|
||||
|
|
@ -669,9 +743,7 @@ rasterFromImage(Raster *raster, Image *image)
|
|||
goto err;
|
||||
break;
|
||||
case 24:
|
||||
if(gl3Caps.gles)
|
||||
conv = conv_RGBA8888_from_RGB888;
|
||||
else if(format == Raster::C8888)
|
||||
if(format == Raster::C8888)
|
||||
conv = conv_RGBA8888_from_RGB888;
|
||||
else if(format == Raster::C888)
|
||||
conv = conv_RGB888_from_RGB888;
|
||||
|
|
@ -679,7 +751,7 @@ rasterFromImage(Raster *raster, Image *image)
|
|||
goto err;
|
||||
break;
|
||||
case 16:
|
||||
if(gl3Caps.gles)
|
||||
if(format == Raster::C8888)
|
||||
conv = conv_RGBA8888_from_ARGB1555;
|
||||
else if(format == Raster::C1555)
|
||||
conv = conv_RGBA5551_from_ARGB1555;
|
||||
|
|
@ -850,7 +922,11 @@ destroyNativeRaster(void *object, int32 offset, int32)
|
|||
Gl3Raster *oldfb = GETGL3RASTEREXT(natras->fboMate);
|
||||
if(oldfb->fbo){
|
||||
bindFramebuffer(oldfb->fbo);
|
||||
#ifdef __SYMBIAN32__
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
|
||||
#else
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
|
||||
#endif
|
||||
}
|
||||
oldfb->fboMate = nil;
|
||||
}
|
||||
|
|
|
|||
30
vendor/librw/src/gl/gl3render.cpp
vendored
30
vendor/librw/src/gl/gl3render.cpp
vendored
|
|
@ -64,9 +64,9 @@ drawInst_GSemu(InstanceDataHeader *header, InstanceData *inst)
|
|||
void
|
||||
drawInst(InstanceDataHeader *header, InstanceData *inst)
|
||||
{
|
||||
if(rw::GetRenderState(rw::GSALPHATEST))
|
||||
drawInst_GSemu(header, inst);
|
||||
else
|
||||
// if(rw::GetRenderState(rw::GSALPHATEST))
|
||||
// drawInst_GSemu(header, inst);
|
||||
// else
|
||||
drawInst_simple(header, inst);
|
||||
}
|
||||
|
||||
|
|
@ -93,21 +93,15 @@ disableAttribPointers(AttribDesc *attribDescs, int32 numAttribs)
|
|||
void
|
||||
setupVertexInput(InstanceDataHeader *header)
|
||||
{
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glBindVertexArray(header->vao);
|
||||
#else
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
||||
setAttribPointers(header->attribDesc, header->numAttribs);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
teardownVertexInput(InstanceDataHeader *header)
|
||||
{
|
||||
#ifndef RW_GL_USE_VAOS
|
||||
disableAttribPointers(header->attribDesc, header->numAttribs);
|
||||
#endif
|
||||
}
|
||||
|
||||
int32
|
||||
|
|
@ -117,9 +111,9 @@ lightingCB(Atomic *atomic)
|
|||
Light *directionals[8];
|
||||
Light *locals[8];
|
||||
lightData.directionals = directionals;
|
||||
lightData.numDirectionals = 8;
|
||||
lightData.numDirectionals = 0; // 8;
|
||||
lightData.locals = locals;
|
||||
lightData.numLocals = 8;
|
||||
lightData.numLocals = 0; // 8;
|
||||
|
||||
if(atomic->geometry->flags & rw::Geometry::LIGHT){
|
||||
((World*)engine->currentWorld)->enumerateLights(atomic, &lightData);
|
||||
|
|
@ -158,17 +152,17 @@ defaultRenderCB(Atomic *atomic, InstanceDataHeader *header)
|
|||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
|
||||
if((vsBits & VSLIGHT_MASK) == 0){
|
||||
// if((vsBits & VSLIGHT_MASK) == 0){
|
||||
if(getAlphaTest())
|
||||
defaultShader->use();
|
||||
else
|
||||
defaultShader_noAT->use();
|
||||
}else{
|
||||
if(getAlphaTest())
|
||||
defaultShader_fullLight->use();
|
||||
else
|
||||
defaultShader_fullLight_noAT->use();
|
||||
}
|
||||
// }else{
|
||||
// if(getAlphaTest())
|
||||
// defaultShader_fullLight->use();
|
||||
// else
|
||||
// defaultShader_fullLight_noAT->use();
|
||||
// }
|
||||
|
||||
drawInst(header, inst);
|
||||
inst++;
|
||||
|
|
|
|||
4
vendor/librw/src/gl/gl3shader.cpp
vendored
4
vendor/librw/src/gl/gl3shader.cpp
vendored
|
|
@ -189,8 +189,8 @@ compileshader(GLenum type, const char **src, GLuint *shader)
|
|||
glShaderSource(shdr, n, src, nil);
|
||||
glCompileShader(shdr);
|
||||
glGetShaderiv(shdr, GL_COMPILE_STATUS, &success);
|
||||
printShaderSource(src);
|
||||
if(!success){
|
||||
printShaderSource(src);
|
||||
fprintf(stderr, "Error in %s shader\n",
|
||||
type == GL_VERTEX_SHADER ? "vertex" : "fragment");
|
||||
glGetShaderiv(shdr, GL_INFO_LOG_LENGTH, &len);
|
||||
|
|
@ -295,6 +295,7 @@ Shader::create(const char **vsrc, const char **fsrc)
|
|||
printf("\n");
|
||||
#endif
|
||||
|
||||
#ifndef __SYMBIAN32__
|
||||
// set uniform block binding
|
||||
for(i = 0; i < uniformRegistry.numBlocks; i++){
|
||||
int idx = glGetUniformBlockIndex(program,
|
||||
|
|
@ -302,6 +303,7 @@ Shader::create(const char **vsrc, const char **fsrc)
|
|||
if(idx >= 0)
|
||||
glUniformBlockBinding(program, idx, i);
|
||||
}
|
||||
#endif
|
||||
|
||||
// query uniform locations
|
||||
sh->program = program;
|
||||
|
|
|
|||
71
vendor/librw/src/gl/gl3skin.cpp
vendored
71
vendor/librw/src/gl/gl3skin.cpp
vendored
|
|
@ -25,7 +25,7 @@ namespace gl3 {
|
|||
#ifdef RW_OPENGL
|
||||
|
||||
static Shader *skinShader, *skinShader_noAT;
|
||||
static Shader *skinShader_fullLight, *skinShader_fullLight_noAT;
|
||||
//static Shader *skinShader_fullLight, *skinShader_fullLight_noAT;
|
||||
static int32 u_boneMatrices;
|
||||
|
||||
void
|
||||
|
|
@ -189,17 +189,9 @@ skinInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance)
|
|||
header->totalNumVertex, a->stride);
|
||||
}
|
||||
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glBindVertexArray(header->vao);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
||||
#endif
|
||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, header->totalNumVertex*attribs[0].stride,
|
||||
header->vertexBuffer, GL_STATIC_DRAW);
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
setAttribPointers(header->attribDesc, header->numAttribs);
|
||||
glBindVertexArray(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -208,7 +200,8 @@ skinUninstanceCB(Geometry *geo, InstanceDataHeader *header)
|
|||
assert(0 && "can't uninstance");
|
||||
}
|
||||
|
||||
static float skinMatrices[64*16];
|
||||
#define MAX_BONES 24
|
||||
static float skinMatrices[MAX_BONES*16];
|
||||
|
||||
void
|
||||
uploadSkinMatrices(Atomic *a)
|
||||
|
|
@ -218,13 +211,18 @@ uploadSkinMatrices(Atomic *a)
|
|||
Matrix *m = (Matrix*)skinMatrices;
|
||||
HAnimHierarchy *hier = Skin::getHierarchy(a);
|
||||
|
||||
int numBones = skin->numBones;
|
||||
if (numBones > MAX_BONES) numBones = MAX_BONES;
|
||||
|
||||
if(hier){
|
||||
Matrix *invMats = (Matrix*)skin->inverseMatrices;
|
||||
Matrix tmp;
|
||||
|
||||
int numNodes = hier->numNodes;
|
||||
if (numNodes > MAX_BONES) numNodes = MAX_BONES;
|
||||
|
||||
assert(skin->numBones == hier->numNodes);
|
||||
if(hier->flags & HAnimHierarchy::LOCALSPACEMATRICES){
|
||||
for(i = 0; i < hier->numNodes; i++){
|
||||
for(i = 0; i < numNodes; i++){
|
||||
invMats[i].flags = 0;
|
||||
Matrix::mult(m, &invMats[i], &hier->matrices[i]);
|
||||
m++;
|
||||
|
|
@ -232,7 +230,7 @@ uploadSkinMatrices(Atomic *a)
|
|||
}else{
|
||||
Matrix invAtmMat;
|
||||
Matrix::invert(&invAtmMat, a->getFrame()->getLTM());
|
||||
for(i = 0; i < hier->numNodes; i++){
|
||||
for(i = 0; i < numNodes; i++){
|
||||
invMats[i].flags = 0;
|
||||
Matrix::mult(&tmp, &hier->matrices[i], &invAtmMat);
|
||||
Matrix::mult(m, &invMats[i], &tmp);
|
||||
|
|
@ -240,7 +238,7 @@ uploadSkinMatrices(Atomic *a)
|
|||
}
|
||||
}
|
||||
}else{
|
||||
for(i = 0; i < skin->numBones; i++){
|
||||
for(i = 0; i < numBones; i++){
|
||||
m->setIdentity();
|
||||
m++;
|
||||
}
|
||||
|
|
@ -273,18 +271,20 @@ skinRenderCB(Atomic *atomic, InstanceDataHeader *header)
|
|||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
|
||||
if((vsBits & VSLIGHT_MASK) == 0){
|
||||
// if((vsBits & VSLIGHT_MASK) == 0){
|
||||
if(getAlphaTest())
|
||||
skinShader->use();
|
||||
else
|
||||
skinShader_noAT->use();
|
||||
}else{
|
||||
if(getAlphaTest())
|
||||
skinShader_fullLight->use();
|
||||
else
|
||||
skinShader_fullLight_noAT->use();
|
||||
}
|
||||
// }else{
|
||||
// if(getAlphaTest())
|
||||
// skinShader_fullLight->use();
|
||||
// else
|
||||
// skinShader_fullLight_noAT->use();
|
||||
// }
|
||||
|
||||
// defaultShader->use();
|
||||
|
||||
drawInst(header, inst);
|
||||
inst++;
|
||||
}
|
||||
|
|
@ -295,7 +295,7 @@ static void*
|
|||
skinOpen(void *o, int32, int32)
|
||||
{
|
||||
skinGlobals.pipelines[PLATFORM_GL3] = makeSkinPipeline();
|
||||
|
||||
|
||||
#include "shaders/simple_fs_gl.inc"
|
||||
#include "shaders/skin_gl.inc"
|
||||
const char *vs[] = { shaderDecl, header_vert_src, skin_vert_src, nil };
|
||||
|
|
@ -307,11 +307,11 @@ skinOpen(void *o, int32, int32)
|
|||
assert(skinShader);
|
||||
skinShader_noAT = Shader::create(vs, fs_noAT);
|
||||
assert(skinShader_noAT);
|
||||
|
||||
skinShader_fullLight = Shader::create(vs_fullLight, fs);
|
||||
assert(skinShader_fullLight);
|
||||
skinShader_fullLight_noAT = Shader::create(vs_fullLight, fs_noAT);
|
||||
assert(skinShader_fullLight_noAT);
|
||||
//
|
||||
// skinShader_fullLight = Shader::create(vs_fullLight, fs);
|
||||
// assert(skinShader_fullLight);
|
||||
// skinShader_fullLight_noAT = Shader::create(vs_fullLight, fs_noAT);
|
||||
// assert(skinShader_fullLight_noAT);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
|
@ -326,10 +326,10 @@ skinClose(void *o, int32, int32)
|
|||
skinShader = nil;
|
||||
skinShader_noAT->destroy();
|
||||
skinShader_noAT = nil;
|
||||
skinShader_fullLight->destroy();
|
||||
skinShader_fullLight = nil;
|
||||
skinShader_fullLight_noAT->destroy();
|
||||
skinShader_fullLight_noAT = nil;
|
||||
// skinShader_fullLight->destroy();
|
||||
// skinShader_fullLight = nil;
|
||||
// skinShader_fullLight_noAT->destroy();
|
||||
// skinShader_fullLight_noAT = nil;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
|
@ -337,10 +337,11 @@ skinClose(void *o, int32, int32)
|
|||
void
|
||||
initSkin(void)
|
||||
{
|
||||
u_boneMatrices = registerUniform("u_boneMatrices", UNIFORM_MAT4, 64);
|
||||
|
||||
Driver::registerPlugin(PLATFORM_GL3, 0, ID_SKIN,
|
||||
skinOpen, skinClose);
|
||||
// TODO
|
||||
// u_boneMatrices = registerUniform("u_boneMatrices", UNIFORM_MAT4, MAX_BONES);
|
||||
//
|
||||
// Driver::registerPlugin(PLATFORM_GL3, 0, ID_SKIN,
|
||||
// skinOpen, skinClose);
|
||||
}
|
||||
|
||||
ObjPipeline*
|
||||
|
|
|
|||
17
vendor/librw/src/gl/rwgl3.h
vendored
17
vendor/librw/src/gl/rwgl3.h
vendored
|
|
@ -1,4 +1,14 @@
|
|||
#ifdef RW_GL3
|
||||
#ifdef __SYMBIAN32__
|
||||
#include <gles2/gl2.h>
|
||||
#include <gles2/gl2ext.h>
|
||||
#include <egl/egl.h>
|
||||
|
||||
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
||||
#else
|
||||
#include "glad/glad.h"
|
||||
#ifdef LIBRW_SDL2
|
||||
#include <SDL.h>
|
||||
|
|
@ -6,6 +16,7 @@
|
|||
#include <GLFW/glfw3.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace rw {
|
||||
|
||||
|
|
@ -15,7 +26,7 @@ struct EngineOpenParams
|
|||
#ifdef LIBRW_SDL2
|
||||
SDL_Window **window;
|
||||
bool32 fullscreen;
|
||||
#else
|
||||
#elif !defined(__SYMBIAN32__)
|
||||
GLFWwindow **window;
|
||||
#endif
|
||||
int width, height;
|
||||
|
|
@ -49,12 +60,14 @@ enum AttribIndices
|
|||
ATTRIB_INDICES,
|
||||
ATTRIB_TEXCOORDS0,
|
||||
ATTRIB_TEXCOORDS1,
|
||||
#if 0
|
||||
ATTRIB_TEXCOORDS2,
|
||||
ATTRIB_TEXCOORDS3,
|
||||
ATTRIB_TEXCOORDS4,
|
||||
ATTRIB_TEXCOORDS5,
|
||||
ATTRIB_TEXCOORDS6,
|
||||
ATTRIB_TEXCOORDS7,
|
||||
#endif
|
||||
};
|
||||
|
||||
// default uniform indices
|
||||
|
|
@ -98,7 +111,7 @@ struct InstanceDataHeader : rw::InstanceDataHeader
|
|||
struct Shader;
|
||||
|
||||
extern Shader *defaultShader, *defaultShader_noAT;
|
||||
extern Shader *defaultShader_fullLight, *defaultShader_fullLight_noAT;
|
||||
//extern Shader *defaultShader_fullLight, *defaultShader_fullLight_noAT;
|
||||
|
||||
struct Im3DVertex
|
||||
{
|
||||
|
|
|
|||
7
vendor/librw/src/gl/rwgl3impl.h
vendored
7
vendor/librw/src/gl/rwgl3impl.h
vendored
|
|
@ -24,10 +24,15 @@ void im3DEnd(void);
|
|||
|
||||
struct DisplayMode
|
||||
{
|
||||
#ifdef __SYMBIAN32__
|
||||
uint32 width;
|
||||
uint32 height;
|
||||
#else
|
||||
#ifdef LIBRW_SDL2
|
||||
SDL_DisplayMode mode;
|
||||
#else
|
||||
GLFWvidmode mode;
|
||||
#endif
|
||||
#endif
|
||||
int32 depth;
|
||||
uint32 flags;
|
||||
|
|
@ -40,10 +45,12 @@ struct GlGlobals
|
|||
SDL_Window *window;
|
||||
SDL_GLContext glcontext;
|
||||
#else
|
||||
#ifndef __SYMBIAN32__
|
||||
GLFWwindow **pWindow;
|
||||
GLFWwindow *window;
|
||||
|
||||
GLFWmonitor *monitor;
|
||||
#endif
|
||||
int numMonitors;
|
||||
int currentMonitor;
|
||||
#endif
|
||||
|
|
|
|||
21
vendor/librw/src/gl/shaders/Makefile
vendored
21
vendor/librw/src/gl/shaders/Makefile
vendored
|
|
@ -2,44 +2,43 @@ all: header_vs.inc header_fs.inc im2d_gl.inc im3d_gl.inc default_vs_gl.inc simpl
|
|||
|
||||
header_vs.inc: header.vert
|
||||
(echo 'const char *header_vert_src =';\
|
||||
sed 's/..*/"&\\n"/' header.vert;\
|
||||
sed 's/..*/"&\\\\n"/' header.vert;\
|
||||
echo ';') >header_vs.inc
|
||||
|
||||
header_fs.inc: header.frag
|
||||
(echo 'const char *header_frag_src =';\
|
||||
sed 's/..*/"&\\n"/' header.frag;\
|
||||
sed 's/..*/"&\\\\n"/' header.frag;\
|
||||
echo ';') >header_fs.inc
|
||||
|
||||
im2d_gl.inc: im2d.vert
|
||||
(echo 'const char *im2d_vert_src =';\
|
||||
sed 's/..*/"&\\n"/' im2d.vert;\
|
||||
sed 's/..*/"&\\\\n"/' im2d.vert;\
|
||||
echo ';') >im2d_gl.inc
|
||||
|
||||
im3d_gl.inc: im3d.vert
|
||||
(echo 'const char *im3d_vert_src =';\
|
||||
sed 's/..*/"&\\n"/' im3d.vert;\
|
||||
sed 's/..*/"&\\\\n"/' im3d.vert;\
|
||||
echo ';') >im3d_gl.inc
|
||||
|
||||
default_vs_gl.inc: default.vert
|
||||
(echo 'const char *default_vert_src =';\
|
||||
sed 's/..*/"&\\n"/' default.vert;\
|
||||
sed 's/..*/"&\\\\n"/' default.vert;\
|
||||
echo ';') >default_vs_gl.inc
|
||||
|
||||
simple_fs_gl.inc: simple.frag
|
||||
(echo 'const char *simple_frag_src =';\
|
||||
sed 's/..*/"&\\n"/' simple.frag;\
|
||||
sed 's/..*/"&\\\\n"/' simple.frag;\
|
||||
echo ';') >simple_fs_gl.inc
|
||||
|
||||
matfx_gl.inc: matfx_env.frag matfx_env.vert
|
||||
(echo 'const char *matfx_env_vert_src =';\
|
||||
sed 's/..*/"&\\n"/' matfx_env.vert;\
|
||||
sed 's/..*/"&\\\\n"/' matfx_env.vert;\
|
||||
echo ';';\
|
||||
echo 'const char *matfx_env_frag_src =';\
|
||||
sed 's/..*/"&\\n"/' matfx_env.frag;\
|
||||
sed 's/..*/"&\\\\n"/' matfx_env.frag;\
|
||||
echo ';') >matfx_gl.inc
|
||||
|
||||
skin_gl.inc: skin.vert
|
||||
(echo 'const char *skin_vert_src =';\
|
||||
sed 's/..*/"&\\n"/' skin.vert;\
|
||||
echo ';') >skin_gl.inc
|
||||
|
||||
sed 's/..*/"&\\\\n"/' skin.vert;\
|
||||
echo ';') >skin_gl.inc
|
||||
9
vendor/librw/src/gl/shaders/default.vert
vendored
9
vendor/librw/src/gl/shaders/default.vert
vendored
|
|
@ -1,8 +1,7 @@
|
|||
VSIN(ATTRIB_POS) vec3 in_pos;
|
||||
VSIN(ATTRIB_POS) vec3 in_pos;
|
||||
|
||||
VSOUT vec4 v_color;
|
||||
VSOUT vec2 v_tex0;
|
||||
VSOUT float v_fog;
|
||||
VSOUT vec3 v_tex0_fog;
|
||||
|
||||
void
|
||||
main(void)
|
||||
|
|
@ -11,7 +10,7 @@ main(void)
|
|||
gl_Position = u_proj * u_view * Vertex;
|
||||
vec3 Normal = mat3(u_world) * in_normal;
|
||||
|
||||
v_tex0 = in_tex0;
|
||||
v_tex0_fog.xy = in_tex0;
|
||||
|
||||
v_color = in_color;
|
||||
v_color.rgb += u_ambLight.rgb*surfAmbient;
|
||||
|
|
@ -19,5 +18,5 @@ main(void)
|
|||
v_color = clamp(v_color, 0.0, 1.0);
|
||||
v_color *= u_matColor;
|
||||
|
||||
v_fog = DoFog(gl_Position.w);
|
||||
v_tex0_fog.z = DoFog(gl_Position.w);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
const char *default_vert_src =
|
||||
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
|
||||
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
|
||||
|
||||
"VSOUT vec4 v_color;\n"
|
||||
"VSOUT vec2 v_tex0;\n"
|
||||
"VSOUT float v_fog;\n"
|
||||
"VSOUT vec3 v_tex0_fog;\n"
|
||||
|
||||
"void\n"
|
||||
"main(void)\n"
|
||||
|
|
@ -12,7 +11,7 @@ const char *default_vert_src =
|
|||
" gl_Position = u_proj * u_view * Vertex;\n"
|
||||
" vec3 Normal = mat3(u_world) * in_normal;\n"
|
||||
|
||||
" v_tex0 = in_tex0;\n"
|
||||
" v_tex0_fog.xy = in_tex0;\n"
|
||||
|
||||
" v_color = in_color;\n"
|
||||
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
|
||||
|
|
@ -20,6 +19,6 @@ const char *default_vert_src =
|
|||
" v_color = clamp(v_color, 0.0, 1.0);\n"
|
||||
" v_color *= u_matColor;\n"
|
||||
|
||||
" v_fog = DoFog(gl_Position.w);\n"
|
||||
" v_tex0_fog.z = DoFog(gl_Position.w);\n"
|
||||
"}\n"
|
||||
;
|
||||
|
|
|
|||
4
vendor/librw/src/gl/shaders/header.vert
vendored
4
vendor/librw/src/gl/shaders/header.vert
vendored
|
|
@ -49,7 +49,7 @@ uniform mat4 u_proj;
|
|||
uniform mat4 u_view;
|
||||
#endif
|
||||
|
||||
#define MAX_LIGHTS 8
|
||||
#define MAX_LIGHTS 4
|
||||
|
||||
#ifdef USE_UBOS
|
||||
layout(std140) uniform Object
|
||||
|
|
@ -80,6 +80,7 @@ uniform vec4 u_surfProps; // amb, spec, diff, extra
|
|||
vec3 DoDynamicLight(vec3 V, vec3 N)
|
||||
{
|
||||
vec3 color = vec3(0.0, 0.0, 0.0);
|
||||
/*
|
||||
for(int i = 0; i < MAX_LIGHTS; i++){
|
||||
if(u_lightParams[i].x == 0.0)
|
||||
break;
|
||||
|
|
@ -119,6 +120,7 @@ vec3 DoDynamicLight(vec3 V, vec3 N)
|
|||
#endif
|
||||
;
|
||||
}
|
||||
*/
|
||||
return color;
|
||||
}
|
||||
|
||||
|
|
|
|||
4
vendor/librw/src/gl/shaders/header_vs.inc
vendored
4
vendor/librw/src/gl/shaders/header_vs.inc
vendored
|
|
@ -50,7 +50,7 @@ const char *header_vert_src =
|
|||
"uniform mat4 u_view;\n"
|
||||
"#endif\n"
|
||||
|
||||
"#define MAX_LIGHTS 8\n"
|
||||
"#define MAX_LIGHTS 4\n"
|
||||
|
||||
"#ifdef USE_UBOS\n"
|
||||
"layout(std140) uniform Object\n"
|
||||
|
|
@ -81,6 +81,7 @@ const char *header_vert_src =
|
|||
"vec3 DoDynamicLight(vec3 V, vec3 N)\n"
|
||||
"{\n"
|
||||
" vec3 color = vec3(0.0, 0.0, 0.0);\n"
|
||||
"/*\n"
|
||||
" for(int i = 0; i < MAX_LIGHTS; i++){\n"
|
||||
" if(u_lightParams[i].x == 0.0)\n"
|
||||
" break;\n"
|
||||
|
|
@ -120,6 +121,7 @@ const char *header_vert_src =
|
|||
"#endif\n"
|
||||
" ;\n"
|
||||
" }\n"
|
||||
"*/\n"
|
||||
" return color;\n"
|
||||
"}\n"
|
||||
|
||||
|
|
|
|||
9
vendor/librw/src/gl/shaders/im2d.vert
vendored
9
vendor/librw/src/gl/shaders/im2d.vert
vendored
|
|
@ -1,18 +1,17 @@
|
|||
uniform vec4 u_xform;
|
||||
|
||||
VSIN(ATTRIB_POS) vec4 in_pos;
|
||||
VSIN(ATTRIB_POS) vec4 in_pos;
|
||||
|
||||
VSOUT vec4 v_color;
|
||||
VSOUT vec2 v_tex0;
|
||||
VSOUT float v_fog;
|
||||
VSOUT vec3 v_tex0_fog;
|
||||
|
||||
void
|
||||
main(void)
|
||||
{
|
||||
gl_Position = in_pos;
|
||||
gl_Position.xy = gl_Position.xy * u_xform.xy + u_xform.zw;
|
||||
v_fog = DoFog(gl_Position.w);
|
||||
v_tex0_fog.z = DoFog(gl_Position.w);
|
||||
gl_Position.xyz *= gl_Position.w;
|
||||
v_color = in_color;
|
||||
v_tex0 = in_tex0;
|
||||
v_tex0_fog.xy = in_tex0;
|
||||
}
|
||||
|
|
|
|||
9
vendor/librw/src/gl/shaders/im2d_gl.inc
vendored
9
vendor/librw/src/gl/shaders/im2d_gl.inc
vendored
|
|
@ -1,20 +1,19 @@
|
|||
const char *im2d_vert_src =
|
||||
"uniform vec4 u_xform;\n"
|
||||
|
||||
"VSIN(ATTRIB_POS) vec4 in_pos;\n"
|
||||
"VSIN(ATTRIB_POS) vec4 in_pos;\n"
|
||||
|
||||
"VSOUT vec4 v_color;\n"
|
||||
"VSOUT vec2 v_tex0;\n"
|
||||
"VSOUT float v_fog;\n"
|
||||
"VSOUT vec3 v_tex0_fog;\n"
|
||||
|
||||
"void\n"
|
||||
"main(void)\n"
|
||||
"{\n"
|
||||
" gl_Position = in_pos;\n"
|
||||
" gl_Position.xy = gl_Position.xy * u_xform.xy + u_xform.zw;\n"
|
||||
" v_fog = DoFog(gl_Position.w);\n"
|
||||
" v_tex0_fog.z = DoFog(gl_Position.w);\n"
|
||||
" gl_Position.xyz *= gl_Position.w;\n"
|
||||
" v_color = in_color;\n"
|
||||
" v_tex0 = in_tex0;\n"
|
||||
" v_tex0_fog.xy = in_tex0;\n"
|
||||
"}\n"
|
||||
;
|
||||
|
|
|
|||
12
vendor/librw/src/gl/shaders/im3d.vert
vendored
12
vendor/librw/src/gl/shaders/im3d.vert
vendored
|
|
@ -1,16 +1,14 @@
|
|||
VSIN(ATTRIB_POS) vec3 in_pos;
|
||||
VSIN(ATTRIB_POS) vec3 in_pos;
|
||||
|
||||
VSOUT vec4 v_color;
|
||||
VSOUT vec2 v_tex0;
|
||||
VSOUT float v_fog;
|
||||
VSOUT vec3 v_tex0_fog;
|
||||
|
||||
void
|
||||
main(void)
|
||||
{
|
||||
vec4 Vertex = u_world * vec4(in_pos, 1.0);
|
||||
vec4 CamVertex = u_view * Vertex;
|
||||
gl_Position = u_proj * CamVertex;
|
||||
gl_Position = u_proj * u_view * Vertex;
|
||||
v_color = in_color;
|
||||
v_tex0 = in_tex0;
|
||||
v_fog = DoFog(gl_Position.w);
|
||||
v_tex0_fog.xy = in_tex0;
|
||||
v_tex0_fog.z = DoFog(gl_Position.w);
|
||||
}
|
||||
|
|
|
|||
12
vendor/librw/src/gl/shaders/im3d_gl.inc
vendored
12
vendor/librw/src/gl/shaders/im3d_gl.inc
vendored
|
|
@ -1,18 +1,16 @@
|
|||
const char *im3d_vert_src =
|
||||
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
|
||||
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
|
||||
|
||||
"VSOUT vec4 v_color;\n"
|
||||
"VSOUT vec2 v_tex0;\n"
|
||||
"VSOUT float v_fog;\n"
|
||||
"VSOUT vec3 v_tex0_fog;\n"
|
||||
|
||||
"void\n"
|
||||
"main(void)\n"
|
||||
"{\n"
|
||||
" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n"
|
||||
" vec4 CamVertex = u_view * Vertex;\n"
|
||||
" gl_Position = u_proj * CamVertex;\n"
|
||||
" gl_Position = u_proj * u_view * Vertex;\n"
|
||||
" v_color = in_color;\n"
|
||||
" v_tex0 = in_tex0;\n"
|
||||
" v_fog = DoFog(gl_Position.w);\n"
|
||||
" v_tex0_fog.xy = in_tex0;\n"
|
||||
" v_tex0_fog.z = DoFog(gl_Position.w);\n"
|
||||
"}\n"
|
||||
;
|
||||
|
|
|
|||
9
vendor/librw/src/gl/shaders/matfx_env.frag
vendored
9
vendor/librw/src/gl/shaders/matfx_env.frag
vendored
|
|
@ -8,20 +8,19 @@ uniform vec4 u_fxparams;
|
|||
|
||||
FSIN vec4 v_color;
|
||||
FSIN vec4 v_envColor;
|
||||
FSIN vec2 v_tex0;
|
||||
FSIN vec3 v_tex0_fog;
|
||||
FSIN vec2 v_tex1;
|
||||
FSIN float v_fog;
|
||||
|
||||
void
|
||||
main(void)
|
||||
{
|
||||
vec4 pass1 = v_color;
|
||||
pass1 *= texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));
|
||||
pass1 *= texture(tex0, vec2(v_tex0_fog.x, 1.0-v_tex0_fog.y));
|
||||
|
||||
vec4 pass2 = v_envColor*shininess*texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));
|
||||
|
||||
pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);
|
||||
pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);
|
||||
pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_tex0_fog.z);
|
||||
pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_tex0_fog.z);
|
||||
|
||||
float fba = max(pass1.a, disableFBA);
|
||||
vec4 color;
|
||||
|
|
|
|||
9
vendor/librw/src/gl/shaders/matfx_env.vert
vendored
9
vendor/librw/src/gl/shaders/matfx_env.vert
vendored
|
|
@ -2,13 +2,12 @@ uniform mat4 u_texMatrix;
|
|||
uniform vec4 u_colorClamp;
|
||||
uniform vec4 u_envColor;
|
||||
|
||||
VSIN(ATTRIB_POS) vec3 in_pos;
|
||||
VSIN(ATTRIB_POS) vec3 in_pos;
|
||||
|
||||
VSOUT vec4 v_color;
|
||||
VSOUT vec4 v_envColor;
|
||||
VSOUT vec2 v_tex0;
|
||||
VSOUT vec3 v_tex0_fog;
|
||||
VSOUT vec2 v_tex1;
|
||||
VSOUT float v_fog;
|
||||
|
||||
void
|
||||
main(void)
|
||||
|
|
@ -17,7 +16,7 @@ main(void)
|
|||
gl_Position = u_proj * u_view * Vertex;
|
||||
vec3 Normal = mat3(u_world) * in_normal;
|
||||
|
||||
v_tex0 = in_tex0;
|
||||
v_tex0_fog.xy = in_tex0;
|
||||
v_tex1 = (u_texMatrix * vec4(Normal, 1.0)).xy;
|
||||
|
||||
v_color = in_color;
|
||||
|
|
@ -27,5 +26,5 @@ main(void)
|
|||
v_envColor = max(v_color, u_colorClamp) * u_envColor;
|
||||
v_color *= u_matColor;
|
||||
|
||||
v_fog = DoFog(gl_Position.w);
|
||||
v_tex0_fog.z = DoFog(gl_Position.w);
|
||||
}
|
||||
|
|
|
|||
18
vendor/librw/src/gl/shaders/matfx_gl.inc
vendored
18
vendor/librw/src/gl/shaders/matfx_gl.inc
vendored
|
|
@ -3,13 +3,12 @@ const char *matfx_env_vert_src =
|
|||
"uniform vec4 u_colorClamp;\n"
|
||||
"uniform vec4 u_envColor;\n"
|
||||
|
||||
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
|
||||
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
|
||||
|
||||
"VSOUT vec4 v_color;\n"
|
||||
"VSOUT vec4 v_envColor;\n"
|
||||
"VSOUT vec2 v_tex0;\n"
|
||||
"VSOUT vec3 v_tex0_fog;\n"
|
||||
"VSOUT vec2 v_tex1;\n"
|
||||
"VSOUT float v_fog;\n"
|
||||
|
||||
"void\n"
|
||||
"main(void)\n"
|
||||
|
|
@ -18,7 +17,7 @@ const char *matfx_env_vert_src =
|
|||
" gl_Position = u_proj * u_view * Vertex;\n"
|
||||
" vec3 Normal = mat3(u_world) * in_normal;\n"
|
||||
|
||||
" v_tex0 = in_tex0;\n"
|
||||
" v_tex0_fog.xy = in_tex0;\n"
|
||||
" v_tex1 = (u_texMatrix * vec4(Normal, 1.0)).xy;\n"
|
||||
|
||||
" v_color = in_color;\n"
|
||||
|
|
@ -28,7 +27,7 @@ const char *matfx_env_vert_src =
|
|||
" v_envColor = max(v_color, u_colorClamp) * u_envColor;\n"
|
||||
" v_color *= u_matColor;\n"
|
||||
|
||||
" v_fog = DoFog(gl_Position.w);\n"
|
||||
" v_tex0_fog.z = DoFog(gl_Position.w);\n"
|
||||
"}\n"
|
||||
;
|
||||
const char *matfx_env_frag_src =
|
||||
|
|
@ -42,20 +41,19 @@ const char *matfx_env_frag_src =
|
|||
|
||||
"FSIN vec4 v_color;\n"
|
||||
"FSIN vec4 v_envColor;\n"
|
||||
"FSIN vec2 v_tex0;\n"
|
||||
"FSIN vec3 v_tex0_fog;\n"
|
||||
"FSIN vec2 v_tex1;\n"
|
||||
"FSIN float v_fog;\n"
|
||||
|
||||
"void\n"
|
||||
"main(void)\n"
|
||||
"{\n"
|
||||
" vec4 pass1 = v_color;\n"
|
||||
" pass1 *= texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
|
||||
" pass1 *= texture(tex0, vec2(v_tex0_fog.x, 1.0-v_tex0_fog.y));\n"
|
||||
|
||||
" vec4 pass2 = v_envColor*shininess*texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));\n"
|
||||
|
||||
" pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);\n"
|
||||
" pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);\n"
|
||||
" pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_tex0_fog.z);\n"
|
||||
" pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_tex0_fog.z);\n"
|
||||
|
||||
" float fba = max(pass1.a, disableFBA);\n"
|
||||
" vec4 color;\n"
|
||||
|
|
|
|||
7
vendor/librw/src/gl/shaders/simple.frag
vendored
7
vendor/librw/src/gl/shaders/simple.frag
vendored
|
|
@ -1,14 +1,13 @@
|
|||
uniform sampler2D tex0;
|
||||
|
||||
FSIN vec4 v_color;
|
||||
FSIN vec2 v_tex0;
|
||||
FSIN float v_fog;
|
||||
FSIN vec3 v_tex0_fog;
|
||||
|
||||
void
|
||||
main(void)
|
||||
{
|
||||
vec4 color = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));
|
||||
color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog);
|
||||
vec4 color = v_color*texture2D(tex0, vec2(v_tex0_fog.x, 1.0 - v_tex0_fog.y));
|
||||
color.rgb = mix(u_fogColor.rgb, color.rgb, v_tex0_fog.z);
|
||||
DoAlphaTest(color.a);
|
||||
FRAGCOLOR(color);
|
||||
}
|
||||
|
|
|
|||
7
vendor/librw/src/gl/shaders/simple_fs_gl.inc
vendored
7
vendor/librw/src/gl/shaders/simple_fs_gl.inc
vendored
|
|
@ -2,14 +2,13 @@ const char *simple_frag_src =
|
|||
"uniform sampler2D tex0;\n"
|
||||
|
||||
"FSIN vec4 v_color;\n"
|
||||
"FSIN vec2 v_tex0;\n"
|
||||
"FSIN float v_fog;\n"
|
||||
"FSIN vec3 v_tex0_fog;\n"
|
||||
|
||||
"void\n"
|
||||
"main(void)\n"
|
||||
"{\n"
|
||||
" vec4 color = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
|
||||
" color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog);\n"
|
||||
" vec4 color = v_color*texture2D(tex0, vec2(v_tex0_fog.x, 1.0 - v_tex0_fog.y));\n"
|
||||
" color.rgb = mix(u_fogColor.rgb, color.rgb, v_tex0_fog.z);\n"
|
||||
" DoAlphaTest(color.a);\n"
|
||||
" FRAGCOLOR(color);\n"
|
||||
"}\n"
|
||||
|
|
|
|||
43
vendor/librw/src/gl/shaders/skin.vert
vendored
43
vendor/librw/src/gl/shaders/skin.vert
vendored
|
|
@ -1,10 +1,37 @@
|
|||
uniform mat4 u_boneMatrices[64];
|
||||
uniform mat4 u_boneMatrices[24];
|
||||
|
||||
VSIN(ATTRIB_POS) vec3 in_pos;
|
||||
VSIN(ATTRIB_POS) vec3 in_pos;
|
||||
|
||||
VSOUT vec4 v_color;
|
||||
VSOUT vec2 v_tex0;
|
||||
VSOUT float v_fog;
|
||||
VSOUT vec3 v_tex0_fog;
|
||||
|
||||
mat4 getBoneMatrix(int idx) {
|
||||
if(idx == 0) return u_boneMatrices[0];
|
||||
if(idx == 1) return u_boneMatrices[1];
|
||||
if(idx == 2) return u_boneMatrices[2];
|
||||
if(idx == 3) return u_boneMatrices[3];
|
||||
if(idx == 4) return u_boneMatrices[4];
|
||||
if(idx == 5) return u_boneMatrices[5];
|
||||
if(idx == 6) return u_boneMatrices[6];
|
||||
if(idx == 7) return u_boneMatrices[7];
|
||||
if(idx == 8) return u_boneMatrices[8];
|
||||
if(idx == 9) return u_boneMatrices[9];
|
||||
if(idx == 10) return u_boneMatrices[10];
|
||||
if(idx == 11) return u_boneMatrices[11];
|
||||
if(idx == 12) return u_boneMatrices[12];
|
||||
if(idx == 13) return u_boneMatrices[13];
|
||||
if(idx == 14) return u_boneMatrices[14];
|
||||
if(idx == 15) return u_boneMatrices[15];
|
||||
if(idx == 16) return u_boneMatrices[16];
|
||||
if(idx == 17) return u_boneMatrices[17];
|
||||
if(idx == 18) return u_boneMatrices[18];
|
||||
if(idx == 19) return u_boneMatrices[19];
|
||||
if(idx == 20) return u_boneMatrices[20];
|
||||
if(idx == 21) return u_boneMatrices[21];
|
||||
if(idx == 22) return u_boneMatrices[22];
|
||||
if(idx == 23) return u_boneMatrices[23];
|
||||
return u_boneMatrices[0];
|
||||
}
|
||||
|
||||
void
|
||||
main(void)
|
||||
|
|
@ -12,15 +39,15 @@ main(void)
|
|||
vec3 SkinVertex = vec3(0.0, 0.0, 0.0);
|
||||
vec3 SkinNormal = vec3(0.0, 0.0, 0.0);
|
||||
for(int i = 0; i < 4; i++){
|
||||
SkinVertex += (u_boneMatrices[int(in_indices[i])] * vec4(in_pos, 1.0)).xyz * in_weights[i];
|
||||
SkinNormal += (mat3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i];
|
||||
SkinVertex += (getBoneMatrix(int(in_indices[i])) * vec4(in_pos, 1.0)).xyz * in_weights[i];
|
||||
SkinNormal += (mat3(getBoneMatrix(int(in_indices[i]))) * in_normal) * in_weights[i];
|
||||
}
|
||||
|
||||
vec4 Vertex = u_world * vec4(SkinVertex, 1.0);
|
||||
gl_Position = u_proj * u_view * Vertex;
|
||||
vec3 Normal = mat3(u_world) * SkinNormal;
|
||||
|
||||
v_tex0 = in_tex0;
|
||||
v_tex0_fog.xy = in_tex0;
|
||||
|
||||
v_color = in_color;
|
||||
v_color.rgb += u_ambLight.rgb*surfAmbient;
|
||||
|
|
@ -28,5 +55,5 @@ main(void)
|
|||
v_color = clamp(v_color, 0.0, 1.0);
|
||||
v_color *= u_matColor;
|
||||
|
||||
v_fog = DoFog(gl_Position.z);
|
||||
v_tex0_fog.z = DoFog(gl_Position.z);
|
||||
}
|
||||
|
|
|
|||
43
vendor/librw/src/gl/shaders/skin_gl.inc
vendored
43
vendor/librw/src/gl/shaders/skin_gl.inc
vendored
|
|
@ -1,11 +1,38 @@
|
|||
const char *skin_vert_src =
|
||||
"uniform mat4 u_boneMatrices[64];\n"
|
||||
"uniform mat4 u_boneMatrices[24];\n"
|
||||
|
||||
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
|
||||
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
|
||||
|
||||
"VSOUT vec4 v_color;\n"
|
||||
"VSOUT vec2 v_tex0;\n"
|
||||
"VSOUT float v_fog;\n"
|
||||
"VSOUT vec3 v_tex0_fog;\n"
|
||||
|
||||
"mat4 getBoneMatrix(int idx) {\n"
|
||||
" if(idx == 0) return u_boneMatrices[0];\n"
|
||||
" if(idx == 1) return u_boneMatrices[1];\n"
|
||||
" if(idx == 2) return u_boneMatrices[2];\n"
|
||||
" if(idx == 3) return u_boneMatrices[3];\n"
|
||||
" if(idx == 4) return u_boneMatrices[4];\n"
|
||||
" if(idx == 5) return u_boneMatrices[5];\n"
|
||||
" if(idx == 6) return u_boneMatrices[6];\n"
|
||||
" if(idx == 7) return u_boneMatrices[7];\n"
|
||||
" if(idx == 8) return u_boneMatrices[8];\n"
|
||||
" if(idx == 9) return u_boneMatrices[9];\n"
|
||||
" if(idx == 10) return u_boneMatrices[10];\n"
|
||||
" if(idx == 11) return u_boneMatrices[11];\n"
|
||||
" if(idx == 12) return u_boneMatrices[12];\n"
|
||||
" if(idx == 13) return u_boneMatrices[13];\n"
|
||||
" if(idx == 14) return u_boneMatrices[14];\n"
|
||||
" if(idx == 15) return u_boneMatrices[15];\n"
|
||||
" if(idx == 16) return u_boneMatrices[16];\n"
|
||||
" if(idx == 17) return u_boneMatrices[17];\n"
|
||||
" if(idx == 18) return u_boneMatrices[18];\n"
|
||||
" if(idx == 19) return u_boneMatrices[19];\n"
|
||||
" if(idx == 20) return u_boneMatrices[20];\n"
|
||||
" if(idx == 21) return u_boneMatrices[21];\n"
|
||||
" if(idx == 22) return u_boneMatrices[22];\n"
|
||||
" if(idx == 23) return u_boneMatrices[23];\n"
|
||||
" return u_boneMatrices[0];\n"
|
||||
"}\n"
|
||||
|
||||
"void\n"
|
||||
"main(void)\n"
|
||||
|
|
@ -13,15 +40,15 @@ const char *skin_vert_src =
|
|||
" vec3 SkinVertex = vec3(0.0, 0.0, 0.0);\n"
|
||||
" vec3 SkinNormal = vec3(0.0, 0.0, 0.0);\n"
|
||||
" for(int i = 0; i < 4; i++){\n"
|
||||
" SkinVertex += (u_boneMatrices[int(in_indices[i])] * vec4(in_pos, 1.0)).xyz * in_weights[i];\n"
|
||||
" SkinNormal += (mat3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i];\n"
|
||||
" SkinVertex += (getBoneMatrix(int(in_indices[i])) * vec4(in_pos, 1.0)).xyz * in_weights[i];\n"
|
||||
" SkinNormal += (mat3(getBoneMatrix(int(in_indices[i]))) * in_normal) * in_weights[i];\n"
|
||||
" }\n"
|
||||
|
||||
" vec4 Vertex = u_world * vec4(SkinVertex, 1.0);\n"
|
||||
" gl_Position = u_proj * u_view * Vertex;\n"
|
||||
" vec3 Normal = mat3(u_world) * SkinNormal;\n"
|
||||
|
||||
" v_tex0 = in_tex0;\n"
|
||||
" v_tex0_fog.xy = in_tex0;\n"
|
||||
|
||||
" v_color = in_color;\n"
|
||||
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
|
||||
|
|
@ -29,6 +56,6 @@ const char *skin_vert_src =
|
|||
" v_color = clamp(v_color, 0.0, 1.0);\n"
|
||||
" v_color *= u_matColor;\n"
|
||||
|
||||
" v_fog = DoFog(gl_Position.z);\n"
|
||||
" v_tex0_fog.z = DoFog(gl_Position.z);\n"
|
||||
"}\n"
|
||||
;
|
||||
|
|
|
|||
11
vendor/librw/src/gl/wdgl.cpp
vendored
11
vendor/librw/src/gl/wdgl.cpp
vendored
|
|
@ -13,9 +13,14 @@
|
|||
#include "../rwplugins.h"
|
||||
#include "rwwdgl.h"
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#include <gles2/gl2.h>
|
||||
#include <gles2/gl2ext.h>
|
||||
#else
|
||||
#ifdef RW_OPENGL
|
||||
#include "glad/glad.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define PLUGIN_ID 2
|
||||
|
||||
|
|
@ -833,7 +838,11 @@ Texture::upload(void)
|
|||
|
||||
static GLenum wrap[] = {
|
||||
0, GL_REPEAT, GL_MIRRORED_REPEAT,
|
||||
#ifdef __SYMBIAN32__
|
||||
GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE
|
||||
#else
|
||||
GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER
|
||||
#endif
|
||||
};
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
|
||||
wrap[(this->filterAddressing >> 8) & 0xF]);
|
||||
|
|
@ -842,7 +851,7 @@ Texture::upload(void)
|
|||
|
||||
switch(r->format & 0xF00){
|
||||
case Raster::C8888:
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, 4, r->width, r->height,
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, r->width, r->height,
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, r->pixels);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
5
vendor/librw/src/image.cpp
vendored
5
vendor/librw/src/image.cpp
vendored
|
|
@ -14,6 +14,7 @@
|
|||
#include "d3d/rwxbox.h"
|
||||
#include "d3d/rwd3d8.h"
|
||||
#include "d3d/rwd3d9.h"
|
||||
#include "fcaseopen.h"
|
||||
|
||||
#define PLUGIN_ID ID_IMAGE
|
||||
|
||||
|
|
@ -937,7 +938,7 @@ Image::getFilename(const char *name)
|
|||
if(g->numSearchPaths == 0){
|
||||
s = rwStrdup(name, MEMDUR_EVENT);
|
||||
makePath(s);
|
||||
f = fopen(s, "rb");
|
||||
f = fcaseopen(s, "rb");
|
||||
if(f){
|
||||
fclose(f);
|
||||
printf("found %s\n", s);
|
||||
|
|
@ -955,7 +956,7 @@ Image::getFilename(const char *name)
|
|||
strcpy(s, p);
|
||||
strcat(s, name);
|
||||
makePath(s);
|
||||
f = fopen(s, "r");
|
||||
f = fcaseopen(s, "r");
|
||||
if(f){
|
||||
fclose(f);
|
||||
printf("found %s\n", name);
|
||||
|
|
|
|||
24
vendor/librw/src/raster.cpp
vendored
24
vendor/librw/src/raster.cpp
vendored
|
|
@ -535,21 +535,21 @@ Raster::convertTexToCurrentPlatform(rw::Raster *ras)
|
|||
// TODO: maybe don't *always* do this?
|
||||
img->unpalettize();
|
||||
Raster::imageFindRasterFormat(img, Raster::TEXTURE, &width, &height, &depth, &format);
|
||||
format |= ras->format & (Raster::MIPMAP | Raster::AUTOMIPMAP);
|
||||
// format |= ras->format & (Raster::MIPMAP | Raster::AUTOMIPMAP);
|
||||
Raster *newras = Raster::create(width, height, depth, format);
|
||||
newras->setFromImage(img);
|
||||
img->destroy();
|
||||
int numLevels = ras->getNumLevels();
|
||||
for(int i = 1; i < numLevels; i++){
|
||||
ras->lock(i, Raster::LOCKREAD);
|
||||
img = ras->toImage();
|
||||
// TODO: maybe don't *always* do this?
|
||||
img->unpalettize();
|
||||
newras->lock(i, Raster::LOCKWRITE|Raster::LOCKNOFETCH);
|
||||
newras->setFromImage(img);
|
||||
newras->unlock(i);
|
||||
ras->unlock(i);
|
||||
}
|
||||
// int numLevels = ras->getNumLevels();
|
||||
// for(int i = 1; i < numLevels; i++){
|
||||
// ras->lock(i, Raster::LOCKREAD);
|
||||
// img = ras->toImage();
|
||||
// // TODO: maybe don't *always* do this?
|
||||
// img->unpalettize();
|
||||
// newras->lock(i, Raster::LOCKWRITE|Raster::LOCKNOFETCH);
|
||||
// newras->setFromImage(img);
|
||||
// newras->unlock(i);
|
||||
// ras->unlock(i);
|
||||
// }
|
||||
ras->destroy();
|
||||
ras = newras;
|
||||
return ras;
|
||||
|
|
|
|||
2
vendor/librw/src/rwanim.h
vendored
2
vendor/librw/src/rwanim.h
vendored
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace rw {
|
||||
|
|
|
|||
6
vendor/librw/src/rwbase.h
vendored
6
vendor/librw/src/rwbase.h
vendored
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef RW_PS2
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
|
@ -6,6 +8,10 @@
|
|||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#ifdef __SYMBIAN32__
|
||||
#define stderr stdout
|
||||
#endif
|
||||
|
||||
// TODO: clean up the opengl defines
|
||||
// and figure out what we even want here...
|
||||
#ifdef RW_GL3
|
||||
|
|
|
|||
2
vendor/librw/src/rwcharset.h
vendored
2
vendor/librw/src/rwcharset.h
vendored
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
namespace rw {
|
||||
|
||||
struct Charset
|
||||
|
|
|
|||
2
vendor/librw/src/rwengine.h
vendored
2
vendor/librw/src/rwengine.h
vendored
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
namespace rw {
|
||||
|
||||
// uhhhm..... why are these not actual functions?
|
||||
|
|
|
|||
2
vendor/librw/src/rwerror.h
vendored
2
vendor/librw/src/rwerror.h
vendored
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
namespace rw {
|
||||
|
||||
struct Error
|
||||
|
|
|
|||
2
vendor/librw/src/rwobjects.h
vendored
2
vendor/librw/src/rwobjects.h
vendored
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace rw {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue