Merge branch 'develop' into vehicle-update

Conflicts:
 object.c
This commit is contained in:
duncanspumpkin committed 2016-01-09 16:51:23 +00:00
commit 268e2d34ce
58 files changed
+3353 -2622

No files matched your search

+7
View File
@@ -272,3 +272,10 @@ openrct2.id*
openrct2.nam
openrct2.til
data/g2.dat
#################
## Linux
#################
# KDE folder settings
.directory
+55 -24
View File
@@ -1,10 +1,63 @@
language: c
before_install:
- bash scripts/linux/install.sh
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then bash scripts/linux/install.sh; fi
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then gem install xcpretty-travis-formatter; fi
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then curl -L https://openrct2.website/files/MacOSX10.10.sdk.tar.xz -o MacOSX10.10.sdk.tar.xz; fi
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then sudo tar xf MacOSX10.10.sdk.tar.xz -C /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/; fi
sudo: required
dist: trusty
matrix:
include:
- os: linux
env: OPENRCT2_CMAKE_OPTS="-DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8"
- os: linux
env: OPENRCT2_CMAKE_OPTS="-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
- os: linux
env: OPENRCT2_CMAKE_OPTS="-DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows
- os: linux
env: TARGET=docker32
services:
- docker
- os: linux
env: OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DDISABLE_HTTP_TWITCH=ON" TARGET=docker32
services:
- docker
- os: osx
osx_image: xcode7.2
after_success:
- cd build/Release
- hdiutil create -size 64m -fs HFS+ -volname "OpenRCT2 OS X" myimg.dmg
- hdiutil attach myimg.dmg
- export DEVS=$(hdiutil attach myimg.dmg | cut -f 1)
- export DEV=$(echo $DEVS | cut -f 1 -d ' ')
- cp -rv OpenRCT2.app "/Volumes/OpenRCT2 OS X"
- sync
- hdiutil detach $DEV
- hdiutil convert myimg.dmg -format UDZO -o OpenRCT2.dmg
- curl --upload-file OpenRCT2.dmg http://transfer.sh/OpenRCT2.dmg
# Following entries used to be included in testing, but they only proved useful while changing things in CMake setup.
# They are meant to be used when there are changes to CMakeLists.txt
# - os: linux
# env: OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DDISABLE_HTTP_TWITCH=ON -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8"
# - os: linux
# env: OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DDISABLE_HTTP_TWITCH=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
# - os: linux
# env: OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=OFF -DDISABLE_HTTP_TWITCH=ON -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8"
# - os: linux
# env: OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=OFF -DDISABLE_HTTP_TWITCH=OFF -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8"
# - os: linux
# env: OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows
# - os: linux
# env: OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DDISABLE_HTTP_TWITCH=ON -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows
# - os: linux
# env: OPENRCT2_CMAKE_OPTS="-DDISABLE_HTTP_TWITCH=ON -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows
script:
- bash scripts/linux/build.sh
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then bash scripts/linux/build.sh ; fi
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then set -o pipefail && xcodebuild -sdk macosx10.10 | xcpretty -f `xcpretty-travis-formatter`; fi
notifications:
on_failure: change
@@ -14,25 +67,3 @@ cache:
directories:
- .cache
apt: true
env:
- OPENRCT2_CMAKE_OPTS="-DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8"
- OPENRCT2_CMAKE_OPTS="-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
- OPENRCT2_CMAKE_OPTS="-DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows
- TARGET=docker32
- OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DDISABLE_HTTP_TWITCH=ON" TARGET=docker32
# Following entries used to be included in testing, but they only proved useful while changing things in CMake setup.
# They are meant to be used when there are changes to CMakeLists.txt
# - OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DDISABLE_HTTP_TWITCH=ON -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8"
# - OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DDISABLE_HTTP_TWITCH=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
# - OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=OFF -DDISABLE_HTTP_TWITCH=ON -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8"
# - OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=OFF -DDISABLE_HTTP_TWITCH=OFF -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8"
# - OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows
# - OPENRCT2_CMAKE_OPTS="-DDISABLE_NETWORK=ON -DDISABLE_HTTP_TWITCH=ON -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows
# - OPENRCT2_CMAKE_OPTS="-DDISABLE_HTTP_TWITCH=ON -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows
sudo: required
dist: trusty
services:
- docker
-15
View File
@@ -187,7 +187,6 @@
D4EC48D41C2634C70024B507 /* libspeexdsp.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D4EC48C81C2634870024B507 /* libspeexdsp.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
D4EC48DF1C2634E90024B507 /* argparse.c in Sources */ = {isa = PBXBuildFile; fileRef = D4EC48D61C2634E90024B507 /* argparse.c */; };
D4EC48E01C2634E90024B507 /* CuTest.c in Sources */ = {isa = PBXBuildFile; fileRef = D4EC48D91C2634E90024B507 /* CuTest.c */; };
D4EC48E21C2634E90024B507 /* lodepng.c in Sources */ = {isa = PBXBuildFile; fileRef = D4EC48DD1C2634E90024B507 /* lodepng.c */; };
D4EC48E61C2637710024B507 /* g2.dat in Resources */ = {isa = PBXBuildFile; fileRef = D4EC48E31C2637710024B507 /* g2.dat */; };
D4EC48E71C2637710024B507 /* language in Resources */ = {isa = PBXBuildFile; fileRef = D4EC48E41C2637710024B507 /* language */; };
D4EC48E81C2637710024B507 /* title in Resources */ = {isa = PBXBuildFile; fileRef = D4EC48E51C2637710024B507 /* title */; };
@@ -547,8 +546,6 @@
D4EC48D91C2634E90024B507 /* CuTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CuTest.c; sourceTree = "<group>"; };
D4EC48DA1C2634E90024B507 /* CuTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CuTest.h; sourceTree = "<group>"; };
D4EC48DB1C2634E90024B507 /* license.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = license.txt; sourceTree = "<group>"; };
D4EC48DD1C2634E90024B507 /* lodepng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lodepng.c; sourceTree = "<group>"; };
D4EC48DE1C2634E90024B507 /* lodepng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lodepng.h; sourceTree = "<group>"; };
D4EC48E31C2637710024B507 /* g2.dat */ = {isa = PBXFileReference; lastKnownFileType = file; name = g2.dat; path = data/g2.dat; sourceTree = SOURCE_ROOT; };
D4EC48E41C2637710024B507 /* language */ = {isa = PBXFileReference; lastKnownFileType = folder; name = language; path = data/language; sourceTree = SOURCE_ROOT; };
D4EC48E51C2637710024B507 /* title */ = {isa = PBXFileReference; lastKnownFileType = folder; name = title; path = data/title; sourceTree = SOURCE_ROOT; };
@@ -651,7 +648,6 @@
children = (
D4EC48D51C2634E90024B507 /* argparse */,
D4EC48D81C2634E90024B507 /* cutest */,
D4EC48DC1C2634E90024B507 /* lodepng */,
);
name = "Source Libraries";
sourceTree = "<group>";
@@ -1152,16 +1148,6 @@
path = lib/cutest;
sourceTree = "<group>";
};
D4EC48DC1C2634E90024B507 /* lodepng */ = {
isa = PBXGroup;
children = (
D4EC48DD1C2634E90024B507 /* lodepng.c */,
D4EC48DE1C2634E90024B507 /* lodepng.h */,
);
name = lodepng;
path = lib/lodepng;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -1464,7 +1450,6 @@
D4EC47F81C26342F0024B507 /* graph.c in Sources */,
D4EC48111C26342F0024B507 /* network.cpp in Sources */,
D4EC47FF1C26342F0024B507 /* widget.c in Sources */,
D4EC48E21C2634E90024B507 /* lodepng.c in Sources */,
D4EC48691C26342F0024B507 /* title_options.c in Sources */,
D4EC48471C26342F0024B507 /* map_tooltip.c in Sources */,
D4EC483F1C26342F0024B507 /* guest.c in Sources */,
+466 -2
View File
@@ -3671,8 +3671,8 @@ STR_5335 :Attractie-ingang
STR_5336 :Attractie-uitgang
STR_5337 :Parkingang
STR_5338 :Elementtype
STR_5339 :Hoogte onderk.
STR_5340 :Hoogte bovenk.
STR_5339 :{SMALLFONT}{BLACK}Hoogte onderkant
STR_5340 :{SMALLFONT}{BLACK}Hoogte bovenkant
STR_5341 :Eigenschappen
STR_5342 :Kies een vakje op de kaart
STR_5343 :Werknemers automatisch plaatsen
@@ -3939,11 +3939,475 @@ STR_5603 :Als een gevolgde bezoeker een attractie is uitgegaan
STR_5604 :Als een gevolgde bezoeker iets gekocht heeft
STR_5605 :Als een gevolgde bezoeker een faciliteit gebruikt
STR_5606 :Als een bezoeker is overleden
STR_5607 :{SMALLFONT}{BLACK}Geselecteerd kaartelement geforceerd verwijderen
STR_5608 :HO
STR_5609 :HB
STR_5610 :{SMALLFONT}{BLACK}Het geselecteerde kaartelement verwijderen. Dit zal worden geforceerd, waardoor er geen geld zal worden teruggegeven of gebruikt. Gebruik deze functie voorzichtig.
STR_5611 :S
STR_5612 :{SMALLFONT}{BLACK}Spookelement (tijdelijk element)
STR_5613 :K
STR_5614 :{SMALLFONT}{BLACK}Element is kapot
STR_5615 :L
STR_5616 :{SMALLFONT}{BLACK}Is het laatste element van dit vakje.
STR_5617 :{SMALLFONT}{BLACK}Geselecteerd element naar boven verplaatsen
STR_5618 :{SMALLFONT}{BLACK}Geselecteerd element naar beneden verplaatsen
STR_5619 :RollerCoaster Tycoon
STR_5620 :Added Attractions
STR_5621 :Loopy Landscapes
STR_5622 :RollerCoaster Tycoon 2
STR_5623 :Wacky Worlds
STR_5624 :Time Twister
STR_5625 :{OPENQUOTES}Echte{ENDQUOTES} parken
STR_5626 :Overige parken
STR_5627 :Scenariolijst groeperen op:
STR_5628 :Oorsprong
STR_5629 :Moeilijkheidsgraad
STR_5630 :Moeilijke scenario's worden ontgrendeld door gemakkelijke
STR_5631 :Originele DLC
STR_5632 :Bouw je eigen...
#############
# Scenarios #
#############
## RCT1 Original
<Forest Frontiers>
STR_SCNR :Forest Frontiers
STR_PARK :Forest Frontiers
STR_DTLS :Bouw een bloeiend pretpark diep in het bos, op een grote open plek.
<Dynamite Dunes>
STR_SCNR :Dynamite Dunes
STR_PARK :Dynamite Dunes
STR_DTLS :Dit park, gebouwd in de woestijn, beschikt over slechts één achtbaan maar heeft ruimte voor uitbreiding.
<Leafy Lake>
STR_SCNR :Leafy Lake
STR_PARK :Leafy Lake
STR_DTLS :Bouw vanaf het begin een pretpark rond een groot meer.
<Diamond Heights>
STR_SCNR :Diamond Heights
STR_PARK :Diamond Heights
STR_DTLS :Diamond Heights is al een succesvol pretpark met fantastische attracties - verander het om de waarde ervan te verdubbelen.
<Evergreen Gardens>
STR_SCNR :Evergreen Gardens
STR_PARK :Evergreen Gardens
STR_DTLS :Verander de schitterende Evergreen Gardens in een bloeiend pretpark.
<Bumbly Beach>
STR_SCNR :Bumbly Beach
STR_PARK :Bumbly Beach
STR_DTLS :Verander het kleine amusementspark van Bumbly Beach in een succesvol pretpark.
<Trinity Islands>
STR_SCNR :Trinity Islands
STR_PARK :Trinity Islands
STR_DTLS :Verscheidene eilanden vormen de basis voor dit nieuwe park.
<Katie's Dreamland>
STR_SCNR :Katie's Dreamland
STR_PARK :Katie's Dreamland
STR_DTLS :Een klein pretpark met een paar attracties en ruimte voor uitbreiding - jouw doel is om de parkwaarde te verdubbelen.
<Pokey Park>
STR_SCNR :Pokey Park
STR_PARK :Pokey Park
STR_DTLS :Een klein, krap pretpark dat grote uitbreiding vereist.
<White Water Park>
STR_SCNR :White Water Park
STR_PARK :White Water Park
STR_DTLS :Een park met enkele uitstekende waterattracties vereist uitbreiding
<Millennium Mines>
STR_SCNR :Millennium Mines
STR_PARK :Millennium Mines
STR_DTLS :Verander een grote verlaten mijn, een toeristische attractie, in een pretpark.
<Karts & Coasters>
STR_SCNR :Karts & Coasters
STR_PARK :Karts & Coasters
STR_DTLS :Een groot park, verscholen in het bos, met alleen kartbanen en houten achtbanen.
<Mel's World>
STR_SCNR :Mel's World
STR_PARK :Mel's World
STR_DTLS :Dit pretpark heeft goed ontworpen, moderne attractions, maar heeft ook veel ruimte voor uitbreiding.
<Mystic Mountain>
STR_SCNR :Mystic Mountain
STR_PARK :Mystic Mountain
STR_DTLS :Bouw vanaf het begin een pretpark in de heuvelachtige bossen van Mystic Mountain.
<Pacific Pyramids>
STR_SCNR :Pacific Pyramids
STR_PARK :Pacific Pyramids
STR_DTLS :Verander de Egyptische ruïnes, een toeristische attractions, in een bloeiend pretpark.
<Crumbly Woods>
STR_SCNR :Crumbly Woods
STR_PARK :Crumbly Woods
STR_DTLS :Een groot park met goed ontwerpen maar nogal oude attracties - vervang de oude attracties of voeg nieuwe toe om het park populairder te maken.
<Paradise Pier>
STR_SCNR :Paradise Pier
STR_PARK :Paradise Pier
STR_DTLS :Verander de pier van dit slaperige stadje in een bloeiende attractie.
<Lightning Peaks>
STR_SCNR :Lightning Peaks
STR_PARK :Lightning Peaks
STR_DTLS :De mooie bergen van Lightning Peaks zijn populair bij wandelaars en toeristen. Gebruik de beschikbare grond om nieuwe sensatiezoekende klanten aan te trekken.
<Ivory Towers>
STR_SCNR :Ivory Towers
STR_PARK :Ivory Towers
STR_DTLS :Een reeds gevestigd park dat wat problemen heeft.
<Rainbow Valley>
STR_SCNR :Rainbow Valley
STR_PARK :Rainbow Valley
STR_DTLS :Van de gemeenteraad van Rainbow Valley mag het landschap niet gewijzigd worden en mogen er geen grote bomen worden gekapt, maar je moet het gebied ontwikkelen tot een groot pretpark.
<Thunder Rock>
STR_SCNR :Thunder Rock
STR_PARK :Thunder Rock
STR_DTLS :Thunder Rock staat midden in een woestijn en trekt veel toeristen aan. Gebruik de beschikbare ruimte om attracties te bouwen en meer mensen aan te trekken.
<Mega Park>
STR_SCNR :Mega Park
STR_PARK :Mega Park
STR_DTLS :Gewoon voor de lol!
## Added Attractions
<Whispering Cliffs>
STR_SCNR :Whispering Cliffs
STR_PARK :Whispering Cliffs
STR_DTLS :Develop the seaside cliffs into a thriving amusement park
<Three Monkeys Park>
STR_SCNR :Three Monkeys Park
STR_PARK :Three Monkeys Park
STR_DTLS :Central to this large developing park is a giant triple-track racing/duelling steel coaster
<Canary Mines>
STR_SCNR :Canary Mines
STR_PARK :Canary Mines
STR_DTLS :This abandoned mine already has the makings of a tourist attraction with its minature railway and a pair of vertical drop roller coasters
<Barony Bridge>
STR_SCNR :Barony Bridge
STR_PARK :Barony Bridge
STR_DTLS :An old redundant bridge is yours to develop into an amusement park
<Funtopia>
STR_SCNR :Funtopia
STR_PARK :Funtopia
STR_DTLS :Covering land both sides of a highway, this park has several rides already operating
<Haunted Harbor>
STR_SCNR :Haunted Harbor
STR_PARK :Haunted Harbor
STR_DTLS :The local authority has agreed to sell nearby land cheaply to this small seaside park, on the condition that certain rides are preserved
<Fun Fortress>
STR_SCNR :Fun Fortress
STR_PARK :Fun Fortress
STR_DTLS :This castle is all yours to turn into a theme park
<Future World>
STR_SCNR :Future World
STR_PARK :Future World
STR_DTLS :This futuristic park has plenty of space for new rides on its alien landscape
<Gentle Glen>
STR_SCNR :Gentle Glen
STR_PARK :Gentle Glen
STR_DTLS :The local population prefer gentle and relaxing rides, so it is your job to expand this park to suit their tastes
<Jolly Jungle>
STR_SCNR :Jolly Jungle
STR_PARK :Jolly Jungle
STR_DTLS :Deep in the jungle lies a large area of land ready to be turned into a theme park
<Hydro Hills>
STR_SCNR :Hydro Hills
STR_PARK :Hydro Hills
STR_DTLS :A series of stepped lakes form the basis for this new park
<Sprightly Park>
STR_SCNR :Sprightly Park
STR_PARK :Sprightly Park
STR_DTLS :This elderly park has many historical rides but is badly in debt
<Magic Quarters>
STR_SCNR :Magic Quarters
STR_PARK :Magic Quarters
STR_DTLS :A large area of land has been cleared and partially themed ready for you to develop into a landscaped theme park
<Fruit Farm>
STR_SCNR :Fruit Farm
STR_PARK :Fruit Farm
STR_DTLS :A thriving fruit farm has built a railroad to boost its income, your job is to develop it into a full-blown amusement park
<Butterfly Dam>
STR_SCNR :Butterfly Dam
STR_PARK :Butterfly Dam
STR_DTLS :The area around a dam is available for you to develop into an amusement park
<Coaster Canyon>
STR_SCNR :Coaster Canyon
STR_PARK :Coaster Canyon
STR_DTLS :A vast canyon is yours to turn into a theme park
<Thunderstorm Park>
STR_SCNR :Thunderstorm Park
STR_PARK :Thunderstorm Park
STR_DTLS :The weather is so wet here that a giant pyramid has been built to allow some rides to be built under cover
<Harmonic Hills>
STR_SCNR :Harmonic Hills
STR_PARK :Harmonic Hills
STR_DTLS :The local authority won't allow you to build above tree height in this park
<Roman Village>
STR_SCNR :Roman Village
STR_PARK :Roman Village
STR_DTLS :Develop this Roman-themed park by adding rides and roller coasters
<Swamp Cove>
STR_SCNR :Swamp Cove
STR_PARK :Swamp Cove
STR_DTLS :Built partly on a series of small islands, this park already has a pair of large roller coasters as its centerpiece
<Adrenaline Heights>
STR_SCNR :Adrenaline Heights
STR_PARK :Adrenaline Heights
STR_DTLS :Build a park to appeal to the high-intensity thrill-seeking local people
<Utopia Park>
STR_SCNR :Utopia Park
STR_PARK :Utopia Park
STR_DTLS :An oasis in the middle of the desert provides an unusual opportunity to build an amusement park
<Rotting Heights>
STR_SCNR :Rotting Heights
STR_PARK :Rotting Heights
STR_DTLS :Overgrown and dilapidated, can you resurrect this once-great amusement park?
<Fiasco Forest>
STR_SCNR :Fiasco Forest
STR_PARK :Fiasco Forest
STR_DTLS :Full of badly designed and dangerous rides, you have a very limited budget and time to fix the problems and turn the park around
<Pickle Park>
STR_SCNR :Pickle Park
STR_PARK :Pickle Park
STR_DTLS :The local authority will not allow any kind of advertising or promotion, so this park must succeed by reputation only
<Giggle Downs>
STR_SCNR :Giggle Downs
STR_PARK :Giggle Downs
STR_DTLS :A four lane steeplechase ride is the centerpiece of this expanding park
<Mineral Park>
STR_SCNR :Mineral Park
STR_PARK :Mineral Park
STR_DTLS :Turn this abandoned stone quarry into a place to attract thrill-seeking tourists
<Coaster Crazy>
STR_SCNR :Coaster Crazy
STR_PARK :Coaster Crazy
STR_DTLS :You have limited funds but unlimited time to turn this mountainside area into a vast roller coaster park
<Urban Park>
STR_SCNR :Urban Park
STR_PARK :Urban Park
STR_DTLS :A tiny park has done a deal with the nearby town to allow expansion through the town itself
<Geoffrey Gardens>
STR_SCNR :Geoffrey Gardens
STR_PARK :Geoffrey Gardens
STR_DTLS :A large garden park needs turning into a thriving theme park
## Loopy Landscapes
<Iceberg Islands>
STR_SCNR :Iceberg Islands
STR_PARK :Iceberg Islands
STR_DTLS :A collection of icebergs make a cold setting for this ambitious theme park
<Volcania>
STR_SCNR :Volcania
STR_PARK :Volcania
STR_DTLS :A dormant volcano is the setting of this coaster-building challenge
<Arid Heights>
STR_SCNR :Arid Heights
STR_PARK :Arid Heights
STR_DTLS :Free of any financial limits, your challenge is to develop this desert park while keeping the guests happy
<Razor Rocks>
STR_SCNR :Razor Rocks
STR_PARK :Razor Rocks
STR_DTLS :Your task is to build a massive coaster-filled park in amongst Razor Rocks
<Crater Lake>
STR_SCNR :Crater Lake
STR_PARK :Crater Lake
STR_DTLS :A large lake in an ancient crater is the setting for this park
<Vertigo Views>
STR_SCNR :Vertigo Views
STR_PARK :Vertigo Views
STR_DTLS :This large park already has an excellent hyper-coaster, but your task is to massively increase its profit
<Paradise Pier 2>
STR_SCNR :Paradise Pier 2
STR_PARK :Paradise Pier 2
STR_DTLS :Paradise Pier has expanded its network of walkways over the sea, and your task is to expand the park to use the extra space
<Dragon's Cove>
STR_SCNR :Dragon's Cove
STR_PARK :Dragon's Cove
STR_DTLS :This sea-side cove is the setting for this coaster-building challenge
<Good Knight Park>
STR_SCNR :Good Knight Park
STR_PARK :Good Knight Park
STR_DTLS :A castle with a pair of roller coasters needs developing into a larger theme park
<Wacky Warren>
STR_SCNR :Wacky Warren
STR_PARK :Wacky Warren
STR_DTLS :A park which has much of its footpaths and coasters underground
<Grand Glacier>
STR_SCNR :Grand Glacier
STR_PARK :Grand Glacier
STR_DTLS :A glacier-filled valley is yours to develop into a theme park
<Crazy Craters>
STR_SCNR :Crazy Craters
STR_PARK :Crazy Craters
STR_DTLS :In a far-off world where money is not needed, you must build an entertainment centre to keep the people happy
<Dusty Desert>
STR_SCNR :Dusty Desert
STR_PARK :Dusty Desert
STR_DTLS :Five coasters require completion in this desert park
<Woodworm Park>
STR_SCNR :Woodworm Park
STR_PARK :Woodworm Park
STR_DTLS :This historical park is only allowed to build older-styled rides
<Icarus Park>
STR_SCNR :Icarus Park
STR_PARK :Icarus Park
STR_DTLS :Develop this alien park to maximize its profit
<Sunny Swamps>
STR_SCNR :Sunny Swamps
STR_PARK :Sunny Swamps
STR_DTLS :This well-themed amusement park already has several rides, but has plenty of space for expansion
<Frightmare Hills>
STR_SCNR :Frightmare Hills
STR_PARK :Frightmare Hills
STR_DTLS :A scary park with a giant centrepiece coaster
<Thunder Rocks>
STR_SCNR :Thunder Rocks
STR_PARK :Thunder Rocks
STR_DTLS :Two large hunks of rock stick out of the sand, upon which the beginnings of a theme park are constructed
<Octagon Park>
STR_SCNR :Octagon Park
STR_PARK :Octagon Park
STR_DTLS :In this large park you must design and build ten large coasters
<Pleasure Island>
STR_SCNR :Pleasure Island
STR_PARK :Pleasure Island
STR_DTLS :A long thin island makes a challenging setting to build a selection of coasters
<Icicle Worlds>
STR_SCNR :Icicle Worlds
STR_PARK :Icicle Worlds
STR_DTLS :An icy landscape needs turning into a thriving theme park
<Southern Sands>
STR_SCNR :Southern Sands
STR_PARK :Southern Sands
STR_DTLS :A desert park with some cleverly designed coasters is yours to expand
<Tiny Towers>
STR_SCNR :Tiny Towers
STR_PARK :Tiny Towers
STR_DTLS :In this tiny park you must finish building the five existing coasters
<Nevermore Park>
STR_SCNR :Nevermore Park
STR_PARK :Nevermore Park
STR_DTLS :A large park with a novel transporation system around its edge
<Pacifica>
STR_SCNR :Pacifica
STR_PARK :Pacifica
STR_DTLS :This large island is all yours to develop as an amusement park
<Urban Jungle>
STR_SCNR :Urban Jungle
STR_PARK :Urban Jungle
STR_DTLS :A giant abandoned skyscraper is a unique opportunity for a theme park developer
<Terror Town>
STR_SCNR :Terror Town
STR_PARK :Terror Town
STR_DTLS :This urban area is all yours to develop into as an amusement park
<Megaworld Park>
STR_SCNR :Megaworld Park
STR_PARK :Megaworld Park
STR_DTLS :A giant park already packed full of rides needs improving
<Venus Ponds>
STR_SCNR :Venus Ponds
STR_PARK :Venus Ponds
STR_DTLS :On a far-away planet this area of land needs turning into a theme park
<Micro Park>
STR_SCNR :Micro Park
STR_PARK :Micro Park
STR_DTLS :Try to create the world's smallest profitable park
## Real Parks from RCT1
# None of them had details
<Alton Towers>
STR_SCNR :Alton Towers
STR_PARK :Alton Towers
STR_DTLS :
<Heide-Park>
STR_SCNR :Heide-Park
STR_PARK :Heide-Park
STR_DTLS :
<Blackpool Pleasure Beach>
STR_SCNR :Blackpool Pleasure Beach
STR_PARK :Blackpool Pleasure Beach
STR_DTLS :
## Misc parks from RCT1
# Had no details
<Fort Anachronism>
STR_SCNR :Fort Anachronism
STR_PARK :Fort Anachronism
STR_DTLS :
## RCT2 Original
<Alpine Adventures>
STR_SCNR :Alpine Adventures
+733 -733
View File
File diff suppressed because it is too large. Load diff
+4
View File
@@ -7,8 +7,12 @@
- Feature: Allow enabling / disabling of different notifications.
- Feature: Improved tile inspector.
- Feature: Integrate RCT1 style scenario select with optional unlock progression.
- Fix: [#1333] Rides never become safe again after a crash.
- Fix: [#2126] Ferris Wheels set to "backward rotation" stop working (original bug)
- Fix: [#2449] Turning off Day/Night Circle while it is night doesn't reset back to day
- Fix: [#2650] Server did not validate actions send from clients (caused error box and desynchronisation)
- Fix: [#2651] Ride was not removed when multiplayer client aborted ride construction.
- Fix: [#2654] Free transport rides can prevent guests from properly leaving the park
0.0.3.1-beta (2015-12-04)
------------------------------------------------------------------------
+3
View File
@@ -35,6 +35,7 @@
<ClCompile Include="src\cmdline.c" />
<ClCompile Include="src\cmdline_sprite.c" />
<ClCompile Include="src\config.c" />
<ClCompile Include="src\core\Stopwatch.cpp" />
<ClCompile Include="src\cursors.c" />
<ClCompile Include="src\diagnostic.c" />
<ClCompile Include="src\drawing\drawing.c" />
@@ -208,6 +209,8 @@
<ClInclude Include="src\core\IStream.hpp" />
<ClInclude Include="src\core\Math.hpp" />
<ClInclude Include="src\core\Memory.hpp" />
<ClInclude Include="src\core\stopwatch.h" />
<ClInclude Include="src\core\Stopwatch.hpp" />
<ClInclude Include="src\core\StringBuilder.hpp" />
<ClInclude Include="src\core\StringReader.hpp" />
<ClInclude Include="src\core\Util.hpp" />
+9
View File
@@ -564,6 +564,9 @@
<ClCompile Include="src\scenario_sources.c">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="src\core\Stopwatch.cpp">
<Filter>Source\Core</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\management\award.h">
@@ -851,5 +854,11 @@
<ClInclude Include="src\image_io.h">
<Filter>Source</Filter>
</ClInclude>
<ClInclude Include="src\core\stopwatch.h">
<Filter>Source\Core</Filter>
</ClInclude>
<ClInclude Include="src\core\Stopwatch.hpp">
<Filter>Source\Core</Filter>
</ClInclude>
</ItemGroup>
</Project>
+164
View File
@@ -0,0 +1,164 @@
#ifdef _WIN32
#include <windows.h>
#else
#include "../platform/platform.h"
#endif
#include "Stopwatch.hpp"
uint64 Stopwatch::Frequency = 0;
Stopwatch::Stopwatch()
{
Reset();
}
uint64 Stopwatch::GetElapsedTicks()
{
uint64 result = _total;
if (_isRunning)
{
uint64 ticks = QueryCurrentTicks();
if (ticks != 0) {
result += QueryCurrentTicks() - _last;
}
}
return _total;
}
uint64 Stopwatch::GetElapsedMilliseconds()
{
if (Frequency == 0)
{
Frequency = QueryFrequency();
if (Frequency == 0)
{
return 0;
}
}
return (GetElapsedTicks() * 1000) / Frequency;
}
void Stopwatch::Reset()
{
_isRunning = false;
_total = 0;
_last = 0;
}
void Stopwatch::Start()
{
if (_isRunning) return;
uint64 ticks = QueryCurrentTicks();
if (ticks != 0)
{
_last = ticks;
_isRunning = true;
}
}
void Stopwatch::Restart()
{
Reset();
Start();
}
void Stopwatch::Stop()
{
uint64 ticks = QueryCurrentTicks();
if (ticks != 0) {
_total += QueryCurrentTicks() - _last;
}
_isRunning = false;
}
uint64 Stopwatch::QueryFrequency()
{
#ifdef _WIN32
LARGE_INTEGER frequency;
if (QueryPerformanceFrequency(&frequency))
{
return frequency.QuadPart;
}
else
{
log_error("QueryPerformanceFrequency failed.");
return 0;
}
#else
STUB();
return 0;
#endif
}
uint64 Stopwatch::QueryCurrentTicks()
{
#ifdef _WIN32
LARGE_INTEGER counter;
if (QueryPerformanceCounter(&counter))
{
return counter.QuadPart;
}
else
{
log_error("QueryPerformanceCounter failed.");
return 0;
}
#else
STUB();
return 0;
#endif
}
extern "C" {
#include "stopwatch.h"
void stopwatch_create(stopwatch *stopwatch)
{
stopwatch->context = new Stopwatch();
}
void stopwatch_dispose(stopwatch *stopwatch)
{
delete ((Stopwatch*)stopwatch->context);
}
uint64 stopwatch_GetElapsedTicks(stopwatch *stopwatch)
{
Stopwatch *ctx = (Stopwatch*)stopwatch->context;
return ctx->GetElapsedTicks();
}
uint64 stopwatch_GetElapsedMilliseconds(stopwatch *stopwatch)
{
Stopwatch *ctx = (Stopwatch*)stopwatch->context;
return ctx->GetElapsedMilliseconds();
}
void stopwatch_Reset(stopwatch *stopwatch)
{
Stopwatch *ctx = (Stopwatch*)stopwatch->context;
return ctx->Reset();
}
void stopwatch_Start(stopwatch *stopwatch)
{
Stopwatch *ctx = (Stopwatch*)stopwatch->context;
return ctx->Start();
}
void stopwatch_Restart(stopwatch *stopwatch)
{
Stopwatch *ctx = (Stopwatch*)stopwatch->context;
return ctx->Restart();
}
void stopwatch_Stop(stopwatch *stopwatch)
{
Stopwatch *ctx = (Stopwatch*)stopwatch->context;
return ctx->Stop();
}
}
+35
View File
@@ -0,0 +1,35 @@
#pragma once
extern "C" {
#include "../common.h"
}
/**
* Class to accuately measure elapsed time with high precision.
*/
class Stopwatch
{
private:
/** Number of ticks in a second. */
static uint64 Frequency;
uint64 _total;
uint64 _last;
bool _isRunning;
static uint64 QueryFrequency();
static uint64 QueryCurrentTicks();
public:
bool IsRunning() { return _isRunning; }
Stopwatch();
uint64 GetElapsedTicks();
uint64 GetElapsedMilliseconds();
void Reset();
void Start();
void Restart();
void Stop();
};
+24
View File
@@ -0,0 +1,24 @@
#ifndef _STOPWATCH_H_
#define _STOPWATCH_H_
#include "../common.h"
/////////////////////////////
// C wrapper for Stopwatch //
/////////////////////////////
typedef struct {
void *context;
} stopwatch;
void stopwatch_create(stopwatch *stopwatch);
void stopwatch_dispose(stopwatch *stopwatch);
uint64 stopwatch_GetElapsedTicks(stopwatch *stopwatch);
uint64 stopwatch_GetElapsedMilliseconds(stopwatch *stopwatch);
void stopwatch_Reset(stopwatch *stopwatch);
void stopwatch_Start(stopwatch *stopwatch);
void stopwatch_Restart(stopwatch *stopwatch);
void stopwatch_Stop(stopwatch *stopwatch);
#endif
+8
View File
@@ -75,9 +75,17 @@ enum {
extern int _log_levels[DIAGNOSTIC_LEVEL_COUNT];
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void diagnostic_log(int diagnosticLevel, const char *format, ...);
void diagnostic_log_with_location(int diagnosticLevel, const char *file, const char *function, int line, const char *format, ...);
#ifdef __cplusplus
}
#endif // __cplusplus
#ifdef _MSC_VER
#define diagnostic_log_macro(level, format, ...) diagnostic_log_with_location(level, __FILE__, __FUNCTION__, __LINE__, format, __VA_ARGS__)
+35 -12
View File
@@ -1042,21 +1042,44 @@ static void ttf_draw_string_raw_ttf(rct_drawpixelinfo *dpi, const utf8 *text, te
int srcScanSkip = surface->pitch - width;
int dstScanSkip = dpi->width + dpi->pitch - width;
for (int yy = 0; yy < height; yy++) {
for (int xx = 0; xx < width; xx++) {
if (*src != 0) {
*dst = colour;
if (info->flags & TEXT_DRAW_FLAG_INSET) {
*(dst + width + dstScanSkip + 1) = info->palette[3];
} else if (info->flags & TEXT_DRAW_FLAG_OUTLINE) {
*(dst + width + dstScanSkip + 1) = info->palette[3];
uint8 *dst_orig = dst;
uint8 *src_orig = src;
// Draw shadow/outline
if (info->flags & TEXT_DRAW_FLAG_OUTLINE) {
for (int yy = 0; yy < height - 0; yy++) {
for (int xx = 0; xx < width - 0; xx++) {
if (*src != 0) {
*(dst + 1) = info->palette[3]; // right
*(dst - 1) = info->palette[3]; // left
*(dst - width - dstScanSkip) = info->palette[3]; // top
*(dst + width + dstScanSkip) = info->palette[3]; // bottom
}
src++;
dst++;
}
src++;
dst++;
// Skip any remaining bits
src += srcScanSkip;
dst += dstScanSkip;
}
}
{
dst = dst_orig;
src = src_orig;
for (int yy = 0; yy < height; yy++) {
for (int xx = 0; xx < width; xx++) {
if (*src != 0) {
if (info->flags & TEXT_DRAW_FLAG_INSET) {
*(dst + width + dstScanSkip + 1) = info->palette[3];
}
*dst = colour;
}
src++;
dst++;
}
src += srcScanSkip;
dst += dstScanSkip;
}
src += srcScanSkip;
dst += dstScanSkip;
}
if (SDL_MUSTLOCK(surface)) {
+8 -10
View File
@@ -129,7 +129,7 @@ void editor_convert_save_to_scenario_callback(int result)
rct_stex_entry* stex = g_stexEntries[0];
if ((int)stex != 0xFFFFFFFF) {
object_unload((rct_object_entry*)&object_entry_groups[OBJECT_TYPE_SCENARIO_TEXT].entries[0]);
object_unload_chunk((rct_object_entry*)&object_entry_groups[OBJECT_TYPE_SCENARIO_TEXT].entries[0]);
reset_loaded_objects();
format_string(s6Info->details, STR_NO_DETAILS_YET, NULL);
@@ -235,23 +235,21 @@ static void set_all_land_owned()
*
* rct2: 0x006758C0
*/
void editor_load_landscape(const char *path)
bool editor_load_landscape(const utf8 *path)
{
window_close_construction_windows();
char *extension = strrchr(path, '.');
if (extension != NULL) {
if (_stricmp(extension, ".sv4") == 0) {
editor_load_landscape_from_sv4(path);
return;
return editor_load_landscape_from_sv4(path);
} else if (_stricmp(extension, ".sc4") == 0) {
editor_load_landscape_from_sc4(path);
return;
return editor_load_landscape_from_sc4(path);
}
}
// Load SC6 / SV6
editor_read_s6(path);
return editor_read_s6(path);
}
/**
@@ -464,7 +462,7 @@ static int editor_read_s6(const char *path)
rct_stex_entry* stex = g_stexEntries[0];
if ((int)stex != 0xFFFFFFFF) {
object_unload((rct_object_entry*)&object_entry_groups[OBJECT_TYPE_SCENARIO_TEXT].entries[0]);
object_unload_chunk((rct_object_entry*)&object_entry_groups[OBJECT_TYPE_SCENARIO_TEXT].entries[0]);
reset_loaded_objects();
format_string(s6Info->details, STR_NO_DETAILS_YET, NULL);
@@ -567,8 +565,8 @@ static void editor_finalise_main_view()
static bool editor_check_object_group_at_least_one_selected(int objectType)
{
uint32 numObjects = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32);
rct_object_entry *entry = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
uint32 numObjects = gInstalledObjectsCount;
rct_object_entry *entry = gInstalledObjects;
uint8 *objectFlag = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
for (uint32 i = 0; i < numObjects; i++) {
if ((entry->flags & 0x0F) == objectType && (*objectFlag & 1)) {
+1 -1
View File
@@ -41,7 +41,7 @@ void editor_load();
void editor_convert_save_to_scenario();
void trackdesigner_load();
void trackmanager_load();
void editor_load_landscape(const char *path);
bool editor_load_landscape(const utf8 *path);
void editor_open_windows_for_current_step();
+23 -82
View File
@@ -543,7 +543,7 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *
RCT2_GLOBAL(0x009A8C28, uint8)--;
// Show error window
if (RCT2_GLOBAL(0x009A8C28, uint8) == 0 && (flags & GAME_COMMAND_FLAG_APPLY) && RCT2_GLOBAL(0x0141F568, uint8) == RCT2_GLOBAL(0x013CA740, uint8) && !(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED))
if (RCT2_GLOBAL(0x009A8C28, uint8) == 0 && (flags & GAME_COMMAND_FLAG_APPLY) && RCT2_GLOBAL(0x0141F568, uint8) == RCT2_GLOBAL(0x013CA740, uint8) && !(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && !(flags & GAME_COMMAND_FLAG_NETWORKED))
window_error_open(RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16), RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16));
return MONEY32_UNDEFINED;
@@ -637,33 +637,6 @@ static int open_load_game_dialog()
static void load_landscape()
{
window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE, NULL);
return;
if (open_landscape_file_dialog() == 0) {
gfx_invalidate_screen();
} else {
// Set default filename
char *esi = (char*)0x0141EF67;
while (1) {
esi++;
if (*esi == '.')
break;
if (*esi != 0)
continue;
strcpy(esi, ".SC6");
break;
}
safe_strncpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*)0x0141EF68, MAX_PATH);
editor_load_landscape((char*)0x0141EF68);
if (1) {
gfx_invalidate_screen();
rct2_endupdate();
} else {
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_AGE, uint16) = 0;
rct2_endupdate();
}
}
}
/**
@@ -887,7 +860,7 @@ int game_load_network(SDL_RWops* rw)
*
* rct2: 0x00675E1B
*/
int game_load_save(const char *path)
bool game_load_save(const utf8 *path)
{
log_verbose("loading saved game, %s", path);
@@ -901,22 +874,24 @@ int game_load_save(const char *path)
log_error("unable to open %s", path);
RCT2_GLOBAL(RCT2_ADDRESS_ERROR_TYPE, uint8) = 255;
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_FILE_CONTAINS_INVALID_DATA;
return 0;
return false;
}
if (!game_load_sv6(rw)) {
title_load();
rct2_endupdate();
SDL_RWclose(rw);
return 0;
}
bool result = game_load_sv6(rw);
SDL_RWclose(rw);
game_load_init();
if (network_get_mode() == NETWORK_MODE_SERVER) {
network_send_map();
if (result) {
game_load_init();
if (network_get_mode() == NETWORK_MODE_SERVER) {
network_send_map();
}
return true;
} else {
// If loading the SV6 failed, the current park state will be corrupted
// so just go back to the title screen.
title_load();
return false;
}
return 1;
}
void game_load_init()
@@ -976,41 +951,6 @@ void reset_all_sprite_quadrant_placements()
sprite_move(spr->unknown.x, spr->unknown.y, spr->unknown.z, spr);
}
/**
*
* rct2: 0x0066DBB7
*/
static void load_game()
{
window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME, NULL);
return;
if (open_load_game_dialog() == 0) {
gfx_invalidate_screen();
} else {
// Set default filename
char *esi = (char*)0x0141EF67;
while (1) {
esi++;
if (*esi == '.')
break;
if (*esi != 0)
continue;
strcpy(esi, ".SV6");
break;
}
safe_strncpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*)0x0141EF68, MAX_PATH);
if (game_load_save((char *)0x0141EF68)) {
gfx_invalidate_screen();
rct2_endupdate();
} else {
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_AGE, uint16) = 0;
rct2_endupdate();
}
}
}
/**
*
* rct2: 0x006750E9
@@ -1058,7 +998,10 @@ void save_game()
}
void save_game_as()
{
window_loadsave_open(LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME, (char*)path_get_filename(gScenarioSavePath));
char name[MAX_PATH];
safe_strncpy(name, path_get_filename(gScenarioSavePath), MAX_PATH);
path_remove_extension(name);
window_loadsave_open(LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME, name);
}
int compare_autosave_file_paths (const void * a, const void * b ) {
@@ -1193,8 +1136,6 @@ void rct2_exit_reason(rct_string_id title, rct_string_id body){
*/
void rct2_exit()
{
//audio_close();
//Post quit message does not work in 0x6e3879 as its windows only.
openrct2_finish();
}
@@ -1207,10 +1148,11 @@ void game_load_or_quit_no_save_prompt()
if (RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16) < 1) {
game_do_command(0, 1, 0, 1, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
tool_cancel();
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) {
load_landscape();
else
load_game();
} else {
window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME, NULL);
}
} else if (RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16) == 1) {
game_do_command(0, 1, 0, 1, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
tool_cancel();
@@ -1219,7 +1161,6 @@ void game_load_or_quit_no_save_prompt()
}
gGameSpeed = 1;
title_load();
rct2_endupdate();
} else {
rct2_exit();
}
+1 -1
View File
@@ -134,7 +134,7 @@ void game_reduce_game_speed();
void game_load_or_quit_no_save_prompt();
int game_load_sv6(SDL_RWops* rw);
int game_load_network(SDL_RWops* rw);
int game_load_save(const char *path);
bool game_load_save(const utf8 *path);
void game_load_init();
void game_pause_toggle(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
void pause_toggle();
+2 -6
View File
@@ -63,10 +63,8 @@ bool image_io_png_read(uint8 **pixels, uint32 *width, uint32 *height, const utf8
uint8 *dst = pngPixels;
if (color_type == PNG_COLOR_TYPE_RGB) {
// 24-bit PNG (no alpha)
const png_size_t expectedRowSize = pngWidth * 3;
assert(rowBytes == pngWidth * 3);
for (png_uint_32 i = 0; i < pngHeight; i++) {
assert(rowBytes == expectedRowSize);
uint8 *src = rowPointers[i];
for (png_uint_32 x = 0; x < pngWidth; x++) {
*dst++ = *src++;
@@ -77,10 +75,8 @@ bool image_io_png_read(uint8 **pixels, uint32 *width, uint32 *height, const utf8
}
} else {
// 32-bit PNG (with alpha)
const png_size_t expectedRowSize = pngWidth * 4;
assert(rowBytes == pngWidth * 4);
for (png_uint_32 i = 0; i < pngHeight; i++) {
assert(rowBytes == expectedRowSize);
memcpy(dst, rowPointers[i], rowBytes);
dst += rowBytes;
}
+230 -232
View File
@@ -43,15 +43,42 @@
#include "world/scenery.h"
#include "openrct2.h"
static sint32 _dragX;
static sint32 _dragY;
enum {
MOUSE_STATE_RELEASED,
MOUSE_STATE_LEFT_PRESS,
MOUSE_STATE_LEFT_RELEASE,
MOUSE_STATE_RIGHT_PRESS,
MOUSE_STATE_RIGHT_RELEASE
};
typedef struct {
uint32 x;
uint32 y;
uint32 state;
} rct_mouse_data;
static rct_mouse_data _mouseInputQueue[64];
static uint8 _mouseInputQueueReadIndex = 0;
static uint8 _mouseInputQueueWriteIndex = 0;
static uint32 _ticksSinceDragStart;
static widget_ref _dragWidget;
static uint8 _dragScrollIndex;
static sint32 _originalWindowWidth;
static sint32 _originalWindowHeight;
static uint8 _currentScrollIndex;
static uint8 _currentScrollArea;
uint8 gInputState;
uint8 gInputFlags;
uint8 gInputPlaceObjectModifier;
sint32 gInputDragLastX;
sint32 gInputDragLastY;
widget_ref gHoverWidget;
widget_ref gPressedWidget;
uint16 gTooltipNotShownTicks;
uint16 gTooltipTimeout;
@@ -59,13 +86,6 @@ widget_ref gTooltipWidget;
sint32 gTooltipCursorX;
sint32 gTooltipCursorY;
typedef struct {
uint32 x, y;
uint32 state; //1 = LeftDown 2 = LeftUp 3 = RightDown 4 = RightUp
} rct_mouse_data;
rct_mouse_data* mouse_buffer = RCT2_ADDRESS(RCT2_ADDRESS_INPUT_QUEUE, rct_mouse_data);
static void game_get_next_input(int *x, int *y, int *state);
static void input_widget_over(int x, int y, rct_window *w, int widgetIndex);
static void input_widget_over_change_check(rct_windowclass windowClass, rct_windownumber windowNumber, int widgetIndex);
@@ -126,8 +146,9 @@ void game_handle_input()
for (;;) {
game_get_next_input(&x, &y, &state);
if (state == 0)
if (state == 0) {
break;
}
game_handle_input_mouse(x, y, state & 0xFF);
}
@@ -155,47 +176,47 @@ void game_handle_input()
*/
static void game_get_next_input(int *x, int *y, int *state)
{
rct_mouse_data* eax = get_mouse_input();
if (eax == NULL) {
rct_mouse_data *input = get_mouse_input();
if (input == NULL) {
*x = gCursorState.x;
*y = gCursorState.y;
*state = 0;
return;
} else {
*x = input->x;
*y = input->y;
*state = input->state;
}
*x = eax->x;
*y = eax->y;
*state = eax->state;
}
/**
*
* rct2: 0x00407074
*/
static rct_mouse_data* get_mouse_input()
static rct_mouse_data *get_mouse_input()
{
uint32 read_index = RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_READ_INDEX, uint32);
// check if that location has been written to yet
if (read_index == RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_WRITE_INDEX, uint32))
// Check if that location has been written to yet
if (_mouseInputQueueReadIndex == _mouseInputQueueWriteIndex) {
return NULL;
RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_READ_INDEX, uint32) = (read_index + 1) % 64;
return &mouse_buffer[read_index];
} else {
rct_mouse_data *result = &_mouseInputQueue[_mouseInputQueueReadIndex];
_mouseInputQueueReadIndex = (_mouseInputQueueReadIndex + 1) % countof(_mouseInputQueue);
return result;
}
}
/**
*
* rct2: 0x006E957F
*/
static void input_scroll_drag_begin(int x, int y, rct_window* w, rct_widget* widget, int widgetIndex) {
static void input_scroll_drag_begin(int x, int y, rct_window* w, rct_widget* widget, int widgetIndex)
{
gInputState = INPUT_STATE_SCROLL_RIGHT;
_dragX = x;
_dragY = y;
gInputDragLastX = x;
gInputDragLastY = y;
_dragWidget.window_classification = w->classification;
_dragWidget.window_number = w->number;
_dragWidget.widget_index = widgetIndex;
RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_DRAG_START, sint16) = 0;
_ticksSinceDragStart = 0;
_dragScrollIndex = window_get_scroll_data_index(w, widgetIndex);
platform_hide_cursor();
@@ -207,15 +228,15 @@ static void input_scroll_drag_begin(int x, int y, rct_window* w, rct_widget* wid
*/
static void input_scroll_drag_continue(int x, int y, rct_window* w)
{
uint8 widgetIndex = _dragWidget.widget_index;
rct_widgetindex widgetIndex = _dragWidget.widget_index;
uint8 scrollIndex = _dragScrollIndex;
rct_widget* widget = &w->widgets[widgetIndex];
rct_scroll* scroll = &w->scrolls[scrollIndex];
int dx, dy;
dx = x - _dragX;
dy = y - _dragY;
dx = x - gInputDragLastX;
dy = y - gInputDragLastY;
if (scroll->flags & HSCROLLBAR_VISIBLE) {
sint16 size = widget->right - widget->left - 1;
@@ -235,19 +256,16 @@ static void input_scroll_drag_continue(int x, int y, rct_window* w)
widget_scroll_update_thumbs(w, widgetIndex);
window_invalidate_by_number(w->classification, w->number);
platform_set_cursor_position(_dragX, _dragY);
platform_set_cursor_position(gInputDragLastX, gInputDragLastY);
}
/**
*
* rct2: 0x006E8ACB
*/
static void input_scroll_right(int x, int y, int state) {
rct_window* w = window_find_by_number(
_dragWidget.window_classification,
_dragWidget.window_number
);
static void input_scroll_right(int x, int y, int state)
{
rct_window* w = window_find_by_number(_dragWidget.window_classification, _dragWidget.window_number);
if (w == NULL) {
platform_show_cursor();
gInputState = INPUT_STATE_RESET;
@@ -255,15 +273,14 @@ static void input_scroll_right(int x, int y, int state) {
}
switch (state) {
case 0:
RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_DRAG_START, sint16) += RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, sint16);
if (x == 0 && y == 0)
return;
RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_DRAG_START, sint16) = 1000;
input_scroll_drag_continue(x, y, w);
case MOUSE_STATE_RELEASED:
_ticksSinceDragStart += RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, sint16);
if (x != 0 || y != 0) {
_ticksSinceDragStart = 1000;
input_scroll_drag_continue(x, y, w);
}
break;
case 4:
case MOUSE_STATE_RIGHT_RELEASE:
gInputState = INPUT_STATE_RESET;
platform_show_cursor();
break;
@@ -291,31 +308,33 @@ static void game_handle_input_mouse(int x, int y, int state)
// fall-through
case INPUT_STATE_NORMAL:
switch (state) {
case 0:
case MOUSE_STATE_RELEASED:
input_widget_over(x, y, w, widgetIndex);
break;
case 1:
case MOUSE_STATE_LEFT_PRESS:
input_widget_left(x, y, w, widgetIndex);
break;
case 3:
case MOUSE_STATE_RIGHT_PRESS:
window_close_by_class(WC_TOOLTIP);
if (w != NULL)
if (w != NULL) {
w = window_bring_to_front(w);
if (widgetIndex == -1)
break;
if (widget->type == WWT_VIEWPORT) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO)))
input_viewport_drag_begin(w, x, y);
}
else if (widget->type == WWT_SCROLL) {
input_scroll_drag_begin(x, y, w, widget, widgetIndex);
if (widgetIndex != -1) {
switch (widget->type) {
case WWT_VIEWPORT:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO))) {
input_viewport_drag_begin(w, x, y);
}
break;
case WWT_SCROLL:
input_scroll_drag_begin(x, y, w, widget, widgetIndex);
break;
}
}
break;
}
break;
case INPUT_STATE_WIDGET_PRESSED:
input_state_widget_pressed(x, y, state, widgetIndex, w, widget);
@@ -324,20 +343,19 @@ static void game_handle_input_mouse(int x, int y, int state)
w = window_find_by_number(_dragWidget.window_classification, _dragWidget.window_number);
if (w == NULL) {
gInputState = INPUT_STATE_RESET;
}
else {
input_window_position_continue(w, _dragX, _dragY, x, y);
if (state == 2)
} else {
input_window_position_continue(w, gInputDragLastX, gInputDragLastY, x, y);
if (state == MOUSE_STATE_LEFT_RELEASE) {
input_window_position_end(w, x, y);
}
}
break;
case INPUT_STATE_VIEWPORT_RIGHT:
if (state == 0) {
if (state == MOUSE_STATE_RELEASED) {
input_viewport_drag_continue();
}
else if (state == 4) {
} else if (state == MOUSE_STATE_RIGHT_RELEASE) {
input_viewport_drag_end();
if (RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_DRAG_START, sint16) < 500) {
if (_ticksSinceDragStart < 500) {
// If the user pressed the right mouse button for less than 500 ticks, interpret as right click
viewport_interaction_right_click(x, y);
}
@@ -347,72 +365,75 @@ static void game_handle_input_mouse(int x, int y, int state)
input_state_widget_pressed(x, y, state, widgetIndex, w, widget);
break;
case INPUT_STATE_VIEWPORT_LEFT:
w = window_find_by_number(
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_WINDOWCLASS, rct_windowclass),
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_WINDOWNUMBER, rct_windownumber)
);
if (!w){
w = window_find_by_number(_dragWidget.window_classification, _dragWidget.window_number);
if (w == NULL) {
gInputState = INPUT_STATE_RESET;
break;
}
if (state == 0){
if (!w->viewport){
switch (state) {
case MOUSE_STATE_RELEASED:
if (w->viewport == NULL) {
gInputState = INPUT_STATE_RESET;
break;
}
if (w->classification != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_WINDOWCLASS, rct_windowclass) ||
w->number != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_WINDOWNUMBER, rct_windownumber) ||
!(gInputFlags & INPUT_FLAG_TOOL_ACTIVE)) break;
if (w->classification != _dragWidget.window_classification ||
w->number != _dragWidget.window_number ||
!(gInputFlags & INPUT_FLAG_TOOL_ACTIVE)
) {
break;
}
w = window_find_by_number(
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass),
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)
);
if (w == NULL)
);
if (w == NULL) {
break;
}
window_event_tool_drag_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), x, y);
}
else if (state == 2){
break;
case MOUSE_STATE_LEFT_RELEASE:
gInputState = INPUT_STATE_RESET;
if (RCT2_GLOBAL(0x9DE52E, rct_windownumber) != w->number)break;
if ((gInputFlags & INPUT_FLAG_TOOL_ACTIVE)){
w = window_find_by_number(
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass),
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)
);
if (w == NULL)
break;
window_event_tool_up_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), x, y);
}
else{
if ((gInputFlags & INPUT_FLAG_4))
break;
viewport_interaction_left_click(x, y);
if (RCT2_GLOBAL(0x009DE52E, rct_windownumber) == w->number) {
if ((gInputFlags & INPUT_FLAG_TOOL_ACTIVE)) {
w = window_find_by_number(
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass),
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)
);
if (w != NULL) {
window_event_tool_up_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), x, y);
}
} else if (!(gInputFlags & INPUT_FLAG_4)) {
viewport_interaction_left_click(x, y);
}
}
break;
}
break;
case INPUT_STATE_SCROLL_LEFT:
if (state == 0)
switch (state) {
case MOUSE_STATE_RELEASED:
input_scroll_continue(w, widgetIndex, state, x, y);
else if (state == 2)
break;
case MOUSE_STATE_LEFT_RELEASE:
input_scroll_end();
break;
}
break;
case INPUT_STATE_RESIZING:
w = window_find_by_number(_dragWidget.window_classification, _dragWidget.window_number);
if (w == NULL) {
gInputState = INPUT_STATE_RESET;
}
else {
if (state == 2)
} else {
if (state == MOUSE_STATE_LEFT_RELEASE) {
input_window_resize_end();
if (state == 0 || state == 2)
}
if (state == MOUSE_STATE_RELEASED || state == MOUSE_STATE_LEFT_RELEASE) {
input_window_resize_continue(w, x, y);
}
}
break;
case INPUT_STATE_SCROLL_RIGHT:
@@ -426,8 +447,8 @@ static void game_handle_input_mouse(int x, int y, int state)
void input_window_position_begin(rct_window *w, int widgetIndex, int x, int y)
{
gInputState = INPUT_STATE_POSITIONING_WINDOW;
_dragX = x - w->x;
_dragY = y - w->y;
gInputDragLastX = x - w->x;
gInputDragLastY = y - w->y;
_dragWidget.window_classification = w->classification;
_dragWidget.window_number = w->number;
_dragWidget.widget_index = widgetIndex;
@@ -452,8 +473,8 @@ static void input_window_position_end(rct_window *w, int x, int y)
static void input_window_resize_begin(rct_window *w, int widgetIndex, int x, int y)
{
gInputState = INPUT_STATE_RESIZING;
_dragX = x;
_dragY = y;
gInputDragLastX = x;
gInputDragLastY = y;
_dragWidget.window_classification = w->classification;
_dragWidget.window_number = w->number;
_dragWidget.widget_index = widgetIndex;
@@ -466,8 +487,8 @@ static void input_window_resize_continue(rct_window *w, int x, int y)
int dx, dy, targetWidth, targetHeight;
if (y < RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 2) {
dx = x - _dragX;
dy = y - _dragY;
dx = x - gInputDragLastX;
dy = y - gInputDragLastY;
targetWidth = _originalWindowWidth + dx;
targetHeight = _originalWindowHeight + dy;
@@ -496,8 +517,8 @@ static void input_viewport_drag_begin(rct_window *w, int x, int y)
gInputState = INPUT_STATE_VIEWPORT_RIGHT;
_dragWidget.window_classification = w->classification;
_dragWidget.window_number = w->number;
RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_DRAG_START, sint16) = 0;
platform_get_cursor_position(&_dragX, &_dragY);
_ticksSinceDragStart = 0;
platform_get_cursor_position(&gInputDragLastX, &gInputDragLastY);
platform_hide_cursor();
// gInputFlags |= INPUT_FLAG_5;
@@ -511,13 +532,13 @@ static void input_viewport_drag_continue()
platform_get_cursor_position(&newDragX, &newDragY);
dx = newDragX - _dragX;
dy = newDragY - _dragY;
dx = newDragX - gInputDragLastX;
dy = newDragY - gInputDragLastY;
w = window_find_by_number(_dragWidget.window_classification, _dragWidget.window_number);
assert(w != NULL);
viewport = w->viewport;
RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_DRAG_START, sint16) += RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, sint16);
_ticksSinceDragStart += RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, sint16);
if (viewport == NULL) {
platform_show_cursor();
gInputState = INPUT_STATE_RESET;
@@ -527,7 +548,7 @@ static void input_viewport_drag_continue()
// If the drag time is less than 500 the "drag" is usually interpreted as a right click.
// As the user moved the mouse, don't interpret it as right click in any case.
RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_DRAG_START, sint16) = 1000;
_ticksSinceDragStart = 1000;
dx <<= viewport->zoom + 1;
dy <<= viewport->zoom + 1;
@@ -541,7 +562,7 @@ static void input_viewport_drag_continue()
}
}
platform_set_cursor_position(_dragX, _dragY);
platform_set_cursor_position(gInputDragLastX, gInputDragLastY);
}
static void input_viewport_drag_end()
@@ -561,9 +582,9 @@ static void input_scroll_begin(rct_window *w, int widgetIndex, int x, int y)
widget = &w->widgets[widgetIndex];
gInputState = INPUT_STATE_SCROLL_LEFT;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, uint16) = widgetIndex;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass) = w->classification;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windownumber) = w->number;
gPressedWidget.window_classification = w->classification;
gPressedWidget.window_number = w->number;
gPressedWidget.widget_index = widgetIndex;
gTooltipCursorX = x;
gTooltipCursorY = y;
@@ -571,8 +592,8 @@ static void input_scroll_begin(rct_window *w, int widgetIndex, int x, int y)
scroll_id = 0; // safety
widget_scroll_get_part(w, widget, x, y, &eax, &ebx, &scroll_area, &scroll_id);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SCROLL_AREA, uint16) = scroll_area;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SCROLL_ID, uint32) = scroll_id * sizeof(rct_scroll);
_currentScrollArea = scroll_area;
_currentScrollIndex = scroll_id;
window_event_unknown_15_call(w, scroll_id, scroll_area);
if (scroll_area == SCROLL_PART_VIEW){
window_event_scroll_mousedown_call(w, scroll_id, eax, ebx);
@@ -633,39 +654,34 @@ static void input_scroll_continue(rct_window *w, int widgetIndex, int state, int
assert(w != NULL);
widget = &w->widgets[widgetIndex];
if (widgetIndex != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, uint32)){
invalidate_scroll();
return;
}
if (w->classification != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, uint8)){
invalidate_scroll();
return;
}
if (w->number != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, uint16)){
if (w->classification != gPressedWidget.window_classification ||
w->number != gPressedWidget.window_number ||
widgetIndex != gPressedWidget.widget_index
) {
invalidate_scroll();
return;
}
widget_scroll_get_part(w, widget, x, y, &x2, &y2, &scroll_part, &scroll_id);
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SCROLL_AREA, uint16) == SCROLL_PART_HSCROLLBAR_THUMB){
gTooltipCursorX = x - gTooltipCursorX;
input_scroll_part_update_hthumb(w, widgetIndex, x, scroll_id);
if (_currentScrollArea == SCROLL_PART_HSCROLLBAR_THUMB){
int originalTooltipCursorX = gTooltipCursorX;
gTooltipCursorX = x;
input_scroll_part_update_hthumb(w, widgetIndex, x - originalTooltipCursorX, scroll_id);
return;
}
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SCROLL_AREA, uint16) == SCROLL_PART_VSCROLLBAR_THUMB){
int temp_y = y;
y -= RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_Y, uint16);
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_Y, uint16) = temp_y;
input_scroll_part_update_vthumb(w, widgetIndex, y, scroll_id);
if (_currentScrollArea == SCROLL_PART_VSCROLLBAR_THUMB){
int originalTooltipCursorY = gTooltipCursorY;
gTooltipCursorY = y;
input_scroll_part_update_vthumb(w, widgetIndex, y - originalTooltipCursorY, scroll_id);
return;
}
x = x2;
y = y2;
if (scroll_part != RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SCROLL_AREA, uint16)){
if (scroll_part != _currentScrollArea) {
invalidate_scroll();
return;
}
@@ -680,10 +696,6 @@ static void input_scroll_continue(rct_window *w, int widgetIndex, int state, int
case SCROLL_PART_HSCROLLBAR_RIGHT:
input_scroll_part_update_hright(w, widgetIndex, scroll_id);
break;
case SCROLL_PART_HSCROLLBAR_LEFT_TROUGH:
case SCROLL_PART_HSCROLLBAR_RIGHT_TROUGH:
return;
break;
case SCROLL_PART_HSCROLLBAR_THUMB:
case SCROLL_PART_VSCROLLBAR_TOP:
input_scroll_part_update_vtop(w, widgetIndex, scroll_id);
@@ -691,18 +703,12 @@ static void input_scroll_continue(rct_window *w, int widgetIndex, int state, int
case SCROLL_PART_VSCROLLBAR_BOTTOM:
input_scroll_part_update_vbottom(w, widgetIndex, scroll_id);
break;
case SCROLL_PART_VSCROLLBAR_TOP_TROUGH:
case SCROLL_PART_VSCROLLBAR_BOTTOM_TROUGH:
return;
break;
default:
return;
}
}
static void input_scroll_end()
{
gInputState = INPUT_STATE_RESET;
gInputState = INPUT_STATE_RESET;
invalidate_scroll();
}
@@ -920,18 +926,17 @@ static void input_widget_over_change_check(rct_windowclass windowClass, rct_wind
return;
// Check if the widget that the cursor was over, has changed
if (
windowClass != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass) ||
windowNumber != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER, rct_windownumber) ||
widgetIndex != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, uint16)
) {
if (windowClass != gHoverWidget.window_classification ||
windowNumber != gHoverWidget.window_number ||
widgetIndex != gHoverWidget.widget_index
) {
// Invalidate last widget cursor was on if widget is a flat button
input_widget_over_flatbutton_invalidate();
// Set new cursor over widget
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass) = windowClass;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER, rct_windownumber) = windowNumber;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, uint16) = widgetIndex;
gHoverWidget.window_classification = windowClass;
gHoverWidget.window_number = windowNumber;
gHoverWidget.widget_index = widgetIndex;
// Invalidate new widget cursor is on if widget is a flat button
if (windowClass != 255)
@@ -945,20 +950,16 @@ static void input_widget_over_change_check(rct_windowclass windowClass, rct_wind
*/
static void input_widget_over_flatbutton_invalidate()
{
rct_window *w = window_find_by_number(
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass),
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER, rct_windownumber)
);
if (w == NULL)
return;
window_event_invalidate_call(w);
if (w->widgets[RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, rct_windownumber)].type == WWT_FLATBTN) {
widget_invalidate_by_number(
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass),
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER, rct_windownumber),
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, rct_windownumber)
rct_window *w = window_find_by_number(gHoverWidget.window_classification, gHoverWidget.window_number);
if (w != NULL) {
window_event_invalidate_call(w);
if (w->widgets[gHoverWidget.widget_index].type == WWT_FLATBTN) {
widget_invalidate_by_number(
gHoverWidget.window_classification,
gHoverWidget.window_number,
gHoverWidget.widget_index
);
}
}
}
@@ -1005,10 +1006,10 @@ static void input_widget_left(int x, int y, rct_window *w, int widgetIndex)
break;
case WWT_VIEWPORT:
gInputState = INPUT_STATE_VIEWPORT_LEFT;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_X, uint16) = x;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16) = y;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_WINDOWCLASS, rct_windowclass) = windowClass;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_WINDOWNUMBER, rct_windownumber) = windowNumber;
gInputDragLastX = x;
gInputDragLastY = y;
_dragWidget.window_classification = windowClass;
_dragWidget.window_number = windowNumber;
if (gInputFlags & INPUT_FLAG_TOOL_ACTIVE) {
w = window_find_by_number(
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass),
@@ -1031,9 +1032,9 @@ static void input_widget_left(int x, int y, rct_window *w, int widgetIndex)
audio_play_sound_panned(SOUND_CLICK_1, w->x + (widget->left + widget->right) / 2, 0, 0, 0);
// Set new cursor down widget
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass) = windowClass;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windownumber) = windowNumber;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, uint16) = widgetIndex;
gPressedWidget.window_classification = windowClass;
gPressedWidget.window_number = windowNumber;
gPressedWidget.widget_index = widgetIndex;
gInputFlags |= INPUT_FLAG_WIDGET_PRESSED;
gInputState = INPUT_STATE_WIDGET_PRESSED;
RCT2_GLOBAL(0x009DE528, uint16) = 1;
@@ -1179,9 +1180,9 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
rct_windowclass cursor_w_class;
rct_windownumber cursor_w_number;
cursor_w_class = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass);
cursor_w_number = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windownumber);
int cursor_widgetIndex = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, uint32);
cursor_w_class = gPressedWidget.window_classification;
cursor_w_number = gPressedWidget.window_number;
int cursor_widgetIndex = gPressedWidget.widget_index;
rct_window *cursor_w = window_find_by_number(cursor_w_class, cursor_w_number);
if (cursor_w == NULL) {
@@ -1189,8 +1190,8 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
return;
}
switch (state){
case 0:
switch (state) {
case MOUSE_STATE_RELEASED:
if (!w || cursor_w_class != w->classification || cursor_w_number != w->number || widgetIndex != cursor_widgetIndex)
break;
@@ -1212,8 +1213,8 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
gInputFlags |= INPUT_FLAG_WIDGET_PRESSED;
widget_invalidate_by_number(cursor_w_class, cursor_w_number, widgetIndex);
return;
case 3:
case 2:
case MOUSE_STATE_LEFT_RELEASE:
case MOUSE_STATE_RIGHT_PRESS:
if (gInputState == INPUT_STATE_DROPDOWN_ACTIVE) {
if (w) {
int dropdown_index = 0;
@@ -1261,7 +1262,9 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
dropdown_cleanup:
window_close_by_class(WC_DROPDOWN);
}
if (state == 3) return;
if (state == MOUSE_STATE_RIGHT_PRESS) {
return;
}
gInputState = INPUT_STATE_NORMAL;
gTooltipTimeout = 0;
@@ -1287,7 +1290,7 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
return;
}
RCT2_GLOBAL(0x9DE528, uint16) = 0;
RCT2_GLOBAL(0x009DE528, uint16) = 0;
if (gInputState != INPUT_STATE_DROPDOWN_ACTIVE){
// Hold down widget and drag outside of area??
if (gInputFlags & INPUT_FLAG_WIDGET_PRESSED){
@@ -1380,14 +1383,14 @@ void title_handle_keyboard_input()
if (!gConsoleOpen) {
// Handle modifier keys and key scrolling
RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) = 0;
gInputPlaceObjectModifier = PLACE_OBJECT_MODIFIER_NONE;
if (RCT2_GLOBAL(0x009E2B64, uint32) != 1) {
if (gKeysState[SDL_SCANCODE_LSHIFT] || gKeysState[SDL_SCANCODE_RSHIFT])
RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) |= 1;
gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_SHIFT_Z;
if (gKeysState[SDL_SCANCODE_LCTRL] || gKeysState[SDL_SCANCODE_RCTRL])
RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) |= 2;
gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_COPY_Z;
if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT])
RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) |= 4;
gInputPlaceObjectModifier |= 4;
}
}
@@ -1407,7 +1410,7 @@ void title_handle_keyboard_input()
continue;
}
key |= RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) << 8;
key |= gInputPlaceObjectModifier << 8;
w = window_find_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
if (w != NULL) {
@@ -1430,20 +1433,24 @@ void game_handle_keyboard_input()
if (!gConsoleOpen) {
// Handle mouse scrolling
if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_EDGE_SCROLLING, uint8) != 0)
if (gInputState == INPUT_STATE_NORMAL)
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & 3))
game_handle_edge_scroll();
if (gInputState == INPUT_STATE_NORMAL && gConfigGeneral.edge_scrolling) {
if (!(gInputPlaceObjectModifier & (PLACE_OBJECT_MODIFIER_SHIFT_Z | PLACE_OBJECT_MODIFIER_COPY_Z))) {
game_handle_edge_scroll();
}
}
// Handle modifier keys and key scrolling
RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) = 0;
gInputPlaceObjectModifier = PLACE_OBJECT_MODIFIER_NONE;
if (RCT2_GLOBAL(0x009E2B64, uint32) != 1) {
if (gKeysState[SDL_SCANCODE_LSHIFT] || gKeysState[SDL_SCANCODE_RSHIFT])
RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) |= 1;
if (gKeysState[SDL_SCANCODE_LCTRL] || gKeysState[SDL_SCANCODE_RCTRL])
RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) |= 2;
if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT])
RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) |= 4;
if (gKeysState[SDL_SCANCODE_LSHIFT] || gKeysState[SDL_SCANCODE_RSHIFT]) {
gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_SHIFT_Z;
}
if (gKeysState[SDL_SCANCODE_LCTRL] || gKeysState[SDL_SCANCODE_RCTRL]) {
gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_COPY_Z;
}
if (gKeysState[SDL_SCANCODE_LALT] || gKeysState[SDL_SCANCODE_RALT]) {
gInputPlaceObjectModifier |= 4;
}
game_handle_key_scroll();
}
}
@@ -1469,7 +1476,7 @@ void game_handle_keyboard_input()
continue;
}
key |= RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) << 8;
key |= gInputPlaceObjectModifier << 8;
w = window_find_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
if (w != NULL) {
@@ -1532,20 +1539,12 @@ void sub_6ED990(char cursor_id){
*/
void invalidate_scroll()
{
rct_window* wind = window_find_by_number(
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, uint8),
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, uint16)
);
if (wind == NULL) return;
int scroll_id = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SCROLL_ID, uint32);
//Reset to basic scroll
wind->scrolls[scroll_id / sizeof(rct_scroll)].flags &= 0xFF11;
window_invalidate_by_number(
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, uint8),
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, uint16)
);
rct_window* w = window_find_by_number(gPressedWidget.window_classification, gPressedWidget.window_number);
if (w != NULL) {
// Reset to basic scroll
w->scrolls[_currentScrollIndex].flags &= 0xFF11;
window_invalidate_by_number(gPressedWidget.window_classification, gPressedWidget.window_number);
}
}
/**
@@ -1553,19 +1552,18 @@ void invalidate_scroll()
*/
void store_mouse_input(int state)
{
uint32 write_index = RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_WRITE_INDEX, uint32);
uint32 next_write_index = (write_index + 1) % 64;
uint32 writeIndex = _mouseInputQueueWriteIndex;
uint32 nextWriteIndex = (writeIndex + 1) % countof(_mouseInputQueue);
// check if the queue is full
if (next_write_index == RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_READ_INDEX, uint32))
return;
// Check if the queue is full
if (nextWriteIndex != _mouseInputQueueReadIndex) {
rct_mouse_data *item = &_mouseInputQueue[writeIndex];
item->x = RCT2_GLOBAL(0x01424318, uint32);
item->y = RCT2_GLOBAL(0x0142431C, uint32);
item->state = state;
rct_mouse_data* item = &mouse_buffer[write_index];
item->x = RCT2_GLOBAL(0x01424318, uint32);
item->y = RCT2_GLOBAL(0x0142431C, uint32);
item->state = state;
RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_WRITE_INDEX, uint32) = next_write_index;
_mouseInputQueueWriteIndex = nextWriteIndex;
}
}
void game_handle_edge_scroll()
+14 -1
View File
@@ -60,14 +60,27 @@ enum {
INPUT_FLAG_VIEWPORT_SCROLLING = (1 << 7)
};
enum {
PLACE_OBJECT_MODIFIER_NONE = 0,
PLACE_OBJECT_MODIFIER_SHIFT_Z = (1 << 0),
PLACE_OBJECT_MODIFIER_COPY_Z = (1 << 1),
};
typedef struct {
rct_windowclass window_classification;
rct_windownumber window_number;
uint8 widget_index;
rct_widgetindex widget_index;
} widget_ref;
extern uint8 gInputState;
extern uint8 gInputFlags;
extern uint8 gInputPlaceObjectModifier;
extern sint32 gInputDragLastX;
extern sint32 gInputDragLastY;
extern widget_ref gHoverWidget;
extern widget_ref gPressedWidget;
extern uint16 gTooltipNotShownTicks;
extern uint16 gTooltipTimeout;
+5 -5
View File
@@ -724,17 +724,17 @@ static int cc_twitch(const utf8 **argv, int argc)
static void editor_load_selected_objects_console()
{
uint8 *selection_flags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
rct_object_entry *installed_entry = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry *installed_entry = gInstalledObjects;
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32) == 0)
if (gInstalledObjectsCount == 0)
return;
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i != 0; i--, selection_flags++) {
for (int i = gInstalledObjectsCount; i != 0; i--, selection_flags++) {
if (*selection_flags & 1) {
uint8 entry_index, entry_type;
if (!find_object_in_entry_group(installed_entry, &entry_type, &entry_index)){
int chunk_size;
if (!object_load(-1, installed_entry, &chunk_size)) {
if (!object_load_chunk(-1, installed_entry, &chunk_size)) {
log_error("Failed to load entry %.8s", installed_entry->name);
}
}
@@ -773,7 +773,7 @@ static int cc_load_object(const utf8 **argv, int argc) {
}
else {
// Load the obect
if (!object_load(entryGroupIndex, &entry, NULL)) {
if (!object_load_chunk(entryGroupIndex, &entry, NULL)) {
console_writeline_error("Could not load object file.");
}
else {
+5 -1
View File
@@ -104,7 +104,7 @@ void viewport_init_all()
// ?
gInputFlags = 0;
gInputState = INPUT_STATE_RESET;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass) = -1;
gPressedWidget.window_classification = 255;
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, sint32) = -1;
gTooltipNotShownTicks = -1;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, sint16) = 0;
@@ -1531,6 +1531,10 @@ void viewport_track_paint_setup(uint8 direction, int height, rct_map_element *ma
rideIndex = mapElement->properties.track.ride_index;
ride = GET_RIDE(rideIndex);
if (ride->type == RIDE_TYPE_NULL) {
log_error("Attempted to paint invalid ride: %d", rideIndex);
return;
}
// HACK Set entrance style to plain if none to stop glitch until entrance track piece is implemented
bool isEntranceStyleNone = false;
+4 -2
View File
@@ -272,9 +272,11 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info
return info->type;
}
if ((gInputFlags & INPUT_FLAG_6) && (gInputFlags & INPUT_FLAG_TOOL_ACTIVE))
if (window_find_by_class(WC_RIDE_CONSTRUCTION) == NULL && window_find_by_class(WC_FOOTPATH) == NULL)
if (!(gInputFlags & INPUT_FLAG_6) || !(gInputFlags & INPUT_FLAG_TOOL_ACTIVE)) {
if (window_find_by_class(WC_RIDE_CONSTRUCTION) == NULL && window_find_by_class(WC_FOOTPATH) == NULL) {
return info->type = VIEWPORT_INTERACTION_ITEM_NONE;
}
}
switch (info->type) {
case VIEWPORT_INTERACTION_ITEM_SCENERY:
+11 -18
View File
@@ -978,31 +978,24 @@ int widget_is_disabled(rct_window *w, int widgetIndex)
int widget_is_pressed(rct_window *w, int widgetIndex)
{
int inputState = gInputState;
if (w->pressed_widgets & (1LL << widgetIndex))
if (w->pressed_widgets & (1LL << widgetIndex)) {
return 1;
}
if (gInputState == INPUT_STATE_WIDGET_PRESSED || gInputState == INPUT_STATE_DROPDOWN_ACTIVE) {
if (!(gInputFlags & INPUT_FLAG_WIDGET_PRESSED)) return 0;
if (gPressedWidget.window_classification != w->classification) return 0;
if (gPressedWidget.window_number != w->number) return 0;
if (gPressedWidget.widget_index != widgetIndex) return 0;
return 1;
if (inputState == INPUT_STATE_WIDGET_PRESSED || inputState == INPUT_STATE_DROPDOWN_ACTIVE) {
if (RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass) != w->classification)
return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windownumber) != w->number)
return 0;
if (!(gInputFlags & INPUT_FLAG_WIDGET_PRESSED))
return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, sint32) == widgetIndex)
return 1;
}
return 0;
}
int widget_is_highlighted(rct_window *w, int widgetIndex)
{
if (RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass) != w->classification)
return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER, rct_windownumber) != w->number)
return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, sint32) != widgetIndex)
return 0;
if (gHoverWidget.window_classification != w->classification) return 0;
if (gHoverWidget.window_number != w->number) return 0;
if (gHoverWidget.widget_index != widgetIndex) return 0;
return 1;
}
+1 -1
View File
@@ -2443,7 +2443,7 @@ void window_start_textbox(rct_window *call_w, int call_widget, rct_string_id exi
// Enter in the the text input buffer any existing
// text.
if (existing_text != (rct_string_id)STR_NONE)
if (existing_text != STR_NONE)
format_string(gTextBoxInput, existing_text, &existing_args);
// In order to prevent strings that exceed the maxLength
+1
View File
@@ -43,6 +43,7 @@ typedef void wndproc(struct rct_window*, union rct_window_event*);
typedef uint8 rct_windowclass;
typedef uint16 rct_windownumber;
typedef sint16 rct_widgetindex;
typedef struct {
rct_windowclass classification;
+5 -5
View File
@@ -135,7 +135,7 @@ const char *language_get_string(rct_string_id id)
{
const char *openrctString = nullptr;
if (id == (rct_string_id)STR_NONE)
if (id == STR_NONE)
return nullptr;
if (_languageCurrent != nullptr)
@@ -356,7 +356,7 @@ rct_string_id object_get_localised_text(uint8_t** pStringTable/*ebp*/, int type/
name[8] = 0;
rct_string_id stringId = _languageCurrent->GetObjectOverrideStringId(name, tableindex);
if (stringId != (rct_string_id)STR_NONE) {
if (stringId != STR_NONE) {
return stringId;
}
@@ -423,9 +423,9 @@ bool language_get_localised_scenario_strings(const utf8 *scenarioFilename, rct_s
outStringIds[1] = _languageCurrent->GetScenarioOverrideStringId(scenarioFilename, 1);
outStringIds[2] = _languageCurrent->GetScenarioOverrideStringId(scenarioFilename, 2);
return
outStringIds[0] != (rct_string_id)STR_NONE ||
outStringIds[1] != (rct_string_id)STR_NONE ||
outStringIds[2] != (rct_string_id)STR_NONE;
outStringIds[0] != STR_NONE ||
outStringIds[1] != STR_NONE ||
outStringIds[2] != STR_NONE;
}
}
+3 -3
View File
@@ -760,7 +760,7 @@ void format_string_part_from_raw(utf8 **dest, const utf8 *src, char **args)
void format_string_part(utf8 **dest, rct_string_id format, char **args)
{
if (format == (rct_string_id)STR_NONE) {
if (format == STR_NONE) {
**dest = 0;
} else if (format < 0x8000) {
// Language string
@@ -832,7 +832,8 @@ void format_string_to_upper(utf8 *dest, rct_string_id format, void *args)
* error (eax)
* format (bx)
*/
void error_string_quit(int error, rct_string_id format){
void error_string_quit(int error, rct_string_id format)
{
RCT2_GLOBAL(0x14241A0, uint32) = error;
RCT2_GLOBAL(0x9E2DA0, uint32) = 1;
@@ -845,7 +846,6 @@ void error_string_quit(int error, rct_string_id format){
}
RCT2_GLOBAL(0x9E2D9C, uint32) = 1;
rct2_exit();
rct2_endupdate();
}
void generate_string_file()
+4 -2
View File
@@ -21,9 +21,11 @@
#ifndef _STRING_IDS_H_
#define _STRING_IDS_H_
enum {
STR_NONE = -1,
#include "../common.h"
#define STR_NONE ((rct_string_id)-1)
enum {
STR_GUEST = 767,
STR_DATE_DAY_1 = 779,
+5 -1
View File
@@ -132,8 +132,8 @@ void finance_pay_ride_upkeep()
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED)) {
ride->build_date = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
ride->reliability = RIDE_INITIAL_RELIABILITY;
}
if (ride->status != RIDE_STATUS_CLOSED && !(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)) {
sint16 upkeep = ride->upkeep_cost;
if (upkeep != -1) {
@@ -142,6 +142,10 @@ void finance_pay_ride_upkeep()
finance_payment(upkeep, RCT_EXPENDITURE_TYPE_RIDE_RUNNING_COSTS);
}
}
if (ride->last_crash_type != RIDE_CRASH_TYPE_NONE) {
ride->last_crash_type--;
}
}
}
+5 -2
View File
@@ -1415,8 +1415,11 @@ int Network::Server_Handle_GAMECMD(NetworkConnection& connection, NetworkPacket&
if (commandCommand != GAME_COMMAND_TOGGLE_PAUSE &&
commandCommand != GAME_COMMAND_LOAD_OR_QUIT
) {
Server_Send_GAMECMD(args[0], args[1], args[2], args[3], args[4], args[5], args[6], playerid, callback);
game_do_command(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
// Run game command, and if it is successful send to clients
money32 cost = game_do_command(args[0], args[1] | GAME_COMMAND_FLAG_NETWORKED, args[2], args[3], args[4], args[5], args[6]);
if (cost != MONEY32_UNDEFINED) {
Server_Send_GAMECMD(args[0], args[1], args[2], args[3], args[4], args[5], args[6], playerid, callback);
}
}
return 1;
+1173 -1075
View File
File diff suppressed because it is too large. Load diff
+16 -3
View File
@@ -22,6 +22,7 @@
#define _OBJECT_H_
#include "common.h"
#include "drawing/drawing.h"
#include "platform/platform.h"
// First 0xF of rct_object_entry->flags
@@ -93,6 +94,13 @@ typedef struct {
extern rct_object_entry_group object_entry_groups[];
extern char gTempObjectLoadName[9];
extern uint32 gInstalledObjectsCount;
extern rct_object_entry *gInstalledObjects;
extern uint32 gNumInstalledRCT2Objects;
extern uint32 gNumInstalledCustomObjects;
extern void *gLastLoadedObjectChunkData;
int object_load_entry(const utf8 *path, rct_object_entry *outEntry);
void object_list_load();
void set_load_objects_fail_reason();
@@ -101,15 +109,14 @@ int object_load_packed(SDL_RWops* rw);
void object_unload_all();
int check_object_entry(rct_object_entry *entry);
int object_load(int groupIndex, rct_object_entry *entry, int* chunk_size);
int object_load_file(int groupIndex, const rct_object_entry *entry, int* chunkSize, const rct_object_entry *installedObject);
void object_unload(rct_object_entry *entry);
int object_load_chunk(int groupIndex, rct_object_entry *entry, int* chunk_size);
void object_unload_chunk(rct_object_entry *entry);
int object_get_scenario_text(rct_object_entry *entry);
void object_free_scenario_text();
int object_get_length(rct_object_entry *entry);
int object_entry_compare(const rct_object_entry *a, const rct_object_entry *b);
int object_calculate_checksum(const rct_object_entry *entry, const uint8 *data, int dataLength);
int object_paint(int type, int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp);
rct_object_entry *object_get_next(rct_object_entry *entry);
int write_object_file(SDL_RWops* rw, rct_object_entry* entry);
void reset_loaded_objects();
@@ -122,4 +129,10 @@ char *object_get_name(rct_object_entry *entry);
rct_object_filters *get_object_filter(int index);
bool object_load(int type, void *objectEntry, uint32 entryIndex);
void object_unload(int type, void *objectEntry);
bool object_test(int type, void *objectEntry);
void object_paint(int type, void *objectEntry, rct_drawpixelinfo *dpi, sint32 x, sint32 y);
rct_string_id object_desc(int type, void *objectEntry);
#endif
+78 -89
View File
@@ -98,6 +98,13 @@ static void load_object_filter(rct_object_entry* entry, uint8* chunk, rct_object
static rct_object_filters *_installedObjectFilters = NULL;
uint32 gInstalledObjectsCount;
rct_object_entry *gInstalledObjects;
uint32 gNumInstalledRCT2Objects;
uint32 gNumInstalledCustomObjects;
void *gLastLoadedObjectChunkData;
static void get_plugin_path(utf8 *outPath)
{
platform_get_user_directory(outPath, NULL);
@@ -112,8 +119,8 @@ static void object_list_sort()
char *objectName, *lowestString;
uint8 *copied;
objectBuffer = &RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
numObjects = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, sint32);
objectBuffer = &gInstalledObjects;
numObjects = gInstalledObjectsCount;
copied = calloc(numObjects, sizeof(uint8));
// Get buffer size
@@ -123,7 +130,7 @@ static void object_list_sort()
bufferSize = (int)entry - (int)*objectBuffer;
// Create new buffer
newBuffer = rct2_malloc(bufferSize);
newBuffer = (rct_object_entry*)malloc(bufferSize);
destEntry = newBuffer;
if (_installedObjectFilters) {
newFilters = malloc(numObjects * sizeof(rct_object_filters));
@@ -155,7 +162,7 @@ static void object_list_sort()
}
// Replace old buffer
rct2_free(*objectBuffer);
free(*objectBuffer);
*objectBuffer = newBuffer;
if (_installedObjectFilters) {
free(_installedObjectFilters);
@@ -165,27 +172,29 @@ static void object_list_sort()
free(copied);
}
static uint32 object_list_count_custom_objects()
{
uint32 numCustomObjects = 0;
rct_object_entry *object = gInstalledObjects;
for (uint32 i = 0; i < gInstalledObjectsCount; i++) {
if ((object->flags & 0xF0) == 0) {
numCustomObjects++;
}
object = object_get_next(object);
}
gNumInstalledCustomObjects = numCustomObjects;
return numCustomObjects;
}
/**
*
* rct2: 0x006A93CD
*/
static void object_list_examine()
{
int i;
rct_object_entry *object;
RCT2_GLOBAL(RCT2_ADDRESS_CUSTOM_OBJECTS_INSTALLED, uint8) = 0;
object = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
for (i = 0; i < RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, sint32); i++) {
if (!(object->flags & 0xF0))
RCT2_GLOBAL(RCT2_ADDRESS_CUSTOM_OBJECTS_INSTALLED, uint8) |= 1;
object = object_get_next(object);
}
object_list_count_custom_objects();
object_list_sort();
// Create a search index
object_list_create_hash_table();
}
@@ -203,7 +212,7 @@ void reset_loaded_objects()
for (int j = 0; j < object_entry_group_counts[type]; j++){
uint8* chunk = object_entry_groups[type].chunks[j];
if (chunk != (uint8*)-1)
object_paint(type, 0, j, type, 0, (int)chunk, 0, 0);
object_load(type, chunk, j);
}
}
}
@@ -256,27 +265,17 @@ void object_list_load()
totalFiles = (totalFiles & ~0xFF) | 1;
totalFiles = rol32(totalFiles, 24);
if (object_list_cache_load(totalFiles, totalFileSize, fileDateModifiedChecksum))
if (object_list_cache_load(totalFiles, totalFileSize, fileDateModifiedChecksum)) {
return;
// Reload object list
// RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS used to control if this was the first time loading objects
// and display the starting RCT2 for the first time message.
//if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS, uint8) != 0)
// RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS, uint8) = 0;
reset_loaded_objects();
// Dispose installed object list
if (RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, sint32) != -1) {
rct2_free(RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, void*));
RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, sint32) = -1;
}
RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, void*) = rct2_malloc(4096);
if (RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, int) == -1){
// Dispose installed object list
reset_loaded_objects();
SafeFree(gInstalledObjects);
gInstalledObjectsCount = 0;
gInstalledObjects = (rct_object_entry*)malloc(4096);
if (gInstalledObjects == NULL) {
log_error("Failed to allocate memory for object list");
rct2_exit_reason(835, 3162);
return;
@@ -284,9 +283,8 @@ void object_list_load()
uint32 fileCount = 0;
uint32 objectCount = 0;
uint32 current_item_offset = 0;
uint32 next_offset = 0;
RCT2_GLOBAL(RCT2_ADDRESS_ORIGINAL_RCT2_OBJECT_COUNT, uint32) = 0;
size_t currentEntryOffset = 0;
gNumInstalledRCT2Objects = 0;
log_verbose("building cache of available objects...");
@@ -297,15 +295,14 @@ void object_list_load()
enumFileHandle = platform_enumerate_files_begin(RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char));
if (enumFileHandle != INVALID_HANDLE) {
uint32 installed_buffer_size = 0x1000;
size_t installedObjectsCapacity = 4096;
while (platform_enumerate_files_next(enumFileHandle, &enumFileInfo)) {
fileCount++;
if ((installed_buffer_size - current_item_offset) <= 2842){
installed_buffer_size += 0x1000;
RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, void*) = rct2_realloc(RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, void*), installed_buffer_size);
if (RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, int) == -1){
if ((installedObjectsCapacity - currentEntryOffset) <= 2842){
installedObjectsCapacity += 4096;
gInstalledObjects = (rct_object_entry*)realloc(gInstalledObjects, installedObjectsCapacity);
if (gInstalledObjects == NULL) {
log_error("Failed to allocate memory for object list");
rct2_exit_reason(835, 3162);
return;
@@ -316,23 +313,17 @@ void object_list_load()
substitute_path(path, RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), enumFileInfo.path);
rct_object_entry entry;
if (!object_load_entry(path, &entry))
continue;
if (_installedObjectFilters)
if (object_load_entry(path, &entry)) {
_installedObjectFilters = realloc(_installedObjectFilters, sizeof(rct_object_filters) * (objectCount + 1));
else
_installedObjectFilters = malloc(sizeof(rct_object_filters) * (objectCount + 1));
rct_object_entry* installed_entry = (rct_object_entry*)(RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, uint8*) + current_item_offset);
rct_object_filters filter;
next_offset = install_object_entry(&entry, installed_entry, enumFileInfo.path, &filter);
if (next_offset) {
current_item_offset += next_offset;
_installedObjectFilters[objectCount] = filter;
objectCount++;
rct_object_entry *installedEntry = (rct_object_entry*)((size_t)gInstalledObjects + currentEntryOffset);
rct_object_filters filter;
size_t newEntrySize = install_object_entry(&entry, installedEntry, enumFileInfo.path, &filter);
if (newEntrySize != 0) {
_installedObjectFilters[objectCount] = filter;
objectCount++;
currentEntryOffset += newEntrySize;
}
}
}
platform_enumerate_files_end(enumFileHandle);
@@ -340,7 +331,7 @@ void object_list_load()
reset_loaded_objects();
object_list_cache_save(fileCount, totalFileSize, fileDateModifiedChecksum, current_item_offset);
object_list_cache_save(fileCount, totalFileSize, fileDateModifiedChecksum, currentEntryOffset);
// Reload track list
ride_list_item ride_list;
@@ -375,26 +366,23 @@ static int object_list_cache_load(int totalFiles, uint64 totalFileSize, int file
pluginHeader.date_modified_checksum == fileDateModifiedChecksum
) {
// Dispose installed object list
if (RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, sint32) != -1) {
rct2_free(RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, void*));
RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, sint32) = -1;
}
SafeFree(gInstalledObjects);
// Read installed object list
RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, void*) = rct2_malloc(pluginHeader.object_list_size);
if (SDL_RWread(file, RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, void*), pluginHeader.object_list_size, 1) == 1) {
RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32) = pluginHeader.object_list_no_items;
gInstalledObjects = (rct_object_entry*)malloc(pluginHeader.object_list_size);
if (SDL_RWread(file, gInstalledObjects, pluginHeader.object_list_size, 1) == 1) {
gInstalledObjectsCount = pluginHeader.object_list_no_items;
if (pluginHeader.object_list_no_items != (pluginHeader.total_files & 0xFFFFFF))
log_error("Potential mismatch in file numbers. Possible corrupt file. Consider deleting plugin.dat.");
if (SDL_RWread(file, &filterVersion, sizeof(filterVersion), 1) == 1) {
if (filterVersion == FILTER_VERSION) {
if (_installedObjectFilters)
if (_installedObjectFilters != NULL) {
free(_installedObjectFilters);
}
_installedObjectFilters = malloc(sizeof(rct_object_filters) * pluginHeader.object_list_no_items);
if (SDL_RWread(file, _installedObjectFilters, sizeof(rct_object_filters) * pluginHeader.object_list_no_items, 1) == 1) {
SDL_RWclose(file);
reset_loaded_objects();
object_list_examine();
@@ -441,7 +429,7 @@ static int object_list_cache_save(int fileCount, uint64 totalFileSize, int fileD
pluginHeader.total_file_size = (uint32)totalFileSize;
pluginHeader.date_modified_checksum = fileDateModifiedChecksum;
pluginHeader.object_list_size = currentItemOffset;
pluginHeader.object_list_no_items = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32);
pluginHeader.object_list_no_items = gInstalledObjectsCount;
get_plugin_path(path);
file = SDL_RWFromFile(path,"wb");
@@ -451,9 +439,9 @@ static int object_list_cache_save(int fileCount, uint64 totalFileSize, int fileD
}
SDL_RWwrite(file, &pluginHeader, sizeof(rct_plugin_header), 1);
SDL_RWwrite(file, RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, uint8*), pluginHeader.object_list_size, 1);
SDL_RWwrite(file, gInstalledObjects, pluginHeader.object_list_size, 1);
SDL_RWwrite(file, &filterVersion, sizeof(filterVersion), 1);
SDL_RWwrite(file, _installedObjectFilters, sizeof(rct_object_filters) * RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32), 1);
SDL_RWwrite(file, _installedObjectFilters, sizeof(rct_object_filters) * gInstalledObjectsCount, 1);
SDL_RWclose(file);
return 1;
}
@@ -468,7 +456,8 @@ int check_object_entry(rct_object_entry *entry)
*
* rct2: 0x006AB344
*/
void object_create_identifier_name(char* string_buffer, const rct_object_entry* object){
void object_create_identifier_name(char* string_buffer, const rct_object_entry* object)
{
for (uint8 i = 0; i < 8; ++i){
if (object->name[i] != ' '){
*string_buffer++ = object->name[i];
@@ -559,7 +548,7 @@ int object_read_and_load_entries(SDL_RWops* rw)
}
// Load the obect
if (!object_load(entryGroupIndex, &entries[i], NULL)) {
if (!object_load_chunk(entryGroupIndex, &entries[i], NULL)) {
log_error("failed to load entry: %.8s", entries[i].name);
memcpy((char*)0x13CE952, &entries[i], sizeof(rct_object_entry));
load_fail = 1;
@@ -590,7 +579,7 @@ void object_unload_all()
for (i = 0; i < OBJECT_ENTRY_GROUP_COUNT; i++)
for (j = 0; j < object_entry_group_counts[i]; j++)
if (object_entry_groups[i].chunks[j] != (uint8*)0xFFFFFFFF)
object_unload((rct_object_entry*)&object_entry_groups[i].entries[j]);
object_unload_chunk((rct_object_entry*)&object_entry_groups[i].entries[j]);
reset_loaded_objects();
}
@@ -617,7 +606,7 @@ uint32 object_get_hash_code(rct_object_entry *object)
void object_list_create_hash_table()
{
rct_object_entry *installedObject;
int numInstalledObjects = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, sint32);
int numInstalledObjects = gInstalledObjectsCount;
if (_installedObjectHashTable != NULL)
free(_installedObjectHashTable);
@@ -626,7 +615,7 @@ void object_list_create_hash_table()
_installedObjectHashTable = calloc(_installedObjectHashTableSize, sizeof(rct_object_entry*));
_installedObjectHashTableCollisions = 0;
installedObject = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
installedObject = gInstalledObjects;
for (int i = 0; i < numInstalledObjects; i++) {
uint32 hash = object_get_hash_code(installedObject);
uint32 index = hash % _installedObjectHashTableSize;
@@ -740,7 +729,7 @@ static uint32 install_object_entry(rct_object_entry* entry, rct_object_entry* in
RCT2_GLOBAL(RCT2_ADDRESS_TOTAL_NO_IMAGES, uint32) = 0xF26E;
RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32)++;
gInstalledObjectsCount++;
// This is a variable used by object_load to decide if it should
// use object_paint on the entry.
@@ -755,7 +744,7 @@ static uint32 install_object_entry(rct_object_entry* entry, rct_object_entry* in
log_error("Object Load File failed. Potentially corrupt file: %.8s", entry->name);
RCT2_GLOBAL(0x009ADAF4, sint32) = -1;
RCT2_GLOBAL(0x009ADAFD, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32)--;
gInstalledObjectsCount--;
return 0;
}
@@ -766,25 +755,25 @@ static uint32 install_object_entry(rct_object_entry* entry, rct_object_entry* in
RCT2_GLOBAL(0x009ADAFD, uint8) = 0;
if ((entry->flags & 0xF0) == 0x80) {
RCT2_GLOBAL(RCT2_ADDRESS_ORIGINAL_RCT2_OBJECT_COUNT, uint32)++;
if (RCT2_GLOBAL(RCT2_ADDRESS_ORIGINAL_RCT2_OBJECT_COUNT, uint32) > 772){
gNumInstalledRCT2Objects++;
if (gNumInstalledRCT2Objects > 772){
log_error("Incorrect number of vanilla RCT2 objects.");
RCT2_GLOBAL(RCT2_ADDRESS_ORIGINAL_RCT2_OBJECT_COUNT, uint32)--;
RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32)--;
object_unload(entry);
gNumInstalledRCT2Objects--;
gInstalledObjectsCount--;
object_unload_chunk(entry);
return 0;
}
}
*((sint32*)installed_entry_pointer) = chunk_size;
installed_entry_pointer += 4;
uint8* chunk = RCT2_GLOBAL(RCT2_ADDRESS_CURR_OBJECT_CHUNK_POINTER, uint8*); // Loaded in object_load
uint8* chunk = (uint8*)gLastLoadedObjectChunkData; // Loaded in object_load
load_object_filter(entry, chunk, filter);
// Always extract only the vehicle type, since the track type is always displayed in the left column, to prevent duplicate track names.
rct_string_id nameStringId = object_get_name_string_id(entry, chunk);
if (nameStringId == (rct_string_id)STR_NONE) {
if (nameStringId == STR_NONE) {
nameStringId = (rct_string_id)RCT2_GLOBAL(RCT2_ADDRESS_CURR_OBJECT_BASE_STRING_ID, uint32);
}
@@ -817,7 +806,7 @@ static uint32 install_object_entry(rct_object_entry* entry, rct_object_entry* in
uint32 size_of_object = installed_entry_pointer - (uint8*)installed_entry;
object_unload(entry);
object_unload_chunk(entry);
return size_of_object;
}
+9
View File
@@ -7279,6 +7279,12 @@ static int guest_path_find_leaving_park(rct_peep *peep, rct_map_element *map_ele
*/
static int guest_path_find_park_entrance(rct_peep* peep, rct_map_element *map_element, uint8 edges){
uint8 entranceNum;
// Resolves already-corrupt guests (e.g. loaded from save)
if (peep->flags & PEEP_FLAGS_PARK_ENTRANCE_CHOSEN &&
(peep->current_ride >= 4 ||
RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, sint16)[peep->current_ride] == (sint16)0x8000)
) peep->flags &= ~(PEEP_FLAGS_PARK_ENTRANCE_CHOSEN);
if (!(peep->flags & PEEP_FLAGS_PARK_ENTRANCE_CHOSEN)){
uint8 chosenEntrance = 0xFF;
@@ -8065,6 +8071,9 @@ static void peep_on_exit_ride(rct_peep *peep, int rideIndex)
peep->happiness = peep->happiness_growth_rate;
peep->nausea = peep->nausea_growth_rate;
peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_STATS;
if (peep->flags & PEEP_FLAGS_LEAVING_PARK)
peep->flags &= ~(PEEP_FLAGS_PARK_ENTRANCE_CHOSEN);
if (peep_should_go_on_ride_again(peep, ride)) {
peep->guest_heading_to_ride_id = rideIndex;
+1 -1
View File
@@ -339,7 +339,7 @@ static void platform_resize(int width, int height)
gfx_invalidate_screen();
// Check if the window has been resized in windowed mode and update the config file accordingly
// This is called in rct2_update_2 and is only called after resizing a window has finished
// This is called in rct2_update and is only called after resizing a window has finished
const int nonWindowFlags =
SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP;
if (!(flags & nonWindowFlags)) {
+2 -2
View File
@@ -349,7 +349,7 @@ static void rct1_load_default_objects()
continue;
}
if (!object_load(j, &entries[j], NULL)) {
if (!object_load_chunk(j, &entries[j], NULL)) {
error_string_quit(0x99990000 + (i * 0x100) + j, -1);
return;
}
@@ -359,7 +359,7 @@ static void rct1_load_default_objects()
// Water is a special case
rct_object_entry *waterEntries = (rct_object_entry*)RCT1DefaultObjects[9].entries;
rct_object_entry *waterEntry = &waterEntries[RCT2_GLOBAL(0x01358841, uint8) == 0 ? 0 : 1];
if (!object_load(0, waterEntry, NULL)) {
if (!object_load_chunk(0, waterEntry, NULL)) {
error_string_quit(0x99990900, -1);
return;
}
+80 -99
View File
@@ -20,7 +20,6 @@
#pragma warning(disable : 4996) // GetVersionExA deprecated
#include <setjmp.h>
#include <time.h>
#include "addresses.h"
#include "audio/audio.h"
@@ -29,6 +28,7 @@
#include "drawing/drawing.h"
#include "editor.h"
#include "game.h"
#include "input.h"
#include "interface/chat.h"
#include "interface/console.h"
#include "interface/viewport.h"
@@ -54,6 +54,61 @@
#include "world/scenery.h"
#include "world/sprite.h"
// rct2: 0x0097F67C
const char * const RCT2FilePaths[PATH_ID_END] = {
"Data\\g1.dat",
"Data\\plugin.dat",
"Data\\css1.dat",
"Data\\css2.dat",
"Data\\css4.dat",
"Data\\css5.dat",
"Data\\css6.dat",
"Data\\css7.dat",
"Data\\css8.dat",
"Data\\css9.dat",
"Data\\css11.dat",
"Data\\css12.dat",
"Data\\css13.dat",
"Data\\css14.dat",
"Data\\css15.dat",
"Data\\css3.dat",
"Data\\css17.dat",
"Data\\css18.dat",
"Data\\css19.dat",
"Data\\css20.dat",
"Data\\css21.dat",
"Data\\css22.dat",
"Saved Games\\scores.dat",
"Data\\css23.dat",
"Data\\css24.dat",
"Data\\css25.dat",
"Data\\css26.dat",
"Data\\css27.dat",
"Data\\css28.dat",
"Data\\css29.dat",
"Data\\css30.dat",
"Data\\css31.dat",
"Data\\css32.dat",
"Data\\css33.dat",
"Data\\css34.dat",
"Data\\css35.dat",
"Data\\css36.dat",
"Data\\css37.dat",
"Data\\css38.dat",
"Data\\CUSTOM1.WAV",
"Data\\CUSTOM2.WAV",
"Data\\css39.dat",
"Data\\css40.dat",
"Data\\css41.dat",
"Scenarios\\Six Flags Magic Mountain.SC6",
"Data\\css42.dat",
"Data\\css43.dat",
"Data\\css44.dat",
"Data\\css45.dat",
"Data\\css46.dat",
"Data\\css50.dat"
};
uint32 gCurrentDrawCount = 0;
typedef struct tm tm_t;
@@ -64,9 +119,6 @@ int rct2_init_directories();
int rct2_startup_checks();
static void rct2_draw_fps();
static void rct2_update_2();
static jmp_buf _end_update_jump;
void rct2_quit()
{
@@ -92,7 +144,7 @@ int rct2_init()
config_reset_shortcut_keys();
config_shortcut_keys_load();
RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) = 0;
gInputPlaceObjectModifier = PLACE_OBJECT_MODIFIER_NONE;
// config_load();
object_list_load();
@@ -212,33 +264,9 @@ int rct2_startup_checks()
if (!check_file_paths())
return 0;
if (!check_files_integrity())
return 0;
return 1;
}
void rct2_update()
{
// Set 0x009DE564 to the value of esp
// RCT2 sets the stack pointer to the value of this address when ending the current game tick from anywhere
#ifdef _MSC_VER
__asm {
mov eax, 009DE564h
mov [eax], esp
}
#else
__asm__ ( "\
\n\
movl $0x009DE564, %%eax \n\
movl %%esp, (%%eax) \n\
" : : : "eax" );
#endif
if (!setjmp(_end_update_jump))
rct2_update_2();
}
void rct2_draw()
{
redraw_rain();
@@ -343,11 +371,12 @@ int rct2_open_file(const char *path)
* rct2: 0x00674C95
*/
int check_file_paths()
{
for (int pathId = 0; pathId < PATH_ID_END; pathId++)
if (!check_file_path(pathId))
return 0;
{
for (int pathId = 0; pathId < PATH_ID_END; pathId++) {
if (!check_file_path(pathId)) {
return 0;
}
}
return 1;
}
@@ -363,69 +392,34 @@ int check_file_path(int pathId)
switch (pathId) {
case PATH_ID_G1:
if (file == NULL) {
// A data file is missing from the installation directory. The original implementation
// asks for a CD-ROM path at this point and stores it in cdrom_path @ 0x9AA318.
// The file_on_cdrom[pathId] @ 0x009AA0B flag is set to 1 as well.
// For PATH_ID_SIXFLAGS_MAGICMOUNTAIN (and the now removed PATH_ID_SIXFLAGS_BUILDYOUROWN),
// the original implementation always assumes they are stored on CD-ROM.
// This has been removed for now for the sake of simplicity and could be added
// later in a more convenient way using the INI file.
log_fatal("Could not find file %s", path);
return 0;
}
break;
case PATH_ID_CUSTOM1:
if (file != NULL)
gRideMusicInfoList[36]->length = (uint32)SDL_RWsize(file); // Store file size in music_custom1_size @ 0x009AF164
if (file != NULL) {
// Store file size in music_custom1_size @ 0x009AF164
gRideMusicInfoList[36]->length = (uint32)SDL_RWsize(file);
}
break;
case PATH_ID_CUSTOM2:
if (file != NULL)
gRideMusicInfoList[37]->length = (uint32)SDL_RWsize(file); // Store file size in music_custom2_size @ 0x009AF16E
if (file != NULL) {
// Store file size in music_custom2_size @ 0x009AF16E
gRideMusicInfoList[37]->length = (uint32)SDL_RWsize(file);
}
break;
}
if (file != NULL)
if (file != NULL) {
SDL_RWclose(file);
return 1;
}
/**
*
* rct2: 0x00674C0B
*/
int check_files_integrity()
{
int i;
const char *path;
#ifdef _WIN32
HANDLE file;
WIN32_FIND_DATA find_data;
for (i = 0; files_to_check[i].pathId != PATH_ID_END; i++) {
path = get_file_path(files_to_check[i].pathId);
file = FindFirstFile(path, &find_data);
if (file == INVALID_HANDLE_VALUE || find_data.nFileSizeLow != files_to_check[i].fileSize) {
if (file != INVALID_HANDLE_VALUE)
FindClose(file);
log_fatal("Integrity check failed for %s", path);
return 0;
}
FindClose(file);
}
#else
STUB();
#endif // _WIN32
return 1;
}
void rct2_update_2()
void rct2_update()
{
int tick, tick2;
@@ -458,30 +452,19 @@ void rct2_update_2()
console_update();
}
void rct2_endupdate()
{
longjmp(_end_update_jump, 0);
}
/**
*
* rct2: 0x00674E6C
*/
const utf8 *get_file_path(int pathId)
{
static utf8 path[MAX_PATH]; // get_file_path_buffer @ 0x009E3605
// The original implementation checks if the file is on CD-ROM here (file_on_cdrom[pathId] @ 0x009AA0B1).
// If so, the CD-ROM path (cdrom_path @ 0x9AA318) is used instead. This has been removed for now for
// the sake of simplicity.
static utf8 path[MAX_PATH];
strcpy(path, gConfigGeneral.game_path);
// Make sure base path is terminated with a slash
if (strlen(path) == 0 || path[strlen(path) - 1] != platform_get_path_separator())
{
if (strlen(path) >= MAX_PATH - 1)
{
log_error("Path for %s too long", file_paths[pathId]);
if (strlen(path) == 0 || path[strlen(path) - 1] != platform_get_path_separator()) {
if (strlen(path) >= MAX_PATH - 1) {
log_error("Path for %s too long", RCT2FilePaths[pathId]);
path[0] = '\0';
return path;
}
@@ -491,16 +474,14 @@ const utf8 *get_file_path(int pathId)
}
// Concatenate file path
if (strlen(path) + strlen(file_paths[pathId]) > MAX_PATH) {
log_error("Path for %s too long", file_paths[pathId]);
if (strlen(path) + strlen(RCT2FilePaths[pathId]) > MAX_PATH) {
log_error("Path for %s too long", RCT2FilePaths[pathId]);
path[0] = '\0';
return path;
}
char *pathp = path + strnlen(path, sizeof(path));
strcat(path, file_paths[pathId]);
strcat(path, RCT2FilePaths[pathId]);
while (*pathp) {
if (*pathp == '\\') *pathp = platform_get_path_separator();
pathp++;
+1 -65
View File
@@ -225,77 +225,13 @@ enum {
PATH_ID_END
};
// rct2 @ 0x0097F67C
static const char * const file_paths[] =
{
"Data\\g1.dat",
"Data\\plugin.dat",
"Data\\css1.dat",
"Data\\css2.dat",
"Data\\css4.dat",
"Data\\css5.dat",
"Data\\css6.dat",
"Data\\css7.dat",
"Data\\css8.dat",
"Data\\css9.dat",
"Data\\css11.dat",
"Data\\css12.dat",
"Data\\css13.dat",
"Data\\css14.dat",
"Data\\css15.dat",
"Data\\css3.dat",
"Data\\css17.dat",
"Data\\css18.dat",
"Data\\css19.dat",
"Data\\css20.dat",
"Data\\css21.dat",
"Data\\css22.dat",
"Saved Games\\scores.dat",
"Data\\css23.dat",
"Data\\css24.dat",
"Data\\css25.dat",
"Data\\css26.dat",
"Data\\css27.dat",
"Data\\css28.dat",
"Data\\css29.dat",
"Data\\css30.dat",
"Data\\css31.dat",
"Data\\css32.dat",
"Data\\css33.dat",
"Data\\css34.dat",
"Data\\css35.dat",
"Data\\css36.dat",
"Data\\css37.dat",
"Data\\css38.dat",
"Data\\CUSTOM1.WAV",
"Data\\CUSTOM2.WAV",
"Data\\css39.dat",
"Data\\css40.dat",
"Data\\css41.dat",
"Scenarios\\Six Flags Magic Mountain.SC6",
"Data\\css42.dat",
"Data\\css43.dat",
"Data\\css44.dat",
"Data\\css45.dat",
"Data\\css46.dat",
"Data\\css50.dat"
};
// Files to check (rct2 @ 0x0097FB5A)
static const struct file_to_check
{
int pathId; // ID of file
unsigned int fileSize; // Expected size in bytes
} files_to_check[] = {
{ PATH_ID_END, 0 }
};
extern const char * const RCT2FilePaths[PATH_ID_END];
extern uint32 gCurrentDrawCount;
int rct2_init();
void rct2_update();
void rct2_draw();
void rct2_endupdate();
void substitute_path(char *dest, const char *path, const char *filename);
int check_mutex();
int check_file_paths();
+9 -14
View File
@@ -311,15 +311,11 @@ money32 ride_calculate_income_per_hour(rct_ride *ride)
* dl ride index
* esi result map element
*/
int sub_6CAF80(int rideIndex, rct_xy_element *output)
bool ride_try_get_origin_element(int rideIndex, rct_xy_element *output)
{
rct_map_element *resultMapElement = NULL;
map_element_iterator it;
rct_map_element *resultMapElement;
int foundSpecialTrackPiece;
resultMapElement = NULL;
foundSpecialTrackPiece = 0;
map_element_iterator_begin(&it);
do {
if (map_element_get_type(it.element) != MAP_ELEMENT_TYPE_TRACK)
@@ -330,9 +326,9 @@ int sub_6CAF80(int rideIndex, rct_xy_element *output)
// Found a track piece for target ride
// Check if its not the station or ??? (but allow end piece of station)
int specialTrackPiece = (
it.element->properties.track.type != 2 &&
it.element->properties.track.type != 3 &&
bool specialTrackPiece = (
it.element->properties.track.type != TRACK_ELEM_BEGIN_STATION &&
it.element->properties.track.type != TRACK_ELEM_MIDDLE_STATION &&
(RCT2_ADDRESS(0x0099BA64, uint8)[it.element->properties.track.type * 16] & 0x10)
);
@@ -348,8 +344,7 @@ int sub_6CAF80(int rideIndex, rct_xy_element *output)
}
if (specialTrackPiece) {
foundSpecialTrackPiece = 1;
return 1;
return true;
}
} while (map_element_iterator_next(&it));
@@ -876,7 +871,7 @@ void ride_construct(int rideIndex)
rct_xy_element trackElement;
rct_window *w;
if (sub_6CAF80(rideIndex, &trackElement)) {
if (ride_try_get_origin_element(rideIndex, &trackElement)) {
ride_find_track_gap(&trackElement, &trackElement);
w = window_get_main();
@@ -4558,7 +4553,7 @@ void loc_6B51C0(int rideIndex)
z = ride->station_heights[i] * 8;
window_scroll_to_location(w, x, y, z);
sub_6CAF80(rideIndex, &trackElement);
ride_try_get_origin_element(rideIndex, &trackElement);
ride_find_track_gap(&trackElement, &trackElement);
ride_modify(&trackElement);
+1 -1
View File
@@ -928,7 +928,7 @@ money32 get_shop_item_cost(int shopItem);
money16 get_shop_base_value(int shopItem);
money16 get_shop_hot_value(int shopItem);
money16 get_shop_cold_value(int shopItem);
int sub_6CAF80(int rideIndex, rct_xy_element *output);
bool ride_try_get_origin_element(int rideIndex, rct_xy_element *output);
int ride_find_track_gap(rct_xy_element *input, rct_xy_element *output);
void ride_construct_new(ride_list_item listItem);
void ride_construct(int rideIndex);
+2 -2
View File
@@ -2677,7 +2677,7 @@ int tracked_ride_to_td6(uint8 rideIndex, rct_track_td6* track_design, uint8* tra
rct_xy_element trackElement;
track_begin_end trackBeginEnd;
if (sub_6CAF80(rideIndex, &trackElement) == 0){
if (!ride_try_get_origin_element(rideIndex, &trackElement)) {
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY;
return 0;
}
@@ -3156,7 +3156,7 @@ rct_track_design *temp_track_get_info(char* path, uint8** preview)
return NULL;
}
if (!object_load(0, &loaded_track->vehicle_object, NULL)){
if (!object_load_chunk(0, &loaded_track->vehicle_object, NULL)){
if (preview != NULL) *preview = NULL;
log_error("Failed to load track (vehicle load fail): %s", path);
return NULL;
+1 -1
View File
@@ -684,7 +684,7 @@ static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 di
RCT2_GLOBAL(0x141E9CA, uint16) = 32;
RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D0, uint16) = height + 2;
RCT2_GLOBAL(0x141E9D0, uint16) = 32;
RCT2_GLOBAL(0x141E9D2, uint16) = 32;
RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF;
height += 110;
+3 -3
View File
@@ -285,13 +285,13 @@ void scenario_begin()
rct_string_id localisedStringIds[3];
if (language_get_localised_scenario_strings(normalisedName, localisedStringIds)) {
if (localisedStringIds[0] != (rct_string_id)STR_NONE) {
if (localisedStringIds[0] != STR_NONE) {
safe_strncpy((char*)RCT2_ADDRESS_SCENARIO_NAME, language_get_string(localisedStringIds[0]), 32);
}
if (localisedStringIds[1] != (rct_string_id)STR_NONE) {
if (localisedStringIds[1] != STR_NONE) {
park_set_name(language_get_string(localisedStringIds[1]));
}
if (localisedStringIds[2] != (rct_string_id)STR_NONE) {
if (localisedStringIds[2] != STR_NONE) {
safe_strncpy((char*)RCT2_ADDRESS_SCENARIO_DETAILS, language_get_string(localisedStringIds[2]), 256);
}
} else {
+2 -2
View File
@@ -190,10 +190,10 @@ static void scenario_translate(scenario_index_entry *scenarioEntry, const rct_ob
{
rct_string_id localisedStringIds[3];
if (language_get_localised_scenario_strings(scenarioEntry->name, localisedStringIds)) {
if (localisedStringIds[0] != (rct_string_id)STR_NONE) {
if (localisedStringIds[0] != STR_NONE) {
safe_strncpy(scenarioEntry->name, language_get_string(localisedStringIds[0]), 64);
}
if (localisedStringIds[2] != (rct_string_id)STR_NONE) {
if (localisedStringIds[2] != STR_NONE) {
safe_strncpy(scenarioEntry->details, language_get_string(localisedStringIds[2]), 256);
}
} else {
+9 -5
View File
@@ -22,6 +22,7 @@
#include "../audio/audio.h"
#include "../config.h"
#include "../editor.h"
#include "../input.h"
#include "../scenario.h"
#include "../sprites.h"
#include "../localisation/localisation.h"
@@ -535,10 +536,11 @@ void window_editor_bottom_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi)
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 + w->y, 0);
int textColour = w->colours[1] & 0x7F;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, uint8) == WC_BOTTOM_TOOLBAR &&
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, uint8) == WIDX_PREVIOUS_STEP_BUTTON)
if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR &&
gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON
) {
textColour = 2;
}
short textX = (window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 30 +
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right) / 2 + w->x;
@@ -559,9 +561,11 @@ void window_editor_bottom_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi)
int textColour = w->colours[1] & 0x7F;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, uint8) == WC_BOTTOM_TOOLBAR &&
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, uint8) == WIDX_NEXT_STEP_BUTTON)
if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR &&
gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON
) {
textColour = 2;
}
short textX = (window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left +
window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 30) / 2 + w->x;
+2 -2
View File
@@ -502,7 +502,7 @@ static rct_research_item *get_research_item_at(int x, int y)
widgetIndex = window_find_widget_from_point(w, x, y);
widget = &w->widgets[widgetIndex];
if (widgetIndex == WIDX_PRE_RESEARCHED_SCROLL || widgetIndex == WIDX_RESEARCH_ORDER_SCROLL) {
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, uint32) = widgetIndex;
gPressedWidget.widget_index = widgetIndex;
widget_scroll_get_part(w, widget, x, y, &outX, &outY, &outScrollArea, &outScrollId);
if (outScrollArea == SCROLL_PART_VIEW) {
outScrollId = outScrollId == 0 ? 0 : 1;
@@ -787,7 +787,7 @@ static void window_editor_inventions_list_paint(rct_window *w, rct_drawpixelinfo
if (chunk == NULL || chunk == (void*)0xFFFFFFFF)
return;
object_paint(objectEntryType, 3, objectEntryType, x, y, 0, (int)dpi, (int)chunk);
object_paint(objectEntryType, chunk, dpi, x, y);
// Item name
x = w->x + ((widget->left + widget->right) / 2) + 1;
+42 -35
View File
@@ -38,7 +38,6 @@
#include "../util/util.h"
#include "../world/footpath.h"
enum {
FILTER_RCT2 = (1 << 0),
FILTER_WW = (1 << 1),
@@ -321,14 +320,14 @@ static int visible_list_sort_ride_type(const void *rawA, const void *rawB)
static void visible_list_refresh(rct_window *w)
{
int numObjects = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, sint32);
int numObjects = gInstalledObjectsCount;
visible_list_dispose();
_listItems = malloc(numObjects * sizeof(list_item));
_numListItems = 0;
list_item *currentListItem = &_listItems[0];
rct_object_entry *entry = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry *entry = gInstalledObjects;
uint8 *itemFlags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
for (int i = 0; i < numObjects; i++) {
rct_object_filters *filter = get_object_filter(i);
@@ -436,10 +435,10 @@ void window_editor_object_selection_open()
static void setup_track_manager_objects(){
uint8 ride_list[128] = { 0 };
uint8* selection_flags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
rct_object_entry* installedObject = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry* installedObject = gInstalledObjects;
uint16 num_objects = 0;
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i > 0; --i){
for (int i = gInstalledObjectsCount; i > 0; --i){
uint8 object_type = installedObject->flags & 0xF;
if (object_type == OBJECT_TYPE_RIDE){
*selection_flags |= OBJECT_SELECTION_FLAG_6;
@@ -503,10 +502,10 @@ static void setup_track_manager_objects(){
*/
static void setup_track_designer_objects(){
uint8* selection_flags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
rct_object_entry* installedObject = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry* installedObject = gInstalledObjects;
uint16 num_objects = 0;
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i > 0; --i){
for (int i = gInstalledObjectsCount; i > 0; --i){
uint8 object_type = installedObject->flags & 0xF;
if (object_type == OBJECT_TYPE_RIDE){
*selection_flags |= OBJECT_SELECTION_FLAG_6;
@@ -640,9 +639,9 @@ static void setup_in_use_selection_flags(){
}
uint8* selection_flags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
rct_object_entry* installedObject = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry* installedObject = gInstalledObjects;
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i > 0; --i){
for (int i = gInstalledObjectsCount; i > 0; --i){
*selection_flags &= ~OBJECT_SELECTION_FLAG_IN_USE;
uint8 entry_type, entry_index;
@@ -666,7 +665,7 @@ static void setup_in_use_selection_flags(){
* rct2: 0x006AB211
*/
static int sub_6AB211(){
uint32 total_objects = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32);
uint32 total_objects = gInstalledObjectsCount;
RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*) = rct2_malloc(total_objects);
@@ -681,9 +680,9 @@ static int sub_6AB211(){
RCT2_ADDRESS(0x00F433E1, uint16)[object_type] = 0;
}
rct_object_entry* installedObject = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry* installedObject = gInstalledObjects;
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i > 0; --i){
for (int i = gInstalledObjectsCount; i > 0; --i){
uint8 object_type = installedObject->flags & 0xF;
RCT2_ADDRESS(0x00F433E1, uint16)[object_type]++;
@@ -752,12 +751,12 @@ void remove_selected_objects_from_research(rct_object_entry* installedObject){
*/
void unload_unselected_objects(){
uint8* selection_flags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
rct_object_entry* installedObject = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry* installedObject = gInstalledObjects;
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i > 0; --i){
for (int i = gInstalledObjectsCount; i > 0; --i){
if (!(*selection_flags & OBJECT_SELECTION_FLAG_SELECTED)){
remove_selected_objects_from_research(installedObject);
object_unload(installedObject);
object_unload_chunk(installedObject);
}
selection_flags++;
installedObject = object_get_next(installedObject);
@@ -1348,7 +1347,7 @@ static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinf
widget = &w->widgets[WIDX_PREVIEW];
x = w->x + (widget->left + widget->right) / 2 + 1;
y = w->y + (widget->top + widget->bottom) / 2 + 1;
object_paint(type, 3, type, x, y, 0, (int)dpi, (int)stex_entry);
object_paint(type, stex_entry, dpi, x, y);
// Draw name of object
x = w->x + (widget->left + widget->right) / 2 + 1;
@@ -1394,9 +1393,17 @@ static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinf
gfx_draw_string_centred_clipped(dpi, stringId, NULL, 0, x, y, width);
// Draw description of object
x = w->x + w->widgets[WIDX_LIST].right + 4;
y += 15;
object_paint(type, 259, type, x, y, (int)w, (int)dpi, (int)stex_entry);
stringId = object_desc(type, stex_entry);
if (stringId != STR_NONE) {
x = w->x + w->widgets[WIDX_LIST].right + 4;
y += 15;
int width = w->x + w->width - x - 4;
if (type == OBJECT_TYPE_SCENARIO_TEXT) {
gfx_draw_string_left_wrapped(dpi, &stringId, x, y, width, 3168, 0);
} else {
gfx_draw_string_left_wrapped(dpi, &stringId, x, y + 5, width, 1191, 0);
}
}
// Draw object source
source = (highlightedEntry->flags & 0xF0) >> 4;
@@ -1577,9 +1584,9 @@ void reset_selected_object_count_and_size(){
uint32 total_object_size = 0;
uint8* selection_flags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
rct_object_entry* installedObject = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry* installedObject = gInstalledObjects;
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i > 0; --i){
for (int i = gInstalledObjectsCount; i > 0; --i){
uint8 object_type = installedObject->flags & 0xF;
if (*selection_flags & OBJECT_SELECTION_FLAG_SELECTED){
@@ -1613,9 +1620,9 @@ void reset_selected_object_count_and_size(){
*/
void set_required_object_flags(rct_object_entry* required_object){
uint8* selection_flags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
rct_object_entry* installedObject = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry* installedObject = gInstalledObjects;
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i > 0; --i){
for (int i = gInstalledObjectsCount; i > 0; --i){
if (object_entry_compare(required_object, installedObject)){
*selection_flags |= OBJECT_SELECTION_FLAG_REQUIRED;
@@ -1656,15 +1663,15 @@ void set_required_object_flags(rct_object_entry* required_object){
*/
void reset_required_object_flags(){
uint8* selection_flags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i > 0; --i){
for (int i = gInstalledObjectsCount; i > 0; --i){
*selection_flags &= ~OBJECT_SELECTION_FLAG_REQUIRED;
selection_flags++;
}
selection_flags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
rct_object_entry* installedObject = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry* installedObject = gInstalledObjects;
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i > 0; --i){
for (int i = gInstalledObjectsCount; i > 0; --i){
if (*selection_flags & OBJECT_SELECTION_FLAG_SELECTED){
uint8* pos = (uint8*)installedObject;
// Skip sizeof(rct_object_entry)
@@ -1734,10 +1741,10 @@ static int window_editor_object_selection_select_object(uint8 bh, int flags, rct
selection_flags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
// There was previously a check to make sure the object list had an item
rct_object_entry* installedObject = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry* installedObject = gInstalledObjects;
uint8 not_found = 1;
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i > 0; --i){
for (int i = gInstalledObjectsCount; i > 0; --i){
if (object_entry_compare(entry, installedObject)){
not_found = 0;
break;
@@ -1971,17 +1978,17 @@ static void window_editor_object_selection_manage_tracks()
static void editor_load_selected_objects()
{
uint8 *selection_flags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
rct_object_entry *installed_entry = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry *installed_entry = gInstalledObjects;
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32) == 0)
if (gInstalledObjectsCount == 0)
return;
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i != 0; i--, selection_flags++) {
for (int i = gInstalledObjectsCount; i != 0; i--, selection_flags++) {
if (*selection_flags & OBJECT_SELECTION_FLAG_SELECTED) {
uint8 entry_index, entry_type;
if (!find_object_in_entry_group(installed_entry, &entry_type, &entry_index)){
int chunk_size;
if (!object_load(-1, installed_entry, &chunk_size)) {
if (!object_load_chunk(-1, installed_entry, &chunk_size)) {
log_error("Failed to load entry %.8s", installed_entry->name);
}
}
@@ -2100,14 +2107,14 @@ static bool filter_chunks(rct_object_entry *entry, rct_object_filters *filter)
static void filter_update_counts()
{
if (!_FILTER_ALL || strlen(_filter_string) > 0) {
rct_object_entry *installed_entry = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
rct_object_entry *installed_entry = gInstalledObjects;
rct_object_filters *filter;
uint8 type;
for (int i = 0; i < 11; i++) {
_filter_object_counts[i] = 0;
}
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i > 0; --i) {
filter = get_object_filter(RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32) - i);
for (int i = gInstalledObjectsCount; i > 0; --i) {
filter = get_object_filter(gInstalledObjectsCount - i);
type = installed_entry->flags & 0xF;
if (filter_source(installed_entry) && filter_string(installed_entry, filter) && filter_chunks(installed_entry, filter)) {
_filter_object_counts[type]++;
+2 -2
View File
@@ -91,13 +91,13 @@ void window_error_open(rct_string_id title, rct_string_id message)
// Format the title
dst = utf8_write_codepoint(dst, FORMAT_BLACK);
if (title != (rct_string_id)STR_NONE) {
if (title != STR_NONE) {
format_string(dst, title, args);
dst = get_string_end(dst);
}
// Format the message
if (message != (rct_string_id)STR_NONE) {
if (message != STR_NONE) {
dst = utf8_write_codepoint(dst, FORMAT_NEWLINE);
format_string(dst, message, args);
dst = get_string_end(dst);
+3 -3
View File
@@ -385,7 +385,7 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, r
dpi,
(RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) < 0 ? 1391 : 1390),
x, y - 3,
(RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass) == 2 && RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, sint32) == WIDX_MONEY ? 2 : w->colours[0] & 0x7F),
(gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_MONEY ? COLOUR_WHITE : w->colours[0] & 0x7F),
(void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS
);
y += 7;
@@ -396,7 +396,7 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, r
dpi,
STR_NUM_GUESTS + RCT2_GLOBAL(RCT2_ADDRESS_GUEST_CHANGE_MODIFIER, uint8),
x, y,
(RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass) == 2 && RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, sint32) == WIDX_GUESTS ? 2 : w->colours[0] & 0x7F),
(gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_GUESTS ? COLOUR_WHITE : w->colours[0] & 0x7F),
(void*)RCT2_ADDRESS_GUESTS_IN_PARK
);
@@ -463,7 +463,7 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi,
stringId,
x,
y,
(RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass) == 2 && RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, sint32) == WIDX_DATE ? 2 : w->colours[0] & 0x7F),
(gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_DATE ? COLOUR_WHITE : w->colours[0] & 0x7F),
(void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS
);
+5 -12
View File
@@ -154,7 +154,7 @@ rct_window *window_loadsave_open(int type, char *defaultName)
int includeNewItem;
rct_window* w;
_type = type;
_defaultName[0] = 0;
_defaultName[0] = '\0';
if (!str_is_null_or_empty(defaultName)) {
safe_strncpy(_defaultName, defaultName, sizeof(_defaultName));
@@ -704,8 +704,7 @@ static void window_loadsave_select(rct_window *w, const char *path)
window_close(w);
}
window_loadsave_invoke_callback(MODAL_RESULT_OK);
}
else if (game_load_save(path)) {
} else if (game_load_save(path)) {
if (_loadsaveType & LOADSAVETYPE_NETWORK) {
network_begin_server(gConfigNetwork.default_port);
}
@@ -716,9 +715,7 @@ static void window_loadsave_select(rct_window *w, const char *path)
window_close(w);
gfx_invalidate_screen();
window_loadsave_invoke_callback(MODAL_RESULT_OK);
rct2_endupdate();
}
else {
} else {
// 1050, not the best message...
window_error_open(STR_LOAD_GAME, 1050);
window_loadsave_invoke_callback(MODAL_RESULT_FAIL);
@@ -730,7 +727,6 @@ static void window_loadsave_select(rct_window *w, const char *path)
int success = scenario_save(rw, gConfigGeneral.save_plugin_data ? 1 : 0);
SDL_RWclose(rw);
if (success) {
safe_strncpy(gScenarioSavePath, path, MAX_PATH);
gFirstTimeSave = 0;
@@ -749,13 +745,10 @@ static void window_loadsave_select(rct_window *w, const char *path)
}
break;
case (LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE) :
editor_load_landscape(path);
if (1) {
if (editor_load_landscape(path)) {
gfx_invalidate_screen();
window_loadsave_invoke_callback(MODAL_RESULT_OK);
rct2_endupdate();
}
else {
} else {
// 1050, not the best message...
window_error_open(STR_LOAD_LANDSCAPE, 1050);
window_loadsave_invoke_callback(MODAL_RESULT_FAIL);
+2 -2
View File
@@ -95,7 +95,7 @@ void window_map_tooltip_update_visibility()
if (
_cursorHoldDuration < 25 ||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS, sint16) == -1 ||
(RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & 3) ||
(gInputPlaceObjectModifier & 3) ||
window_find_by_class(WC_ERROR) != NULL
) {
window_close_by_class(WC_MAP_TOOLTIP);
@@ -148,7 +148,7 @@ static void window_map_tooltip_update(rct_window *w)
*/
static void window_map_tooltip_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS, rct_string_id) == (rct_string_id)STR_NONE)
if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS, rct_string_id) == STR_NONE)
return;
gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_MAP_TOOLTIP_ARGS, w->x + (w->width / 2), w->y + (w->height / 2), w->width, 1162, 0);
+1 -1
View File
@@ -1390,7 +1390,7 @@ static void window_options_invalidate(rct_window *w)
w->disabled_widgets |= (1ULL << WIDX_REAL_NAME_CHECKBOX);
// save plugin data checkbox: visible or not
if (RCT2_GLOBAL(RCT2_ADDRESS_CUSTOM_OBJECTS_INSTALLED, uint8) == 1)
if (gNumInstalledCustomObjects == 0)
window_options_misc_widgets[WIDX_SAVE_PLUGIN_DATA_CHECKBOX].type = WWT_EMPTY;
else
window_options_misc_widgets[WIDX_SAVE_PLUGIN_DATA_CHECKBOX].type = WWT_CHECKBOX;
+12 -12
View File
@@ -566,8 +566,6 @@ rct_window *window_ride_construction_open()
*/
static void window_ride_construction_close(rct_window *w)
{
rct_xy_element mapElement;
sub_6C9627();
viewport_set_visibility(0);
@@ -584,8 +582,7 @@ static void window_ride_construction_close(rct_window *w)
hide_gridlines();
uint8 rideIndex = _currentRideIndex;
if (sub_6CAF80(rideIndex, &mapElement) || network_get_mode() == NETWORK_MODE_CLIENT) {
if (ride_try_get_origin_element(rideIndex, NULL)) {
rct_ride *ride = GET_RIDE(rideIndex);
if (ride->mode == RIDE_MODE_SHOP_STALL && gConfigGeneral.auto_open_shops) {
ride->status = RIDE_STATUS_OPEN;
@@ -1799,7 +1796,7 @@ void window_ride_construction_mouseup_demolish_next_piece(int x, int y, int z, i
b4 = _currentTrackLiftHill;
ride_construction_set_default_next_piece();
sub_6C84CE();
if (!sub_6CAF80(_currentRideIndex, NULL)) {
if (!ride_try_get_origin_element(_currentRideIndex, NULL)) {
sub_6CC3FB(_currentRideIndex);
_currentTrackPieceDirection = direction;
if (!(slope & 0x100)) {
@@ -1866,7 +1863,7 @@ static void window_ride_construction_rotate(rct_window *w)
static void window_ride_construction_entrance_click(rct_window *w)
{
if (tool_set(w, WIDX_ENTRANCE, 12)) {
if (!sub_6CAF80(_currentRideIndex, NULL)) {
if (!ride_try_get_origin_element(_currentRideIndex, NULL)) {
sub_6CC3FB(_currentRideIndex);
}
} else {
@@ -1890,7 +1887,7 @@ static void window_ride_construction_entrance_click(rct_window *w)
static void window_ride_construction_exit_click(rct_window *w)
{
if (tool_set(w, WIDX_EXIT, 12)) {
if (!sub_6CAF80(_currentRideIndex, NULL)) {
if (!ride_try_get_origin_element(_currentRideIndex, NULL)) {
sub_6CC3FB(_currentRideIndex);
}
} else {
@@ -1964,7 +1961,7 @@ static bool ride_get_place_position_from_screen_position(int screenX, int screen
rct_viewport *viewport;
if (!_trackPlaceCtrlState) {
if (RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & 2) {
if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_SHIFT_Z) {
get_map_coordinates_from_pos(screenX, screenY, 0xFCCA, &mapX, &mapY, &interactionType, &mapElement, &viewport);
if (interactionType != 0) {
_trackPlaceCtrlZ = mapElement->base_height * 8;
@@ -1972,20 +1969,20 @@ static bool ride_get_place_position_from_screen_position(int screenX, int screen
}
}
} else {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & 2)) {
if (!(gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_SHIFT_Z)) {
_trackPlaceCtrlState = false;
}
}
if (!_trackPlaceShiftState) {
if (RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & 1) {
if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_SHIFT_Z) {
_trackPlaceShiftState = true;
_trackPlaceShiftStartScreenX = screenX;
_trackPlaceShiftStartScreenY = screenY;
_trackPlaceShiftZ = 0;
}
} else {
if (RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & 1) {
if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_SHIFT_Z) {
_trackPlaceShiftZ = floor2(_trackPlaceShiftStartScreenY - screenY + 4, 8);
screenX = _trackPlaceShiftStartScreenX;
screenY = _trackPlaceShiftStartScreenY;
@@ -3648,7 +3645,10 @@ void ride_construction_tooldown_construct(int screenX, int screenY)
w = window_find_by_class(WC_RIDE_CONSTRUCTION);
if (w != NULL) {
if (ride_are_all_possible_entrances_and_exits_built(ride)) {
window_close(w);
// Clients don't necessarily have any ride built at this point
if (network_get_mode() == NETWORK_MODE_NONE) {
window_close(w);
}
} else {
window_event_mouse_up_call(w, WIDX_ENTRANCE);
}
+1 -1
View File
@@ -111,7 +111,7 @@ void window_text_input_open(rct_window* call_w, int call_widget, rct_string_id t
// Enter in the the text input buffer any existing
// text.
if (existing_text != (rct_string_id)STR_NONE)
if (existing_text != STR_NONE)
format_string(text_input, existing_text, &existing_args);
// In order to prevent strings that exceed the maxLength
+5 -2
View File
@@ -28,6 +28,7 @@
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../interface/themes.h"
#include "../title.h"
#include "../util/util.h"
#define INITIAL_NUM_UNLOCKED_SCENARIOS 5
@@ -274,7 +275,9 @@ static void window_scenarioselect_scrollmousedown(rct_window *w, int scrollIndex
y -= 24;
if (y < 0 && !listItem->scenario.is_locked) {
audio_play_sound_panned(SOUND_CLICK_1, w->width / 2 + w->x, 0, 0, 0);
scenario_load_and_play_from_path(listItem->scenario.scenario->path);
if (!scenario_load_and_play_from_path(listItem->scenario.scenario->path)) {
title_load();
}
}
break;
}
@@ -556,7 +559,7 @@ static void initialise_list_items(rct_window *w)
}
}
}
if (headingStringId != (rct_string_id)STR_NONE) {
if (headingStringId != STR_NONE) {
// Ensure list capacity
if (length == capacity) {
capacity += 32;
+1 -1
View File
@@ -158,7 +158,7 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y
gTooltipWidget.window_number = widgetWindow->number;
gTooltipWidget.widget_index = widgetIndex;
if (window_event_tooltip_call(widgetWindow, widgetIndex) == (rct_string_id)STR_NONE)
if (window_event_tooltip_call(widgetWindow, widgetIndex) == STR_NONE)
return;
window_tooltip_show(widget->tooltip, x, y);
+19 -28
View File
@@ -1008,11 +1008,10 @@ void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sin
if (type == 0 && !gCheatsDisableSupportLimits) {
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) = 0;
}
else{
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) == 0){
// CTRL pressed
if (RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & (1 << 1)){
} else {
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) == 0) {
if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_COPY_Z) {
// CTRL pressed
rct_map_element* map_element;
uint16 flags =
VIEWPORT_INTERACTION_MASK_TERRAIN &
@@ -1029,17 +1028,16 @@ void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sin
RCT2_GLOBAL(RCT2_ADDRESS_CTRL_PRESS_Z_COORDINATE, uint16) = map_element->base_height * 8;
}
}
}
else{
// CTRL not pressed
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & (1 << 1))){
} else {
if (!(gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_COPY_Z)) {
// CTRL not pressed
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED, uint8) = 0;
}
}
if (RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) == 0){
// SHIFT pressed
if (RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & (1 << 0)){
if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_SHIFT_Z) {
// SHIFT pressed
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) = 1;
RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_X_COORDINATE, uint16) = x;
RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Y_COORDINATE, uint16) = y;
@@ -1047,15 +1045,14 @@ void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sin
}
}
else{
// SHIFT pressed
if (RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & (1 << 0)){
if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_SHIFT_Z) {
// SHIFT pressed
RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Z_VECTOR, sint16) =
(RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Y_COORDINATE, sint16) - y + 4) & 0xFFF8;
x = RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_X_COORDINATE, sint16);
y = RCT2_GLOBAL(RCT2_ADDRESS_SHIFT_PRESS_Y_COORDINATE, sint16);
}
else{
} else {
// SHIFT not pressed
RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED, uint8) = 0;
}
@@ -2641,27 +2638,21 @@ void window_top_toolbar_land_tool_drag(short x, short y)
sint16 tile_height = -16 / (1 << viewport->zoom);
int y_diff = y - RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16);
int y_diff = y - gInputDragLastY;
if (y_diff <= tile_height) {
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16) += tile_height;
gInputDragLastY += tile_height;
selection_raise_land(GAME_COMMAND_FLAG_APPLY);
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, uint32) = MONEY32_UNDEFINED;
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, uint32) = MONEY32_UNDEFINED;
return;
}
if (y_diff >= -tile_height) {
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16) -= tile_height;
} else if (y_diff >= -tile_height) {
gInputDragLastY -= tile_height;
selection_lower_land(GAME_COMMAND_FLAG_APPLY);
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, uint32) = MONEY32_UNDEFINED;
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, uint32) = MONEY32_UNDEFINED;
return;
}
}
@@ -2687,10 +2678,10 @@ void window_top_toolbar_water_tool_drag(short x, short y)
sint16 dx = 0xFFF0;
dx >>= viewport->zoom;
y -= RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16);
y -= gInputDragLastY;
if (y <= dx) {
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16) += dx;
gInputDragLastY += dx;
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_RAISE_WATER_LEVEL_HERE;
@@ -2712,7 +2703,7 @@ void window_top_toolbar_water_tool_drag(short x, short y)
dx = -dx;
if (y >= dx) {
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, uint16) += dx;
gInputDragLastY += dx;
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_LOWER_WATER_LEVEL_HERE;