code stringlengths 3 1.05M | repo_name stringlengths 4 116 | path stringlengths 4 991 | language stringclasses 9 values | license stringclasses 15 values | size int32 3 1.05M |
|---|---|---|---|---|---|
using System;
using System.Runtime.InteropServices;
namespace ABC.PInvoke
{
/// <summary>
/// Class through which user32.dll calls can be accessed for which the .NET framework offers no alternative.
/// TODO: Clean up remaining original documentation, converting it to the wrapper's equivalents.
/// </summary>
public static partial class User32
{
const string Dll = "user32.dll";
#region Window Functions.
/// <summary>
/// Calls the default window procedure to provide default processing for any window messages that an application does not process. This function ensures that every message is processed. DefWindowProc is called with the same parameters received by the window procedure.
/// </summary>
/// <param name="handle">A handle to the window procedure that received the message.</param>
/// <param name="message">The message.</param>
/// <param name="wParam">Additional message information. The content of this parameter depends on the value of the Msg parameter.</param>
/// <param name="lParam">Additional message information. The content of this parameter depends on the value of the Msg parameter</param>
/// <returns>The return value is the result of the message processing and depends on the message.</returns>
[DllImport( Dll )]
public static extern IntPtr DefWindowProc( IntPtr handle, uint message, IntPtr wParam, IntPtr lParam );
/// <summary>
/// Registers a specified Shell window to receive certain messages for events or notifications that are useful to Shell applications.
/// </summary>
/// <param name="hwnd">A handle to the window to register for Shell hook messages.</param>
/// <returns>TRUE if the function succeeds; otherwise, FALSE.</returns>
[DllImport( Dll, CharSet = CharSet.Auto, SetLastError = true )]
public static extern bool RegisterShellHookWindow( IntPtr hwnd );
/// <summary>
/// Changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified offset into the extra window memory. Note: this function has been superseded by the SetWindowLongPtr function. To write code that is compatible with both 32-bit and 64-bit versions of Windows, use the SetWindowLongPtr function.
/// </summary>
/// <param name="windowHandle">A handle to the window and, indirectly, the class to which the window belongs.</param>
/// <param name="index">The zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer. To set any other value, specify one of the following values.</param>
/// <param name="dwNewLong">The replacement value.</param>
/// <returns>If the function succeeds, the return value is the previous value of the specified 32-bit integer. If the function fails, the return value is zero. To get extended error information, call GetLastError.</returns>
public static IntPtr SetWindowLongPtr( IntPtr windowHandle, int index, uint dwNewLong )
{
// GetWindowLongPtr is only supported by Win64. By checking the pointer size the correct function can be called.
return IntPtr.Size == 8
? SetWindowLongPtr64( windowHandle, index, dwNewLong )
: SetWindowLongPtr32( windowHandle, index, dwNewLong );
}
[DllImport( Dll, EntryPoint = "SetWindowLong", SetLastError = true )]
static extern IntPtr SetWindowLongPtr32( IntPtr windowHandle, int index, uint dwNewLong );
[DllImport( Dll, EntryPoint = "SetWindowLongPtr", SetLastError = true )]
static extern IntPtr SetWindowLongPtr64( IntPtr windowHandle, int index, uint dwNewLong );
#endregion // Window Functions.
}
} | Whathecode/ABC | ABC/ABC.PInvoke/User32.cs | C# | gpl-3.0 | 3,655 |
#!/usr/bin/python
from django.http import HttpResponse
from django.template import RequestContext, loader
from django.views.decorators.csrf import csrf_exempt
import django.shortcuts
from wlokalu.api import presence
#-----------------------------------------------------------------------------
from wlokalu.logging import getLogger, message as log
logger = getLogger(__name__)
#-----------------------------------------------------------------------------
@csrf_exempt
def list(request, nick = None):
template = loader.get_template("list.html")
from django.core.urlresolvers import reverse
from forms import PresenceForm
form = PresenceForm()
if nick is not None:
form.initial['nick'] = nick
form_target = reverse(list, kwargs = {'nick': nick})
else:
form_target = reverse(list)
if request.POST.get('nick', '') != '':
context = {
'address': request.META['REMOTE_ADDR'],
'uri': request.META['REQUEST_URI'],
}
if 'enter' in request.POST:
presence.person_entered(request.POST['nick'], context)
else: # 'leave' in request.POST
presence.person_left(request.POST['nick'], context)
# tell the browser to reload the page, but with GET request
return django.shortcuts.redirect(request.path)
context = RequestContext(request, {
'form_target': form_target,
'form': form,
'present': presence.list_people(),
'sensors': presence.list_simple_sensors(),
'complex_sensors': presence.list_complex_sensors(),
})
return HttpResponse(template.render(context))
#-----------------------------------------------------------------------------
# vim:ft=python:foldmethod=marker
| HackerspaceWroclaw/wlokalu | wlokalu/views.py | Python | gpl-3.0 | 1,663 |
using System;
using System.Runtime.InteropServices;
using System.Security;
namespace xServer.Core.Build
{
public static class IconInjector
{
// Basically, you can change icons with the UpdateResource api call.
// When you make the call you say "I'm updating an icon", and you send the icon data.
// The main problem is that ICO files store the icons in one set of structures, and exe/dll files store them in
// another set of structures. So you have to translate between the two -- you can't just load the ICO file as
// bytes and send them with the UpdateResource api call.
[SuppressUnmanagedCodeSecurity()]
private class NativeMethods
{
[DllImport("kernel32")]
public static extern IntPtr BeginUpdateResource(string fileName, [MarshalAs(UnmanagedType.Bool)]bool deleteExistingResources);
[DllImport("kernel32")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool UpdateResource(IntPtr hUpdate, IntPtr type, IntPtr name, short language, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)]byte[] data, int dataSize);
[DllImport("kernel32")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EndUpdateResource(IntPtr hUpdate, [MarshalAs(UnmanagedType.Bool)]bool discard);
}
// The first structure in an ICO file lets us know how many images are in the file.
[StructLayout(LayoutKind.Sequential)]
private struct ICONDIR
{
// Reserved, must be 0
public ushort Reserved;
// Resource type, 1 for icons.
public ushort Type;
// How many images.
public ushort Count;
// The native structure has an array of ICONDIRENTRYs as a final field.
}
// Each ICONDIRENTRY describes one icon stored in the ico file. The offset says where the icon image data
// starts in the file. The other fields give the information required to turn that image data into a valid
// bitmap.
[StructLayout(LayoutKind.Sequential)]
private struct ICONDIRENTRY
{
// Width, in pixels, of the image
public byte Width;
// Height, in pixels, of the image
public byte Height;
// Number of colors in image (0 if >=8bpp)
public byte ColorCount;
// Reserved ( must be 0)
public byte Reserved;
// Color Planes
public ushort Planes;
// Bits per pixel
public ushort BitCount;
// Length in bytes of the pixel data
public int BytesInRes;
// Offset in the file where the pixel data starts.
public int ImageOffset;
}
// Each image is stored in the file as an ICONIMAGE structure:
//typdef struct
//{
// BITMAPINFOHEADER icHeader; // DIB header
// RGBQUAD icColors[1]; // Color table
// BYTE icXOR[1]; // DIB bits for XOR mask
// BYTE icAND[1]; // DIB bits for AND mask
//} ICONIMAGE, *LPICONIMAGE;
[StructLayout(LayoutKind.Sequential)]
private struct BITMAPINFOHEADER
{
public uint Size;
public int Width;
public int Height;
public ushort Planes;
public ushort BitCount;
public uint Compression;
public uint SizeImage;
public int XPelsPerMeter;
public int YPelsPerMeter;
public uint ClrUsed;
public uint ClrImportant;
}
// The icon in an exe/dll file is stored in a very similar structure:
[StructLayout(LayoutKind.Sequential, Pack = 2)]
private struct GRPICONDIRENTRY
{
public byte Width;
public byte Height;
public byte ColorCount;
public byte Reserved;
public ushort Planes;
public ushort BitCount;
public int BytesInRes;
public ushort ID;
}
public static void InjectIcon(string exeFileName, string iconFileName)
{
InjectIcon(exeFileName, iconFileName, 1, 1);
}
public static void InjectIcon(string exeFileName, string iconFileName, uint iconGroupID, uint iconBaseID)
{
const uint RT_ICON = 3u;
const uint RT_GROUP_ICON = 14u;
IconFile iconFile = IconFile.FromFile(iconFileName);
var hUpdate = NativeMethods.BeginUpdateResource(exeFileName, false);
var data = iconFile.CreateIconGroupData(iconBaseID);
NativeMethods.UpdateResource(hUpdate, new IntPtr(RT_GROUP_ICON), new IntPtr(iconGroupID), 0, data, data.Length);
for (int i = 0; i <= iconFile.ImageCount - 1; i++)
{
var image = iconFile.ImageData(i);
NativeMethods.UpdateResource(hUpdate, new IntPtr(RT_ICON), new IntPtr(iconBaseID + i), 0, image, image.Length);
}
NativeMethods.EndUpdateResource(hUpdate, false);
}
private class IconFile
{
private ICONDIR iconDir = new ICONDIR();
private ICONDIRENTRY[] iconEntry;
private byte[][] iconImage;
public int ImageCount
{
get { return iconDir.Count; }
}
public byte[] ImageData (int index)
{
return iconImage[index];
}
public static IconFile FromFile(string filename)
{
IconFile instance = new IconFile();
// Read all the bytes from the file.
byte[] fileBytes = System.IO.File.ReadAllBytes(filename);
// First struct is an ICONDIR
// Pin the bytes from the file in memory so that we can read them.
// If we didn't pin them then they could move around (e.g. when the
// garbage collector compacts the heap)
GCHandle pinnedBytes = GCHandle.Alloc(fileBytes, GCHandleType.Pinned);
// Read the ICONDIR
instance.iconDir = (ICONDIR)Marshal.PtrToStructure(pinnedBytes.AddrOfPinnedObject(), typeof(ICONDIR));
// which tells us how many images are in the ico file. For each image, there's a ICONDIRENTRY, and associated pixel data.
instance.iconEntry = new ICONDIRENTRY[instance.iconDir.Count];
instance.iconImage = new byte[instance.iconDir.Count][];
// The first ICONDIRENTRY will be immediately after the ICONDIR, so the offset to it is the size of ICONDIR
int offset = Marshal.SizeOf(instance.iconDir);
// After reading an ICONDIRENTRY we step forward by the size of an ICONDIRENTRY
var iconDirEntryType = typeof(ICONDIRENTRY);
var size = Marshal.SizeOf(iconDirEntryType);
for (int i = 0; i <= instance.iconDir.Count - 1; i++)
{
// Grab the structure.
var entry = (ICONDIRENTRY)Marshal.PtrToStructure(new IntPtr(pinnedBytes.AddrOfPinnedObject().ToInt64() + offset), iconDirEntryType);
instance.iconEntry[i] = entry;
// Grab the associated pixel data.
instance.iconImage[i] = new byte[entry.BytesInRes];
Buffer.BlockCopy(fileBytes, entry.ImageOffset, instance.iconImage[i], 0, entry.BytesInRes);
offset += size;
}
pinnedBytes.Free();
return instance;
}
public byte[] CreateIconGroupData(uint iconBaseID)
{
// This will store the memory version of the icon.
int sizeOfIconGroupData = Marshal.SizeOf(typeof(ICONDIR)) + Marshal.SizeOf(typeof(GRPICONDIRENTRY)) * ImageCount;
byte[] data = new byte[sizeOfIconGroupData];
var pinnedData = GCHandle.Alloc(data, GCHandleType.Pinned);
Marshal.StructureToPtr(iconDir, pinnedData.AddrOfPinnedObject(), false);
var offset = Marshal.SizeOf(iconDir);
for (int i = 0; i <= ImageCount - 1; i++)
{
GRPICONDIRENTRY grpEntry = new GRPICONDIRENTRY();
BITMAPINFOHEADER bitmapheader = new BITMAPINFOHEADER();
var pinnedBitmapInfoHeader = GCHandle.Alloc(bitmapheader, GCHandleType.Pinned);
Marshal.Copy(ImageData(i), 0, pinnedBitmapInfoHeader.AddrOfPinnedObject(), Marshal.SizeOf(typeof(BITMAPINFOHEADER)));
pinnedBitmapInfoHeader.Free();
grpEntry.Width = iconEntry[i].Width;
grpEntry.Height = iconEntry[i].Height;
grpEntry.ColorCount = iconEntry[i].ColorCount;
grpEntry.Reserved = iconEntry[i].Reserved;
grpEntry.Planes = bitmapheader.Planes;
grpEntry.BitCount = bitmapheader.BitCount;
grpEntry.BytesInRes = iconEntry[i].BytesInRes;
grpEntry.ID = Convert.ToUInt16(iconBaseID + i);
Marshal.StructureToPtr(grpEntry, new IntPtr(pinnedData.AddrOfPinnedObject().ToInt64() + offset), false);
offset += Marshal.SizeOf(typeof(GRPICONDIRENTRY));
}
pinnedData.Free();
return data;
}
}
}
}
| 1ookup/xRAT | Server/Core/Build/IconInjector.cs | C# | gpl-3.0 | 9,721 |
/**
* Copyright (C) 2007-2012 Hypertable, Inc.
*
* This file is part of Hypertable.
*
* Hypertable is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or any later version.
*
* Hypertable is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
package org.hypertable.examples.PerformanceTest;
import java.nio.ByteBuffer;
import org.hypertable.AsyncComm.Serialization;
public class Result {
public int encodedLength() {
return 48;
}
public void encode(ByteBuffer buf) {
buf.putLong(itemsSubmitted);
buf.putLong(itemsReturned);
buf.putLong(requestCount);
buf.putLong(valueBytesReturned);
buf.putLong(elapsedMillis);
buf.putLong(cumulativeLatency);
}
public void decode(ByteBuffer buf) {
itemsSubmitted = buf.getLong();
itemsReturned = buf.getLong();
requestCount = buf.getLong();
valueBytesReturned = buf.getLong();
elapsedMillis = buf.getLong();
cumulativeLatency = buf.getLong();
}
public String toString() {
return new String("(items-submitted=" + itemsSubmitted + ", items-returned=" + itemsReturned +
"requestCount=" + requestCount + "value-bytes-returned=" + valueBytesReturned +
", elapsed-millis=" + elapsedMillis + ", cumulativeLatency=" + cumulativeLatency + ")");
}
public long itemsSubmitted = 0;
public long itemsReturned = 0;
public long requestCount = 0;
public long valueBytesReturned = 0;
public long elapsedMillis = 0;
public long cumulativeLatency = 0;
}
| deniskin82/hypertable | examples/java/org/hypertable/examples/PerformanceTest/Result.java | Java | gpl-3.0 | 2,057 |
<?php
/**
* @package Projectlog.Administrator
* @subpackage com_projectlog
*
* @copyright Copyright (C) 2009 - 2016 The Thinkery, LLC. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined( '_JEXEC' ) or die( 'Restricted access');
jimport('joomla.application.component.controller');
jimport('joomla.log.log');
class ProjectlogControllerAjax extends JControllerLegacy
{
/**
* Get json encoded list of DB values
*
* @param string $field DB field to filter *
* @param string $token Joomla token
*
* @return json_encoded list of values
*/
public function autoComplete()
{
// Check for request forgeries
JSession::checkToken('get') or die( 'Invalid Token');
$field = JRequest::getString('field');
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('DISTINCT '.$db->quoteName($field))
->from('#__projectlog_projects')
->groupby($db->quoteName($field));
$db->setQuery($query);
$data = $db->loadColumn();
echo new JResponseJson($data);
}
/**
* Add a new log via the project logs tab
*
* @return JResponseJson result of ajax request
*/
public function addLog()
{
// Check for request forgeries
JSession::checkToken('get') or die( 'Invalid Token');
$app = JFactory::getApplication();
$data = JRequest::get('post');
$user = JFactory::getUser();
$clientmodel = (JFactory::getApplication()->getName() == 'site') ? 'Logform' : 'Log';
$model = $this->getModel($clientmodel);
$currdate = JFactory::getDate()->toSql();
$gravatar = projectlogHtml::getGravatar($user->get('email'));
$data['associations'] = array();
$data['published'] = 1;
$data['created_by'] = $user->get('id');
$data['language'] = JFactory::getLanguage()->getTag();
if(!$data['language']) $data['language'] = '*';
try
{
$result = false;
if($model->save($data)){
$new_log =
'<div class="plitem-cnt">
'.$gravatar["image"].'
<div class="theplitem">
<h5>'.$data['title'].'</h5>
<br/>
<p>'.$data['description'].'</p>
<p data-utime="1371248446" class="small plitem-dt">
'.$user->get('name').' - '.JHtml::date($currdate, JText::_('DATE_FORMAT_LC2')).'
</p>
</div>
</div>';
//$app->enqueueMessage(JText::_('COM_PROJECTLOG_SUCCESS'));
echo new JResponseJson($new_log);
return;
}
echo new JResponseJson($result, $model->getError());
return;
}
catch(Exception $e)
{
echo new JResponseJson($e);
}
}
/**
* Delete a log via the project logs tab
*
* @return JResponseJson result of ajax request
*/
public function deleteLog()
{
// Check for request forgeries
JSession::checkToken('get') or die( 'Invalid Token');
$data = JRequest::get('post');
$log_id = (int)$data['log_id'];
$clientmodel = (JFactory::getApplication()->getName() == 'site') ? 'Logform' : 'Log';
$model = $this->getModel($clientmodel);
try{
$result = false;
if($model->delete($log_id)){
echo new JResponseJson($log_id);
}
else
{
echo new JResponseJson($result, $model->getError());
}
}
catch(Exception $e)
{
echo new JResponseJson($e);
}
}
/**
* Delete a document via the project docs tab
*
* @return JResponseJson result of ajax request
*/
public function deleteDoc()
{
// Check for request forgeries
JSession::checkToken('get') or die( 'Invalid Token');
$data = JRequest::get('post');
$doc_id = (int)$data['doc_id'];
$clientmodel = (JFactory::getApplication()->getName() == 'site') ? 'Docform' : 'Doc';
$model = $this->getModel($clientmodel);
try{
$result = false;
if($model->delete($doc_id)){
echo new JResponseJson($doc_id);
}
else
{
echo new JResponseJson($result, $model->getError());
}
}
catch(Exception $e)
{
echo new JResponseJson($e);
}
}
}
?>
| thinkerytim/ProjectLog | admin/controllers/ajax.json.php | PHP | gpl-3.0 | 5,016 |
$('.attach_detach').on('click', function(){
var device_id = $(this).attr('device_id');
$('#device_id').val(device_id);
});
$('.detach_customer').on('click', function(){
//get the attached customer name
var customer_name = $(this).attr('cust_name');
if(confirm('Are you sure you want to detach('+customer_name+') from the device?')){
return true;
}else{
return false;
}
}); | toxicaliens/rental | src/js/allocate_devices.js | JavaScript | gpl-3.0 | 399 |
#region License, Terms and Conditions
//
// Jayrock - A JSON-RPC implementation for the Microsoft .NET Framework
// Written by Atif Aziz (www.raboof.com)
// Copyright (c) Atif Aziz. All rights reserved.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation; either version 3 of the License, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
#endregion
namespace Jayrock
{
#region Imports
using System;
using System.Reflection;
using Jayrock.Tests;
using NUnit.Framework;
#endregion
[ TestFixture ]
public class TestTypeResolution : TestUtilityBase
{
private TypeResolutionHandler _initialCurrent;
[ SetUp ]
public void Init()
{
_initialCurrent = TypeResolution.Current;
}
[ TearDown ]
public void Dispose()
{
TypeResolution.Current = _initialCurrent;
}
[ Test ]
public void Default()
{
Assert.IsNotNull(TypeResolution.Default);
}
[ Test ]
public void Current()
{
Assert.IsNotNull(TypeResolution.Current);
Assert.AreSame(TypeResolution.Default, TypeResolution.Current);
}
[ Test, ExpectedException(typeof(ArgumentNullException)) ]
public void CannotSetCurrentToNull()
{
TypeResolution.Current = null;
}
[ Test ]
public void SetCurrent()
{
TypeResolutionHandler handler = new TypeResolutionHandler(DummyGetType);
TypeResolution.Current = handler;
Assert.AreSame(handler, TypeResolution.Current);
}
[ Test ]
public void FindTypeResolution()
{
TestTypeResolver resolver = new TestTypeResolver(typeof(object));
TypeResolution.Current = new TypeResolutionHandler(resolver.Resolve);
Assert.AreSame(typeof(object), TypeResolution.FindType("obj"));
Assert.AreEqual("obj", resolver.LastTypeName, "typeName");
Assert.AreEqual(false, resolver.LastThrowOnError, "throwOnError");
Assert.AreEqual(false, resolver.LastIgnoreCase, "ignoreCase");
}
[ Test ]
public void GetTypeResolution()
{
TestTypeResolver resolver = new TestTypeResolver(typeof(object));
TypeResolution.Current = new TypeResolutionHandler(resolver.Resolve);
Assert.AreSame(typeof(object), TypeResolution.GetType("obj"));
Assert.AreEqual("obj", resolver.LastTypeName, "typeName");
Assert.AreEqual(true, resolver.LastThrowOnError, "throwOnError");
Assert.AreEqual(false, resolver.LastIgnoreCase, "ignoreCase");
}
private static Type DummyGetType(string typeName, bool throwOnError, bool ignoreCase)
{
throw new NotImplementedException();
}
private sealed class TestTypeResolver
{
public string LastTypeName;
public bool LastThrowOnError;
public bool LastIgnoreCase;
public Type NextResult;
public TestTypeResolver(Type nextResult)
{
NextResult = nextResult;
}
public Type Resolve(string typeName, bool throwOnError, bool ignoreCase)
{
LastTypeName = typeName;
LastThrowOnError = throwOnError;
LastIgnoreCase = ignoreCase;
return NextResult;
}
}
}
} | atifaziz/Jayrock | tests/Jayrock/TestTypeResolution.cs | C# | gpl-3.0 | 4,130 |
MODX Evolution 1.1 = 07452b3a1b6754a6861e6c36f1cd3e62
| gohdan/DFC | known_files/hashes/assets/plugins/managermanager/widgets/ddfillmenuindex/ddfillmenuindex.php | PHP | gpl-3.0 | 54 |
Bitrix 16.5 Business Demo = b10b46488015710ddcf5f4d0217eea77
| gohdan/DFC | known_files/hashes/bitrix/modules/main/interface/settings_admin_list.php | PHP | gpl-3.0 | 61 |
<?php
/*
This file is part of Vosbox.
Vosbox is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Vosbox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Vosbox. If not, see <http://www.gnu.org/licenses/>.
Vosbox copyright Callan Bryant 2011-2012 <callan.bryant@gmail.com> http://callanbryant.co.uk/
*/
/*
produces an abject containing metadata of an mp3 file
define ('GETID3_INCLUDEPATH', ROOT_DIR.'/getid3/');
*/
require_once __DIR__.'/constants.php';
require_once __DIR__.'/VSE/keyStore.class.php';
require_once GETID3_INCLUDEPATH.'/getid3.php';
class audioFile
{
public $title,$artist,$album,$year,$genre,$id,$time;
protected $path;
// id of blob in keystore in namespace 'albumArt'
// for album cover art, if any
public $albumArtId = null;
public $count = 0;
// output from getid3 (removed after use)
private $analysis;
private $dir;
// ... for compariston purposes when multiple songs exist
// integer
protected $quality = 0;
public function __construct($filepath)
{
// force string on filename (when using recursive file iterator,
// objects are returned)
$filepath = (string)$filepath;
if (!extension_loaded('Imagick'))
throw new Exception("Imagic extension required. Not loaded");
if (!file_exists($filepath))
throw new Exception("$filepath not found");
if (!is_readable($filepath))
throw new Exception("permission denied reading $filepath");
$this->path = $filepath;
$this->dir = dirname($filepath).'/';
$getID3 = new getID3();
$this->analysis = $getID3->analyze($filepath);
if (@isset($this->analysis['error']) )
throw new Exception( $this->analysis['error'][0] );
if (!isset($this->analysis['id3v1']) and !isset($this->analysis['id3v2']) )
throw new Exception("no ID3v1 or ID3v2 tags in $filepath");
// aggregate both tag formats (clobbering other metadata)
getid3_lib::CopyTagsToComments($this->analysis);
@$this->title = $this->analysis['comments']['title'][0];
@$this->artist = $this->analysis['comments']['artist'][0];
@$this->year = $this->analysis['comments']['year'][0];
@$this->genre = $this->analysis['comments']['genre'][0];
@$this->album = $this->analysis['comments']['album'][0];
@$seconds = ceil($this->analysis['playtime_seconds']);
@$this->time = floor($seconds/60).':'.str_pad($seconds%60, 2, "0", STR_PAD_LEFT);
if (!$this->title)
throw new Exception("No title found in $filepath");
if (!$this->album)
$this->album = 'Various artists';
$this->assignAlbumArt();
// set an ID relative to metadata
$this->id = md5($this->artist.$this->album.$this->title);
// let's guess quality is proportional to bitrate
@$this->quality = floor($this->analysis['audio']['bitrate']/1000);
// remove the getID3 analysis -- it's massive. It should not be indexed!
unset ($this->analysis);
}
// get and save album art from the best source possible
// then resize it to 128x128 JPG format
private function assignAlbumArt()
{
$k = new keyStore('albumArt');
// generate a potential ID corresponding to this album/artist combination
$id = md5($this->album.$this->artist);
// check for existing art from the same album
// if there, then assign this song that albumn ID
if ($k->get($id))
return $this->albumArtId = $id;
// get an instance of the ImageMagick class to manipulate
// the album art image
$im = new Imagick();
$blob = null;
// look in the ID3v2 tag
if (isset($this->analysis['id3v2']['APIC'][0]['data']))
$blob = &$this->analysis['id3v2']['APIC'][0]['data'];
elseif (isset($this->analysis['id3v2']['PIC'][0]['data']))
$blob = &$this->analysis['id3v2']['PIC'][0]['data'];
// look in containing folder for images
elseif($images = glob($this->dir.'*.{jpg,png}',GLOB_BRACE) )
{
// use file pointers instead of file_get_contents
// to fix a memory leak due to failed re-use of allocated memory
// when loading successivle bigger files
@$h = fopen($images[0], 'rb');
$size = filesize($images[0]);
if ($h === false)
throw new Exception("Could not open cover art: $images[0]");
if (!$size)
// invalid or no image
//throw new Exception("Could not open cover art: $images[0]");
// assign no art
return;
$blob = fread($h,$size);
fclose($h);
}
else
// no albumn art available, assign none
return;
// TODO, if necessary: try amazon web services
// standardise the album art to 128x128 jpg
$im->readImageBlob($blob);
$im->thumbnailImage(128,128);
$im->setImageFormat('jpeg');
$im->setImageCompressionQuality(90);
$blob = $im->getImageBlob();
// save the album art under the generated ID
$k->set($id,$blob);
// assign this song that albumn art ID
$this->albumArtId = $id;
}
public function getPath()
{
return $this->path;
}
public function getQuality()
{
return $this->quality;
}
}
| naggie/vosbox | audioFile.class.php | PHP | gpl-3.0 | 5,333 |
<div class= "parametre">
<a href = "parametre.php" onclick="">mon compte</a>
</div>
<div style = "background-color:blue; border:2px solid white; border-radius:25px; padding:1%; font-size:1.5em;" >
<a href = "./deconnect.php">deconnection</a>
</div>
| mysteriou13/protonet | view/divmembre.php | PHP | gpl-3.0 | 258 |
from urllib.request import urlopen
from urllib.parse import urlparse, parse_qs
from socket import error as SocketError
import errno
from bs4 import BeautifulSoup
MAX_PAGES_TO_SEARCH = 3
def parse_news(item):
'''Parse news item
return is a tuple(id, title, url)
'''
url = 'http://www.spa.gov.sa' + item['href']
url_parsed = urlparse(url)
qs = parse_qs(url_parsed[4])
id = qs['newsid'][0]
title = item.h2.contents[0]
title = " ".join(title.split())
item_parsed = (id, title, url)
return item_parsed
def retrieve_news(person=0, royal=0, cabinet=0, last_id=-1):
'''Retrieve news for person or royal
person 1= king, 2= crown prince and 3= deputy crown prince
if royal is = 1 news will be retriveved
if last_id not definend it will return the max
return list of news tuples up to MAX_PAGES_TO_SEARCH (page = 10 news)
[(id, title, url)...]
'''
all_news = []
found = False
page = 1
while (page <= MAX_PAGES_TO_SEARCH and not found):
url = ("http://www.spa.gov.sa/ajax/listnews.php?sticky={}&cat=0&cabine"
"t={}&royal={}&lang=ar&pg={}".format(person, cabinet, royal, page))
try:
html = urlopen(url)
soup = BeautifulSoup(html, "html.parser")
news = soup.find_all("a", class_="aNewsTitle")
for item in news:
item_parsed = parse_news(item)
if item_parsed[0] <= str(last_id):
found = True
break
all_news.append(item_parsed)
except SocketError as e:
if e.errno != errno.ECONNRESET:
raise
pass
page = page + 1
return all_news
def retrieve_detail(item):
'''Retrive detaill for news item
return is tuple (id, title, url, text)
'''
url = item[2]
html = urlopen(url)
soup = BeautifulSoup(html, 'html.parser')
detail = soup.find(class_='divNewsDetailsText')
detail = detail.get_text()
_list = list(item)
_list.insert(3, detail)
item = tuple(_list)
return item
def royal_order(last_id=-1):
'''Retrive royal orders
if last_id not defiend it will return the max
return list of royal orders tuples up to MAX_PAGES_TO_SEARCH (page=10)
[(id, title, url, text)...]
'''
orders = []
_news = retrieve_news(royal=1, last_id=last_id)
for item in _news:
_detail = retrieve_detail(item)
orders.append(_detail)
return orders
def cabinet_decision(last_id=-1):
'''Retrive cabinet decisions
if last_id not defiend it will return the max
return list of cabinet decisions tuples up to MAX_PAGES_TO_SEARCH (page=10)
[(id, title, url, text)...]
'''
decisions = []
_news = retrieve_news(cabinet=1, last_id=last_id)
for item in _news:
_detail = retrieve_detail(item)
decisions.append(_detail)
return decisions
def arrival_news(person, last_id=-1):
'''Retrive only arrival news for person
if last_id not defiend it will return the max
return list of arrival news tuples up to MAX_PAGES_TO_SEARCH (page = 10 news)
[(id, title, url, location)...]
'''
arrival_news = []
all_news = retrieve_news(person=person, last_id= last_id)
for item in all_news:
if 'يصل إلى' in item[1]:
_list = list(item)
_list.insert(3, (item[1].split('يصل إلى'))[1].split('قادماً من')[0])
item = tuple(_list)
arrival_news.append(item)
return arrival_news
def leave_news(person, last_id=-1):
'''Retrive only leave news for person
if last_id not defiend it will return the max
return list of leave news tuples up to MAX_PAGES_TO_SEARCH (page = 10 news)
[(id, title, url, locationFromTo)...]
'''
leave_news = []
all_news = retrieve_news(person=person, last_id= last_id)
for item in all_news:
if 'يغادر' in item[1]:
_list = list(item)
_list.insert(3, item[1].split('يغادر')[1])
item = tuple(_list)
leave_news.append(item)
return leave_news
if __name__ == "__main__":
# just for testing
news = cabinet_decision()
print(news)
| saudisproject/saudi-bots | bots/spa.py | Python | gpl-3.0 | 4,254 |
<?php
/*
* +----------------------------------------------------------------------+
* | PHP Version 4 |
* +----------------------------------------------------------------------+
* | Copyright (c) 2002-2005 Heinrich Stamerjohanns |
* | |
* | getrecord.php -- Utilities for the OAI Data Provider |
* | |
* | This is free software; you can redistribute it and/or modify it under|
* | the terms of the GNU General Public License as published by the |
* | Free Software Foundation; either version 2 of the License, or (at |
* | your option) any later version. |
* | This software is distributed in the hope that it will be useful, but |
* | WITHOUT ANY WARRANTY; without even the implied warranty of |
* | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* | GNU General Public License for more details. |
* | You should have received a copy of the GNU General Public License |
* | along with software; if not, write to the Free Software Foundation, |
* | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* | |
* +----------------------------------------------------------------------+
* | Derived from work by U. Mόller, HUB Berlin, 2002 |
* | |
* | Written by Heinrich Stamerjohanns, May 2002 |
* | stamer@uni-oldenburg.de |
* +----------------------------------------------------------------------+
*/
//
// $Id: getrecord.php,v 1.02 2003/04/08 14:22:07 stamer Exp $
//
// parse and check arguments
foreach($args as $key => $val) {
switch ($key) {
case 'identifier':
$identifier = $val;
if (!is_valid_uri($identifier)) {
$errors .= oai_error('badArgument', $key, $val);
}
break;
case 'metadataPrefix':
if (is_array($METADATAFORMATS[$val])
&& isset($METADATAFORMATS[$val]['myhandler'])) {
$metadataPrefix = $val;
$inc_record = $METADATAFORMATS[$val]['myhandler'];
} else {
$errors .= oai_error('cannotDisseminateFormat', $key, $val);
}
break;
default:
$errors .= oai_error('badArgument', $key, $val);
}
}
if (!isset($args['identifier'])) {
$errors .= oai_error('missingArgument', 'identifier');
}
if (!isset($args['metadataPrefix'])) {
$errors .= oai_error('missingArgument', 'metadataPrefix');
}
// remove the OAI part to get the identifier
if (empty($errors)) {
$id = str_replace($oaiprefix, '', $identifier);
if ($id == '') {
$errors .= oai_error('idDoesNotExist', '', $identifier);
}
$query = selectallQuery($id);
$res = $db->query($query);
if (DB::isError($res)) {
if ($SHOW_QUERY_ERROR) {
echo __FILE__.','.__LINE."<br />";
echo "Query: $query<br />\n";
die($db->errorNative());
} else {
$errors .= oai_error('idDoesNotExist', '', $identifier);
}
} elseif (!$res->numRows()) {
$errors .= oai_error('idDoesNotExist', '', $identifier);
}
}
// break and clean up on error
if ($errors != '') {
oai_exit();
}
$output .= " <GetRecord>\n";
$num_rows = $res->numRows();
if (DB::isError($num_rows)) {
if ($SHOW_QUERY_ERROR) {
echo __FILE__.','.__LINE."<br />";
echo "Query: $query<br />\n";
die($db->errorNative());
}
}
if ($num_rows) {
$record = $res->fetchRow();
if (DB::isError($record)) {
if ($SHOW_QUERY_ERROR) {
echo __FILE__.','.__LINE."<br />";
die($db->errorNative());
}
}
$identifier = $oaiprefix.$record[$SQL['identifier']];;
$datestamp = formatDatestamp($record[$SQL['datestamp']]);
if (isset($record[$SQL['deleted']]) && ($record[$SQL['deleted']] == 'true') &&
($deletedRecord == 'transient' || $deletedRecord == 'persistent')) {
$status_deleted = TRUE;
} else {
$status_deleted = FALSE;
}
// print Header
$output .=
' <record>'."\n";
$output .=
' <header';
if ($status_deleted) {
$output .= ' status="deleted"';
}
$output .='>'."\n";
// use xmlrecord since we include stuff from database;
$output .= xmlrecord($identifier, 'identifier', '', 3);
$output .= xmlformat($datestamp, 'datestamp', '', 3);
if (!$status_deleted)
$output .= xmlrecord($record[$SQL['set']], 'setSpec', '', 3);
$output .=
' </header>'."\n";
// return the metadata record itself
if (!$status_deleted)
include('lib/'.$inc_record);
$output .=
' </record>'."\n";
}
else {
// we should never get here
oai_error('idDoesNotExist');
}
// End GetRecord
$output .=
' </GetRecord>'."\n";
$output = utf8_decode($output);
?> | agroknow/agrimoodle | blocks/oai_target/target/lib/getrecord.php | PHP | gpl-3.0 | 5,027 |
import time
from threading import Thread
import threading
from wtfj_ids import *
from wtfj_utils import *
class Printer:
''' Opens a new output window and prints messages sent to it '''
def __init__(self,header=''):
self._header = header
def send(self,string):
print(self._header+string)
class Console:
''' Allows user to enter commands '''
def __init__(self,prompt='[$] '):
self._prompt = prompt
self._at = ''
def poll(self,wait_s=None,uid=None):
try:
prompt = str(self._at)+str(self._prompt)
msg = raw_input(prompt)
if msg == '':
self._at = ''
return []
if msg[0] == '@':
self._at = msg.split()[0]+' '
else:
msg = self._at+msg
return [msg]
except Exception as e:
print(repr(e))
return []
def subscribe(self,*uids):
pass
class Script:
''' Runs a script passed as a list, default frequency = 1000Hz '''
def __init__(self,msgs):
self._msgs = msgs
self._index = 0
self._period = 0.001
self._pid = 'SCRIPT'
def poll(self,wait_s=None,uid=None):
period = self._period if wait_s is None else wait_s
time.sleep(period)
try:
msg = self._msgs[self._index]
print(self._pid+' SEND > '+msg)
self._index += 1
return [msg]
except IndexError:
return []
def subscribe(self,*uids):
for uid in uids:
if uid is not None:
if uid[0] is '@': assert uid[1:] in get_attr(Uid)
else: assert uid in get_attr(Uid)
return self
def load(self,msg_array):
self._msgs += msg_array
return self
def set_period(self,period):
self._period = period
return self
def run(self):
t = threading.current_thread()
self._pid = str(t.ident)+' '+str(t.name)
while len(self.poll()) > 0: pass
def run_async(self):
Thread(target=self.run).start()
if __name__ == '__main__':
Printer('A simple printer: ').send('Just printing a msg to current_thread')
script = [
'@other_uid topic data',
'@other_uid topic',
'uid topic data',
'uid topic'
]
async = ['async topic '+str(n) for n in [1,2,3,4,5,6,7,8,9,0]]
async2 = ['async2 topic '+str(n) for n in [1,2,3,4,5,6,7,8,9,0]]
Script(script).set_period(1).run()
Script(async).set_period(0.15).run_async()
Script(async2).set_period(0.2).run_async() | WritingTechForJarrod/app | src/wtfj/connectors_local.py | Python | gpl-3.0 | 2,202 |
// Copyright (c) 2016 Tristan Colgate-McFarlane
//
// This file is part of hugot.
//
// hugot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// hugot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with hugot. If not, see <http://www.gnu.org/licenses/>.
// Package hugot provides a simple interface for building extensible
// chat bots in an idiomatic go style. It is heavily influenced by
// net/http, and uses an internal message format that is compatible
// with Slack messages.
//
// Note: This package requires go1.7
//
// Adapters
//
// Adapters are used to integrate with external chat systems. Currently
// the following adapters exist:
// slack - github.com/tcolgate/hugot/adapters/slack - for https://slack.com/
// mattermost - github.com/tcolgate/hugot/adapters/mattermost - for https://www.mattermost.org/
// irc - github.com/tcolgate/hugot/adapters/irc - simple irc adapter
// shell - github.com/tcolgate/hugot/adapters/shell - simple readline based adapter
// ssh - github.com/tcolgate/hugot/adapters/ssh - Toy implementation of unauth'd ssh interface
//
// Examples of using these adapters can be found in github.com/tcolgate/hugot/cmd
//
// Handlers
//
// Handlers process messages. There are a several built in handler types:
//
// - Plain Handlers will execute for every message sent to them.
//
// - Background handlers, are started when a bot is started. They do not
// receive messages but can send them. They are intended to implement long
// lived background tasks that react to external inputs.
//
// - WebHook handlers can be used to implement web hooks by adding the bot to a
// http.ServeMux. A URL is built from the name of the handler.
//
// In addition to these basic handlers some more complex handlers are supplied.
//
// - Hears Handlers will execute for any message which matches a given regular
// expression.
//
// - Command Handlers act as command line tools. Message are attempted to be
// processed as a command line. Quoted text is handle as a single argument. The
// passed message can be used as a flag.FlagSet.
//
// - A Mux. The Mux will multiplex message across a set of handlers. In addition,
// a top level "help" Command handler is added to provide help on usage of the
// various handlers added to the Mux.
//
// WARNING: The API is still subject to change.
package hugot
| tcolgate/hugot | doc.go | GO | gpl-3.0 | 2,788 |
#include "shader.h"
#include <iostream>
Shader::Shader(GLuint shader_id)
: shader_id(shader_id) {}
void Shader::use()
{
glUseProgram(shader_id);
}
void Shader::send_cam_pos(glm::vec3 cam_pos)
{
this->cam_pos = cam_pos;
}
void Shader::set_VP(glm::mat4 V, glm::mat4 P)
{
this->V = V;
this->P = P;
}
void Shader::send_mesh_model(glm::mat4 mesh_model)
{
this->mesh_model = mesh_model;
}
void Shader::set_material(Material m) {}
void Shader::draw(Geometry *g, glm::mat4 to_world) {} | jytang/greed_island | src/shader.cpp | C++ | gpl-3.0 | 503 |
/*
Playdar - music content resolver
Copyright (C) 2009 Richard Jones
Copyright (C) 2009 Last.fm Ltd.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RESOLVED_ITEM_BUILDER_H__
#define __RESOLVED_ITEM_BUILDER_H__
#include "playdar/resolved_item.h"
#include "library.h"
using namespace json_spirit;
namespace playdar {
/*
Builds a ResolvedItem describing something (a song) that can be played.
*/
class ResolvedItemBuilder
{
public:
static void createFromFid(Library& lib, int fid, json_spirit::Object& out)
{
createFromFid( lib.db(), fid, out );
}
static void createFromFid( sqlite3pp::database& db, int fid, Object& out)
{
LibraryFile_ptr file( Library::file_from_fid(db, fid) );
out.push_back( Pair("mimetype", file->mimetype) );
out.push_back( Pair("size", file->size) );
out.push_back( Pair("duration", file->duration) );
out.push_back( Pair("bitrate", file->bitrate) );
artist_ptr artobj = Library::load_artist( db, file->piartid);
track_ptr trkobj = Library::load_track( db, file->pitrkid);
out.push_back( Pair("artist", artobj->name()) );
out.push_back( Pair("track", trkobj->name()) );
// album metadata kinda optional for now
if (file->pialbid) {
album_ptr albobj = Library::load_album(db, file->pialbid);
out.push_back( Pair("album", albobj->name()) );
}
out.push_back( Pair("url", file->url) );
}
};
} // ns
#endif //__RESOLVED_ITEM_BUILDER_H__
| RJ/playdar | resolvers/local/resolved_item_builder.hpp | C++ | gpl-3.0 | 2,176 |
#region License
//
// GroupableTest.cs
//
// Copyright (C) 2009-2013 Alex Taylor. All Rights Reserved.
//
// This file is part of Digitalis.LDTools.DOM.UnitTests.dll
//
// Digitalis.LDTools.DOM.UnitTests.dll is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Digitalis.LDTools.DOM.UnitTests.dll is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Digitalis.LDTools.DOM.UnitTests.dll. If not, see <http://www.gnu.org/licenses/>.
//
#endregion License
namespace UnitTests
{
#region Usings
using System;
using System.Reflection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Digitalis.LDTools.DOM;
using Digitalis.LDTools.DOM.API;
#endregion Usings
[TestClass]
public sealed class GroupableTest : IGroupableTest
{
#region Infrastructure
protected override Type TestClassType { get { return typeof(Groupable); } }
protected override IGroupable CreateTestGroupable()
{
return new MockGroupable();
}
#endregion Infrastructure
#region Definition Test
[TestMethod]
public override void DefinitionTest()
{
Assert.IsTrue(TestClassType.IsAbstract);
Assert.IsFalse(TestClassType.IsSealed);
base.DefinitionTest();
}
#endregion Definition Test
#region Disposal
[TestMethod]
public override void DisposeTest()
{
LDStep step = new LDStep();
MockGroupable groupable = new MockGroupable();
MLCadGroup group = new MLCadGroup();
step.Add(group);
Assert.AreEqual(1, step.PathToDocumentChangedSubscribers);
Assert.AreEqual(0, group.PathToDocumentChangedSubscribers);
step.Add(groupable);
groupable.Group = group;
// the Groupable should subscribe to its step's PathToDocumentChanged event...
Assert.AreEqual(3, step.PathToDocumentChangedSubscribers); // adds two subscribers: Groupable and its superclass Element
// ...and to its group's PathToDocumentChanged event
Assert.AreEqual(1, group.PathToDocumentChangedSubscribers);
groupable.Dispose();
Assert.AreEqual(1, step.PathToDocumentChangedSubscribers);
Assert.AreEqual(0, group.PathToDocumentChangedSubscribers);
base.DisposeTest();
}
#endregion Disposal
#region Grouping
[TestMethod]
public override void GroupTest()
{
IGroupable groupable = CreateTestGroupable();
IStep step = new LDStep();
MLCadGroup group = new MLCadGroup();
step.Add(groupable);
step.Add(group);
Assert.AreEqual(0, group.PathToDocumentChangedSubscribers);
groupable.Group = group;
Assert.AreEqual(1, group.PathToDocumentChangedSubscribers);
groupable.Group = null;
Assert.AreEqual(0, group.PathToDocumentChangedSubscribers);
base.GroupTest();
}
#endregion Grouping
}
}
| alex-taylor/Digitalis.LDTools.DOM | UnitTests/GroupableTest.cs | C# | gpl-3.0 | 3,733 |
/*
* WANDORA
* Knowledge Extraction, Management, and Publishing Application
* http://wandora.org
*
* Copyright (C) 2004-2016 Wandora Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
* JoinDirective.java
*
* Created on 25. lokakuuta 2007, 11:38
*
*/
package org.wandora.query;
import org.wandora.topicmap.*;
import java.util.*;
/**
* @deprecated
*
* @author olli
*/
public class JoinDirective implements Directive {
private Directive query;
private Locator joinContext;
private Directive joinQuery;
/** Creates a new instance of JoinDirective */
public JoinDirective(Directive query,Directive joinQuery) {
this(query,(Locator)null,joinQuery);
}
public JoinDirective(Directive query,Locator joinContext,Directive joinQuery) {
this.query=query;
this.joinContext=joinContext;
this.joinQuery=joinQuery;
}
public JoinDirective(Directive query,String joinContext,Directive joinQuery) {
this(query,new Locator(joinContext),joinQuery);
}
public ArrayList<ResultRow> query(QueryContext context) throws TopicMapException {
return query(context,null,null);
}
public ArrayList<ResultRow> query(QueryContext context,FilterDirective filter,Object filterParam) throws TopicMapException {
Topic contextTopic=context.getContextTopic();
TopicMap tm=contextTopic.getTopicMap();
ArrayList<ResultRow> inner=query.query(context);
ArrayList<ResultRow> res=new ArrayList<ResultRow>();
ArrayList<ResultRow> cachedJoin=null;
boolean useCache=!joinQuery.isContextSensitive();
for(ResultRow row : inner){
Topic t=null;
if(joinContext!=null){
Locator c=row.getPlayer(joinContext);
if(c==null) continue;
t=tm.getTopic(c);
}
else t=context.getContextTopic();
if(t==null) continue;
ArrayList<ResultRow> joinRes;
if(!useCache || cachedJoin==null){
joinRes=joinQuery.query(context.makeNewWithTopic(t));
if(useCache) cachedJoin=joinRes;
}
else joinRes=cachedJoin;
for(ResultRow joinRow : joinRes){
ResultRow joined=ResultRow.joinRows(row,joinRow);
if(filter!=null && !filter.includeRow(joined, contextTopic, tm, filterParam)) continue;
res.add(joined);
}
}
return res;
}
public boolean isContextSensitive(){
return query.isContextSensitive();
// note joinQuery gets context from query so it's sensitivity is same
// as that of query
}
}
| wandora-team/wandora | src/org/wandora/query/JoinDirective.java | Java | gpl-3.0 | 3,327 |
<?php
// Heading
$_['heading_title'] = 'Εγγραφή';
// Text
$_['text_account'] = 'Λογαριασμός';
$_['text_register'] = 'Εγγραφή';
$_['text_account_already'] = 'Εάν έχετε ήδη λογαριασμό, εισέλθετε από <a href="%s">εδώ</a>.';
$_['text_your_details'] = 'Προσωπικά Στοιχεία';
$_['text_your_address'] = 'Διεύθυνση';
$_['text_newsletter'] = 'Ενημερώσεις';
$_['text_your_password'] = 'Ο Κωδικός σας';
$_['text_agree'] = 'Αποδέχομαι τους <a class="fancybox" href="%s" alt="%s"><b>%s</b></a>';
// Entry
$_['entry_firstname'] = 'Όνομα:';
$_['entry_lastname'] = 'Επίθετο:';
$_['entry_email'] = 'E-Mail:';
$_['entry_telephone'] = 'Τηλέφωνο:';
$_['entry_fax'] = 'Fax:';
$_['entry_company'] = 'Εταιρία:';
$_['entry_customer_group'] = 'Είδος Εταιρίας:';
$_['entry_company_id'] = 'Αναγνωριστικό (ID) Εταιρίας:';
$_['entry_tax_id'] = 'ΑΦΜ:';
$_['entry_address_1'] = 'Διεύθυνση 1:';
$_['entry_address_2'] = 'Διεύθυνση 2:';
$_['entry_postcode'] = 'Ταχυδρομικός Κώδικας:';
$_['entry_city'] = 'Πόλη:';
$_['entry_country'] = 'Χώρα:';
$_['entry_zone'] = 'Περιοχή:';
$_['entry_newsletter'] = 'Συνδρομή:';
$_['entry_password'] = 'Κωδικός:';
$_['entry_confirm'] = 'Επαλήθευση Κωδικού:';
// Error
$_['error_exists'] = 'Προειδοποίηση: Η διεύθυνση E-Mail είναι ήδη καταχωρημένη!';
$_['error_firstname'] = 'Το Όνομα πρέπει να είναι από 1 έως 32 χαρακτήρες!';
$_['error_lastname'] = 'Το Επίθετο πρέπει να είναι από 1 έως 32 χαρακτήρες!';
$_['error_email'] = 'Η διεύθυνση E-Mail φαίνεται να μην είναι έγκυρη!';
$_['error_telephone'] = 'Το Τηλέφωνο πρέπει να είναι από 3 έως 32 χαρακτήρες!';
$_['error_password'] = 'Ο Κωδικός πρέπει να είναι από 4 έως 20 χαρακτήρες!';
$_['error_confirm'] = 'Η Επαλήθευση Κωδικού δεν ταιριάζει με τον αρχικό Κωδικό!';
$_['error_company_id'] = 'Απαιτείται η εισαγωγή του Αναγνωριστικού (ID) Εταιρίας!';
$_['error_tax_id'] = 'Απαιτείται η εισαγωγή ΑΦΜ!';
$_['error_vat'] = 'Ο ΦΠΑ είναι λανθασμένος!';
$_['error_address_1'] = 'Η Διεύθυνση 1 πρέπει να είναι από 3 έως 128 χαρακτήρες!';
$_['error_city'] = 'Η Πόλη πρέπει να είναι από 2 έως 128 χαρακτήρες!';
$_['error_postcode'] = 'Ο Ταχυδρομικός Κώδικας πρέπει να είναι από 2 έως 10 χαρακτήρες!';
$_['error_country'] = 'Εισάγετε Χώρα!';
$_['error_zone'] = 'Εισάγετε Περιοχή!';
$_['error_agree'] = 'Προειδοποίηση: Πρέπει να συμφωνήσετε με %s!';
?>
| lathan/opencart-greek | catalog/language/greek/account/register.php | PHP | gpl-3.0 | 3,384 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-03 08:56
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('snapventure', '0004_auto_20161102_2043'),
]
operations = [
migrations.CreateModel(
name='Inscription',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('created', models.DateTimeField(auto_now_add=True)),
('last_updated', models.DateTimeField(auto_now=True)),
('journey', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='snapventure.Journey')),
],
),
migrations.CreateModel(
name='Profile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('bio', models.TextField(blank=True, max_length=500)),
('location', models.CharField(blank=True, max_length=30)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField(
model_name='inscription',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='snapventure.Profile'),
),
migrations.AddField(
model_name='journey',
name='inscriptions',
field=models.ManyToManyField(through='snapventure.Inscription', to='snapventure.Profile'),
),
]
| DomDomPow/snapventure | snapventure-backend/snapventure/migrations/0005_auto_20161103_0856.py | Python | gpl-3.0 | 1,892 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
namespace SO.SilList.Manager.Models.ValueObjects
{
[Table("JobType", Schema = "app" )]
[Serializable]
public class JobTypeVo
{
[DisplayName("job Type Id")]
[Required]
[Key]
public int jobTypeId { get; set; }
[DisplayName("name")]
[StringLength(50)]
public string name { get; set; }
[DisplayName("description")]
public string description { get; set; }
[DisplayName("created")]
public Nullable<DateTime> created { get; set; }
[DisplayName("modified")]
public Nullable<DateTime> modified { get; set; }
[DisplayName("created By")]
public Nullable<int> createdBy { get; set; }
[DisplayName("modified By")]
public Nullable<int> modifiedBy { get; set; }
[DisplayName("is Active")]
[Required]
public bool isActive { get; set; }
[Association("JobType_Job", "jobTypeId", "jobTypeId")]
public List<JobVo> jobses { get; set; }
public JobTypeVo()
{
this.isActive = true;
}
}
}
| SilverObject/SilList | SO.SilList.Manager/Models/ValueObjects/JobTypeVo.cs | C# | gpl-3.0 | 1,430 |
/****************************************************************************
**
** Copyright (C) 2014-2015 Dinu SV.
** (contact: mail@dinusv.com)
** This file is part of C++ Snippet Assist application.
**
** GNU General Public License Usage
**
** This file may be used under the terms of the GNU General Public License
** version 3.0 as published by the Free Software Foundation and appearing
** in the file LICENSE.GPL included in the packaging of this file. Please
** review the following information to ensure the GNU General Public License
** version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
**
****************************************************************************/
#ifndef QSOURCELOCATION_HPP
#define QSOURCELOCATION_HPP
#include "QCSAGlobal.hpp"
#include <QString>
#include <QObject>
namespace csa{
class Q_CSA_EXPORT QSourceLocation : public QObject{
Q_OBJECT
public:
QSourceLocation(
const QString& file,
unsigned int line,
unsigned int column,
unsigned int offset,
QObject* parent = 0);
QSourceLocation(
const char* file,
unsigned int line,
unsigned int column,
unsigned int offset,
QObject* parent = 0);
QSourceLocation(
const QSourceLocation& other,
QObject* parent = 0);
~QSourceLocation();
void assign(const QSourceLocation& other);
QSourceLocation& operator =(const QSourceLocation& other);
public slots:
unsigned int line() const;
unsigned int column() const;
unsigned int offset() const;
QString filePath() const;
QString fileName() const;
QString toString() const;
private:
QString m_filePath;
unsigned int m_line;
unsigned int m_column;
unsigned int m_offset;
};
inline unsigned int QSourceLocation::line() const{
return m_line;
}
inline unsigned int QSourceLocation::column() const{
return m_column;
}
inline unsigned int QSourceLocation::offset() const{
return m_offset;
}
inline QString QSourceLocation::filePath() const{
return m_filePath;
}
}// namespace
Q_DECLARE_METATYPE(csa::QSourceLocation*)
#endif // QSOURCELOCATION_HPP
| dinusv/cpp-snippet-assist | modules/csa-lib/codebase/QSourceLocation.hpp | C++ | gpl-3.0 | 2,242 |
package cat.foixench.test.parcelable;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | gothalo/Android-2017 | 014-Parcelable/app/src/test/java/cat/foixench/test/parcelable/ExampleUnitTest.java | Java | gpl-3.0 | 406 |
package com.acgmodcrew.kip.tileentity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
/**
* Created by Malec on 05/03/2015.
*/
public class TileEntityRepositry extends TileEntity implements IInventory
{
private ItemStack[] inventory = new ItemStack[4];
@Override
public int getSizeInventory()
{
return 4;
}
@Override
public ItemStack getStackInSlot(int slot)
{
return inventory[slot];
}
@Override
public ItemStack decrStackSize(int slot, int p_70298_2_)
{
if (this.inventory[slot] != null)
{
ItemStack itemstack;
if (this.inventory[slot].stackSize <= p_70298_2_)
{
itemstack = this.inventory[slot];
this.inventory[slot] = null;
this.markDirty();
return itemstack;
}
else
{
itemstack = this.inventory[slot].splitStack(p_70298_2_);
if (this.inventory[slot].stackSize == 0)
{
this.inventory[slot] = null;
}
this.markDirty();
return itemstack;
}
}
else
{
return null;
}
}
@Override
public ItemStack getStackInSlotOnClosing(int p_70304_1_)
{
return null;
}
@Override
public void setInventorySlotContents(int slot, ItemStack itemStack)
{
inventory[slot] = itemStack;
}
@Override
public String getInventoryName()
{
return "Repository";
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public int getInventoryStackLimit()
{
return 1;
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
if (worldObj == null)
{
return true;
}
if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
{
return false;
}
return entityplayer.getDistanceSq((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64D;
}
@Override
public void openInventory()
{
}
@Override
public void closeInventory()
{
}
@Override
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_)
{
return false;
}
}
| ACGModCrew/kip | src/main/java/com/acgmodcrew/kip/tileentity/TileEntityRepositry.java | Java | gpl-3.0 | 2,563 |
import os
import re
import subprocess
# Copied from Trojita
"""Fetch the .po files from KDE's SVN for GCompris
Run me from GCompris's top-level directory.
"""
SVN_PATH = "svn://anonsvn.kde.org/home/kde/trunk/l10n-kf5/"
SOURCE_PO_PATH = "/messages/kdereview/gcompris_qt.po"
OUTPUT_PO_PATH = "./po/"
OUTPUT_PO_PATTERN = "gcompris_%s.po"
fixer = re.compile(r'^#~\| ', re.MULTILINE)
re_empty_msgid = re.compile('^msgid ""$', re.MULTILINE)
re_empty_line = re.compile('^$', re.MULTILINE)
re_has_qt_contexts = re.compile('X-Qt-Contexts: true\\n')
if not os.path.exists(OUTPUT_PO_PATH):
os.mkdir(OUTPUT_PO_PATH)
all_languages = subprocess.check_output(['svn', 'cat', SVN_PATH + 'subdirs'],
stderr=subprocess.STDOUT)
all_languages = [x.strip() for x in all_languages.split("\n") if len(x)]
all_languages.remove("x-test")
for lang in all_languages:
try:
raw_data = subprocess.check_output(['svn', 'cat', SVN_PATH + lang + SOURCE_PO_PATH],
stderr=subprocess.PIPE)
(transformed, subs) = fixer.subn('# ~| ', raw_data)
pos1 = re_empty_msgid.search(transformed).start()
pos2 = re_empty_line.search(transformed).start()
if re_has_qt_contexts.search(transformed, pos1, pos2) is None:
transformed = transformed[:pos2] + \
'"X-Qt-Contexts: true\\n"\n' + \
transformed[pos2:]
subs = subs + 1
if (subs > 0):
print "Fetched %s (and performed %d cleanups)" % (lang, subs)
else:
print "Fetched %s" % lang
file(OUTPUT_PO_PATH + OUTPUT_PO_PATTERN % lang, "wb").write(transformed)
except subprocess.CalledProcessError:
print "No data for %s" % lang
# Inform qmake about the updated file list
#os.utime("CMakeLists.txt", None)
| siddhism/GCompris-qt | tools/l10n-fetch-po-files.py | Python | gpl-3.0 | 1,862 |
#include "Scene.h"
#include "Screen.h"
Scene::Scene()
{
}
void Scene::Update()
{
Object::AddPreparedObjects();
for (Object* obj : Object::objects)
{
if (obj->IsActive())
obj->Update();
}
for (auto iter = Object::objects.begin(); iter != Object::objects.end(); iter++)
{
if (!(*iter)->IsActive())
{
Object::DeleteObject(*iter);
break;
}
}
}
void Scene::Render()
{
SDL_SetRenderDrawColor(Screen::GetRenderer(), 0, 0, 0, 255);
SDL_RenderClear(Screen::GetRenderer());
for (Object* obj : Object::objects)
{
if(obj->IsActive())
obj->Render();
}
SDL_RenderPresent(Screen::GetRenderer());
}
Object* Scene::FindObject(string name)
{
return Object::FindObject(name);
}
void Scene::OnOpened()
{
}
void Scene::OnClosed()
{
Object::ClearObjects();
}
Object** Scene::GetObjectsOfName(string name, int* count)
{
*count = 0;
for (auto iter = Object::objects.begin(); iter != Object::objects.end(); iter++)
{
if (!(*iter)->IsActive())
continue;
Object* obj = *iter;
if (obj->GetObjectName() == name)
(*count)++;
}
Object** objs = new Object*[*count];
int index = 0;
for (auto iter = Object::objects.begin(); iter != Object::objects.end(); iter++)
{
if (!(*iter)->IsActive())
continue;
Object* obj = *iter;
if (obj->GetObjectName() == name)
{
objs[index] = obj;
index++;
}
}
return objs;
} | TrinityLab/MagicEdge | MagicEdge/Scene.cpp | C++ | gpl-3.0 | 1,367 |
package com.simplecity.amp_library.playback;
import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.media.RemoteControlClient;
import android.os.Bundle;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import android.util.Log;
import com.annimon.stream.Stream;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.cantrowitz.rxbroadcast.RxBroadcast;
import com.simplecity.amp_library.R;
import com.simplecity.amp_library.ShuttleApplication;
import com.simplecity.amp_library.androidauto.CarHelper;
import com.simplecity.amp_library.androidauto.MediaIdHelper;
import com.simplecity.amp_library.data.Repository;
import com.simplecity.amp_library.model.Song;
import com.simplecity.amp_library.playback.constants.InternalIntents;
import com.simplecity.amp_library.ui.screens.queue.QueueItem;
import com.simplecity.amp_library.ui.screens.queue.QueueItemKt;
import com.simplecity.amp_library.utils.LogUtils;
import com.simplecity.amp_library.utils.MediaButtonIntentReceiver;
import com.simplecity.amp_library.utils.SettingsManager;
import io.reactivex.Completable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import java.util.List;
import kotlin.Unit;
class MediaSessionManager {
private static final String TAG = "MediaSessionManager";
private Context context;
private MediaSessionCompat mediaSession;
private QueueManager queueManager;
private PlaybackManager playbackManager;
private PlaybackSettingsManager playbackSettingsManager;
private SettingsManager settingsManager;
private CompositeDisposable disposables = new CompositeDisposable();
private MediaIdHelper mediaIdHelper;
private static String SHUFFLE_ACTION = "ACTION_SHUFFLE";
MediaSessionManager(
Context context,
QueueManager queueManager,
PlaybackManager playbackManager,
PlaybackSettingsManager playbackSettingsManager,
SettingsManager settingsManager,
Repository.SongsRepository songsRepository,
Repository.AlbumsRepository albumsRepository,
Repository.AlbumArtistsRepository albumArtistsRepository,
Repository.GenresRepository genresRepository,
Repository.PlaylistsRepository playlistsRepository
) {
this.context = context.getApplicationContext();
this.queueManager = queueManager;
this.playbackManager = playbackManager;
this.settingsManager = settingsManager;
this.playbackSettingsManager = playbackSettingsManager;
mediaIdHelper = new MediaIdHelper((ShuttleApplication) context.getApplicationContext(), songsRepository, albumsRepository, albumArtistsRepository, genresRepository, playlistsRepository);
ComponentName mediaButtonReceiverComponent = new ComponentName(context.getPackageName(), MediaButtonIntentReceiver.class.getName());
mediaSession = new MediaSessionCompat(context, "Shuttle", mediaButtonReceiverComponent, null);
mediaSession.setCallback(new MediaSessionCompat.Callback() {
@Override
public void onPause() {
playbackManager.pause(true);
}
@Override
public void onPlay() {
playbackManager.play();
}
@Override
public void onSeekTo(long pos) {
playbackManager.seekTo(pos);
}
@Override
public void onSkipToNext() {
playbackManager.next(true);
}
@Override
public void onSkipToPrevious() {
playbackManager.previous(false);
}
@Override
public void onSkipToQueueItem(long id) {
List<QueueItem> queueItems = queueManager.getCurrentPlaylist();
QueueItem queueItem = Stream.of(queueItems)
.filter(aQueueItem -> (long) aQueueItem.hashCode() == id)
.findFirst()
.orElse(null);
if (queueItem != null) {
playbackManager.setQueuePosition(queueItems.indexOf(queueItem));
}
}
@Override
public void onStop() {
playbackManager.stop(true);
}
@Override
public boolean onMediaButtonEvent(Intent mediaButtonEvent) {
Log.e("MediaButtonReceiver", "OnMediaButtonEvent called");
MediaButtonIntentReceiver.handleIntent(context, mediaButtonEvent, playbackSettingsManager);
return true;
}
@Override
public void onPlayFromMediaId(String mediaId, Bundle extras) {
mediaIdHelper.getSongListForMediaId(mediaId, (songs, position) -> {
playbackManager.load((List<Song>) songs, position, true, 0);
return Unit.INSTANCE;
});
}
@SuppressWarnings("ResultOfMethodCallIgnored")
@SuppressLint("CheckResult")
@Override
public void onPlayFromSearch(String query, Bundle extras) {
if (TextUtils.isEmpty(query)) {
playbackManager.play();
} else {
mediaIdHelper.handlePlayFromSearch(query, extras)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
pair -> {
if (!pair.getFirst().isEmpty()) {
playbackManager.load(pair.getFirst(), pair.getSecond(), true, 0);
} else {
playbackManager.pause(false);
}
},
error -> LogUtils.logException(TAG, "Failed to gather songs from search. Query: " + query, error)
);
}
}
@Override
public void onCustomAction(String action, Bundle extras) {
if (action.equals(SHUFFLE_ACTION)) {
queueManager.setShuffleMode(queueManager.shuffleMode == QueueManager.ShuffleMode.ON ? QueueManager.ShuffleMode.OFF : QueueManager.ShuffleMode.ON);
}
updateMediaSession(action);
}
});
mediaSession.setFlags(MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS | MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS);
//For some reason, MediaSessionCompat doesn't seem to pass all of the available 'actions' on as
//transport control flags for the RCC, so we do that manually
RemoteControlClient remoteControlClient = (RemoteControlClient) mediaSession.getRemoteControlClient();
if (remoteControlClient != null) {
remoteControlClient.setTransportControlFlags(
RemoteControlClient.FLAG_KEY_MEDIA_PAUSE
| RemoteControlClient.FLAG_KEY_MEDIA_PLAY
| RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE
| RemoteControlClient.FLAG_KEY_MEDIA_NEXT
| RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS
| RemoteControlClient.FLAG_KEY_MEDIA_STOP);
}
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(InternalIntents.QUEUE_CHANGED);
intentFilter.addAction(InternalIntents.META_CHANGED);
intentFilter.addAction(InternalIntents.PLAY_STATE_CHANGED);
intentFilter.addAction(InternalIntents.POSITION_CHANGED);
disposables.add(RxBroadcast.fromBroadcast(context, intentFilter).subscribe(intent -> {
String action = intent.getAction();
if (action != null) {
updateMediaSession(intent.getAction());
}
}));
}
private void updateMediaSession(final String action) {
int playState = playbackManager.isPlaying() ? PlaybackStateCompat.STATE_PLAYING : PlaybackStateCompat.STATE_PAUSED;
long playbackActions = getMediaSessionActions();
QueueItem currentQueueItem = queueManager.getCurrentQueueItem();
PlaybackStateCompat.Builder builder = new PlaybackStateCompat.Builder();
builder.setActions(playbackActions);
switch (queueManager.shuffleMode) {
case QueueManager.ShuffleMode.OFF:
builder.addCustomAction(
new PlaybackStateCompat.CustomAction.Builder(SHUFFLE_ACTION, context.getString(R.string.btn_shuffle_on), R.drawable.ic_shuffle_off_circled).build());
break;
case QueueManager.ShuffleMode.ON:
builder.addCustomAction(
new PlaybackStateCompat.CustomAction.Builder(SHUFFLE_ACTION, context.getString(R.string.btn_shuffle_off), R.drawable.ic_shuffle_on_circled).build());
break;
}
builder.setState(playState, playbackManager.getSeekPosition(), 1.0f);
if (currentQueueItem != null) {
builder.setActiveQueueItemId((long) currentQueueItem.hashCode());
}
PlaybackStateCompat playbackState = builder.build();
if (action.equals(InternalIntents.PLAY_STATE_CHANGED) || action.equals(InternalIntents.POSITION_CHANGED) || action.equals(SHUFFLE_ACTION)) {
mediaSession.setPlaybackState(playbackState);
} else if (action.equals(InternalIntents.META_CHANGED) || action.equals(InternalIntents.QUEUE_CHANGED)) {
if (currentQueueItem != null) {
MediaMetadataCompat.Builder metaData = new MediaMetadataCompat.Builder()
.putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, String.valueOf(currentQueueItem.getSong().id))
.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, currentQueueItem.getSong().artistName)
.putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ARTIST, currentQueueItem.getSong().albumArtistName)
.putString(MediaMetadataCompat.METADATA_KEY_ALBUM, currentQueueItem.getSong().albumName)
.putString(MediaMetadataCompat.METADATA_KEY_TITLE, currentQueueItem.getSong().name)
.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, currentQueueItem.getSong().duration)
.putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, (long) (queueManager.queuePosition + 1))
//Getting the genre is expensive.. let's not bother for now.
//.putString(MediaMetadataCompat.METADATA_KEY_GENRE, getGenreName())
.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, null)
.putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, (long) (queueManager.getCurrentPlaylist().size()));
// If we're in car mode, don't wait for the artwork to load before setting session metadata.
if (CarHelper.isCarUiMode(context)) {
mediaSession.setMetadata(metaData.build());
}
mediaSession.setPlaybackState(playbackState);
mediaSession.setQueue(QueueItemKt.toMediaSessionQueueItems(queueManager.getCurrentPlaylist()));
mediaSession.setQueueTitle(context.getString(R.string.menu_queue));
if (settingsManager.showLockscreenArtwork() || CarHelper.isCarUiMode(context)) {
updateMediaSessionArtwork(metaData);
} else {
mediaSession.setMetadata(metaData.build());
}
}
}
}
private void updateMediaSessionArtwork(MediaMetadataCompat.Builder metaData) {
QueueItem currentQueueItem = queueManager.getCurrentQueueItem();
if (currentQueueItem != null) {
disposables.add(Completable.defer(() -> Completable.fromAction(() ->
Glide.with(context)
.load(currentQueueItem.getSong().getAlbum())
.asBitmap()
.override(1024, 1024)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation<? super Bitmap> glideAnimation) {
if (bitmap != null) {
metaData.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, bitmap);
}
try {
mediaSession.setMetadata(metaData.build());
} catch (NullPointerException e) {
metaData.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, null);
mediaSession.setMetadata(metaData.build());
}
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
mediaSession.setMetadata(metaData.build());
}
})
))
.subscribeOn(AndroidSchedulers.mainThread())
.subscribe()
);
}
}
private long getMediaSessionActions() {
return PlaybackStateCompat.ACTION_PLAY
| PlaybackStateCompat.ACTION_PAUSE
| PlaybackStateCompat.ACTION_PLAY_PAUSE
| PlaybackStateCompat.ACTION_SKIP_TO_NEXT
| PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS
| PlaybackStateCompat.ACTION_STOP
| PlaybackStateCompat.ACTION_SEEK_TO
| PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID
| PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH
| PlaybackStateCompat.ACTION_SKIP_TO_QUEUE_ITEM;
}
MediaSessionCompat.Token getSessionToken() {
return mediaSession.getSessionToken();
}
void setActive(boolean active) {
mediaSession.setActive(active);
}
void destroy() {
disposables.clear();
mediaSession.release();
}
} | timusus/Shuttle | app/src/main/java/com/simplecity/amp_library/playback/MediaSessionManager.java | Java | gpl-3.0 | 15,327 |
<?php require_once 'header.php';?>
<div class="page-header">
<h1><?=APP_NAME ?></h1>
</div>
<a href="auth">auth</a>
<!--echo "role=".<?=$role ?>; -->
<?php
$app = \Slim\Slim::getInstance();
// echo "user->role=".$app->user->role;
?>
<?php require_once 'footer.php';?> | winguse/GithubApp | assets/index.php | PHP | gpl-3.0 | 279 |
/**
* Copyright 2017 Kaloyan Raev
*
* This file is part of chitanka4kindle.
*
* chitanka4kindle is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* chitanka4kindle is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with chitanka4kindle. If not, see <http://www.gnu.org/licenses/>.
*/
package name.raev.kaloyan.kindle.chitanka.model.search.label;
public class Label {
private String slug;
private String name;
private int nrOfTexts;
public String getSlug() {
return slug;
}
public void setSlug(String slug) {
this.slug = slug;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getNumberOfTexts() {
return nrOfTexts;
}
public void setNumberOfTexts(int nrOfTexts) {
this.nrOfTexts = nrOfTexts;
}
}
| kaloyan-raev/chitanka4kindle | src/main/java/name/raev/kaloyan/kindle/chitanka/model/search/label/Label.java | Java | gpl-3.0 | 1,251 |
export class GameId {
constructor(
public game_id: string) {
}
}
| mkokotovich/play_smear | front_end/src/app/model/game-id.ts | TypeScript | gpl-3.0 | 81 |
namespace Net.Demandware.Ocapi.Resources.Data
{
class Coupons
{
}
}
| CoderHead/DemandwareDotNet | Net.Demandware.Ocapi/Resources/Data/Coupons.cs | C# | gpl-3.0 | 89 |
/** File errors.cc author Vladislav Tcendrovskii
* Copyright (c) 2013
* This source subjected to the Gnu General Public License v3 or later (see LICENSE)
* All other rights reserved
* THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY
* OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
* */
#include "errors.h"
std::string error_str(int errnum)
{
std::string ans;
switch(errnum)
{
case ENO:
ans = "No error";
break;
case EZERO:
ans = "Division by zero";
break;
case EDIM:
ans = "Dimension mismatch";
break;
case EMEM:
ans = "Memory allocation fail";
break;
case ETYPE:
ans = "Wrong object type/form";
break;
case EIND:
ans = "Index out of range";
break;
default:
ans = "Error number " + errnum;
break;
}
return ans;
} | vladtcvs/geodesic | src/errors.cc | C++ | gpl-3.0 | 987 |
#! /usr/bin/python
from xml.sax.saxutils import escape
import re
def ConvertDiagnosticLineToSonqarqube(item):
try:
id, line, message, source_file = GetDiagnosticFieldsFromDiagnosticLine(item)
WriteDiagnosticFieldsToFile(id, line, message, source_file)
except:
print 'Cant parse line {}'.format(item)
def GetDiagnosticFieldsFromDiagnosticLine(item):
source_file = re.search('\/(.*?):', item).group(0).replace(':', '')
line = re.search(':\d*:', item).group(0).replace(':', '')
id = re.search('\[.*\]', item).group(0).replace('[', '').replace(']', '') + '-clang-compiler'
message = re.search('warning: (.*)\[', item).group(0).replace('[', '').replace('warning: ', '')
return id, line, message, source_file
def WriteDiagnosticFieldsToFile(id, line, message, source_file):
clang_sonar_report.write(" <error file=\"" + str(source_file) +
"\" line=\"" + str(line) +
"\" id=\"" + str(id) +
"\" msg=\"" + escape(str(message)) + "\"/>\n")
def CreateOutputFile():
file_to_write = open('clang_compiler_report.xml', 'w')
file_to_write.write('<?xml version="1.0" encoding="UTF-8"?>\n')
file_to_write.write('<results>\n')
return file_to_write
def ReadCompilerReportFile():
file = open('clang_compiler_report_formatted', 'r')
messages_xml = file.readlines()
return messages_xml
def CloseOutputFile():
clang_sonar_report.write('</results>\n')
clang_sonar_report.close()
def WriteSonarRulesToOutputFile():
item_list = clang_compiler_report
for item in item_list:
ConvertDiagnosticLineToSonqarqube(item)
if __name__ == '__main__':
clang_sonar_report = CreateOutputFile()
clang_compiler_report = ReadCompilerReportFile()
WriteSonarRulesToOutputFile()
CloseOutputFile()
| deadloko/ClangCompilerWarningsToSonarQubeRules | report_converter.py | Python | gpl-3.0 | 1,862 |
#!/usr/bin/env python
import os
import tempfile
import pipes
import subprocess
import time
import random
import shutil
try:
from wand.image import Image
from wand.display import display
except ImportError as e:
# cd /usr/lib/
# ln -s libMagickWand-6.Q16.so libMagickWand.so
print("Couldn't import Wand package.")
print("Please refer to #http://dahlia.kr/wand/ to install it.")
import traceback; traceback.print_exc()
raise e
try:
import magic
mime = magic.Magic()
except ImportError:
mime = None
#https://github.com/ahupp/python-magic
try:
from docopt import docopt
except ImportError:
print("Couldn't import Docopt package.")
print("Please refer to#https://github.com/docopt/docopt to install it.")
print("/!\\ Option parsing not possible, defaulting to hardcoded values/!\\")
def to_bool(val):
if val is None:
return false
return val == 1
def to_int(val):
return int(val)
def to_str(val):
return val
def to_path(val):
return val
OPT_TO_KEY = {
'--do-wrap' : ("DO_WRAP", to_bool),
'--line-height': ("LINE_HEIGHT", to_int),
'--nb-lines' : ('LINES', to_int),
'--no-caption' : ("WANT_NO_CAPTION", to_bool),
'--force-no-vfs': ("FORCE_VFS", to_bool),
'--force-vfs' : ("FORCE_NO_VFS", to_bool),
'--pick-random': ("PICK_RANDOM", to_bool),
'--put-random' : ("PUT_RANDOM", to_bool),
'--resize' : ("DO_RESIZE", to_bool),
'--sleep' : ('SLEEP_TIME', to_int),
'--width' : ('WIDTH', to_int),
'--no-switch-to-mini': ("NO_SWITCH_TO_MINI", to_bool),
'<path>' : ('PATH', to_path),
'<target>' : ('TARGET', to_path),
'--polaroid' : ("DO_POLAROID", to_bool),
'--format' : ("IMG_FORMAT_SUFFIX", to_str),
'--crop-size' : ("CROP_SIZE", to_int),
'~~use-vfs' : ("USE_VFS", to_bool),
'--help' : ("HELP", to_bool)
}
KEY_TO_OPT = dict([(key, (opt, ttype)) for opt, (key, ttype) in OPT_TO_KEY.items()])
PARAMS = {
"PATH" : "/home/kevin/mount/first",
"TARGET" : "/tmp/final.png",
#define the size of the picture
"WIDTH" : 2000,
#define how many lines do we want
"LINES": 2,
"LINE_HEIGHT": 200,
#minimum width of cropped image. Below that, we black it out
#only for POLAROID
"CROP_SIZE": 1000,
"IMG_FORMAT_SUFFIX": ".png",
# False if PATH is a normal directory, True if it is WebAlbums-FS
"USE_VFS": False,
"FORCE_VFS": False,
"FORCE_NO_VFS": False,
# True if end-of-line photos are wrapped to the next line
"DO_WRAP": False,
# True if we want a black background and white frame, plus details
"DO_POLAROID": True,
"WANT_NO_CAPTION": True,
# False if we want to add pictures randomly
"PUT_RANDOM": False,
"DO_RESIZE": False,
### VFS options ###
"NO_SWITCH_TO_MINI": False,
### Directory options ###
# False if we pick directory images sequentially, false if we take them randomly
"PICK_RANDOM": False, #not implemented yet
## Random wall options ##
"SLEEP_TIME": 0,
"HELP": False
}
DEFAULTS = dict([(key, value) for key, value in PARAMS.items()])
DEFAULTS_docstr = dict([(KEY_TO_OPT[key][0], value) for key, value in PARAMS.items()])
usage = """Photo Wall for WebAlbums 3.
Usage:
photowall.py <path> <target> [options]
Arguments:
<path> The path where photos are picked up from. [default: %(<path>)s]
<target> The path where the target photo is written. Except in POLAROID+RANDOM mode, the image will be blanked out first. [default: %(<target>)s]
Options:
--polaroid Use polaroid-like images for the wall
--width <width> Set final image width. [default: %(--width)d]
--nb-lines <nb> Number on lines of the target image. [default: %(--nb-lines)d]
--resize Resize images before putting in the wall. [default: %(--resize)s]
--line-height <height> Set the height of a single image. [default: %(--line-height)d]
--do-wrap If not POLAROID, finish images on the next line. [default: %(--do-wrap)s]
--help Display this message
Polaroid mode options:
--crop-size <crop> Minimum size to allow cropping an image. [default: %(--crop-size)s]
--no-caption Disable caption. [default: %(--no-caption)s]
--put-random Put images randomly instead of linearily. [default: %(--put-random)s]
--sleep <time> If --put-random, time (in seconds) to go asleep before adding a new image. [default: %(--sleep)d]
Filesystem options:
--force-vfs Treat <path> as a VFS filesystem. [default: %(--force-vfs)s]
--force-no-vfs Treat <path> as a normal filesystem. [default: %(--force-no-vfs)s]
--no-switch-to-mini If VFS, don't switch from the normal image to the miniature. [default: %(--no-switch-to-mini)s]
--pick-random If not VFS, pick images randomly in the <path> folder. [default: %(--pick-random)s]
""" % DEFAULTS_docstr
class UpdateCallback:
def newExec(self):
pass
def newImage(self, row=0, col=0, filename=""):
print("%d.%d > %s" % (row, col, filename))
def updLine(self, row, tmpLine):
#print("--- %d ---" % row)
pass
def newFinal(self, name):
pass
def finished(self, name):
print("==========")
def stopRequested(self):
return False
def checkPause(self):
pass
updateCB = UpdateCallback()
if __name__ == "__main__":
arguments = docopt(usage, version="3.5-dev")
if arguments["--help"]:
print(usage)
exit()
param_args = dict([(OPT_TO_KEY[opt][0], OPT_TO_KEY[opt][1](value)) for opt, value in arguments.items()])
PARAMS = dict(PARAMS, **param_args)
###########################################
###########################################
previous = None
def get_next_file_vfs():
global previous
if previous is not None:
try:
os.unlink(previous)
except OSerror:
pass
files = os.listdir(PARAMS["PATH"])
for filename in files:
if not "By Years" in filename:
previous = PARAMS["PATH"]+filename
if "gpx" in previous:
return get_next_file()
to_return = previous
try:
to_return = os.readlink(to_return)
except OSError:
pass
if not PARAMS["NO_SWITCH_TO_MINI"]:
to_return = to_return.replace("/images/", "/miniatures/") + ".png"
return to_return
def get_file_details(filename):
try:
link = filename
try:
link = os.readlink(filename)
except OSError:
pass
link = pipes.quote(link)
names = link[link.index("/miniatures/" if not PARAMS["NO_SWITCH_TO_MINI"] else "/images"):].split("/")[2:]
theme, year, album, fname = names
return "%s (%s)" % (album, theme)
except Exception as e:
#print("Cannot get details from {}: {}".format(filename, e))
fname = get_file_details_dir(filename)
fname = fname.rpartition(".")[0]
fname = fname.replace("_", "\n")
return fname
###########################################
class GetFileDir:
def __init__(self, randomize):
self.idx = 0
self.files = os.listdir(PARAMS["PATH"])
if len(self.files) == 0:
raise EnvironmentError("No file available")
self.files.sort()
if randomize:
print("RANDOMIZE")
random.shuffle(self.files)
def get_next_file(self):
to_return = self.files[self.idx]
self.idx += 1
self.idx %= len(self.files)
return PARAMS["PATH"]+to_return
def get_file_details_dir(filename):
return filename[filename.rindex("/")+1:]
###########################################
###########################################
def do_append(first, second, underneath=False):
sign = "-" if underneath else "+"
background = "-background black" if PARAMS["DO_POLAROID"] else ""
command = "convert -gravity center %s %sappend %s %s %s" % (background, sign, first, second, first)
ret = subprocess.call(command, shell=True)
if ret != 0:
raise Exception("Command failed: ", command)
def do_polaroid (image, filename=None, background="black", suffix=None):
if suffix is None:
suffix = PARAMS["IMG_FORMAT_SUFFIX"]
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=suffix)
tmp.close()
image.save(filename=tmp.name)
if not(PARAMS["WANT_NO_CAPTION"]) and filename:
details = get_file_details(filename)
caption = """-caption "%s" """ % details.replace("'", "\\'")
else:
caption = ""
command = "convert -bordercolor snow -background %(bg)s -gravity center %(caption)s +polaroid %(name)s %(name)s" % {"bg" : background, "name":tmp.name, "caption":caption}
ret = subprocess.call(command, shell=True)
if ret != 0:
raise Exception("Command failed: "+ command)
img = Image(filename=tmp.name).clone()
os.unlink(tmp.name)
img.resize(width=image.width, height=image.height)
return img
def do_blank_image(height, width, filename, color="black"):
command = "convert -size %dx%d xc:%s %s" % (width, height, color, filename)
ret = subprocess.call(command, shell=True)
if ret != 0:
raise Exception("Command failed: "+ command)
def do_polaroid_and_random_composite(target_filename, target, image, filename):
PERCENT_IN = 100
image = do_polaroid(image, filename, background="transparent", suffix=".png")
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=PARAMS["IMG_FORMAT_SUFFIX"])
image.save(filename=tmp.name)
height = random.randint(0, target.height - image.height) - target.height/2
width = random.randint(0, target.width - image.width) - target.width/2
geometry = ("+" if height >= 0 else "") + str(height) + ("+" if width >= 0 else "") + str(width)
command = "composite -geometry %s -compose Over -gravity center %s %s %s" % (geometry, tmp.name, target_filename, target_filename)
ret = os.system(command)
os.unlink(tmp.name)
if ret != 0:
raise object("failed")
def photowall(name):
output_final = None
previous_filename = None
#for all the rows,
for row in range(PARAMS["LINES"]):
output_row = None
row_width = 0
#concatenate until the image width is reached
img_count = 0
while row_width < PARAMS["WIDTH"]:
# get a new file, or the end of the previous one, if it was split
filename = get_next_file() if previous_filename is None else previous_filename
mimetype = None
previous_filename = None
# get a real image
if mime is not None:
mimetype = mime.from_file(filename)
if "symbolic link" in mimetype:
filename = os.readlink(filename)
mimetype = mime.from_file(filename)
if not "image" in mimetype:
continue
else:
try:
filename = os.readlink(filename)
except OSError:
pass
updateCB.newImage(row, img_count, filename)
img_count += 1
# resize the image
image = Image(filename=filename)
with image.clone() as clone:
factor = float(PARAMS["LINE_HEIGHT"])/clone.height
clone.resize(height=PARAMS["LINE_HEIGHT"], width=int(clone.width*factor))
#if the new image makes an overflow
if row_width + clone.width > PARAMS["WIDTH"]:
#compute how many pixels will overflow
overflow = row_width + clone.width - PARAMS["WIDTH"]
will_fit = clone.width - overflow
if PARAMS["DO_POLAROID"] and will_fit < PARAMS["CROP_SIZE"]:
row_width = PARAMS["WIDTH"]
previous_filename = filename
print("Doesn't fit")
continue
if PARAMS["DO_WRAP"]:
with clone.clone() as next_img:
next_img.crop(will_fit+1, 0, width=overflow, height=PARAMS["LINE_HEIGHT"])
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=PARAMS["IMG_FORMAT_SUFFIX"])
tmp.close()
next_img.save(filename=tmp.name)
previous_filename = tmp.name
clone.crop(0, 0, width=will_fit, height=PARAMS["LINE_HEIGHT"])
if PARAMS["DO_POLAROID"]:
clone = do_polaroid(clone, filename)
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=PARAMS["IMG_FORMAT_SUFFIX"])
tmp.close()
clone.save(filename=tmp.name)
row_width += clone.width
if output_row is not None:
do_append(output_row.name, tmp.name)
os.unlink(tmp.name)
else:
output_row = tmp
updateCB.updLine(row, output_row.name)
updateCB.checkPause()
if updateCB.stopRequested():
break
else:
if output_final is not None:
do_append(output_final.name, output_row.name, underneath=True)
os.unlink(output_row.name)
else:
output_final = output_row
updateCB.newFinal(output_final.name)
if output_final is not None:
shutil.move(output_final.name, name)
updateCB.finished(name)
else:
updateCB.finished(None)
return name
def random_wall(real_target_filename):
name = real_target_filename
filename = name[name.rindex("/"):]
name = filename[:filename.index(".")]
ext = filename[filename.index("."):]
target_filename = tempfile.gettempdir()+"/"+name+".2"+ext
try:
#remove any existing tmp file
os.unlink(target_filename)
except:
pass
try:
#if source already exist, build up on it
os.system("cp %s %s" % (target_filename, real_target_filename))
except:
pass
print("Target file is %s" % real_target_filename )
target = None
if mime is not None:
try:
mimetype = mime.from_file(target_filename)
if "symbolic link" in mimetype:
filename = os.readlink(target_filename)
mimetype = mime.from_file(target_filename)
if "image" in mimetype:
target = Image(filename=target_filename)
except IOError:
pass
if target is None:
height = PARAMS["LINES"] * PARAMS["LINE_HEIGHT"]
do_blank_image(height, PARAMS["WIDTH"], target_filename)
target = Image(filename=target_filename)
cnt = 0
while True:
updateCB.checkPause()
if updateCB.stopRequested():
break
filename = get_next_file()
print(filename)
img = Image(filename=filename)
with img.clone() as clone:
if PARAMS["DO_RESIZE"]:
factor = float(PARAMS["LINE_HEIGHT"])/clone.height
clone.resize(width=int(clone.width*factor), height=int(clone.height*factor))
do_polaroid_and_random_composite(target_filename, target, clone, filename)
updateCB.checkPause()
if updateCB.stopRequested():
break
updateCB.newImage(row=cnt, filename=filename)
updateCB.newFinal(target_filename)
os.system("cp %s %s" % (target_filename, real_target_filename))
cnt += 1
updateCB.checkPause()
if updateCB.stopRequested():
break
time.sleep(PARAMS["SLEEP_TIME"])
updateCB.checkPause()
if updateCB.stopRequested():
break
get_next_file = None
def path_is_jnetfs(path):
#check if PATH is VFS or not
df_output_lines = os.popen("df -Ph '%s'" % path).read().splitlines()
return df_output_lines and "JnetFS" in df_output_lines[1]
def fix_args():
global get_next_file
if PARAMS["PATH"][-1] != "/":
PARAMS["PATH"] += "/"
if PARAMS["FORCE_NO_VFS"]:
PARAMS["USE_VFS"]
elif PARAMS["FORCE_NO_VFS"]:
PARAMS["USE_VFS"]
else:
PARAMS["USE_VFS"] = path_is_jnetfs(PARAMS["PATH"])
if not PARAMS["USE_VFS"]:
get_next_file = GetFileDir(PARAMS["PICK_RANDOM"]).get_next_file
else:
get_next_file = get_next_file_vfs
def do_main():
fix_args()
updateCB.newExec()
target = PARAMS["TARGET"]
if not(PARAMS["PUT_RANDOM"]):
photowall(target)
else:
random_wall(target)
if __name__== "__main__":
do_main()
| wazari972/WebAlbums | WebAlbums-FS/WebAlbums-Utils/Photowall/photowall.py | Python | gpl-3.0 | 15,846 |
/*
* Copyright (C) 2019 phramusca ( https://github.com/phramusca/ )
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package jamuz.process.book;
import java.util.List;
import org.junit.After;
import org.junit.AfterClass;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
/**
*
* @author phramusca ( https://github.com/phramusca/ )
*/
public class TableModelBookTest {
/**
*
*/
public TableModelBookTest() {
}
/**
*
*/
@BeforeClass
public static void setUpClass() {
}
/**
*
*/
@AfterClass
public static void tearDownClass() {
}
/**
*
*/
@Before
public void setUp() {
}
/**
*
*/
@After
public void tearDown() {
}
/**
* Test of isCellEditable method, of class TableModelBook.
*/
@Test
public void testIsCellEditable() {
System.out.println("isCellEditable");
int row = 0;
int col = 0;
TableModelBook instance = new TableModelBook();
boolean expResult = false;
boolean result = instance.isCellEditable(row, col);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of isCellEnabled method, of class TableModelBook.
*/
@Test
public void testIsCellEnabled() {
System.out.println("isCellEnabled");
int row = 0;
int col = 0;
TableModelBook instance = new TableModelBook();
boolean expResult = false;
boolean result = instance.isCellEnabled(row, col);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of getBooks method, of class TableModelBook.
*/
@Test
public void testGetBooks() {
System.out.println("getBooks");
TableModelBook instance = new TableModelBook();
List<Book> expResult = null;
List<Book> result = instance.getBooks();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of getFile method, of class TableModelBook.
*/
@Test
public void testGetFile() {
System.out.println("getFile");
int index = 0;
TableModelBook instance = new TableModelBook();
Book expResult = null;
Book result = instance.getFile(index);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of getLengthAll method, of class TableModelBook.
*/
@Test
public void testGetLengthAll() {
System.out.println("getLengthAll");
TableModelBook instance = new TableModelBook();
long expResult = 0L;
long result = instance.getLengthAll();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of getNbSelected method, of class TableModelBook.
*/
@Test
public void testGetNbSelected() {
System.out.println("getNbSelected");
TableModelBook instance = new TableModelBook();
int expResult = 0;
int result = instance.getNbSelected();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of getRowCount method, of class TableModelBook.
*/
@Test
public void testGetRowCount() {
System.out.println("getRowCount");
TableModelBook instance = new TableModelBook();
int expResult = 0;
int result = instance.getRowCount();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of getValueAt method, of class TableModelBook.
*/
@Test
public void testGetValueAt() {
System.out.println("getValueAt");
int rowIndex = 0;
int columnIndex = 0;
TableModelBook instance = new TableModelBook();
Object expResult = null;
Object result = instance.getValueAt(rowIndex, columnIndex);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of setValueAt method, of class TableModelBook.
*/
@Test
public void testSetValueAt() {
System.out.println("setValueAt");
Object value = null;
int row = 0;
int col = 0;
TableModelBook instance = new TableModelBook();
instance.setValueAt(value, row, col);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of select method, of class TableModelBook.
*/
@Test
public void testSelect() {
System.out.println("select");
Book book = null;
boolean selected = false;
TableModelBook instance = new TableModelBook();
instance.select(book, selected);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of getLengthSelected method, of class TableModelBook.
*/
@Test
public void testGetLengthSelected() {
System.out.println("getLengthSelected");
TableModelBook instance = new TableModelBook();
long expResult = 0L;
long result = instance.getLengthSelected();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of getColumnClass method, of class TableModelBook.
*/
@Test
public void testGetColumnClass() {
System.out.println("getColumnClass");
int col = 0;
TableModelBook instance = new TableModelBook();
Class expResult = null;
Class result = instance.getColumnClass(col);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of clear method, of class TableModelBook.
*/
@Test
public void testClear() {
System.out.println("clear");
TableModelBook instance = new TableModelBook();
instance.clear();
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of addRow method, of class TableModelBook.
*/
@Test
public void testAddRow() {
System.out.println("addRow");
Book file = null;
TableModelBook instance = new TableModelBook();
instance.addRow(file);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of removeRow method, of class TableModelBook.
*/
@Test
public void testRemoveRow() {
System.out.println("removeRow");
Book file = null;
TableModelBook instance = new TableModelBook();
instance.removeRow(file);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of loadThumbnails method, of class TableModelBook.
*/
@Test
public void testLoadThumbnails() {
System.out.println("loadThumbnails");
TableModelBook instance = new TableModelBook();
instance.loadThumbnails();
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
}
| phramusca/JaMuz | test/jamuz/process/book/TableModelBookTest.java | Java | gpl-3.0 | 7,906 |
<?PHP
class ftp {
/**
* @var string FTP Host
*/
private $_host;
/**
* @var string FTP Port
*/
private $_port;
/**
* @var string FTP User
*/
private $_user;
/**
* @var string FTP Passwort
*/
private $_password;
/**
* @var ressource FTP Verbindung
*/
private $_connection;
/**
* @var bool befindet man sich im Lito Ordner (Root)
*/
public $lito_root = false; //Wenn true, kann der Paketmanager diese Verbindung verwenden
/**
* @var bool Steht die Verbindung?
*/
public $connected = false;
/**
* @var string PHP or FTP
*/
private $_method = 'PHP';
/**
* Daten angeben um eine Verbindung herzustellen
* @param string host
* @param string user
* @param string password
* @param string rootdir Verzeichniss auf dem Server
* @param int port
*/
/**
* @var string rootdir for phpmode
*/
private $rootdir = './';
public function ftp($host = '', $user = '', $password = '', $rootdir = './', $port = 21) {
if(defined('C_FTP_METHOD')){
$this->_method = C_FTP_METHOD;
}
if($this->_method == 'PHP'){
$rootdir=LITO_ROOT_PATH;
if(!is_dir($rootdir))
return false;
$this->rootdir = preg_replace('!\/$!', '', $rootdir);
$this->connected = true;
$this->lito_root = true;
//echo 'Useing PHP as a workaround!';
} else {
$this->_host = $host;
$this->_port = $port;
$this->_user = $user;
$this->_password = $password;
if (!@ $this->_connection = ftp_connect($this->_host, $this->_port))
return false;
if (!@ ftp_login($this->_connection, $this->_user, $this->_password))
return false;
$this->connected = true;
ftp_chdir($this->_connection, $rootdir);
//if ($this->exists('litotex.php'))
$this->lito_root = true;
}
}
/**
* Erstellt ein Verzeichniss
* @param string dir Verzeichnissname
*/
public function mk_dir($dir) {
if (!$this->connected)
return false;
if ($this->exists($dir)){
return true;
}
if($this->_method == 'PHP')
return mkdir($this->rootdir.'/'.$dir);
else
return @ ftp_mkdir($this->_connection, $dir);
}
/**
* L�scht ein Verzeichniss
* @param string dir Verzeichnissname
*/
public function rm_dir($dir) {
$dir = preg_replace('!^\/!', '', $dir);
if (!$this->connected)
return false;
if (!$this->exists($dir))
return false;
if($this->_method == 'PHP'){
$this->_php_all_delete($this->_rootdir.'/'.$dir);
} else {
$list = $this->list_files($dir);
if (is_array($list)) {
foreach ($list as $file) {
if (!is_array($this->list_files($file)) || in_array($file, $this->list_files($file))) {
$this->rm_file($file);
} else {
$this->rm_dir($file);
}
}
}
return @ ftp_rmdir($this->_connection, $dir);
}
}
/**
* Verschiebt ein Verzeichniss oder eine Datei
* @param string file Verzeichnissname/Dateiname
* @param string dest Ziel
*/
public function mv($file, $dest) {
if (!$this->connected)
return false;
if (!$this->exists($file))
return false;
if($this->_method == 'PHP'){
return @ rename($this->rootdir.'/'.$file, $this->rootdir.'/'.$dest);
} else
return @ftp_rename($this->_connection, $file, $dest);
}
/**
* Listet den Inhalt eines Verzeichnisses auf
* @param string dir Verzeichnissname
*/
public function list_files($dir = './') {
if (!$this->connected)
return false;
if($this->_method == 'PHP'){
if(!is_dir($this->rootdir.'/'.$dir))
return false;
$dir = opendir($this->rootdir.'/'.$dir);
$return = array();
while($file = readdir($dir)){
if($file == '.' || $file == '..')
continue;
$return[] = $file;
}
return $return;
} else {
$dir = preg_replace('!^\/!', '', $dir);
$return = @ ftp_nlist($this->_connection, './'.$dir);
if(!is_array($return))
return false;
foreach($return as $i => $param){
$return[$i] = preg_replace('!^'.str_replace("/", "\\/", $dir).'\\/!', '', $param);
}
return $return;
}
}
/**
* L�scht eine Datei
* @param string file Dateiname
*/
public function rm_file($file) {
if (!$this->connected)
return false;
if (!$this->exists($file))
return true;
if($file == '.' || $file == '..')
return false;
if($this->_method == 'PHP'){
if(!is_file($this->rootdir.'/'.$file))
return false;
return @unlink($this->rootdir.'/'.$file);
} else
return @ftp_delete($this->_connection, $file);
}
/**
* Setzt Berechtigungen
* @param string ch Berechtigungen
* @param string file Dateiname
*/
public function chown_perm($ch, $file) {
if (!$this->connected)
return false;
if (!$this->exists($file)){
return false;
}
if($this->_method == 'PHP'){
return @chmod($this->rootdir.'/'.$file, $ch);
} else
return @ftp_chmod($this->_connection, $ch, $file);
}
/**
* Gibt den Inhalt einer Datei zur�ck
* @param string file Dateiname
*/
public function get_contents($file) {
if (!$this->connected)
return false;
if (!$this->exists($file))
return false;
if($this->_method == 'PHP'){
if(!is_file($this->rootdir.'/'.$file))
return false;
return file_get_contents($this->rootdir.'/'.$file);
} else {
$time = time();
$local_cache = fopen(LITO_ROOT_PATH . 'cache/ftpcache.php' . $time, 'w');
ftp_fget($this->_connection, $local_cache, $file, FTP_BINARY);
$return = file_get_contents(LITO_ROOT_PATH . 'cache/ftpcache.php' . $time);
fclose($local_cache);
unlink(LITO_ROOT_PATH . 'cache/ftpcache.php' . $time);
return $return;
}
}
/**
* Schreibt in eine Datei
* @param string file Dateiname
* @param string new Neuer Inhalt
*/
public function write_contents($file, $new, $overwrite = true) {
if (!$this->connected)
return false;
if ($overwrite && $this->exists($file))
return false;
if($this->_method == 'PHP'){
$file_h = fopen($this->rootdir.'/'.$file, 'w');
fwrite($file_h, $new);
return @fclose($file_h);
} else {
$time = time();
$local_cache = fopen(LITO_ROOT_PATH . 'cache/ftpcache.php' . $time, 'w');
fwrite($local_cache, $new);
fclose($local_cache);
$local_cache = fopen(LITO_ROOT_PATH . 'cache/ftpcache.php' . $time, 'r');
@$return = ftp_fput($this->_connection, $file, $local_cache, FTP_BINARY);
fclose($local_cache);
unlink(LITO_ROOT_PATH . 'cache/ftpcache.php' . $time);
return $return;
}
}
/**
* Kopiert dateien per FTP
* @param string file Zu kopierende Datei
* @param string dest Ziel
*/
public function copy_file($file, $dest){
$file_c = $this->get_contents($file);
$this->write_contents($dest, $file_c);
}
/**
* Kopiert Dateien und Ordner rekursiv per FTP
* @param string source Zu kopierendes Verzeichniss
* @param string dest Ziel
*/
public function copy_req($source, $dest){
$source = preg_replace("!\/$!", '', $source);
if(!$this->list_files($source))
return false;
if(!$this->exists($dest))
if(!$this->mk_dir($dest))
return false;
$source_files = $this->list_files($source);
foreach($source_files as $file){
if($file == '.' || $file == '..' || $file == $source.'/.' || $file == $source.'/..')
continue;
if(!preg_match('!'.preg_replace('!^\/!', '', $source).'!', $file))
$file = $source.'/'.$file;
if($this->isdir($file))
$this->copy_req($file, str_replace($source, $dest, $file));
else{
$this->copy_file($file, str_replace($source, $dest, $file));
}
}
}
/**
* Löscht ein Verzeichniss rekursiv
* @param string dir Verzeichniss
*/
public function req_remove($dir){
$dir = preg_replace('!\/$!', '', $dir);
if(!$this->exists($dir)){
return true;
}
if($dir == '.' || $dir == '..')
return false;
if(!$this->isdir($dir)){
return $this->rm_file($dir);
}
if($this->_method == 'PHP'){
$this->_php_all_delete($this->rootdir.'/'.$dir);
} else {
$files = $this->list_files($dir);
foreach($files as $file){
if($file == '.' || $file == '..')
continue;
$file = $dir.'/'.$file;
$this->req_remove($file);
}
$this->rm_dir($dir);
}
}
public function isdir($file){
if(!$this->exists($file))
return false;
if($this->_method == 'PHP'){
return is_dir($this->rootdir.'/'.$file);
} else {
if(ftp_size($this->_connection, $file) == -1)
return true;
return false;
}
}
/**
* Schließt die FTP Verbindung
*/
public function disconnect() {
if($this->_method == 'PHP')
$this->connected = false;
else{
if (!$this->connected)
return false;
ftp_close($this->_connection);
$this->connected = false;
}
}
/**
* �berpr�ft ob die angegebene Datei/das Verzeichniss existiert
* @param string file
* @return bool
*/
public function exists($file) {
if($this->_method == 'PHP'){
return file_exists($this->rootdir.'/'.$file);
} else {
$dir = dirname($file);
$file = basename($file);
if($dir == '.')
$dir = '';
if($dir == '' && count($this->list_files($dir)) == 0)
$dir = '.';
if (@ in_array($file, @ $this->list_files($dir), '/'))
return true;
else
return false;
}
}
/**
* Deletes a Directory recursivly
* @param $verz Direcotory
* @param $folder foldersarray (ignore!)
* @return array, deletet folders
*/
private function _php_dir_delete($verz, $folder = array())
{
$folder[] = $verz;
$fp = opendir($verz);
while ($dir_file = readdir($fp))
{
if (($dir_file == '.') || ($dir_file == '..'))
continue;
$neu_file = $verz . '/' . $dir_file;
if (is_dir($neu_file))
$folder = $this->_php_dir_delete($neu_file, $folder);
else
unlink($neu_file);
}
closedir($fp);
return $folder;
}
/**
* Deletes all (dirs and files)
* @param $dir_file dir or file to delete
* @return bool
*/
private function _php_all_delete($dir_file)
{
if (is_dir($dir_file))
{
$array = $this->_php_dir_delete($dir_file);
$array = array_reverse($array);
foreach ($array as $elem)
rmdir($elem);
}
elseif (is_file($dir_file))
unlink($dir_file);
else
return false;
}
}
?> | extremmichi/Litotex-0.7 | setup/ftp_class.php | PHP | gpl-3.0 | 9,941 |
/*
* This file is part of EchoPet.
*
* EchoPet is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EchoPet is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EchoPet. If not, see <http://www.gnu.org/licenses/>.
*/
package com.dsh105.echopet.compat.nms.v1_14_R1.entity.type;
import com.dsh105.echopet.compat.api.entity.EntityPetType;
import com.dsh105.echopet.compat.api.entity.EntitySize;
import com.dsh105.echopet.compat.api.entity.IPet;
import com.dsh105.echopet.compat.api.entity.PetType;
import com.dsh105.echopet.compat.api.entity.SizeCategory;
import com.dsh105.echopet.compat.api.entity.type.nms.IEntityGiantPet;
import net.minecraft.server.v1_14_R1.EntityTypes;
import net.minecraft.server.v1_14_R1.World;
@EntitySize(width = 5.5F, height = 5.5F)
@EntityPetType(petType = PetType.GIANT)
public class EntityGiantPet extends EntityZombiePet implements IEntityGiantPet{
public EntityGiantPet(World world){
super(EntityTypes.GIANT, world);
}
public EntityGiantPet(World world, IPet pet){
super(EntityTypes.GIANT, world, pet);
}
@Override
public SizeCategory getSizeCategory(){
return SizeCategory.OVERSIZE;
}
}
| Borlea/EchoPet | modules/v1_14_R1/src/com/dsh105/echopet/compat/nms/v1_14_R1/entity/type/EntityGiantPet.java | Java | gpl-3.0 | 1,596 |
<?php
namespace GO\Base\Fs;
class MemoryFile extends File{
private $_data;
public function __construct($filename, $data) {
$this->_data = $data;
return parent::__construct($filename);
}
public function getContents() {
return $this->_data;
}
public function contents() {
return $this->_data;
}
public function putContents($data, $flags = null, $context = null) {
if($flags = FILE_APPEND){
$this->_data .= $data;
}else
{
$this->_data = $data;
}
}
public function size() {
return strlen($this->_data);
}
public function mtime() {
return time();
}
public function ctime() {
return time();
}
public function exists() {
return true;
}
public function move(Base $destinationFolder, $newFileName = false, $isUploadedFile = false, $appendNumberToNameIfDestinationExists = false) {
throw Exception("move not implemented for memory file");
}
public function copy(Folder $destinationFolder, $newFileName = false) {
throw Exception("copy not implemented for memory file");
}
public function parent() {
return false;
}
public function child($filename) {
throw Exception("child not possible for memory file");
}
public function createChild($filename, $isFile = true) {
throw Exception("createChild not possible for memory file");
}
/**
* Check if the file or folder is writable for the webserver user.
*
* @return boolean
*/
public function isWritable(){
return true;
}
/**
* Change owner
* @param StringHelper $user
* @return boolean
*/
public function chown($user){
return false;
}
/**
* Change group
*
* @param StringHelper $group
* @return boolean
*/
public function chgrp($group){
return false;
}
/**
*
* @param int $permissionsMode <p>
* Note that mode is not automatically
* assumed to be an octal value, so strings (such as "g+w") will
* not work properly. To ensure the expected operation,
* you need to prefix mode with a zero (0):
* </p>
*
* @return boolean
*/
public function chmod($permissionsMode){
return false;
}
/**
* Delete the file
*
* @return boolean
*/
public function delete(){
return false;
}
public function isFolder() {
return false;
}
/**
* Check if this object is a file.
*
* @return boolean
*/
public function isFile(){
return true;
}
public function rename($name){
$this->path=$name;
}
public function appendNumberToNameIfExists() {
return $this->path;
}
public function output() {
echo $this->_data;
}
public function setDefaultPermissions() {
}
public function md5Hash(){
return md5($this->_data);
}
}
| deependhulla/powermail-debian9 | files/rootdir/usr/local/src/groupoffice-6.3/go/base/fs/MemoryFile.php | PHP | gpl-3.0 | 2,677 |
<?PHP
require_once("./include/membersite_config.php");
if(isset($_POST['submitted']))
{
if($fgmembersite->RegisterUser())
{
require_once("config.php");
mkdir($dataDir);
mkdir($dataDir."CLASSTéléversés");
$fgmembersite->RedirectToURL("thank-you.html");
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<title>Register</title>
<link rel="STYLESHEET" type="text/css" href="style/fg_membersite.css" />
<script type='text/javascript' src='scripts/gen_validatorv31.js'></script>
<link rel="STYLESHEET" type="text/css" href="style/pwdwidget.css" />
<script src="scripts/pwdwidget.js" type="text/javascript"></script>
</head>
<body>
<!-- Form Code Start -->
<div id='fg_membersite'>
<form id='register' action='<?php echo $fgmembersite->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'>
<fieldset >
<legend>Register</legend>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<div class='short_explanation'>* required fields</div>
<input type='text' class='spmhidip' name='<?php echo $fgmembersite->GetSpamTrapInputName(); ?>' />
<div><span class='error'><?php echo $fgmembersite->GetErrorMessage(); ?></span></div>
<div class='container'>
<label for='name' >Your Full Name*: </label><br/>
<input type='text' name='name' id='name' value='<?php echo $fgmembersite->SafeDisplay('name') ?>' maxlength="50" /><br/>
<span id='register_name_errorloc' class='error'></span>
</div>
<div class='container'>
<label for='email' >Email Address*:</label><br/>
<input type='text' name='email' id='email' value='<?php echo $fgmembersite->SafeDisplay('email') ?>' maxlength="50" /><br/>
<span id='register_email_errorloc' class='error'></span>
</div>
<div class='container'>
<label for='username' >UserName*:</label><br/>
<input type='text' name='username' id='username' value='<?php echo $fgmembersite->SafeDisplay('username') ?>' maxlength="50" /><br/>
<span id='register_username_errorloc' class='error'></span>
</div>
<div class='container' style='height:80px;'>
<label for='password' >Password*:</label><br/>
<div class='pwdwidgetdiv' id='thepwddiv' ></div>
<noscript>
<input type='password' name='password' id='password' maxlength="50" />
</noscript>
<div id='register_password_errorloc' class='error' style='clear:both'></div>
</div>
<div class='container'>
<input type='submit' name='Submit' value='Submit' />
</div>
</fieldset>
</form>
<!-- client-side Form Validations:
Uses the excellent form validation script from JavaScript-coder.com-->
<script type='text/javascript'>
// <![CDATA[
var pwdwidget = new PasswordWidget('thepwddiv','password');
pwdwidget.MakePWDWidget();
var frmvalidator = new Validator("register");
frmvalidator.EnableOnPageErrorDisplay();
frmvalidator.EnableMsgsTogether();
frmvalidator.addValidation("name","req","Please provide your name");
frmvalidator.addValidation("email","req","Please provide your email address");
frmvalidator.addValidation("email","email","Please provide a valid email address");
frmvalidator.addValidation("username","req","Please provide a username");
frmvalidator.addValidation("password","req","Please provide a password");
// ]]>
</script>
<!--
Form Code End (see html-form-guide.com for more info.)
-->
</body>
</html> | LaboManu/bloc-notes | app/register.php | PHP | gpl-3.0 | 3,638 |
/*
* Copyright (C) 2006-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.jlan.server.filesys;
import org.alfresco.jlan.server.SrvSession;
/**
* Transactional Filesystem Interface
*
* <p>Optional interface that a filesystem driver can implement to add support for transactions around filesystem calls.
*
* @author gkspencer
*/
public interface TransactionalFilesystemInterface {
/**
* Begin a read-only transaction
*
* @param sess SrvSession
*/
public void beginReadTransaction(SrvSession sess);
/**
* Begin a writeable transaction
*
* @param sess SrvSession
*/
public void beginWriteTransaction(SrvSession sess);
/**
* End an active transaction
*
* @param sess SrvSession
* @param tx Object
*/
public void endTransaction(SrvSession sess, Object tx);
}
| arcusys/Liferay-CIFS | source/java/org/alfresco/jlan/server/filesys/TransactionalFilesystemInterface.java | Java | gpl-3.0 | 1,957 |
/*
* This file is part of InTEL, the Interactive Toolkit for Engineering Learning.
* http://intel.gatech.edu
*
* InTEL is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* InTEL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with InTEL. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package keyboard;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.system.DisplaySystem;
import edu.gatech.statics.application.StaticsApplication;
import edu.gatech.statics.exercise.Diagram;
import edu.gatech.statics.exercise.DiagramType;
import edu.gatech.statics.exercise.Schematic;
import edu.gatech.statics.math.Unit;
import edu.gatech.statics.math.Vector3bd;
import edu.gatech.statics.modes.description.Description;
import edu.gatech.statics.modes.equation.EquationDiagram;
import edu.gatech.statics.modes.equation.EquationMode;
import edu.gatech.statics.modes.equation.EquationState;
import edu.gatech.statics.modes.equation.worksheet.TermEquationMathState;
import edu.gatech.statics.modes.frame.FrameExercise;
import edu.gatech.statics.objects.Body;
import edu.gatech.statics.objects.DistanceMeasurement;
import edu.gatech.statics.objects.Force;
import edu.gatech.statics.objects.Point;
import edu.gatech.statics.objects.bodies.Bar;
import edu.gatech.statics.objects.bodies.Beam;
import edu.gatech.statics.objects.connectors.Connector2ForceMember2d;
import edu.gatech.statics.objects.connectors.Pin2d;
import edu.gatech.statics.objects.connectors.Roller2d;
import edu.gatech.statics.objects.representations.ModelNode;
import edu.gatech.statics.objects.representations.ModelRepresentation;
import edu.gatech.statics.tasks.Solve2FMTask;
import edu.gatech.statics.ui.AbstractInterfaceConfiguration;
import edu.gatech.statics.ui.windows.navigation.Navigation3DWindow;
import edu.gatech.statics.ui.windows.navigation.ViewConstraints;
import java.math.BigDecimal;
import java.util.Map;
/**
*
* @author Calvin Ashmore
*/
public class KeyboardExercise extends FrameExercise {
@Override
public AbstractInterfaceConfiguration createInterfaceConfiguration() {
AbstractInterfaceConfiguration ic = super.createInterfaceConfiguration();
ic.setNavigationWindow(new Navigation3DWindow());
ic.setCameraSpeed(.2f, 0.02f, .05f);
ViewConstraints vc = new ViewConstraints();
vc.setPositionConstraints(-2, 2, -1, 4);
vc.setZoomConstraints(0.5f, 1.5f);
vc.setRotationConstraints(-5, 5, 0, 5);
ic.setViewConstraints(vc);
return ic;
}
@Override
public Description getDescription() {
Description description = new Description();
description.setTitle("Keyboard Stand");
description.setNarrative(
"Kasiem Hill is in a music group comprised of Civil Engineering " +
"students from Georgia Tech, in which he plays the keyboard. " +
"For his birthday, he received a new keyboard, but it is much bigger " +
"(both in size and weight) than his last one, so he needs to buy a " +
"new keyboard stand. He finds one he really likes from a local " +
"dealer and is unsure if the connections will be able to support " +
"the weight of the new keyboard. He measures the dimensions of " +
"the stand and he wants to calculate how much force he can expect " +
"at each connection in the cross bar before he makes the investment.");
description.setProblemStatement(
"The stand can be modeled as a frame and is supported by two beams and a cross bar PQ. " +
"The supports at B and E are rollers and the floor is frictionless.");
description.setGoals(
"Find the force in PQ and define whether it is in tension or compression.");
description.addImage("keyboard/assets/keyboard 1.png");
description.addImage("keyboard/assets/keyboard 2.jpg");
description.addImage("keyboard/assets/keyboard 3.jpg");
return description;
}
@Override
public void initExercise() {
// setName("Keyboard Stand");
//
// setDescription(
// "This is a keyboard stand supported by two beams and a cross bar, PQ. " +
// "Find the force in PQ and define whether it is in tension or compression. " +
// "The supports at B and E are rollers, and the floor is frictionless.");
Unit.setSuffix(Unit.distance, " m");
Unit.setSuffix(Unit.moment, " N*m");
Unit.setDisplayScale(Unit.distance, new BigDecimal("10"));
getDisplayConstants().setMomentSize(0.5f);
getDisplayConstants().setForceSize(0.5f);
getDisplayConstants().setPointSize(0.5f);
getDisplayConstants().setCylinderRadius(0.5f);
//getDisplayConstants().setForceLabelDistance(1f);
//getDisplayConstants().setMomentLabelDistance(0f);
//getDisplayConstants().setMeasurementBarSize(0.1f);
// 10/21/2010 HOTFIX: THIS CORRECTS AN ISSUE IN WHICH OBSERVATION DIRECTION IS SET TO NULL IN EQUATIONS
for (Map<DiagramType, Diagram> diagramMap : getState().allDiagrams().values()) {
EquationDiagram eqDiagram = (EquationDiagram) diagramMap.get(EquationMode.instance.getDiagramType());
if(eqDiagram == null) continue;
EquationState.Builder builder = new EquationState.Builder(eqDiagram.getCurrentState());
TermEquationMathState.Builder xBuilder = new TermEquationMathState.Builder((TermEquationMathState) builder.getEquationStates().get("F[x]"));
xBuilder.setObservationDirection(Vector3bd.UNIT_X);
TermEquationMathState.Builder yBuilder = new TermEquationMathState.Builder((TermEquationMathState) builder.getEquationStates().get("F[y]"));
yBuilder.setObservationDirection(Vector3bd.UNIT_Y);
TermEquationMathState.Builder zBuilder = new TermEquationMathState.Builder((TermEquationMathState) builder.getEquationStates().get("M[p]"));
zBuilder.setObservationDirection(Vector3bd.UNIT_Z);
builder.putEquationState(xBuilder.build());
builder.putEquationState(yBuilder.build());
builder.putEquationState(zBuilder.build());
eqDiagram.pushState(builder.build());
eqDiagram.clearStateStack();
}
}
Point A, B, C, D, E, P, Q;
Pin2d jointC;
Connector2ForceMember2d jointP, jointQ;
Roller2d jointB, jointE;
Body leftLeg, rightLeg;
Bar bar;
@Override
public void loadExercise() {
Schematic schematic = getSchematic();
DisplaySystem.getDisplaySystem().getRenderer().setBackgroundColor(new ColorRGBA(.7f, .8f, .9f, 1.0f));
StaticsApplication.getApp().getCamera().setLocation(new Vector3f(0.0f, 0.0f, 65.0f));
A = new Point("A", "0", "6", "0");
D = new Point("D", "8", "6", "0");
B = new Point("B", "8", "0", "0");
E = new Point("E", "0", "0", "0");
C = new Point("C", "4", "3", "0");
P = new Point("P", "2.7", "4", "0");
Q = new Point("Q", "5.3", "4", "0");
leftLeg = new Beam("Left Leg", B, A);
bar = new Bar("Bar", P, Q);
rightLeg = new Beam("Right Leg", E, D);
jointC = new Pin2d(C);
jointP = new Connector2ForceMember2d(P, bar); //Pin2d(P);
jointQ = new Connector2ForceMember2d(Q, bar); //new Pin2d(Q);
jointB = new Roller2d(B);
jointE = new Roller2d(E);
jointB.setDirection(Vector3bd.UNIT_Y);
jointE.setDirection(Vector3bd.UNIT_Y);
DistanceMeasurement distance1 = new DistanceMeasurement(D, A);
distance1.setName("Measure AD");
distance1.createDefaultSchematicRepresentation(0.5f);
distance1.addPoint(E);
distance1.addPoint(B);
schematic.add(distance1);
DistanceMeasurement distance2 = new DistanceMeasurement(C, D);
distance2.setName("Measure CD");
distance2.createDefaultSchematicRepresentation(0.5f);
distance2.forceVertical();
distance2.addPoint(A);
schematic.add(distance2);
DistanceMeasurement distance3 = new DistanceMeasurement(C, Q);
distance3.setName("Measure CQ");
distance3.createDefaultSchematicRepresentation(1f);
distance3.forceVertical();
distance3.addPoint(P);
schematic.add(distance3);
DistanceMeasurement distance4 = new DistanceMeasurement(B, D);
distance4.setName("Measure BD");
distance4.createDefaultSchematicRepresentation(2.4f);
distance4.addPoint(A);
distance4.addPoint(E);
schematic.add(distance4);
Force keyboardLeft = new Force(A, Vector3bd.UNIT_Y.negate(), new BigDecimal(50));
keyboardLeft.setName("Keyboard Left");
leftLeg.addObject(keyboardLeft);
Force keyboardRight = new Force(D, Vector3bd.UNIT_Y.negate(), new BigDecimal(50));
keyboardRight.setName("Keyboard Right");
rightLeg.addObject(keyboardRight);
jointC.attach(leftLeg, rightLeg);
jointC.setName("Joint C");
jointP.attach(leftLeg, bar);
jointP.setName("Joint P");
jointQ.attach(bar, rightLeg);
jointQ.setName("Joint Q");
jointE.attachToWorld(rightLeg);
jointE.setName("Joint E");
jointB.attachToWorld(leftLeg);
jointB.setName("Joint B");
A.createDefaultSchematicRepresentation();
B.createDefaultSchematicRepresentation();
C.createDefaultSchematicRepresentation();
D.createDefaultSchematicRepresentation();
E.createDefaultSchematicRepresentation();
P.createDefaultSchematicRepresentation();
Q.createDefaultSchematicRepresentation();
keyboardLeft.createDefaultSchematicRepresentation();
keyboardRight.createDefaultSchematicRepresentation();
//leftLeg.createDefaultSchematicRepresentation();
//bar.createDefaultSchematicRepresentation();
//rightLeg.createDefaultSchematicRepresentation();
schematic.add(leftLeg);
schematic.add(bar);
schematic.add(rightLeg);
ModelNode modelNode = ModelNode.load("keyboard/assets/", "keyboard/assets/keyboard.dae");
float scale = .28f;
ModelRepresentation rep = modelNode.extractElement(leftLeg, "VisualSceneNode/stand/leg1");
rep.setLocalScale(scale);
rep.setModelOffset(new Vector3f(14f, 0, 0));
leftLeg.addRepresentation(rep);
rep.setSynchronizeRotation(false);
rep.setSynchronizeTranslation(false);
rep.setHoverLightColor(ColorRGBA.yellow);
rep.setSelectLightColor(ColorRGBA.yellow);
rep = modelNode.extractElement(rightLeg, "VisualSceneNode/stand/leg2");
rep.setLocalScale(scale);
rep.setModelOffset(new Vector3f(14f, 0, 0));
rightLeg.addRepresentation(rep);
rep.setSynchronizeRotation(false);
rep.setSynchronizeTranslation(false);
rep.setHoverLightColor(ColorRGBA.yellow);
rep.setSelectLightColor(ColorRGBA.yellow);
rep = modelNode.extractElement(bar, "VisualSceneNode/stand/middle_support");
rep.setLocalScale(scale);
rep.setModelOffset(new Vector3f(14f, 0, 0));
bar.addRepresentation(rep);
rep.setSynchronizeRotation(false);
rep.setSynchronizeTranslation(false);
rep.setHoverLightColor(ColorRGBA.yellow);
rep.setSelectLightColor(ColorRGBA.yellow);
rep = modelNode.getRemainder(schematic.getBackground());
schematic.getBackground().addRepresentation(rep);
rep.setLocalScale(scale);
rep.setModelOffset(new Vector3f(14f, 0, 0));
rep.setSynchronizeRotation(false);
rep.setSynchronizeTranslation(false);
addTask(new Solve2FMTask("Solve PQ", bar, jointP));
}
}
| jogjayr/InTEL-Project | exercises/Keyboard/src/keyboard/KeyboardExercise.java | Java | gpl-3.0 | 12,512 |
<?php
/**
* Online Course Resources [Pre-Clerkship]
* Module: Courses
* Area: Admin
* @author Unit: Medical Education Technology Unit
* @author Director: Dr. Benjamin Chen <bhc@post.queensu.ca>
* @author Developer: James Ellis <james.ellis@queensu.ca>
* @version 0.8.3
* @copyright Copyright 2009 Queen's University, MEdTech Unit
*
* $Id: add.inc.php 505 2009-07-09 19:15:57Z jellis $
*/
@set_include_path(implode(PATH_SEPARATOR, array(
dirname(__FILE__) . "/../core",
dirname(__FILE__) . "/../core/includes",
dirname(__FILE__) . "/../core/library",
dirname(__FILE__) . "/../core/library/vendor",
get_include_path(),
)));
/**
* Include the Entrada init code.
*/
require_once("init.inc.php");
if((!isset($_SESSION["isAuthorized"])) || (!$_SESSION["isAuthorized"])) {
header("Location: ".ENTRADA_URL);
exit;
} else {
/**
* Clears all open buffers so we can return a simple REST response.
*/
ob_clear_open_buffers();
$id = (int) $_GET["objective_id"];
$course_id = (int) (isset($_GET["course_id"]) ? $_GET["course_id"] : false);
$event_id = (int) (isset($_GET["event_id"]) ? $_GET["event_id"] : false);
$assessment_id = (int) (isset($_GET["assessment_id"]) ? $_GET["assessment_id"] : false);
$org_id = (int) (isset($_GET["org_id"]) ? $_GET["org_id"] : (isset($ENTRADA_USER) && $ENTRADA_USER->getActiveOrganisation() ? $ENTRADA_USER->getActiveOrganisation() : false));
$objective_ids_string = "";
if (isset($_GET["objective_ids"]) && ($objective_ids = explode(",", $_GET["objective_ids"])) && @count($objective_ids)) {
foreach ($objective_ids as $objective_id) {
$objective_ids_string .= ($objective_ids_string ? ", " : "").$db->qstr($objective_id);
}
}
$select = "a.*";
if ($course_id) {
$select .= ", COALESCE(b.`cobjective_id`, 0) AS `mapped`";
} elseif ($event_id) {
$select .= ", COALESCE(b.`eobjective_id`, 0) AS `mapped`";
} elseif ($assessment_id) {
$select .= ", COALESCE(b.`aobjective_id`, 0) AS `mapped`";
} elseif ($objective_ids_string) {
$select .= ", COALESCE(b.`objective_id`, 0) AS `mapped`";
}
$qu_arr = array("SELECT ".$select." FROM `global_lu_objectives` a");
if ($course_id) {
$qu_arr[1] = " LEFT JOIN `course_objectives` b
ON a.`objective_id` = b.`objective_id`
AND b.`course_id` = ".$db->qstr($course_id);
} elseif ($event_id) {
$qu_arr[1] = " LEFT JOIN `event_objectives` b
ON a.`objective_id` = b.`objective_id`
AND b.`event_id` = ".$db->qstr($event_id);
} elseif ($assessment_id) {
$qu_arr[1] = " LEFT JOIN `assessment_objectives` b
ON a.`objective_id` = b.`objective_id`
AND b.`assessment_id` = ".$db->qstr($assessment_id);
} elseif ($objective_ids_string) {
$qu_arr[1] = " LEFT JOIN `global_lu_objectives` AS b
ON a.`objective_id` = b.`objective_id`
AND b.`objective_id` IN (".$objective_ids_string.")";
} else {
$qu_arr[1] = "";
}
$qu_arr[1] .= " JOIN `objective_organisation` AS c ON a.`objective_id` = c.`objective_id` ";
$qu_arr[2] = " WHERE a.`objective_parent` = ".$db->qstr($id)."
AND a.`objective_active` = '1'
AND c.`organisation_id` = ".$db->qstr($org_id);
$qu_arr[4] = " ORDER BY a.`objective_order`";
$query = implode(" ",$qu_arr);
$objectives = $db->GetAll($query);
if ($objectives) {
$obj_array = array();
foreach($objectives as $objective){
$fields = array( 'objective_id'=>$objective["objective_id"],
'objective_code'=>$objective["objective_code"],
'objective_name'=>$objective["objective_name"],
'objective_description'=>$objective["objective_description"]
);
if ($course_id || $event_id || $assessment_id || $objective_ids_string){
$fields["mapped"] = $objective["mapped"];
if ($course_id) {
$fields["child_mapped"] = course_objective_has_child_mapped($objective["objective_id"],$course_id,true);
} else if ($event_id) {
$fields["child_mapped"] = event_objective_parent_mapped_course($objective["objective_id"],$event_id,true);
} else if ($assessment_id) {
$fields["child_mapped"] = assessment_objective_parent_mapped_course($objective["objective_id"],$assessment_id,true);
}
}
$query = " SELECT a.* FROM `global_lu_objectives` AS a
JOIN `objective_organisation` AS b ON a.`objective_id` = b.`objective_id`
WHERE a.`objective_parent` = ".$db->qstr($objective["objective_id"])."
AND b.`organisation_id` = ".$db->qstr($org_id);
$fields["has_child"] = $db->GetAll($query) ? true : false;
$obj_array[] = $fields;
}
echo json_encode($obj_array);
} else {
echo json_encode(array('error'=>'No child objectives found for the selected objective.'));
}
exit;
} | EntradaProject/entrada-1x | www-root/api/fetchobjectives.api.php | PHP | gpl-3.0 | 4,728 |
import time
from datetime import datetime
from pydoc import locate
from unittest import SkipTest
from countries_plus.models import Country
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
from django.test import override_settings, tag
from django.urls import reverse
from django.utils import timezone
from django.utils.timezone import make_aware
from elasticsearch.client import IngestClient
from elasticsearch.exceptions import ConnectionError
from elasticsearch_dsl.connections import (
connections,
get_connection as get_es_connection,
)
from languages_plus.models import Language
from rest_framework import status
from rest_framework.test import APITestCase, APITransactionTestCase
from ESSArch_Core.agents.models import (
Agent,
AgentTagLink,
AgentTagLinkRelationType,
AgentType,
MainAgentType,
RefCode,
)
from ESSArch_Core.auth.models import Group, GroupType
from ESSArch_Core.configuration.models import Feature
from ESSArch_Core.ip.models import InformationPackage
from ESSArch_Core.maintenance.models import AppraisalJob
from ESSArch_Core.search import alias_migration
from ESSArch_Core.tags.documents import (
Archive,
Component,
File,
StructureUnitDocument,
)
from ESSArch_Core.tags.models import (
Structure,
StructureType,
StructureUnit,
StructureUnitType,
Tag,
TagStructure,
TagVersion,
TagVersionType,
)
User = get_user_model()
def get_test_client(nowait=False):
client = get_es_connection('default')
# wait for yellow status
for _ in range(1 if nowait else 5):
try:
client.cluster.health(wait_for_status="yellow")
return client
except ConnectionError:
time.sleep(0.1)
else:
# timeout
raise SkipTest("Elasticsearch failed to start")
class ESSArchSearchBaseTestCaseMixin:
@staticmethod
def _get_client():
return get_test_client()
@classmethod
def setUpClass(cls):
if cls._overridden_settings:
cls._cls_overridden_context = override_settings(**cls._overridden_settings)
cls._cls_overridden_context.enable()
connections.configure(**settings.ELASTICSEARCH_CONNECTIONS)
cls.es_client = cls._get_client()
IngestClient(cls.es_client).put_pipeline(id='ingest_attachment', body={
'description': "Extract attachment information",
'processors': [
{
"attachment": {
"field": "data",
"indexed_chars": "-1"
},
"remove": {
"field": "data"
}
}
]
})
super().setUpClass()
def setUp(self):
for _index_name, index_class in settings.ELASTICSEARCH_INDEXES['default'].items():
doctype = locate(index_class)
alias_migration.setup_index(doctype)
def tearDown(self):
self.es_client.indices.delete(index="*", ignore=404)
self.es_client.indices.delete_template(name="*", ignore=404)
@override_settings(ELASTICSEARCH_CONNECTIONS=settings.ELASTICSEARCH_TEST_CONNECTIONS)
@tag('requires-elasticsearch')
class ESSArchSearchBaseTestCase(ESSArchSearchBaseTestCaseMixin, APITestCase):
pass
@override_settings(ELASTICSEARCH_CONNECTIONS=settings.ELASTICSEARCH_TEST_CONNECTIONS)
@tag('requires-elasticsearch')
class ESSArchSearchBaseTransactionTestCase(ESSArchSearchBaseTestCaseMixin, APITransactionTestCase):
pass
class ComponentSearchTestCase(ESSArchSearchBaseTestCase):
fixtures = ['countries_data', 'languages_data']
@classmethod
def setUpTestData(cls):
cls.url = reverse('search-list')
Feature.objects.create(name='archival descriptions', enabled=True)
cls.user = User.objects.create()
permission = Permission.objects.get(codename='search')
cls.user.user_permissions.add(permission)
org_group_type = GroupType.objects.create(codename='organization')
cls.group1 = Group.objects.create(name='group1', group_type=org_group_type)
cls.group1.add_member(cls.user.essauth_member)
cls.group2 = Group.objects.create(name='group2', group_type=org_group_type)
cls.group2.add_member(cls.user.essauth_member)
cls.component_type = TagVersionType.objects.create(name='component', archive_type=False)
cls.archive_type = TagVersionType.objects.create(name='archive', archive_type=True)
def setUp(self):
super().setUp()
self.client.force_authenticate(user=self.user)
@staticmethod
def create_agent():
return Agent.objects.create(
type=AgentType.objects.create(main_type=MainAgentType.objects.create()),
ref_code=RefCode.objects.create(
country=Country.objects.get(iso='SE'),
repository_code='repo',
),
level_of_detail=0,
record_status=0,
script=0,
language=Language.objects.get(iso_639_1='sv'),
create_date=timezone.now(),
)
def test_search_component(self):
component_tag = Tag.objects.create()
component_tag_version = TagVersion.objects.create(
tag=component_tag,
type=self.component_type,
elastic_index="component",
)
Component.from_obj(component_tag_version).save(refresh='true')
with self.subTest('without archive'):
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
structure_type = StructureType.objects.create()
structure_template = Structure.objects.create(type=structure_type, is_template=True)
archive_tag = Tag.objects.create()
archive_tag_version = TagVersion.objects.create(
tag=archive_tag,
type=self.archive_type,
elastic_index="archive",
)
self.group1.add_object(archive_tag_version)
structure, archive_tag_structure = structure_template.create_template_instance(archive_tag)
Archive.from_obj(archive_tag_version).save(refresh='true')
TagStructure.objects.create(tag=component_tag, parent=archive_tag_structure, structure=structure)
Component.index_documents(remove_stale=True)
with self.subTest('with archive'):
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
self.assertEqual(res.data['hits'][0]['_id'], str(component_tag_version.pk))
with self.subTest('with archive, non-active organization'):
self.user.user_profile.current_organization = self.group2
self.user.user_profile.save()
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 0)
def test_filter_on_component_agent(self):
agent = self.create_agent()
component_tag = Tag.objects.create()
component_tag_version = TagVersion.objects.create(
tag=component_tag,
type=self.component_type,
elastic_index="component",
)
structure_type = StructureType.objects.create()
structure_template = Structure.objects.create(type=structure_type, is_template=True)
archive_tag = Tag.objects.create()
archive_tag_version = TagVersion.objects.create(
tag=archive_tag,
type=self.archive_type,
elastic_index="archive",
)
structure, archive_tag_structure = structure_template.create_template_instance(archive_tag)
Archive.from_obj(archive_tag_version).save(refresh='true')
TagStructure.objects.create(tag=component_tag, parent=archive_tag_structure, structure=structure)
AgentTagLink.objects.create(
agent=agent,
tag=component_tag_version,
type=AgentTagLinkRelationType.objects.create(),
)
Component.from_obj(component_tag_version).save(refresh='true')
res = self.client.get(self.url, {'agents': str(agent.pk)})
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
self.assertEqual(res.data['hits'][0]['_id'], str(component_tag_version.pk))
def test_filter_on_archive_agent(self):
agent = self.create_agent()
component_tag = Tag.objects.create()
component_tag_version = TagVersion.objects.create(
tag=component_tag,
type=self.component_type,
elastic_index="component",
)
structure_type = StructureType.objects.create()
structure_template = Structure.objects.create(type=structure_type, is_template=True)
archive_tag = Tag.objects.create()
archive_tag_version = TagVersion.objects.create(
tag=archive_tag,
type=self.archive_type,
elastic_index="archive",
)
structure, archive_tag_structure = structure_template.create_template_instance(archive_tag)
Archive.from_obj(archive_tag_version).save(refresh='true')
TagStructure.objects.create(tag=component_tag, parent=archive_tag_structure, structure=structure)
AgentTagLink.objects.create(
agent=agent,
tag=archive_tag_version,
type=AgentTagLinkRelationType.objects.create(),
)
Component.from_obj(component_tag_version).save(refresh='true')
res = self.client.get(self.url, {'agents': str(agent.pk)})
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
self.assertEqual(res.data['hits'][0]['_id'], str(component_tag_version.pk))
def test_filter_appraisal_date(self):
component_tag = Tag.objects.create(appraisal_date=make_aware(datetime(year=2020, month=1, day=1)))
component_tag_version = TagVersion.objects.create(
tag=component_tag,
type=self.component_type,
elastic_index="component",
)
doc = Component.from_obj(component_tag_version)
doc.save(refresh='true')
with self.subTest('2020-01-01 is after or equal to 2020-01-01'):
res = self.client.get(self.url, data={'appraisal_date_after': '2020-01-01'})
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
with self.subTest('2020-01-01 not after 2020-01-02'):
res = self.client.get(self.url, data={'appraisal_date_after': '2020-01-02'})
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 0)
with self.subTest('2020-01-01 not before 2019-12-31'):
res = self.client.get(self.url, data={'appraisal_date_before': '2019-12-31'})
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 0)
with self.subTest('2020-01-01 between 2019-01-01 and 2020-01-01'):
res = self.client.get(self.url, data={
'appraisal_date_after': '2019-01-01',
'appraisal_date_before': '2020-01-01',
})
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
with self.subTest('2020-01-01 between 2020-01-01 and 2020-12-31'):
res = self.client.get(self.url, data={
'appraisal_date_after': '2020-01-01',
'appraisal_date_before': '2020-12-31',
})
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
with self.subTest('2020-01-01 not between 2020-01-02 and 2020-12-31'):
res = self.client.get(self.url, data={
'appraisal_date_after': '2020-01-02',
'appraisal_date_before': '2020-12-31',
})
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 0)
with self.subTest('2020-01-01 not between 2019-01-01 and 2019-12-31'):
res = self.client.get(self.url, data={
'appraisal_date_after': '2019-01-01',
'appraisal_date_before': '2019-12-31',
})
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 0)
with self.subTest('invalid range 2020-12-31 - 2020-01-01'):
res = self.client.get(self.url, data={
'appraisal_date_after': '2020-12-31',
'appraisal_date_before': '2020-01-01',
})
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_add_results_to_appraisal(self):
component_tag = Tag.objects.create()
component_tag_version = TagVersion.objects.create(
name='foo',
tag=component_tag,
type=self.component_type,
elastic_index="component",
)
Component.from_obj(component_tag_version).save(refresh='true')
component_tag2 = Tag.objects.create()
component_tag_version2 = TagVersion.objects.create(
name='bar',
tag=component_tag2,
type=self.component_type,
elastic_index="component",
)
Component.from_obj(component_tag_version2).save(refresh='true')
# test that we don't try to add structure units matched by query to job
structure = Structure.objects.create(type=StructureType.objects.create(), is_template=False)
structure_unit = StructureUnit.objects.create(
name='foo',
structure=structure, type=StructureUnitType.objects.create(structure_type=structure.type),
)
StructureUnitDocument.from_obj(structure_unit).save(refresh='true')
appraisal_job = AppraisalJob.objects.create()
res = self.client.get(self.url, data={
'q': 'foo',
'add_to_appraisal': appraisal_job.pk
})
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertCountEqual(appraisal_job.tags.all(), [component_tag])
res = self.client.get(self.url, data={
'add_to_appraisal': appraisal_job.pk
})
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertCountEqual(appraisal_job.tags.all(), [component_tag, component_tag2])
class DocumentSearchTestCase(ESSArchSearchBaseTestCase):
fixtures = ['countries_data', 'languages_data']
@classmethod
def setUpTestData(cls):
cls.url = reverse('search-list')
Feature.objects.create(name='archival descriptions', enabled=True)
org_group_type = GroupType.objects.create(codename='organization')
cls.group = Group.objects.create(group_type=org_group_type)
cls.component_type = TagVersionType.objects.create(name='component', archive_type=False)
cls.archive_type = TagVersionType.objects.create(name='archive', archive_type=True)
def setUp(self):
super().setUp()
permission = Permission.objects.get(codename='search')
self.user = User.objects.create()
self.user.user_permissions.add(permission)
self.group.add_member(self.user.essauth_member)
self.client.force_authenticate(user=self.user)
def test_search_document_in_ip_with_other_user_responsible_without_permission_to_see_it(self):
other_user = User.objects.create(username='other')
self.group.add_member(other_user.essauth_member)
ip = InformationPackage.objects.create(responsible=other_user)
self.group.add_object(ip)
document_tag = Tag.objects.create(information_package=ip)
document_tag_version = TagVersion.objects.create(
tag=document_tag,
type=self.component_type,
elastic_index="document",
)
File.from_obj(document_tag_version).save(refresh='true')
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 0)
def test_search_document_in_ip_with_other_user_responsible_with_permission_to_see_it(self):
self.user.user_permissions.add(Permission.objects.get(codename='see_other_user_ip_files'))
other_user = User.objects.create(username='other')
self.group.add_member(other_user.essauth_member)
ip = InformationPackage.objects.create(responsible=other_user)
self.group.add_object(ip)
document_tag = Tag.objects.create(information_package=ip)
document_tag_version = TagVersion.objects.create(
tag=document_tag,
type=self.component_type,
elastic_index="document",
)
File.from_obj(document_tag_version).save(refresh='true')
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
self.assertEqual(res.data['hits'][0]['_id'], str(document_tag_version.pk))
class SecurityLevelTestCase(ESSArchSearchBaseTestCase):
fixtures = ['countries_data', 'languages_data']
@classmethod
def setUpTestData(cls):
cls.url = reverse('search-list')
Feature.objects.create(name='archival descriptions', enabled=True)
cls.component_type = TagVersionType.objects.create(name='component', archive_type=False)
cls.security_levels = [1, 2, 3, 4, 5]
def setUp(self):
super().setUp()
self.user = User.objects.create()
permission = Permission.objects.get(codename='search')
self.user.user_permissions.add(permission)
self.client.force_authenticate(user=self.user)
def test_user_with_no_security_level(self):
component_tag = Tag.objects.create()
component_tag_version = TagVersion.objects.create(
tag=component_tag,
type=self.component_type,
elastic_index="component",
security_level=None,
)
Component.from_obj(component_tag_version).save(refresh='true')
with self.subTest('no security level'):
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
self.assertEqual(res.data['hits'][0]['_id'], str(component_tag_version.pk))
for lvl in self.security_levels[1:]:
with self.subTest(f'security level {lvl}'):
component_tag_version.security_level = lvl
component_tag_version.save()
Component.from_obj(component_tag_version).save(refresh='true')
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 0)
def test_user_with_security_level_3(self):
self.user.user_permissions.add(Permission.objects.get(codename='security_level_3'))
self.user = User.objects.get(pk=self.user.pk)
component_tag = Tag.objects.create()
component_tag_version = TagVersion.objects.create(
tag=component_tag,
type=self.component_type,
elastic_index="component",
security_level=None,
)
Component.from_obj(component_tag_version).save(refresh='true')
with self.subTest('no security level'):
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
self.assertEqual(res.data['hits'][0]['_id'], str(component_tag_version.pk))
for lvl in self.security_levels:
with self.subTest(f'security level {lvl}'):
component_tag_version.security_level = lvl
component_tag_version.save()
Component.from_obj(component_tag_version).save(refresh='true')
if lvl == 3:
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
self.assertEqual(res.data['hits'][0]['_id'], str(component_tag_version.pk))
else:
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 0)
def test_user_with_multiple_security_levels(self):
self.user.user_permissions.add(
Permission.objects.get(codename='security_level_1'),
Permission.objects.get(codename='security_level_3'),
)
self.user = User.objects.get(pk=self.user.pk)
component_tag = Tag.objects.create()
component_tag_version = TagVersion.objects.create(
tag=component_tag,
type=self.component_type,
elastic_index="component",
security_level=None,
)
Component.from_obj(component_tag_version).save(refresh='true')
with self.subTest('no security level'):
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
self.assertEqual(res.data['hits'][0]['_id'], str(component_tag_version.pk))
for lvl in self.security_levels:
with self.subTest(f'security level {lvl}'):
component_tag_version.security_level = lvl
component_tag_version.save()
Component.from_obj(component_tag_version).save(refresh='true')
if lvl in [1, 3]:
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 1)
self.assertEqual(res.data['hits'][0]['_id'], str(component_tag_version.pk))
else:
res = self.client.get(self.url)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['hits']), 0)
| ESSolutions/ESSArch_Core | ESSArch_Core/tags/tests/test_search.py | Python | gpl-3.0 | 22,665 |
/**
* Bukkit plugin which moves the mobs closer to the players.
* Copyright (C) 2016 Jakub "Co0sh" Sapalski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package pl.betoncraft.hordes;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
/**
* Blocks the mobs from spawning in unwanted places.
*
* @author Jakub Sapalski
*/
public class Blocker implements Listener {
private Hordes plugin;
private Random rand = new Random();
/**
* Starts the blocker.
*
* @param plugin
* instance of the plugin
*/
public Blocker(Hordes plugin) {
this.plugin = plugin;
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onSpawn(CreatureSpawnEvent event) {
LivingEntity e = event.getEntity();
WorldSettings set = plugin.getWorlds().get(event.getEntity().getWorld().getName());
if (set == null) {
return;
}
if (!set.getEntities().contains(e.getType())) {
return;
}
if (!set.shouldExist(e)) {
event.setCancelled(true);
} else if (rand.nextDouble() > set.getRatio(e.getType())) {
event.setCancelled(true);
} else {
AttributeInstance maxHealth = e.getAttribute(Attribute.GENERIC_MAX_HEALTH);
maxHealth.setBaseValue(maxHealth.getBaseValue() * set.getHealth(e.getType()));
e.setHealth(e.getMaxHealth());
}
}
}
| Co0sh/Hordes | src/main/java/pl/betoncraft/hordes/Blocker.java | Java | gpl-3.0 | 2,168 |
<?php
include(__DIR__ . '/http_move.php');
include(__DIR__ . '/security_arguments.php');
// this is it
| wooygcom/mapc.me | web/mapc-system/library/_library.php | PHP | gpl-3.0 | 104 |
#include <QtGui>
#include <QTcpSocket>
#include "phonecall.h"
#include "dcc.h"
DCCDialog::DCCDialog(QWidget *parent)
: QDialog(parent)
{
QStringList list;
QVBoxLayout* mainLayout = new QVBoxLayout(this);
table = new QTableWidget(this);
table->setColumnCount(8);
list << tr("Status") << tr("File") << tr("Size") << tr("Position") << "%" << "KB/s" << "ETA" << tr("Nick");
table->setHorizontalHeaderLabels(list);
mainLayout->addWidget(table);
closeButton = new QPushButton(tr("Save and Close"));
connect(closeButton, SIGNAL(clicked()), this, SLOT(saveAndClose()));
mainLayout->addWidget(closeButton);
setLayout(mainLayout);
setWindowTitle(tr("File Transfers"));
call = 0;
}
DCCDialog::~DCCDialog()
{
}
void DCCDialog::command(const QString &cmd)
{
//user:ip:DCC SEND <filename> <ip> <port> <filesize>
//user:ip:DCC CHAT accept <ip> <audio port> <video port>
//user:ip:DCC CHAT call <ip> <audio port> <video port>
//qWarning()<<"cmd: "<<cmd;
QStringList list = cmd.split(':');
QString user = list.at(0);
QString ip = list.at(1);
QStringList params = cmd.split(' ');
//qWarning()<<"params "<<params;
//qWarning()<<"list "<<list;
if(params.size() < 6) return;
if(params.at(1).contains("SEND")) {
QMessageBox msgBox;
QString text = QString("%1 wants to send you a file called %2").arg(user).arg(params.at(2));
msgBox.setText(text);
msgBox.setInformativeText("Do you want to accept the file transfer?");
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Cancel);
int ret = msgBox.exec();
if(ret == QMessageBox::Save) {
QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::AnyFile);
dialog.selectFile(params.at(2));
if(dialog.exec()) {
QStringList files = dialog.selectedFiles();
//qWarning()<<"destination = "<<files.at(0);
TransferData* data = new TransferData;
data->user = user;
data->status = "Waiting";
data->file = params.at(2);
data->destination = new QFile(files.at(0));
data->size = params.at(5).toInt();
data->position = 0;
data->complete = 0;
data->rate = 0;
data->eta = -1;
data->comms = new QTcpSocket;
int currentRow = table->rowCount();
//qWarning()<<"currentRow="<<currentRow;
table->insertRow(currentRow);
table->setItem(currentRow, 0, new QTableWidgetItem(data->status));
table->setItem(currentRow, 1, new QTableWidgetItem(data->file));
table->setItem(currentRow, 2, new QTableWidgetItem(QString("%1kB").arg(data->size/1024)));
table->setItem(currentRow, 3, new QTableWidgetItem(QString("%1").arg(data->position)));
table->setItem(currentRow, 4, new QTableWidgetItem(QString("%1\%").arg(data->complete)));
table->setItem(currentRow, 5, new QTableWidgetItem(QString("%1Kb/s").arg(data->rate)));
table->setItem(currentRow, 6, new QTableWidgetItem(QString("%1min").arg(data->eta)));
table->setItem(currentRow, 7, new QTableWidgetItem(data->user));
connect(data->comms,SIGNAL(connected()),this,SLOT(startTransfer()));
connect(data->comms,SIGNAL(readyRead()),this,SLOT(processReadyRead()));
transfers.append(data);
table->resizeColumnsToContents();
if(table->selectedItems().isEmpty()) {
table->selectRow(0);
// start transfer...
}
}
}
show();
} else if(params.at(1).contains("CHAT")) {
//qWarning()<<"got a CHAT message";
if(params.at(2).contains("call")) {
//qWarning()<<"got a CHAT call";
// someone has requested a call
QMessageBox msgBox;
QString text = QString("%1 wants to talk").arg(user);
msgBox.setText(text);
msgBox.setInformativeText("Do you want to accept the call?");
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Cancel);
int ret = msgBox.exec();
if(ret == QMessageBox::Ok) {
// send accept message and setup for incoming.
QString msg = QString("PRIVMSG %1 :\001DCC CHAT accept %2 %3 %4\001\r\n").arg(user).arg(ip).arg(AUDIO_PORT).arg(0);
PhoneCallDialog* incoming = new PhoneCallDialog(this,user,ip,false);
incoming->show();
emit ircMsg(msg);
}
} else if(params.at(2).contains("accept")) {
//qWarning()<<"got a CHAT accept";
// your request has been accepted, connect to other end.
//qWarning()<<"I should be able to connect to "<<ip<<QString(" on port %1").arg(AUDIO_PORT);
if(call) delete call;
call = new PhoneCallDialog(this,user,ip,true);
call->show();
call->connectToHost();
}
}
}
void DCCDialog::startTransfer()
{
//qWarning()<<"TODO:startTransfer()";
}
void DCCDialog::processReadyRead()
{
//qWarning()<<"TODO:processReadyRead()";
}
void DCCDialog::saveAndClose()
{
close();
}
| korbatit/qtchat | dcc.cpp | C++ | gpl-3.0 | 5,563 |
package cn.com.jautoitx;
import org.apache.commons.lang3.StringUtils;
import com.sun.jna.platform.win32.WinDef.HWND;
/**
* Build window title base on Advanced Window Descriptions.
*
* @author zhengbo.wang
*/
public class TitleBuilder {
/**
* Build window title base on Advanced Window Descriptions.
*
* @param bys
* Selectors to build advanced window title.
* @return Returns advanced window title.
*/
public static String by(By... bys) {
StringBuilder title = new StringBuilder();
title.append('[');
String separator = "";
for (int i = 0; i < bys.length; i++) {
title.append(separator);
String strBy = bys[i].toAdvancedTitle();
if (!strBy.isEmpty()) {
title.append(strBy);
separator = "; ";
}
}
title.append(']');
return title.toString();
}
/**
* Build window title base on window title.
*
* @param title
* Window title.
* @return Returns advanced window title.
*/
public static String byTitle(String title) {
return by(By.title(title));
}
/**
* Build window title base on the internal window classname.
*
* @param className
* The internal window classname.
* @return Returns advanced window title.
*/
public static String byClassName(String className) {
return by(By.className(className));
}
/**
* Build window title base on window title using a regular expression.
*
* @param regexpTitle
* Window title using a regular expression.
* @return Returns advanced window title.
*/
public static String byRegexpTitle(String regexpTitle) {
return by(By.regexpTitle(regexpTitle));
}
/**
* Build window title base on window classname using a regular expression.
*
* @param regexpClassName
* Window classname using a regular expression.
* @return Returns advanced window title.
*/
public static String byRegexpClassName(String regexpClassName) {
return by(By.regexpClassName(regexpClassName));
}
/**
* Build window title base on window used in a previous AutoIt command.
*
* @return Returns advanced window title.
*/
public static String byLastWindow() {
return by(By.lastWindow());
}
/**
* Build window title base on currently active window.
*
* @return Returns advanced window title.
*/
public static String byActiveWindow() {
return by(By.activeWindow());
}
/**
* Build window title base on the position and size of a window. All
* parameters are optional.
*
* @param x
* Optional, the X coordinate of the window.
* @param y
* Optional, the Y coordinate of the window.
* @param width
* Optional, the width of the window.
* @param height
* Optional, the height of the window.
* @return Returns advanced window title.
*/
public static String byBounds(Integer x, Integer y, Integer width,
Integer height) {
return by(By.bounds(x, y, width, height));
}
/**
* Build window title base on the position of a window. All parameters are
* optional.
*
* @param x
* Optional, the X coordinate of the window.
* @param y
* Optional, the Y coordinate of the window.
* @return Returns advanced window title.
*/
public static String byPosition(Integer x, Integer y) {
return by(By.position(x, y));
}
/**
* Build window title base on the size of a window. All parameters are
* optional.
*
* @param width
* Optional, the width of the window.
* @param height
* Optional, the height of the window.
* @return Returns advanced window title.
*/
public static String bySize(Integer width, Integer height) {
return by(By.size(width, height));
}
/**
* Build window title base on the 1-based instance when all given properties
* match.
*
* @param instance
* The 1-based instance when all given properties match.
* @return Returns advanced window title.
*/
public static String byInstance(int instance) {
return by(By.instance(instance));
}
/**
* Build window title base on the handle address as returned by a method
* like Win.getHandle.
*
* @param handle
* The handle address as returned by a method like Win.getHandle.
* @return Returns advanced window title.
*/
public static String byHandle(String handle) {
return by(By.handle(handle));
}
/**
* Build window title base on the handle address as returned by a method
* like Win.getHandle_.
*
* @param hWnd
* The handle address as returned by a method like
* Win.getHandle_.
* @return Returns advanced window title.
*/
public static String byHandle(HWND hWnd) {
return by(By.handle(hWnd));
}
/**
* Selector to build advanced window title.
*
* @author zhengbo.wang
*/
public static abstract class By {
private final String property;
private final String value;
public By(final String property) {
this.property = property;
this.value = null;
}
public By(final String property, final String value) {
this.property = property;
this.value = StringUtils.defaultString(value);
}
/**
* @param title
* Window title.
* @return a By which locates window by the window title.
*/
public static By title(String title) {
return new ByTitle(title);
}
/**
* @param className
* The internal window classname.
* @return a By which locates window by the internal window classname.
*/
public static By className(String className) {
return new ByClass(className);
}
/**
* @param regexpTitle
* Window title using a regular expression.
* @return a By which locates window by the window title using a regular
* expression.
*/
public static By regexpTitle(String regexpTitle) {
return new ByRegexpTitle(regexpTitle);
}
/**
* @param regexpClassName
* Window classname using a regular expression.
* @return a By which locates window by the window classname using a
* regular expression.
*/
public static By regexpClassName(String regexpClassName) {
return new ByRegexpClass(regexpClassName);
}
/**
* @return a By which locates window used in a previous AutoIt command.
*/
public static By lastWindow() {
return new ByLast();
}
/**
* @return a By which locates currently active window.
*/
public static By activeWindow() {
return new ByActive();
}
/**
* All parameters are optional.
*
* @param x
* Optional, the X coordinate of the window.
* @param y
* Optional, the Y coordinate of the window.
* @param width
* Optional, the width of the window.
* @param height
* Optional, the height of the window.
* @return a By which locates window by the position and size of a
* window.
*/
public static By bounds(Integer x, Integer y, Integer width,
Integer height) {
return new ByBounds(x, y, width, height);
}
/**
* All parameters are optional.
*
* @param x
* Optional, the X coordinate of the window.
* @param y
* Optional, the Y coordinate of the window.
* @return a By which locates window by the position of a window.
*/
public static By position(Integer x, Integer y) {
return bounds(x, y, null, null);
}
/**
* All parameters are optional.
*
* @param width
* Optional, the width of the window.
* @param height
* Optional, the height of the window.
* @return a By which locates window by the size of a window.
*/
public static By size(Integer width, Integer height) {
return bounds(null, null, width, height);
}
/**
* @param instance
* The 1-based instance when all given properties match.
* @return a By which locates window by the instance when all given
* properties match.
*/
public static By instance(int instance) {
return new ByInstance(instance);
}
/**
* @param handle
* The handle address as returned by a method like
* Win.getHandle.
* @return a By which locates window by the handle address as returned
* by a method like Win.getHandle.
*/
public static By handle(String handle) {
return new ByHandle(handle);
}
/**
* @param hWnd
* The handle address as returned by a method like
* Win.getHandle_.
* @return a By which locates window by the handle address as returned
* by a method like Win.getHandle.
*/
public static By handle(HWND hWnd) {
return new ByHandle(hWnd);
}
public String toAdvancedTitle() {
StringBuilder advancedTitle = new StringBuilder();
advancedTitle.append(property);
if (value != null) {
advancedTitle.append(':');
for (int i = 0; i < value.length(); i++) {
char ch = value.charAt(i);
advancedTitle.append(ch);
// Note: if a Value must contain a ";" it must be doubled.
if (ch == ';') {
advancedTitle.append(';');
}
}
}
return advancedTitle.toString();
}
@Override
public String toString() {
return "By." + property + ": " + value;
}
}
/**
* Window title.
*
* @author zhengbo.wang
*/
public static class ByTitle extends By {
public ByTitle(String title) {
super("TITLE", title);
}
}
/**
* The internal window classname.
*
* @author zhengbo.wang
*/
public static class ByClass extends By {
public ByClass(String clazz) {
super("CLASS", clazz);
}
}
/**
* Window title using a regular expression.
*
* @author zhengbo.wang
*/
public static class ByRegexpTitle extends By {
public ByRegexpTitle(String clazz) {
super("REGEXPTITLE", clazz);
}
}
/**
* Window classname using a regular expression.
*
* @author zhengbo.wang
*/
public static class ByRegexpClass extends By {
public ByRegexpClass(String regexpClass) {
super("REGEXPCLASS", regexpClass);
}
}
/**
* Last window used in a previous AutoIt command.
*
* @author zhengbo.wang
*/
public static class ByLast extends By {
public ByLast() {
super("LAST");
}
}
/**
* Currently active window.
*
* @author zhengbo.wang
*/
public static class ByActive extends By {
public ByActive() {
super("ACTIVE");
}
}
/**
* The position and size of a window.
*
* @author zhengbo.wang
*/
public static class ByBounds extends By {
private final Integer x;
private final Integer y;
private final Integer width;
private final Integer height;
public ByBounds(Integer x, Integer y, Integer width, Integer height) {
super("POSITION AND SIZE", String.format("%s \\ %s \\ %s \\ %s",
String.valueOf(x), String.valueOf(y),
String.valueOf(width), String.valueOf(height)));
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
@Override
public String toAdvancedTitle() {
// see http://www.autoitscript.com/forum/topic/90848-x-y-w-h/
StringBuilder advancedTitle = new StringBuilder();
if (x != null) {
advancedTitle.append("X:").append(x);
}
if (y != null) {
if (!advancedTitle.toString().isEmpty()) {
advancedTitle.append("\\");
}
advancedTitle.append("Y:").append(y);
}
if (width != null) {
if (!advancedTitle.toString().isEmpty()) {
advancedTitle.append("\\");
}
advancedTitle.append("W:").append(width);
}
if (height != null) {
if (!advancedTitle.toString().isEmpty()) {
advancedTitle.append("\\");
}
advancedTitle.append("H:").append(height);
}
return advancedTitle.toString();
}
}
/**
* The 1-based instance when all given properties match.
*
* @author zhengbo.wang
*/
public static class ByInstance extends By {
public ByInstance(int instance) {
super("INSTANCE", String.valueOf(instance));
}
}
/**
* The handle address as returned by a method like Win.getHandle or
* Win.getHandle_.
*
* @author zhengbo.wang
*/
public static class ByHandle extends By {
public ByHandle(String handle) {
super("HANDLE", handle);
}
public ByHandle(HWND hWnd) {
this(AutoItX.hwndToHandle(hWnd));
}
}
}
| Pheelbert/twitchplayclient | src/cn/com/jautoitx/TitleBuilder.java | Java | gpl-3.0 | 12,238 |
package me.vadik.instaclimb.view.adapter;
import android.content.Context;
import android.databinding.ViewDataBinding;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import me.vadik.instaclimb.databinding.RowLayoutRouteBinding;
import me.vadik.instaclimb.databinding.UserCardBinding;
import me.vadik.instaclimb.model.Route;
import me.vadik.instaclimb.model.User;
import me.vadik.instaclimb.view.adapter.abstr.AbstractRecyclerViewWithHeaderAdapter;
import me.vadik.instaclimb.viewmodel.RouteItemViewModel;
import me.vadik.instaclimb.viewmodel.UserViewModel;
/**
* User: vadik
* Date: 4/13/16
*/
public class UserRecyclerViewAdapter extends AbstractRecyclerViewWithHeaderAdapter<User, Route> {
public UserRecyclerViewAdapter(Context context, User user) {
super(context, user);
}
@Override
protected ViewDataBinding onCreateHeader(LayoutInflater inflater, ViewGroup parent) {
return UserCardBinding.inflate(inflater, parent, false);
}
@Override
protected ViewDataBinding onCreateItem(LayoutInflater inflater, ViewGroup parent) {
return RowLayoutRouteBinding.inflate(inflater, parent, false);
}
@Override
protected void onBindHeader(ViewDataBinding binding, User user) {
((UserCardBinding) binding).setUser(new UserViewModel(mContext, user));
}
@Override
protected void onBindItem(ViewDataBinding binding, Route route) {
((RowLayoutRouteBinding) binding).setRoute(new RouteItemViewModel(mContext, route));
}
} | sirekanyan/instaclimb | app/src/main/java/me/vadik/instaclimb/view/adapter/UserRecyclerViewAdapter.java | Java | gpl-3.0 | 1,531 |
Ext.define('Omni.view.sizes.Explorer', {
extend: 'Buildit.ux.explorer.Panel',
alias: 'widget.omni-sizes-Explorer',
initComponent: function() {
var me = this;
// EXPLORER INIT (Start) ===============================================================
Ext.apply(this, {
allowFind: true,
store: Ext.create('Omni.store.Size'),
contextMenuConfig: {
xtype: 'omni-app-ExplorerContextMenu'
},
newForms: [{
xtype: 'omni-sizes-Form',
windowConfig: {}
}],
inspectorConfig: {
xtype: 'omni-sizes-Inspector'
}
});
// EXPLORER INIT (End)
// LABELS (Start) ======================================================================
Ext.applyIf(this, {
size_nbrLabel: Omni.i18n.model.Size.size_nbr,
size_typeLabel: Omni.i18n.model.Size.size_type,
displayLabel: Omni.i18n.model.Size.display,
concatenated_nameLabel: Omni.i18n.model.Size.concatenated_name,
dimension_1Label: Omni.i18n.model.Size.dimension_1,
dimension_2Label: Omni.i18n.model.Size.dimension_2,
is_enabledLabel: Omni.i18n.model.Size.is_enabled
});
// LABELS (End)
// COLUMNS (Start) =====================================================================
Ext.apply(this, {
columns: [{
header: this.displayLabel,
dataIndex: 'display',
flex: 1,
sortable: false
}, {
header: this.concatenated_nameLabel,
dataIndex: 'concatenated_name',
flex: 1,
sortable: false
}, {
header: this.dimension_1Label,
dataIndex: 'dimension_1',
flex: 1,
sortable: false
}, {
header: this.dimension_2Label,
dataIndex: 'dimension_2',
flex: 1,
sortable: false
}, {
header: this.size_typeLabel,
dataIndex: 'size_type',
flex: 1,
sortable: false,
renderer: Buildit.util.Format.lookupRenderer('SIZE_TYPE')
}, {
header: this.size_nbrLabel,
dataIndex: 'size_nbr',
flex: 1,
sortable: false
}, {
header: this.is_enabledLabel,
dataIndex: 'is_enabled',
flex: 1,
sortable: false
}, ]
});
// COLUMNS (End)
// TITLES (Start) ======================================================================
Ext.apply(this, {
title: 'Size',
subtitle: 'All Product Sizes that are valid in the system'
});
// TITLES (End)
this.callParent();
}
});
| tunacasserole/omni | app/assets/javascripts/omni/view/sizes/Explorer.js | JavaScript | gpl-3.0 | 2,541 |
# Copyright (C) 2012 Statoil ASA, Norway.
#
# The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ERT is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
#
# See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
# for more details.
from ert.cwrap import BaseCClass, CWrapper
from ert.enkf import ENKF_LIB, EnkfFs, NodeId
from ert.enkf.data import EnkfConfigNode, GenKw, GenData, CustomKW
from ert.enkf.enums import ErtImplType
class EnkfNode(BaseCClass):
def __init__(self, config_node, private=False):
assert isinstance(config_node, EnkfConfigNode)
if private:
c_pointer = EnkfNode.cNamespace().alloc_private(config_node)
else:
c_pointer = EnkfNode.cNamespace().alloc(config_node)
super(EnkfNode, self).__init__(c_pointer, config_node, True)
def valuePointer(self):
return EnkfNode.cNamespace().value_ptr(self)
def asGenData(self):
""" @rtype: GenData """
impl_type = EnkfNode.cNamespace().get_impl_type(self)
assert impl_type == ErtImplType.GEN_DATA
return GenData.createCReference(self.valuePointer(), self)
def asGenKw(self):
""" @rtype: GenKw """
impl_type = EnkfNode.cNamespace().get_impl_type(self)
assert impl_type == ErtImplType.GEN_KW
return GenKw.createCReference(self.valuePointer(), self)
def asCustomKW(self):
""" @rtype: CustomKW """
impl_type = EnkfNode.cNamespace().get_impl_type(self)
assert impl_type == ErtImplType.CUSTOM_KW
return CustomKW.createCReference(self.valuePointer(), self)
def tryLoad(self, fs, node_id):
"""
@type fs: EnkfFS
@type node_id: NodeId
@rtype: bool
"""
assert isinstance(fs, EnkfFs)
assert isinstance(node_id, NodeId)
return EnkfNode.cNamespace().try_load(self, fs, node_id)
def name(self):
return EnkfNode.cNamespace().get_name(self)
def load(self, fs, node_id):
if not self.tryLoad(fs, node_id):
raise Exception("Could not load node: %s iens: %d report: %d" % (self.name(), node_id.iens, node_id.report_step))
def save(self, fs, node_id):
assert isinstance(fs, EnkfFs)
assert isinstance(node_id, NodeId)
EnkfNode.cNamespace().store(self, fs, True, node_id)
def free(self):
EnkfNode.cNamespace().free(self)
cwrapper = CWrapper(ENKF_LIB)
cwrapper.registerObjectType("enkf_node", EnkfNode)
EnkfNode.cNamespace().free = cwrapper.prototype("void enkf_node_free(enkf_node)")
EnkfNode.cNamespace().alloc = cwrapper.prototype("c_void_p enkf_node_alloc(enkf_node)")
EnkfNode.cNamespace().alloc_private = cwrapper.prototype("c_void_p enkf_node_alloc_private_container(enkf_node)")
EnkfNode.cNamespace().get_name = cwrapper.prototype("char* enkf_node_get_key(enkf_node)")
EnkfNode.cNamespace().value_ptr = cwrapper.prototype("c_void_p enkf_node_value_ptr(enkf_node)")
EnkfNode.cNamespace().try_load = cwrapper.prototype("bool enkf_node_try_load(enkf_node, enkf_fs, node_id)")
EnkfNode.cNamespace().get_impl_type = cwrapper.prototype("ert_impl_type_enum enkf_node_get_impl_type(enkf_node)")
EnkfNode.cNamespace().store = cwrapper.prototype("void enkf_node_store(enkf_node, enkf_fs, bool, node_id)")
| iLoop2/ResInsight | ThirdParty/Ert/devel/python/python/ert/enkf/data/enkf_node.py | Python | gpl-3.0 | 3,730 |
package task_config
import (
"github.com/sonm-io/core/proto"
"github.com/sonm-io/core/util/config"
)
func LoadConfig(path string) (*sonm.TaskSpec, error) {
// Manual renaming from snake_case to lowercase fields here to be able to
// load them directly in the protobuf.
cfg := &sonm.TaskSpec{}
if err := config.LoadWith(cfg, path, config.SnakeToLower); err != nil {
return nil, err
}
if err := cfg.Validate(); err != nil {
return nil, err
}
return cfg, nil
}
| sonm-io/core | cmd/cli/task_config/config.go | GO | gpl-3.0 | 476 |
package tencentcloud.constant;
/**
* @author fanwh
* @version v1.0
* @decription
* @create on 2017/11/10 16:09
*/
public class RegionConstants {
/**
* 北京
*/
public static final String PEKING = "ap-beijing";
/**
* 上海
*/
public static final String SHANGHAI = "ap-shanghai";
/**
* 香港
*/
public static final String HONGKONG = "ap-hongkong";
/**
* 多伦多
*/
public static final String TORONTO = "na-toronto";
/**
* 硅谷
*/
public static final String SILICON_VALLEY = "na-siliconvalley";
/**
* 新加坡
*/
public static final String SINGAPORE = "ap-singapore";
/**
* 上海金融
*/
public static final String SHANGHAI_FSI = "ap-shanghai-fsi";
/**
* 广州open专区
*/
public static final String GUANGZHOU_OPEN = "ap-guangzhou-open";
/**
* 深圳金融
*/
public static final String SHENZHEN_FSI = "ap-shenzhen-fsi";
}
| ghforlang/Working | Test/src/main/java/tencentcloud/constant/RegionConstants.java | Java | gpl-3.0 | 1,002 |
/* The following code was generated by JFlex 1.6.1 */
package com.jim_project.interprete.parser.previo;
import com.jim_project.interprete.parser.AnalizadorLexico;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.6.1
* from the specification file <tt>C:/Users/alber_000/Documents/NetBeansProjects/tfg-int-rpretes/jim/src/main/java/com/jim_project/interprete/parser/previo/lexico.l</tt>
*/
public class PrevioLex extends AnalizadorLexico {
/** This character denotes the end of file */
public static final int YYEOF = -1;
/** initial size of the lookahead buffer */
private static final int ZZ_BUFFERSIZE = 16384;
/** lexical states */
public static final int YYINITIAL = 0;
/**
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
* ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
private static final int ZZ_LEXSTATE[] = {
0, 0
};
/**
* Translates characters to character classes
*/
private static final String ZZ_CMAP_PACKED =
"\11\0\1\3\1\2\1\51\1\3\1\1\22\0\1\3\1\16\1\0"+
"\1\5\1\0\1\20\2\0\3\20\1\15\1\20\1\14\1\0\1\20"+
"\1\10\11\7\2\0\1\13\1\17\3\0\3\6\1\50\1\42\1\24"+
"\1\30\1\40\1\23\2\4\1\41\1\4\1\47\1\31\1\44\3\4"+
"\1\32\2\4\1\37\1\11\1\12\1\11\1\20\1\0\1\20\3\0"+
"\3\6\1\46\1\36\1\22\1\25\1\34\1\21\2\4\1\35\1\4"+
"\1\45\1\26\1\43\3\4\1\27\2\4\1\33\1\11\1\12\1\11"+
"\12\0\1\51\u1fa2\0\1\51\1\51\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\udfe6\0";
/**
* Translates characters to character classes
*/
private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
/**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\1\0\1\1\2\2\1\1\1\2\1\3\2\4\2\5"+
"\1\1\2\6\1\1\1\6\6\1\1\3\2\1\1\3"+
"\1\7\1\3\1\5\1\10\1\11\1\12\1\0\1\13"+
"\10\7\1\14\4\7\1\15\2\7\1\16\1\7\1\17"+
"\1\7\1\20";
private static int [] zzUnpackAction() {
int [] result = new int[55];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAction(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\52\0\124\0\52\0\176\0\250\0\322\0\374"+
"\0\52\0\u0126\0\176\0\u0150\0\u017a\0\u01a4\0\u01ce\0\52"+
"\0\u01f8\0\u0222\0\u024c\0\u0276\0\u02a0\0\u02ca\0\u02f4\0\u031e"+
"\0\u0348\0\u0372\0\176\0\u039c\0\u03c6\0\52\0\52\0\52"+
"\0\u03f0\0\176\0\u041a\0\u0444\0\u046e\0\u0498\0\u04c2\0\u04ec"+
"\0\u0516\0\u0540\0\52\0\u056a\0\u0594\0\u05be\0\u05e8\0\176"+
"\0\u0612\0\u063c\0\176\0\u0666\0\176\0\u0690\0\176";
private static int [] zzUnpackRowMap() {
int [] result = new int[55];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
}
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
}
return j;
}
/**
* The transition table of the DFA
*/
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\1\2\1\3\2\4\1\5\1\6\1\7\1\10\1\11"+
"\1\12\1\13\1\14\1\15\1\16\1\17\1\2\1\20"+
"\1\21\1\5\1\22\1\5\1\23\2\5\1\24\2\5"+
"\1\25\1\5\1\26\1\27\1\30\1\5\1\31\1\32"+
"\3\5\1\7\1\5\1\7\55\0\1\4\53\0\1\33"+
"\1\0\1\33\2\0\2\33\6\0\30\33\1\0\1\6"+
"\1\3\1\4\47\6\4\0\1\33\1\0\1\33\1\34"+
"\1\0\2\33\6\0\30\33\10\0\2\10\45\0\1\33"+
"\1\0\1\33\1\35\1\0\2\33\6\0\30\33\15\0"+
"\1\36\51\0\1\37\52\0\1\40\53\0\1\41\36\0"+
"\1\33\1\0\1\33\2\0\2\33\6\0\1\33\1\42"+
"\26\33\5\0\1\33\1\0\1\33\2\0\2\33\6\0"+
"\3\33\1\42\24\33\5\0\1\33\1\0\1\33\2\0"+
"\2\33\6\0\5\33\1\43\22\33\5\0\1\33\1\0"+
"\1\33\2\0\2\33\6\0\10\33\1\44\17\33\5\0"+
"\1\33\1\0\1\33\2\0\2\33\6\0\13\33\1\45"+
"\14\33\5\0\1\33\1\0\1\33\2\0\2\33\6\0"+
"\5\33\1\46\22\33\5\0\1\33\1\0\1\33\1\34"+
"\1\0\2\33\6\0\24\33\1\47\3\33\5\0\1\33"+
"\1\0\1\33\2\0\2\33\6\0\17\33\1\50\10\33"+
"\5\0\1\33\1\0\1\33\2\0\2\33\6\0\10\33"+
"\1\51\17\33\5\0\1\33\1\0\1\33\1\34\1\0"+
"\2\33\6\0\26\33\1\52\1\33\10\0\2\34\50\0"+
"\2\35\44\0\1\41\4\0\1\53\45\0\1\33\1\0"+
"\1\33\2\0\2\33\6\0\6\33\1\54\21\33\5\0"+
"\1\33\1\0\1\33\2\0\2\33\6\0\11\33\1\55"+
"\16\33\5\0\1\33\1\0\1\33\2\0\2\33\6\0"+
"\1\56\27\33\5\0\1\33\1\0\1\33\2\0\2\33"+
"\6\0\5\33\1\57\22\33\5\0\1\33\1\0\1\33"+
"\2\0\2\33\6\0\25\33\1\60\2\33\5\0\1\33"+
"\1\0\1\33\2\0\2\33\6\0\2\33\1\61\25\33"+
"\5\0\1\33\1\0\1\33\2\0\2\33\6\0\10\33"+
"\1\62\17\33\5\0\1\33\1\0\1\33\2\0\2\33"+
"\6\0\27\33\1\60\5\0\1\33\1\0\1\33\2\0"+
"\2\33\6\0\5\33\1\63\22\33\5\0\1\33\1\0"+
"\1\33\2\0\2\33\6\0\10\33\1\63\17\33\5\0"+
"\1\33\1\0\1\33\2\0\2\33\6\0\14\33\1\64"+
"\13\33\5\0\1\33\1\0\1\33\2\0\2\33\6\0"+
"\22\33\1\65\5\33\5\0\1\33\1\0\1\33\2\0"+
"\2\33\6\0\20\33\1\66\7\33\5\0\1\33\1\0"+
"\1\33\2\0\2\33\6\0\23\33\1\65\4\33\5\0"+
"\1\33\1\0\1\33\2\0\2\33\6\0\15\33\1\67"+
"\12\33\5\0\1\33\1\0\1\33\2\0\2\33\6\0"+
"\21\33\1\67\6\33\1\0";
private static int [] zzUnpackTrans() {
int [] result = new int[1722];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
private static int zzUnpackTrans(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
value--;
do result[j++] = value; while (--count > 0);
}
return j;
}
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
private static final String ZZ_ERROR_MSG[] = {
"Unknown internal scanner error",
"Error: could not match input",
"Error: pushback value was too large"
};
/**
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\1\0\1\11\1\1\1\11\4\1\1\11\6\1\1\11"+
"\15\1\3\11\1\0\11\1\1\11\14\1";
private static int [] zzUnpackAttribute() {
int [] result = new int[55];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** the input device */
private java.io.Reader zzReader;
/** the current state of the DFA */
private int zzState;
/** the current lexical state */
private int zzLexicalState = YYINITIAL;
/** this buffer contains the current text to be matched and is
the source of the yytext() string */
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
/** the textposition at the last accepting state */
private int zzMarkedPos;
/** the current text position in the buffer */
private int zzCurrentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int zzStartRead;
/** endRead marks the last character in the buffer, that has been read
from input */
private int zzEndRead;
/** number of newlines encountered up to the start of the matched text */
private int yyline;
/** the number of characters up to the start of the matched text */
private int yychar;
/**
* the number of characters from the last newline up to the start of the
* matched text
*/
private int yycolumn;
/**
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean zzAtBOL = true;
/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;
/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;
/**
* The number of occupied positions in zzBuffer beyond zzEndRead.
* When a lead/high surrogate has been read from the input stream
* into the final zzBuffer position, this will have a value of 1;
* otherwise, it will have a value of 0.
*/
private int zzFinalHighSurrogate = 0;
/* user code: */
private PrevioParser yyparser;
/**
* Constructor de clase.
* @param r Referencia al lector de entrada.
* @param p Referencia al analizador sintáctico.
*/
public PrevioLex(java.io.Reader r, PrevioParser p) {
this(r);
yyparser = p;
}
/**
* Creates a new scanner
*
* @param in the java.io.Reader to read input from.
*/
public PrevioLex(java.io.Reader in) {
this.zzReader = in;
}
/**
* Unpacks the compressed character translation table.
*
* @param packed the packed character translation table
* @return the unpacked character translation table
*/
private static char [] zzUnpackCMap(String packed) {
char [] map = new char[0x110000];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
while (i < 184) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--count > 0);
}
return map;
}
/**
* Refills the input buffer.
*
* @return <code>false</code>, iff there was new input.
*
* @exception java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
zzEndRead += zzFinalHighSurrogate;
zzFinalHighSurrogate = 0;
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRead;
zzCurrentPos-= zzStartRead;
zzMarkedPos-= zzStartRead;
zzStartRead = 0;
}
/* is the buffer big enough? */
if (zzCurrentPos >= zzBuffer.length - zzFinalHighSurrogate) {
/* if not: blow it up */
char newBuffer[] = new char[zzBuffer.length*2];
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
zzBuffer = newBuffer;
zzEndRead += zzFinalHighSurrogate;
zzFinalHighSurrogate = 0;
}
/* fill the buffer with new input */
int requested = zzBuffer.length - zzEndRead;
int numRead = zzReader.read(zzBuffer, zzEndRead, requested);
/* not supposed to occur according to specification of java.io.Reader */
if (numRead == 0) {
throw new java.io.IOException("Reader returned 0 characters. See JFlex examples for workaround.");
}
if (numRead > 0) {
zzEndRead += numRead;
/* If numRead == requested, we might have requested to few chars to
encode a full Unicode character. We assume that a Reader would
otherwise never return half characters. */
if (numRead == requested) {
if (Character.isHighSurrogate(zzBuffer[zzEndRead - 1])) {
--zzEndRead;
zzFinalHighSurrogate = 1;
}
}
/* potentially more input available */
return false;
}
/* numRead < 0 ==> end of stream */
return true;
}
/**
* Closes the input stream.
*/
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Resets the scanner to read from a new input stream.
* Does not close the old reader.
*
* All internal variables are reset, the old input stream
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* Internal scan buffer is resized down to its initial length, if it has grown.
*
* @param reader the new input stream
*/
public final void yyreset(java.io.Reader reader) {
zzReader = reader;
zzAtBOL = true;
zzAtEOF = false;
zzEOFDone = false;
zzEndRead = zzStartRead = 0;
zzCurrentPos = zzMarkedPos = 0;
zzFinalHighSurrogate = 0;
yyline = yychar = yycolumn = 0;
zzLexicalState = YYINITIAL;
if (zzBuffer.length > ZZ_BUFFERSIZE)
zzBuffer = new char[ZZ_BUFFERSIZE];
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final String yytext() {
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
}
/**
* Returns the character at position <tt>pos</tt> from the
* matched text.
*
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
*
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead+pos];
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos-zzStartRead;
}
/**
* Reports an error that occured while scanning.
*
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
*
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
*
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Contains user EOF-code, which will be executed exactly once,
* when the end of file is reached
*/
private void zzDoEOF() throws java.io.IOException {
if (!zzEOFDone) {
zzEOFDone = true;
yyclose();
}
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
public int yylex() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
// set up zzAction for empty match case:
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
}
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL) {
zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL, zzEndReadL);
zzCurrentPosL += Character.charCount(zzInput);
}
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL, zzEndReadL);
zzCurrentPosL += Character.charCount(zzInput);
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
zzDoEOF();
{ return 0; }
}
else {
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 1:
{ yyparser.programa().error().deCaracterNoReconocido(yytext());
}
case 17: break;
case 2:
{
}
case 18: break;
case 3:
{ yyparser.yylval = new PrevioParserVal(yytext());
return PrevioParser.ETIQUETA;
}
case 19: break;
case 4:
{ yyparser.yylval = new PrevioParserVal(yytext());
return PrevioParser.NUMERO;
}
case 20: break;
case 5:
{ yyparser.yylval = new PrevioParserVal(yytext());
return PrevioParser.VARIABLE;
}
case 21: break;
case 6:
{ return yycharat(0);
}
case 22: break;
case 7:
{ yyparser.yylval = new PrevioParserVal(yytext());
return PrevioParser.IDMACRO;
}
case 23: break;
case 8:
{ return PrevioParser.FLECHA;
}
case 24: break;
case 9:
{ return PrevioParser.DECREMENTO;
}
case 25: break;
case 10:
{ return PrevioParser.INCREMENTO;
}
case 26: break;
case 11:
{ return PrevioParser.IF;
}
case 27: break;
case 12:
{ return PrevioParser.DISTINTO;
}
case 28: break;
case 13:
{ return PrevioParser.END;
}
case 29: break;
case 14:
{ return PrevioParser.GOTO;
}
case 30: break;
case 15:
{ return PrevioParser.LOOP;
}
case 31: break;
case 16:
{ return PrevioParser.WHILE;
}
case 32: break;
default:
zzScanError(ZZ_NO_MATCH);
}
}
}
}
}
| alberh/JIM | jim/src/main/java/com/jim_project/interprete/parser/previo/PrevioLex.java | Java | gpl-3.0 | 20,877 |
#include "cdi.h"
#include "mds_reader.h"
#include "common.h"
SessionInfo mds_ses;
TocInfo mds_toc;
DiscType mds_Disctype=CdRom;
struct file_TrackInfo
{
u32 FAD;
u32 Offset;
u32 SectorSize;
};
file_TrackInfo mds_Track[101];
FILE* fp_mdf=0;
u8 mds_SecTemp[5120];
u32 mds_TrackCount;
u32 mds_ReadSSect(u8* p_out,u32 sector,u32 secsz)
{
for (u32 i=0;i<mds_TrackCount;i++)
{
if (mds_Track[i+1].FAD>sector)
{
u32 fad_off=sector-mds_Track[i].FAD;
fseek(fp_mdf,mds_Track[i].Offset+fad_off*mds_Track[i].SectorSize,SEEK_SET);
fread(mds_SecTemp,mds_Track[i].SectorSize,1,fp_mdf);
ConvertSector(mds_SecTemp,p_out,mds_Track[i].SectorSize,secsz,sector);
return mds_Track[i].SectorSize;
}
}
return 0;
}
void FASTCALL mds_DriveReadSector(u8 * buff,u32 StartSector,u32 SectorCount,u32 secsz)
{
// printf("MDS/NRG->Read : Sector %d , size %d , mode %d \n",StartSector,SectorCount,secsz);
while(SectorCount--)
{
mds_ReadSSect(buff,StartSector,secsz);
buff+=secsz;
StartSector++;
}
}
void mds_CreateToc()
{
//clear structs to 0xFF :)
memset(mds_Track,0xFF,sizeof(mds_Track));
memset(&mds_ses,0xFF,sizeof(mds_ses));
memset(&mds_toc,0xFF,sizeof(mds_toc));
printf("\n--GD toc info start--\n");
int track=0;
bool CD_DA=false;
bool CD_M1=false;
bool CD_M2=false;
strack* last_track=&sessions[nsessions-1].tracks[sessions[nsessions-1].ntracks-1];
mds_ses.SessionCount=nsessions;
mds_ses.SessionsEndFAD=last_track->sector+last_track->sectors+150;
mds_toc.LeadOut.FAD=last_track->sector+last_track->sectors+150;
mds_toc.LeadOut.Addr=0;
mds_toc.LeadOut.Control=0;
mds_toc.LeadOut.Session=0;
printf("Last Sector : %d\n",mds_ses.SessionsEndFAD);
printf("Session count : %d\n",mds_ses.SessionCount);
mds_toc.FistTrack=1;
for (int s=0;s<nsessions;s++)
{
printf("Session %d:\n",s);
session* ses=&sessions[s];
printf(" Track Count: %d\n",ses->ntracks);
for (int t=0;t< ses->ntracks ;t++)
{
strack* c_track=&ses->tracks[t];
//pre gap
if (t==0)
{
mds_ses.SessionFAD[s]=c_track->sector+150;
mds_ses.SessionStart[s]=track+1;
printf(" Session start FAD: %d\n",mds_ses.SessionFAD[s]);
}
//verify(cdi_track->dwIndexCount==2);
printf(" track %d:\n",t);
printf(" Type : %d\n",c_track->mode);
if (c_track->mode>=2)
CD_M2=true;
if (c_track->mode==1)
CD_M1=true;
if (c_track->mode==0)
CD_DA=true;
//verify((c_track->mode==236) || (c_track->mode==169))
mds_toc.tracks[track].Addr=0;//hmm is that ok ?
mds_toc.tracks[track].Session=s;
mds_toc.tracks[track].Control=c_track->mode>0?4:0;//mode 1 , 2 , else are data , 0 is audio :)
mds_toc.tracks[track].FAD=c_track->sector+150;
mds_Track[track].FAD=mds_toc.tracks[track].FAD;
mds_Track[track].SectorSize=c_track->sectorsize;
mds_Track[track].Offset=(u32)c_track->offset;
printf(" Start FAD : %d\n",mds_Track[track].FAD);
printf(" SectorSize : %d\n",mds_Track[track].SectorSize);
printf(" File Offset : %d\n",mds_Track[track].Offset);
//main track data
track++;
}
}
//normal CDrom : mode 1 tracks .All sectors on the track are mode 1.Mode 2 was defined on the same book , but is it ever used? if yes , how can i detect
//cd XA ???
//CD Extra : session 1 is audio , session 2 is data
//cd XA : mode 2 tracks.Form 1/2 are selected per sector.It allows mixing of mode1/mode2 tracks ?
//CDDA : audio tracks only <- thats simple =P
/*
if ((CD_M1==true) && (CD_DA==false) && (CD_M2==false))
mds_Disctype = CdRom;
else if (CD_M2)
mds_Disctype = CdRom_XA;
else if (CD_DA && CD_M1)
mds_Disctype = CdRom_Extra;
else
mds_Disctype=CdRom;//hmm?
*/
if (nsessions==1 && (CD_M1 | CD_M2))
mds_Disctype = CdRom; //hack so that non selfboot stuff works on utopia
else
{
if ((CD_M1==true) && (CD_DA==false) && (CD_M2==false))
mds_Disctype = CdRom; //is that even correct ? what if its multysessions ? ehh ? what then ???
else if (CD_M2)
mds_Disctype = CdRom_XA; // XA XA ! its mode 2 wtf ?
else if (CD_DA && CD_M1)
mds_Disctype = CdRom_XA; //data + audio , duno wtf as@!#$ lets make it _XA since it seems to boot
else if (CD_DA && !CD_M1 && !CD_M2)
mds_Disctype = CdDA; //audio
else
mds_Disctype=CdRom_XA;//and hope for the best
}
/*
bool data = CD_M1 | CD_M2;
bool audio=CD_DA;
if (data && audio)
mds_Disctype = CdRom_XA; //Extra/CdRom won't boot , so meh
else if (data)
mds_Disctype = CdRom; //only data
else
mds_Disctype = CdDA; //only audio
*/
mds_toc.LastTrack=track;
mds_TrackCount=track;
printf("--GD toc info end--\n\n");
}
bool mds_init(wchar* file)
{
wchar fn[512]=L"";
bool rv=false;
if (rv==false && parse_mds(file,false))
{
bool found=false;
if (wcslen(file)>4)
{
wcscpy(&fn[0],file);
size_t len=wcslen(fn);
wcscpy(&fn[len-4],L".mdf");
fp_mdf=_tfopen(fn,L"rb");
found=fp_mdf!=0;
}
if (!found)
{
if (GetFile(fn,L"mds images (*.mds) \0*.mdf\0\0")==1)
{
fp_mdf=_tfopen(fn,L"rb");
found=true;
}
}
if (!found)
return false;
rv=true;
}
if (rv==false && parse_nrg(file,false))
{
rv=true;
fp_mdf=_tfopen(file,L"rb");
}
if (rv==false)
return false;
/*
for(int j=0;j<nsessions;j++)
for(int i=0;i<sessions[j].ntracks;i++)
{
printf("Session %d Track %d mode %d/%d sector %d count %d offset %I64d\n",
sessions[j].session_,
sessions[j].tracks[i].track,
sessions[j].tracks[i].mode,
sessions[j].tracks[i].sectorsize,
sessions[j].tracks[i].sector,
sessions[j].tracks[i].sectors,
sessions[j].tracks[i].offset);
}*/
mds_CreateToc();
return true;
}
void mds_term()
{
if (fp_mdf)
fclose(fp_mdf);
fp_mdf=0;
}
u32 FASTCALL mds_DriveGetDiscType()
{
return mds_Disctype;
}
void mds_DriveGetTocInfo(TocInfo* toc,DiskArea area)
{
verify(area==SingleDensity);
memcpy(toc,&mds_toc,sizeof(TocInfo));
}
void mds_GetSessionsInfo(SessionInfo* sessions)
{
memcpy(sessions,&mds_ses,sizeof(SessionInfo));
}
struct MDSDiskWrapper : Disc
{
MDSDiskWrapper() {
}
bool TryOpen(wchar* file) {
if (mds_init(file)) {
//printf("Session count %d:\n",nsessions);
//s32 tr_c = 1;
for (s32 s=0;s<nsessions;++s) {
//printf("Session %d:\n",s);
session* ses=&mds_sessions[s];
//printf(" Track Count: %d\n",ses->ntracks);
Track tr;
for (s32 t=0;t< ses->ntracks;++t) {
strack* c_track=&ses->tracks[t];
if (t==0) {
Session ts;
ts.FirstTrack = t + 1;//(tr_c++);
ts.StartFAD = c_track->sector+150;
sessions.push_back(ts);
//printf(" Session start FAD: %d\n",mds_ses.SessionFAD[s]);
}
tr.ADDR = 0;
tr.StartFAD = c_track->sector+150;
tr.EndFAD = 0;
tr.CTRL = c_track->mode>0?4:0;
//printf("SECTOR SIZE %u\n",c_track->sectorsize);
tr.file = new RawTrackFile(fp_mdf,(u32)c_track->offset,tr.StartFAD,c_track->sectorsize,false);
tracks.push_back(tr);
}
}
type=mds_Disctype;
LeadOut.ADDR=0;
LeadOut.CTRL=0;
LeadOut.StartFAD=549300;
EndFAD=549300;
return true;
}
return false;
}
~MDSDiskWrapper() {
mds_term();
}
};
Disc* mds_parse(wchar* fname) {
MDSDiskWrapper* dsk = new MDSDiskWrapper();
if (!dsk) {
return 0;
}
if (dsk->TryOpen(fname)) {
wprintf(L"\n\n Loaded %s\n\n",fname);
} else {
wprintf(L"\n\n Unable to load %s \n\n",fname);
delete dsk;
return 0;
}
return dsk;
} | workhorsy/nulldc-linux | nulldc/plugins/ImgReader/mds.cpp | C++ | gpl-3.0 | 7,400 |
package visGrid.diagram.edit.parts;
import java.io.File;
import java.util.Collections;
import java.util.List;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RunnableWithResult;
import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.Request;
import org.eclipse.gef.requests.DirectEditRequest;
import org.eclipse.gef.tools.DirectEditManager;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
/**
* @generated
*/
public class Series_reactorNameEditPart extends CompartmentEditPart implements
ITextAwareEditPart {
/**
* @generated
*/
public static final int VISUAL_ID = 5072;
/**
* @generated
*/
private DirectEditManager manager;
/**
* @generated
*/
private IParser parser;
/**
* @generated
*/
private List<?> parserElements;
/**
* @generated
*/
private String defaultText;
/**
* @generated
*/
public Series_reactorNameEditPart(View view) {
super(view);
}
/**
* @generated
*/
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(
EditPolicy.SELECTION_FEEDBACK_ROLE,
new visGrid.diagram.edit.policies.VisGridTextSelectionEditPolicy());
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE,
new LabelDirectEditPolicy());
installEditPolicy(
EditPolicy.PRIMARY_DRAG_ROLE,
new visGrid.diagram.edit.parts.GridEditPart.NodeLabelDragPolicy());
}
/**
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
if (figure instanceof WrappingLabel) {
return ((WrappingLabel) figure).getText();
} else {
return ((Label) figure).getText();
}
}
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
if (figure instanceof WrappingLabel) {
((WrappingLabel) figure).setText(text);
} else {
((Label) figure).setText(text);
}
}
/**
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
if (figure instanceof WrappingLabel) {
return ((WrappingLabel) figure).getIcon();
} else {
return ((Label) figure).getIcon();
}
}
/**
* @generated
*/
protected void setLabelIconHelper(IFigure figure, Image icon) {
if (figure instanceof WrappingLabel) {
((WrappingLabel) figure).setIcon(icon);
} else {
((Label) figure).setIcon(icon);
}
}
/**
* @generated
*/
public void setLabel(WrappingLabel figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
registerVisuals();
refreshVisuals();
}
/**
* @generated
*/
@SuppressWarnings("rawtypes")
protected List getModelChildren() {
return Collections.EMPTY_LIST;
}
/**
* @generated
*/
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
/**
* @generated
*/
protected EObject getParserElement() {
return resolveSemanticElement();
}
/**
* @generated
*/
protected Image getLabelIcon() {
EObject parserElement = getParserElement();
if (parserElement == null) {
return null;
}
return visGrid.diagram.providers.VisGridElementTypes
.getImage(parserElement.eClass());
}
/**
* @generated
*/
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
text = getParser().getPrintString(
new EObjectAdapter(parserElement),
getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
}
/**
* @generated
*/
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
if (pdEditPolicy instanceof visGrid.diagram.edit.policies.VisGridTextSelectionEditPolicy) {
((visGrid.diagram.edit.policies.VisGridTextSelectionEditPolicy) pdEditPolicy)
.refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
if (sfEditPolicy instanceof visGrid.diagram.edit.policies.VisGridTextSelectionEditPolicy) {
((visGrid.diagram.edit.policies.VisGridTextSelectionEditPolicy) sfEditPolicy)
.refreshFeedback();
}
}
/**
* @generated
*/
public String getEditText() {
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
return getParser().getEditString(
new EObjectAdapter(getParserElement()),
getParserOptions().intValue());
}
/**
* @generated
*/
protected boolean isEditable() {
return getParser() != null;
}
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
public String isValid(final Object value) {
if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
.runExclusive(
new RunnableWithResult.Impl<IParserEditStatus>() {
public void run() {
setResult(parser
.isValidEditString(
new EObjectAdapter(
element),
(String) value));
}
});
return valid.getCode() == ParserEditStatus.EDITABLE ? null
: valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
// shouldn't get here
return null;
}
};
}
/**
* @generated
*/
public IContentAssistProcessor getCompletionProcessor() {
if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(
new EObjectAdapter(getParserElement()));
}
/**
* @generated
*/
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
/**
* @generated
*/
public IParser getParser() {
if (parser == null) {
parser = visGrid.diagram.providers.VisGridParserProvider
.getParser(
visGrid.diagram.providers.VisGridElementTypes.Series_reactor_2032,
getParserElement(),
visGrid.diagram.part.VisGridVisualIDRegistry
.getType(visGrid.diagram.edit.parts.Series_reactorNameEditPart.VISUAL_ID));
}
return parser;
}
/**
* @generated
*/
protected DirectEditManager getManager() {
if (manager == null) {
setManager(new TextDirectEditManager(this,
TextDirectEditManager.getTextCellEditorClass(this),
visGrid.diagram.edit.parts.VisGridEditPartFactory
.getTextCellEditorLocator(this)));
}
return manager;
}
/**
* @generated
*/
protected void setManager(DirectEditManager manager) {
this.manager = manager;
}
/**
* @generated
*/
protected void performDirectEdit() {
getManager().show();
}
/**
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
if (getManager().getClass() == TextDirectEditManager.class) {
((TextDirectEditManager) getManager()).show(eventLocation
.getSWTPoint());
}
}
/**
* @generated
*/
private void performDirectEdit(char initialCharacter) {
if (getManager() instanceof TextDirectEditManager) {
((TextDirectEditManager) getManager()).show(initialCharacter);
} else {
performDirectEdit();
}
}
/**
* @generated
*/
protected void performDirectEditRequest(Request request) {
final Request theRequest = request;
try {
getEditingDomain().runExclusive(new Runnable() {
public void run() {
if (isActive() && isEditable()) {
if (theRequest
.getExtendedData()
.get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
Character initialChar = (Character) theRequest
.getExtendedData()
.get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
performDirectEdit(initialChar.charValue());
} else if ((theRequest instanceof DirectEditRequest)
&& (getEditText().equals(getLabelText()))) {
DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
}
}
}
});
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/**
* @generated
*/
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
refreshFont();
refreshFontColor();
refreshUnderline();
refreshStrikeThrough();
refreshBounds();
}
/**
* @generated
*/
protected void refreshLabel() {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
if (pdEditPolicy instanceof visGrid.diagram.edit.policies.VisGridTextSelectionEditPolicy) {
((visGrid.diagram.edit.policies.VisGridTextSelectionEditPolicy) pdEditPolicy)
.refreshFeedback();
}
Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
if (sfEditPolicy instanceof visGrid.diagram.edit.policies.VisGridTextSelectionEditPolicy) {
((visGrid.diagram.edit.policies.VisGridTextSelectionEditPolicy) sfEditPolicy)
.refreshFeedback();
}
}
/**
* @generated
*/
protected void refreshUnderline() {
FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
}
}
/**
* @generated
*/
protected void refreshStrikeThrough() {
FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style
.isStrikeThrough());
}
}
/**
* @generated
*/
protected void refreshFont() {
FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
NotationPackage.eINSTANCE.getFontStyle());
if (style != null) {
FontData fontData = new FontData(style.getFontName(),
style.getFontHeight(), (style.isBold() ? SWT.BOLD
: SWT.NORMAL)
| (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
/**
* @generated
*/
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
/**
* @generated
*/
protected void addSemanticListeners() {
if (getParser() instanceof ISemanticParser) {
EObject element = resolveSemanticElement();
parserElements = ((ISemanticParser) getParser())
.getSemanticElementsBeingParsed(element);
for (int i = 0; i < parserElements.size(); i++) {
addListenerFilter(
"SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
}
} else {
super.addSemanticListeners();
}
}
/**
* @generated
*/
protected void removeSemanticListeners() {
if (parserElements != null) {
for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
super.removeSemanticListeners();
}
}
/**
* @generated
*/
protected AccessibleEditPart getAccessibleEditPart() {
if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
public void getName(AccessibleEvent e) {
e.result = getLabelTextHelper(getFigure());
}
};
}
return accessibleEP;
}
/**
* @generated
*/
private View getFontStyleOwnerView() {
return getPrimaryView();
}
/**
* @generated
*/
protected void addNotationalListeners() {
super.addNotationalListeners();
addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
}
/**
* @generated
*/
protected void removeNotationalListeners() {
super.removeNotationalListeners();
removeListenerFilter("PrimaryView"); //$NON-NLS-1$
}
/**
* @generated
*/
protected void refreshBounds() {
int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE
.getSize_Width())).intValue();
int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE
.getSize_Height())).intValue();
Dimension size = new Dimension(width, height);
int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE
.getLocation_X())).intValue();
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE
.getLocation_Y())).intValue();
Point loc = new Point(x, y);
((GraphicalEditPart) getParent()).setLayoutConstraint(this,
getFigure(), new Rectangle(loc, size));
}
/**
* @generated
*/
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
|| NotationPackage.eINSTANCE.getSize_Height().equals(feature)
|| NotationPackage.eINSTANCE.getLocation_X().equals(feature)
|| NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
Integer c = (Integer) event.getNewValue();
setFontColor(DiagramColorRegistry.getInstance().getColor(c));
} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(
feature)) {
refreshUnderline();
} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough()
.equals(feature)) {
refreshStrikeThrough();
} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(
feature)
|| NotationPackage.eINSTANCE.getFontStyle_FontName().equals(
feature)
|| NotationPackage.eINSTANCE.getFontStyle_Bold()
.equals(feature)
|| NotationPackage.eINSTANCE.getFontStyle_Italic().equals(
feature)) {
refreshFont();
} else {
if (getParser() != null
&& getParser().isAffectingEvent(event,
getParserOptions().intValue())) {
refreshLabel();
}
if (getParser() instanceof ISemanticParser) {
ISemanticParser modelParser = (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
super.handleNotificationEvent(event);
}
/**
* @generated
*/
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
}
| mikesligo/visGrid | ie.tcd.gmf.visGrid.diagram/src/visGrid/diagram/edit/parts/Series_reactorNameEditPart.java | Java | gpl-3.0 | 16,066 |
#include "mainwindow.h"
#include <exception>
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
//setWindowFlags(Qt::CustomizeWindowHint);
menuBar()->close();
setStyleSheet("QPushButton{"
"background-color:gray;"
"color: white;"
"width:55px;"
"height:55px;"
"font-size: 15px;"
"border-radius: 10px;"
"border: 2px groove gray;"
"border-style: outset;}"
"QPushButton:hover{"
"background-color:white;"
"color: black;}"
"QPushButton:pressed,QPushButton:disabled{"
"color: white;"
"background-color:rgb(0, 0, 0);"
"border-style: inset; }");
CentralWidget=new QWidget(this);
setCentralWidget(CentralWidget);
setWindowTitle(tr("Calculator"));
buttonsLayout = new QGridLayout();
/*
* 根据BUTTONS表添加,设置按钮
*/
for(int i=0; i<BUTTONS.size(); ++i)
{
QVector<string> row = BUTTONS.at(i); //一行按钮
for(int j=0; j<row.size(); ++j)
{
const string &symbol = row.at(j); //按钮上显示的字符
if(!(symbol.empty()))
{
PushButton *pushButton = new PushButton(QString::fromStdString(symbol));
buttons.push_back(pushButton); //保存至按钮数组
connect(pushButton,&PushButton::clicked,this,&MainWindow::setInputText);
buttonsLayout->addWidget(pushButton, i, j);
}
}
}
/*
* 功能键
*/
functionKeyButtonClear=new QPushButton(QString::fromStdString(CLEAR));
functionKeyButtonBackspace=new QPushButton(QString::fromStdString(BACKSPACE));
functionKeyButtonAns=new QPushButton(QString::fromStdString(ANS));
functionKeyButtonShift=new QPushButton(QString::fromStdString(SHIFT));
equalButton = new QPushButton(QString::fromStdString(EQUAL));
connect(functionKeyButtonBackspace,&QPushButton::clicked,this,&MainWindow::onBackspaceClicked);
connect(functionKeyButtonClear,&QPushButton::clicked,this,&MainWindow::onClearClicked);
connect(functionKeyButtonAns,&QPushButton::clicked,this,&MainWindow::onAnsClicked);
connect(functionKeyButtonShift,&QPushButton::clicked,this,&MainWindow::onShiftClicked);
connect(equalButton, &QPushButton::clicked, this, &MainWindow::onEqualClicked);
buttonsLayout->addWidget(functionKeyButtonBackspace, 1, 0);
buttonsLayout->addWidget(functionKeyButtonClear, 1, 1);
buttonsLayout->addWidget(functionKeyButtonAns, 1, 2);
buttonsLayout->addWidget(functionKeyButtonShift, 0, 4);
//将等号添加至最后一行最后两格位置
buttonsLayout->addWidget(equalButton, BUTTONS.size(), BUTTONS.at(BUTTONS.size()-1).size()-2, 1, 2);
MainLayout=new QGridLayout(CentralWidget);
//设置表达式输入框
inputText=new QLineEdit("0");
inputText->setAlignment(Qt::AlignRight);
inputText->setReadOnly(true);
inputText->setStyleSheet("QLineEdit{height: 50px;"
"border-style: plain;"
"border-radius: 10px;"
"font-size: 30px}");
//设置等于符号
equalLabel = new QLabel("=");
equalLabel->setStyleSheet("width:55px;"
"height:55px;"
"font-size: 30px;");
//设置结果显示框
resultText = new QLineEdit("0");
resultText->setReadOnly(true);
resultText->setStyleSheet("QLineEdit{height: 50px;"
"border-style: plain;"
"border-radius: 10px;"
"font-size: 30px}");
MainLayout->addWidget(inputText, 0, 0, 1, 5);
MainLayout->addWidget(equalLabel, 1, 1);
MainLayout->addWidget(resultText, 1, 2, 1, 3);
MainLayout->addLayout(buttonsLayout, 2, 0, 7, 5);
MainLayout->setSizeConstraint(QLayout::SetFixedSize);
setFixedSize(MainLayout->sizeHint());
}
MainWindow::~MainWindow()
{
}
QString MainWindow::cal(QString s)
{
QString temp;
expression = new Expression(transformStdExpression(s));
try
{
temp=QString::fromStdString(expression->getResult());
}catch(runtime_error e){
QMessageBox messagebox(QMessageBox::Warning,"错误",QString::fromStdString(e.what()));
messagebox.exec();
temp = "Error";
}
calcFinished = true;
delete expression;
return temp;
}
string MainWindow::transformStdExpression(QString expression)
{
expression = expression.replace("×", "*").replace("÷", "/").replace("√", "#").replace("°", "`");
return expression.toStdString();
}
void MainWindow::setInputText(PushButton *pushButton)
{
QString symbol = pushButton->text();
/*
* 未计算完成,还在输入中,将输入的字符直接添加至表达式输入框文本后
*/
if(calcFinished==false)
{
inputText->setText(inputText->text()+pushButton->text());
}
/*
* 已经计算完成,准备开始下一次计算
* 根据输入的内容,若为数字/括号/前置运算符/可省略第一个操作数的中置运算符,则直接将输入显示在输入框中
*/
else
{
Metacharacter m = METACHARACTERS.at(transformStdExpression(symbol));
if(m.type == 0 || m.type == 2 || (m.type==1 && (m.position == 1 || m.e == "#" || m.e == "-")))
{
//如果输入的是小数点,则在其前面添加小数点
if(symbol == ".")
{
inputText->setText(QString("0."));
}
else
{
inputText->setText(pushButton->text());
}
}
else if(m.type == 1)
{
inputText->setText(Ans + pushButton->text());
}
historySize.clear(); //清空上次输入的历史记录
calcFinished=false; //表示正在输入过程中
}
historySize.push(pushButton->text().size()); //记录输入的操作词大小
}
void MainWindow::onEqualClicked()
{
QString temp;
temp=cal(inputText->text());
if(temp=="Error") //如果计算出错
{
resultText->setText(tr("Error"));
Ans = "0";
return;
}
/*
* 由于返回值为double转换的QString,字符串小数位会有一串0,需要去除,并在小数位全为0时去除小数点
*/
while(temp.right(1)=="0")
temp=temp.left(temp.size()-1);
if(temp.right(1)==".")
temp=temp.left(temp.size()-1);
resultText->setText(temp);
/*
* 如果计算结果为负数,为Ans加上括号便于下次计算使用
*/
if(temp.at(0) == '-')
Ans=QString("%1%2%3").arg("(").arg(temp).arg(")");
else
Ans = temp;
}
void MainWindow::onClearClicked()
{
inputText->setText("0");
historySize.clear();
calcFinished=true;
}
void MainWindow::onAnsClicked()
{
if(inputText->text()=="0"||calcFinished==true)
{
inputText->setText(Ans);
calcFinished=false;
}
else
inputText->setText(inputText->text()+Ans);
int length = Ans.size();
while(length--)
historySize.push(1);
}
void MainWindow::onShiftClicked()
{
/*
* 根据shift按下状态转换sin,cos,tan和lg四个按钮
*/
if(isShifting)
{
isShifting = false;
for(int i=0; i<4; ++i)
{
buttons[i]->setText(QString::fromStdString(BUTTONS.at(0).at(i)));
}
functionKeyButtonShift->setStyleSheet("QPushButton{background-color:gray;"
"font-size: 15px;"
"border-style: outset;}"
"QPushButton:hover{"
"background-color:white;"
"color: black;}"
"QPushButton:pressed{"
"background-color:rgb(0, 0, 0);"
"border-style: inset;}");
}
else
{
isShifting = true;
for(int i=0; i<4; ++i)
{
buttons[i]->setText(QString::fromStdString(SHIFT_TABLE[buttons[i]->text().toStdString()]));
}
functionKeyButtonShift->setStyleSheet("QPushButton:pressed{background-color:gray;"
"border-style: outset;}"
"QPushButton:hover{"
"background-color:white;"
"color: black;}"
"QPushButton{"
"font-size: 40px;"
"font-style: bold;"
"background-color:rgb(0, 0, 0);"
"border-style: inset;}");
}
}
void MainWindow::onBackspaceClicked()
{
QString result=inputText->text();
calcFinished = false; //计算完成时若按下删除键,重新将计算完成标记置为正在输入中
if(result.size()==1) //输入框只剩一个字符
{
historySize.clear();
inputText->setText("0");
calcFinished = true;
}
else
{
int length = historySize.empty() ? 1:historySize.pop(); //兼容手动输入字符情况
inputText->setText(result.left(result.size()-length));
}
}
| Zix777/Complex-mathematical-expressions | Calculator/mainwindow.cpp | C++ | gpl-3.0 | 10,051 |
// Copyright 2017 Ryan Wick (rrwick@gmail.com)
// https://github.com/rrwick/Unicycler
// This file is part of Unicycler. Unicycler is free software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later version. Unicycler is
// distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
// Public License for more details. You should have received a copy of the GNU Genral Public
// License along with Unicycler. If not, see <http://www.gnu.org/licenses/>.
#include "overlap_align.h"
#include "string_functions.h"
#include <seqan/align.h>
char * overlapAlignment(char * s1, char * s2,
int matchScore, int mismatchScore, int gapOpenScore, int gapExtensionScore,
int guessOverlap) {
std::string sequence1(s1);
std::string sequence2(s2);
// Trim the sequences down to a bit more than the expected overlap. This will help save time
// because the non-overlapping sequence isn't informative.
int trim_size = int((guessOverlap + 100) * 1.5);
if (trim_size < int(sequence1.length()))
sequence1 = sequence1.substr(sequence1.length() - trim_size, trim_size);
if (trim_size < int(sequence2.length()))
sequence2 = sequence2.substr(0, trim_size);
Dna5String sequenceH(sequence1);
Dna5String sequenceV(sequence2);
Align<Dna5String, ArrayGaps> alignment;
resize(rows(alignment), 2);
assignSource(row(alignment, 0), sequenceH);
assignSource(row(alignment, 1), sequenceV);
Score<int, Simple> scoringScheme(matchScore, mismatchScore, gapExtensionScore, gapOpenScore);
// The alignment configuration allows for overlap from s1 -> s2.
AlignConfig<true, false, true, false> alignConfig;
try {
globalAlignment(alignment, scoringScheme, alignConfig);
}
catch (...) {
return cppStringToCString("-1,-1");
}
std::ostringstream stream1;
stream1 << row(alignment, 0);
std::string seq1Alignment = stream1.str();
std::ostringstream stream2;
stream2 << row(alignment, 1);
std::string seq2Alignment = stream2.str();
int alignmentLength = std::max(seq1Alignment.size(), seq2Alignment.size());
if (alignmentLength == 0)
return cppStringToCString("-1,-1");
int seq1Pos = 0, seq2Pos = 0;
int seq1PosAtSeq2Start = -1, seq2PosAtSeq1End = -1;
for (int i = 0; i < alignmentLength; ++i) {
char base1 = seq1Alignment[i];
char base2 = seq2Alignment[i];
if (base1 != '-')
seq2PosAtSeq1End = seq2Pos + 1;
if (base2 != '-' && seq1PosAtSeq2Start == -1)
seq1PosAtSeq2Start = seq1Pos;
if (base1 != '-')
++seq1Pos;
if (base2 != '-')
++seq2Pos;
}
int overlap1 = seq1Pos - seq1PosAtSeq2Start;
int overlap2 = seq2PosAtSeq1End;
return cppStringToCString(std::to_string(overlap1) + "," + std::to_string(overlap2));
}
| rrwick/Unicycler | unicycler/src/overlap_align.cpp | C++ | gpl-3.0 | 3,185 |
package me.anthonybruno.soccerSim.reader;
import org.apache.pdfbox.io.RandomAccessFile;
import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.text.PDFTextStripperByArea;
import java.awt.geom.Rectangle2D;
import java.io.File;
import java.io.IOException;
/**
* A class that parsers team PDF files into XML files.
*/
public class TeamPdfReader {
private static final Rectangle2D.Double firstTeamFirstPageRegion = new Rectangle2D.Double(0, 0, 330, 550);
private static final Rectangle2D.Double secondTeamFirstPageRegion = new Rectangle2D.Double(350, 0, 350, 550);
private final File file;
public TeamPdfReader(String fileName) {
this.file = new File(fileName);
}
public TeamPdfReader(File file) {
this.file = file;
}
// public String read() { //Using IText :(
// try {
// PdfReader pdfReader = new PdfReader(file.getAbsolutePath());
// PdfDocument pdfDocument = new PdfDocument(pdfReader);
//
// LocationTextExtractionStrategy strategy = new LocationTextExtractionStrategy();
//
// PdfCanvasProcessor parser = new PdfCanvasProcessor(strategy);
// parser.processPageContent(pdfDocument.getFirstPage());
// return strategy.getResultantText();
//
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
public void readAllTeamsToFiles() { //Using PDFBox
try {
PDFParser parser = new PDFParser(new RandomAccessFile(file, "r"));
parser.parse();
PDFTextStripperByArea pdfTextStripperByArea = new PDFTextStripperByArea();
pdfTextStripperByArea.addRegion("First", firstTeamFirstPageRegion);
pdfTextStripperByArea.addRegion("Second", secondTeamFirstPageRegion);
for (int i = 0; i < parser.getPDDocument().getNumberOfPages(); i++) {
pdfTextStripperByArea.extractRegions(parser.getPDDocument().getPage(i));
writeTeamToFile(pdfTextStripperByArea.getTextForRegion("First"), "teams");
writeTeamToFile(pdfTextStripperByArea.getTextForRegion("Second"), "teams");
}
} catch (IOException e) {
e.printStackTrace();
}
}
public void writeTeamToFile(String teamExtractedFromPDf, String saveDirectory) { //FIXME: Reduce size of method
if (teamExtractedFromPDf.isEmpty() || !teamExtractedFromPDf.contains(" ")) {
return; //reached a blank page
}
XmlWriter xmlWriter = new XmlWriter("UTF-8");
String text = teamExtractedFromPDf;
if (text.indexOf('\n') < text.indexOf(' ')) {
text = text.substring(text.indexOf('\n') + 1);
}
xmlWriter.createOpenTag("team");
if (text.startsWith(" ")) {
text = text.substring(text.indexOf('\n') + 1); //need this for El Salvador
}
String name = text.substring(0, text.indexOf(" "));
text = text.substring(text.indexOf(" ") + 1);
if (!Character.isDigit(text.charAt(0))) { //handles countries with two words in name
name += " " + text.substring(0, text.indexOf(" "));
}
xmlWriter.createTagWithValue("name", name);
for (int i = 0; i < 3; i++) { //skipping stuff we don't care about
text = moveToNextLine(text);
}
text = text.substring(text.indexOf(':') + 2);
String firstHalfAttempts = text.substring(0, text.indexOf(' '));
text = text.substring(text.indexOf(' ') + 1);
String secondHalfAttempts = text.substring(0, text.indexOf('\n'));
text = moveToNextLine(text);
xmlWriter.createTagWithValue("goalRating", text.substring(text.indexOf('-') + 1, text.indexOf('\n')));
text = moveToNextLine(text);
String[] defensiveAttempts = parseHalfValues(text);
text = defensiveAttempts[0];
String firstHalfDefensiveAttempts = defensiveAttempts[1];
String secondHalfDefensiveAttempts = defensiveAttempts[2];
String[] defensiveSOG = parseHalfValues(text);
text = defensiveSOG[0];
String firstHalfSOG = defensiveSOG[1];
String secondHalfSOG = defensiveSOG[2];
xmlWriter.createTagWithValue("formation", text.substring(text.indexOf(':') + 2, text.indexOf('\n')));
text = moveToNextLine(text);
text = text.substring(text.indexOf(':') + 2);
if (text.indexOf(' ') < text.indexOf('\n')) {
xmlWriter.createTagWithValue("strategy", text.substring(0, text.indexOf(' '))); //team has fair play score
} else {
xmlWriter.createTagWithValue("strategy", text.substring(0, text.indexOf("\n")));
}
text = moveToNextLine(text);
text = moveToNextLine(text);
parseHalfStats(xmlWriter, "halfStats", firstHalfAttempts, firstHalfDefensiveAttempts, firstHalfSOG);
parseHalfStats(xmlWriter, "halfStats", secondHalfAttempts, secondHalfDefensiveAttempts, secondHalfSOG);
xmlWriter.createOpenTag("players");
while (!text.startsWith("Goalies")) {
text = parsePlayer(xmlWriter, text);
}
text = moveToNextLine(text);
parseGoalies(xmlWriter, text);
xmlWriter.createCloseTag("players");
xmlWriter.createCloseTag("team");
File saveDir = new File(saveDirectory);
try {
saveDir.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
if (!saveDir.exists()) {
file.mkdir();
}
xmlWriter.writeToFile(new File("src/main/resources/teams/" + name + ".xml"));
}
private void parseGoalies(XmlWriter xmlWriter, String text) {
while (!text.isEmpty()) {
xmlWriter.createOpenTag("goalie");
String playerName = "";
do {
playerName += text.substring(0, text.indexOf(' '));
text = text.substring(text.indexOf(' ') + 1);
} while (!isNumeric(text.substring(0, text.indexOf(' '))));
xmlWriter.createTagWithValue("name", playerName);
xmlWriter.createTagWithValue("rating", text.substring(0, text.indexOf(' ')));
text = text.substring(text.indexOf(' ') + 1);
text = text.substring(text.indexOf(' ') + 1);
text = parsePlayerAttribute(xmlWriter, "injury", text);
createMultiplierTag(xmlWriter, text);
text = moveToNextLine(text);
xmlWriter.createCloseTag("goalie");
}
}
private boolean isNumeric(char c) {
return isNumeric(c + "");
}
private boolean isNumeric(String string) {
return string.matches("^[-+]?\\d+$");
}
private void createMultiplierTag(XmlWriter xmlWriter, String text) {
if (text.charAt(0) != '-') {
xmlWriter.createTagWithValue("multiplier", text.charAt(1) + "");
} else {
xmlWriter.createTagWithValue("multiplier", "0");
}
}
private String parsePlayer(XmlWriter xmlWriter, String text) {
xmlWriter.createOpenTag("player");
text = parsePlayerName(xmlWriter, text);
text = parsePlayerAttribute(xmlWriter, "shotRange", text);
text = parsePlayerAttribute(xmlWriter, "goal", text);
text = parsePlayerAttribute(xmlWriter, "injury", text);
createMultiplierTag(xmlWriter, text);
xmlWriter.createCloseTag("player");
text = moveToNextLine(text);
return text;
}
private String parsePlayerName(XmlWriter xmlWriter, String text) {
if (isNumeric(text.charAt(text.indexOf(' ') + 1))) {
return parsePlayerAttribute(xmlWriter, "name", text); //Player has single name
} else {
String playerName = text.substring(0, text.indexOf(' '));
text = text.substring(text.indexOf(' ') + 1);
while (!isNumeric(text.charAt(0))) {
playerName += ' ' + text.substring(0, text.indexOf(' '));
text = text.substring(text.indexOf(' ') + 1);
}
xmlWriter.createTagWithValue("name", playerName);
return text;
}
}
private String parsePlayerAttribute(XmlWriter xmlWriter, String tagName, String text) {
xmlWriter.createTagWithValue(tagName, text.substring(0, text.indexOf(' ')));
text = text.substring(text.indexOf(' ') + 1);
return text;
}
private String[] parseHalfValues(String text) {
text = text.substring(text.indexOf(':') + 2);
String firstHalf = text.substring(0, text.indexOf(' '));
text = text.substring(text.indexOf(' ') + 1);
String secondHalf = text.substring(0, text.indexOf('\n'));
text = moveToNextLine(text);
return new String[]{text, firstHalf, secondHalf};
}
private void parseHalfStats(XmlWriter xmlWriter, String halfName, String attempts, String defensiveAttempts, String defensiveShotsOnGoal) {
xmlWriter.createOpenTag(halfName);
xmlWriter.createTagWithValue("attempts", attempts);
xmlWriter.createTagWithValue("defensiveAttempts", defensiveAttempts);
xmlWriter.createTagWithValue("defensiveShotsOnGoal", defensiveShotsOnGoal);
xmlWriter.createCloseTag(halfName);
}
private String moveToNextLine(String text) {
return text.substring(text.indexOf("\n") + 1);
}
public static void main(String[] args) {
TeamPdfReader teamPdfReader = new TeamPdfReader("src/main/resources/ruleFiles/Cards1.pdf");
teamPdfReader.readAllTeamsToFiles();
teamPdfReader = new TeamPdfReader("src/main/resources/ruleFiles/Cards2.pdf");
teamPdfReader.readAllTeamsToFiles();
}
}
| AussieGuy0/soccerSim | src/main/java/me/anthonybruno/soccerSim/reader/TeamPdfReader.java | Java | gpl-3.0 | 9,771 |
module TransactionChains
class Lifetimes::ExpirationWarning < ::TransactionChain
label 'Expiration'
allow_empty
def link_chain(klass, q)
q.each do |obj|
user = if obj.is_a?(::User)
obj
elsif obj.respond_to?(:user)
obj.user
else
fail "Unable to find an owner for #{obj} of class #{klass}"
end
mail(:expiration_warning, {
params: {
object: klass.name.underscore,
state: obj.object_state,
},
user: user,
vars: {
object: obj,
state: obj.current_object_state,
klass.name.underscore => obj
}
}) if user.mailer_enabled
end
end
end
end
| vpsfreecz/vpsadmin-webui | api/models/transaction_chains/lifetimes/expiration_warning.rb | Ruby | gpl-3.0 | 792 |
// This file belongs to the "MiniCore" game engine.
// Copyright (C) 2012 Jussi Lind <jussi.lind@iki.fi>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
// MA 02110-1301, USA.
//
#ifndef MCLOGGER_HH
#define MCLOGGER_HH
#include "mcmacros.hh"
#include <cstdio>
#include <sstream>
/*! A logging class. A MCLogger instance flushes on destruction.
*
* Example initialization:
*
* MCLogger::init("myLog.txt");
* MCLogger::enableEchoMode(true);
*
* Example logging:
*
* MCLogger().info() << "Initialization finished.";
* MCLogger().error() << "Foo happened!";
*/
class MCLogger
{
public:
//! Constructor.
MCLogger();
//! Destructor.
~MCLogger();
/*! Initialize the logger.
* \param fileName Log to fileName. Can be nullptr.
* \param append The existing log will be appended if true.
* \return false if file couldn't be opened. */
static bool init(const char * fileName, bool append = false);
//! Enable/disable echo mode.
//! \param enable Echo everything if true. Default is false.
static void enableEchoMode(bool enable);
//! Enable/disable date and time prefix.
//! \param enable Prefix with date and time if true. Default is true.
static void enableDateTimePrefix(bool enable);
//! Get stream to the info log message.
std::ostringstream & info();
//! Get stream to the warning log message.
std::ostringstream & warning();
//! Get stream to the error log message.
std::ostringstream & error();
//! Get stream to the fatal log message.
std::ostringstream & fatal();
private:
DISABLE_COPY(MCLogger);
DISABLE_ASSI(MCLogger);
void prefixDateTime();
static bool m_echoMode;
static bool m_dateTime;
static FILE * m_file;
std::ostringstream m_oss;
};
#endif // MCLOGGER_HH
| juzzlin/DustRacing2D | src/game/MiniCore/src/Core/mclogger.hh | C++ | gpl-3.0 | 2,473 |
//
// tcpconnection.cpp
//
// This implements RFC 793 with some changes in RFC 1122 and RFC 6298.
//
// Non-implemented features:
// dynamic receive window
// URG flag and urgent pointer
// delayed ACK
// queueing out-of-order TCP segments
// security/compartment
// precedence
// user timeout
//
// Circle - A C++ bare metal environment for Raspberry Pi
// Copyright (C) 2015-2021 R. Stange <rsta2@o2online.de>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#include <circle/net/tcpconnection.h>
#include <circle/macros.h>
#include <circle/util.h>
#include <circle/logger.h>
#include <circle/net/in.h>
#include <assert.h>
//#define TCP_DEBUG
#define TCP_MAX_CONNECTIONS 1000 // maximum number of active TCP connections
#define MSS_R 1480 // maximum segment size to be received from network layer
#define MSS_S 1480 // maximum segment size to be send to network layer
#define TCP_CONFIG_MSS (MSS_R - 20)
#define TCP_CONFIG_WINDOW (TCP_CONFIG_MSS * 10)
#define TCP_CONFIG_RETRANS_BUFFER_SIZE 0x10000 // should be greater than maximum send window size
#define TCP_MAX_WINDOW ((u16) -1) // without Window extension option
#define TCP_QUIET_TIME 30 // seconds after crash before another connection starts
#define HZ_TIMEWAIT (60 * HZ)
#define HZ_FIN_TIMEOUT (60 * HZ) // timeout in FIN-WAIT-2 state
#define MAX_RETRANSMISSIONS 5
struct TTCPHeader
{
u16 nSourcePort;
u16 nDestPort;
u32 nSequenceNumber;
u32 nAcknowledgmentNumber;
u16 nDataOffsetFlags; // following #define(s) are valid without BE()
#define TCP_DATA_OFFSET(field) (((field) >> 4) & 0x0F)
#define TCP_DATA_OFFSET_SHIFT 4
//#define TCP_FLAG_NONCE (1 << 0)
//#define TCP_FLAG_CWR (1 << 15)
//#define TCP_FLAG_ECN_ECHO (1 << 14)
#define TCP_FLAG_URGENT (1 << 13)
#define TCP_FLAG_ACK (1 << 12)
#define TCP_FLAG_PUSH (1 << 11)
#define TCP_FLAG_RESET (1 << 10)
#define TCP_FLAG_SYN (1 << 9)
#define TCP_FLAG_FIN (1 << 8)
u16 nWindow;
u16 nChecksum;
u16 nUrgentPointer;
u32 Options[];
}
PACKED;
#define TCP_HEADER_SIZE 20 // valid for normal data segments without TCP options
struct TTCPOption
{
u8 nKind; // Data:
#define TCP_OPTION_END_OF_LIST 0 // None (no length field)
#define TCP_OPTION_NOP 1 // None (no length field)
#define TCP_OPTION_MSS 2 // Maximum segment size (2 byte)
#define TCP_OPTION_WINDOW_SCALE 3 // Shift count (1 byte)
#define TCP_OPTION_SACK_PERM 4 // None
#define TCP_OPTION_TIMESTAMP 8 // Timestamp value, Timestamp echo reply (2*4 byte)
u8 nLength;
u8 Data[];
}
PACKED;
#define min(n, m) ((n) <= (m) ? (n) : (m))
#define max(n, m) ((n) >= (m) ? (n) : (m))
// Modulo 32 sequence number arithmetic
#define lt(x, y) ((int) ((u32) (x) - (u32) (y)) < 0)
#define le(x, y) ((int) ((u32) (x) - (u32) (y)) <= 0)
#define gt(x, y) lt (y, x)
#define ge(x, y) le (y, x)
#define bw(l, x, h) (lt ((l), (x)) && lt ((x), (h))) // between
#define bwl(l, x, h) (le ((l), (x)) && lt ((x), (h))) // low border inclusive
#define bwh(l, x, h) (lt ((l), (x)) && le ((x), (h))) // high border inclusive
#define bwlh(l, x, h) (le ((l), (x)) && le ((x), (h))) // both borders inclusive
#if !defined (NDEBUG) && defined (TCP_DEBUG)
#define NEW_STATE(state) NewState (state, __LINE__);
#else
#define NEW_STATE(state) (m_State = state)
#endif
#ifndef NDEBUG
#define UNEXPECTED_STATE() UnexpectedState (__LINE__)
#else
#define UNEXPECTED_STATE() ((void) 0)
#endif
unsigned CTCPConnection::s_nConnections = 0;
static const char FromTCP[] = "tcp";
CTCPConnection::CTCPConnection (CNetConfig *pNetConfig,
CNetworkLayer *pNetworkLayer,
CIPAddress &rForeignIP,
u16 nForeignPort,
u16 nOwnPort)
: CNetConnection (pNetConfig, pNetworkLayer, rForeignIP, nForeignPort, nOwnPort, IPPROTO_TCP),
m_bActiveOpen (TRUE),
m_State (TCPStateClosed),
m_nErrno (0),
m_RetransmissionQueue (TCP_CONFIG_RETRANS_BUFFER_SIZE),
m_bRetransmit (FALSE),
m_bSendSYN (FALSE),
m_bFINQueued (FALSE),
m_nRetransmissionCount (0),
m_bTimedOut (FALSE),
m_pTimer (CTimer::Get ()),
m_nSND_WND (TCP_CONFIG_WINDOW),
m_nSND_UP (0),
m_nRCV_NXT (0),
m_nRCV_WND (TCP_CONFIG_WINDOW),
m_nIRS (0),
m_nSND_MSS (536) // RFC 1122 section 4.2.2.6
{
s_nConnections++;
for (unsigned nTimer = TCPTimerUser; nTimer < TCPTimerUnknown; nTimer++)
{
m_hTimer[nTimer] = 0;
}
m_nISS = CalculateISN ();
m_RTOCalculator.Initialize (m_nISS);
m_nSND_UNA = m_nISS;
m_nSND_NXT = m_nISS+1;
if (SendSegment (TCP_FLAG_SYN, m_nISS))
{
m_RTOCalculator.SegmentSent (m_nISS);
NEW_STATE (TCPStateSynSent);
m_nRetransmissionCount = MAX_RETRANSMISSIONS;
StartTimer (TCPTimerRetransmission, m_RTOCalculator.GetRTO ());
}
}
CTCPConnection::CTCPConnection (CNetConfig *pNetConfig,
CNetworkLayer *pNetworkLayer,
u16 nOwnPort)
: CNetConnection (pNetConfig, pNetworkLayer, nOwnPort, IPPROTO_TCP),
m_bActiveOpen (FALSE),
m_State (TCPStateListen),
m_nErrno (0),
m_RetransmissionQueue (TCP_CONFIG_RETRANS_BUFFER_SIZE),
m_bRetransmit (FALSE),
m_bSendSYN (FALSE),
m_bFINQueued (FALSE),
m_nRetransmissionCount (0),
m_bTimedOut (FALSE),
m_pTimer (CTimer::Get ()),
m_nSND_WND (TCP_CONFIG_WINDOW),
m_nSND_UP (0),
m_nRCV_NXT (0),
m_nRCV_WND (TCP_CONFIG_WINDOW),
m_nIRS (0),
m_nSND_MSS (536) // RFC 1122 section 4.2.2.6
{
s_nConnections++;
for (unsigned nTimer = TCPTimerUser; nTimer < TCPTimerUnknown; nTimer++)
{
m_hTimer[nTimer] = 0;
}
}
CTCPConnection::~CTCPConnection (void)
{
#ifdef TCP_DEBUG
CLogger::Get ()->Write (FromTCP, LogDebug, "Delete TCB");
#endif
assert (m_State == TCPStateClosed);
for (unsigned nTimer = TCPTimerUser; nTimer < TCPTimerUnknown; nTimer++)
{
StopTimer (nTimer);
}
// ensure no task is waiting any more
m_Event.Set ();
m_TxEvent.Set ();
assert (s_nConnections > 0);
s_nConnections--;
}
int CTCPConnection::Connect (void)
{
if (m_nErrno < 0)
{
return m_nErrno;
}
switch (m_State)
{
case TCPStateSynSent:
case TCPStateSynReceived:
m_Event.Clear ();
m_Event.Wait ();
break;
case TCPStateEstablished:
break;
case TCPStateListen:
case TCPStateFinWait1:
case TCPStateFinWait2:
case TCPStateCloseWait:
case TCPStateClosing:
case TCPStateLastAck:
case TCPStateTimeWait:
UNEXPECTED_STATE ();
// fall through
case TCPStateClosed:
return -1;
}
return m_nErrno;
}
int CTCPConnection::Accept (CIPAddress *pForeignIP, u16 *pForeignPort)
{
if (m_nErrno < 0)
{
return m_nErrno;
}
switch (m_State)
{
case TCPStateSynSent:
UNEXPECTED_STATE ();
// fall through
case TCPStateClosed:
case TCPStateFinWait1:
case TCPStateFinWait2:
case TCPStateCloseWait:
case TCPStateClosing:
case TCPStateLastAck:
case TCPStateTimeWait:
return -1;
case TCPStateListen:
m_Event.Clear ();
m_Event.Wait ();
break;
case TCPStateSynReceived:
case TCPStateEstablished:
break;
}
assert (pForeignIP != 0);
pForeignIP->Set (m_ForeignIP);
assert (pForeignPort != 0);
*pForeignPort = m_nForeignPort;
return m_nErrno;
}
int CTCPConnection::Close (void)
{
if (m_nErrno < 0)
{
return m_nErrno;
}
switch (m_State)
{
case TCPStateClosed:
return -1;
case TCPStateListen:
case TCPStateSynSent:
StopTimer (TCPTimerRetransmission);
NEW_STATE (TCPStateClosed);
break;
case TCPStateSynReceived:
case TCPStateEstablished:
assert (!m_bFINQueued);
m_StateAfterFIN = TCPStateFinWait1;
m_nRetransmissionCount = MAX_RETRANSMISSIONS;
m_bFINQueued = TRUE;
break;
case TCPStateFinWait1:
case TCPStateFinWait2:
break;
case TCPStateCloseWait:
assert (!m_bFINQueued);
m_StateAfterFIN = TCPStateLastAck; // RFC 1122 section 4.2.2.20 (a)
m_nRetransmissionCount = MAX_RETRANSMISSIONS;
m_bFINQueued = TRUE;
break;
case TCPStateClosing:
case TCPStateLastAck:
case TCPStateTimeWait:
return -1;
}
if (m_nErrno < 0)
{
return m_nErrno;
}
return 0;
}
int CTCPConnection::Send (const void *pData, unsigned nLength, int nFlags)
{
if ( nFlags != 0
&& nFlags != MSG_DONTWAIT)
{
return -1;
}
if (m_nErrno < 0)
{
return m_nErrno;
}
switch (m_State)
{
case TCPStateClosed:
case TCPStateListen:
case TCPStateFinWait1:
case TCPStateFinWait2:
case TCPStateClosing:
case TCPStateLastAck:
case TCPStateTimeWait:
return -1;
case TCPStateSynSent:
case TCPStateSynReceived:
case TCPStateEstablished:
case TCPStateCloseWait:
break;
}
unsigned nResult = nLength;
assert (pData != 0);
u8 *pBuffer = (u8 *) pData;
while (nLength > FRAME_BUFFER_SIZE)
{
m_TxQueue.Enqueue (pBuffer, FRAME_BUFFER_SIZE);
pBuffer += FRAME_BUFFER_SIZE;
nLength -= FRAME_BUFFER_SIZE;
}
if (nLength > 0)
{
m_TxQueue.Enqueue (pBuffer, nLength);
}
if (!(nFlags & MSG_DONTWAIT))
{
m_TxEvent.Clear ();
m_TxEvent.Wait ();
if (m_nErrno < 0)
{
return m_nErrno;
}
}
return nResult;
}
int CTCPConnection::Receive (void *pBuffer, int nFlags)
{
if ( nFlags != 0
&& nFlags != MSG_DONTWAIT)
{
return -1;
}
if (m_nErrno < 0)
{
return m_nErrno;
}
unsigned nLength;
while ((nLength = m_RxQueue.Dequeue (pBuffer)) == 0)
{
switch (m_State)
{
case TCPStateClosed:
case TCPStateListen:
case TCPStateFinWait1:
case TCPStateFinWait2:
case TCPStateCloseWait:
case TCPStateClosing:
case TCPStateLastAck:
case TCPStateTimeWait:
return -1;
case TCPStateSynSent:
case TCPStateSynReceived:
case TCPStateEstablished:
break;
}
if (nFlags & MSG_DONTWAIT)
{
return 0;
}
m_Event.Clear ();
m_Event.Wait ();
if (m_nErrno < 0)
{
return m_nErrno;
}
}
return nLength;
}
int CTCPConnection::SendTo (const void *pData, unsigned nLength, int nFlags,
CIPAddress &rForeignIP, u16 nForeignPort)
{
// ignore rForeignIP and nForeignPort
return Send (pData, nLength, nFlags);
}
int CTCPConnection::ReceiveFrom (void *pBuffer, int nFlags, CIPAddress *pForeignIP, u16 *pForeignPort)
{
int nResult = Receive (pBuffer, nFlags);
if (nResult <= 0)
{
return nResult;
}
if ( pForeignIP != 0
&& pForeignPort != 0)
{
pForeignIP->Set (m_ForeignIP);
*pForeignPort = m_nForeignPort;
}
return 0;
}
int CTCPConnection::SetOptionBroadcast (boolean bAllowed)
{
return 0;
}
boolean CTCPConnection::IsConnected (void) const
{
return m_State > TCPStateSynSent
&& m_State != TCPStateTimeWait;
}
boolean CTCPConnection::IsTerminated (void) const
{
return m_State == TCPStateClosed;
}
void CTCPConnection::Process (void)
{
if (m_bTimedOut)
{
m_nErrno = -1;
NEW_STATE (TCPStateClosed);
m_Event.Set ();
return;
}
switch (m_State)
{
case TCPStateClosed:
case TCPStateListen:
case TCPStateFinWait2:
case TCPStateTimeWait:
return;
case TCPStateSynSent:
case TCPStateSynReceived:
if (m_bSendSYN)
{
m_bSendSYN = FALSE;
if (m_State == TCPStateSynSent)
{
SendSegment (TCP_FLAG_SYN, m_nISS);
}
else
{
SendSegment (TCP_FLAG_SYN | TCP_FLAG_ACK, m_nISS, m_nRCV_NXT);
}
m_RTOCalculator.SegmentSent (m_nISS);
StartTimer (TCPTimerRetransmission, m_RTOCalculator.GetRTO ());
}
return;
case TCPStateEstablished:
case TCPStateFinWait1:
case TCPStateCloseWait:
case TCPStateClosing:
case TCPStateLastAck:
if ( m_RetransmissionQueue.IsEmpty ()
&& m_TxQueue.IsEmpty ()
&& m_bFINQueued)
{
SendSegment (TCP_FLAG_FIN | TCP_FLAG_ACK, m_nSND_NXT, m_nRCV_NXT);
m_RTOCalculator.SegmentSent (m_nSND_NXT);
m_nSND_NXT++;
NEW_STATE (m_StateAfterFIN);
m_bFINQueued = FALSE;
StartTimer (TCPTimerRetransmission, m_RTOCalculator.GetRTO ());
}
break;
}
u8 TempBuffer[FRAME_BUFFER_SIZE];
unsigned nLength;
while ( m_RetransmissionQueue.GetFreeSpace () >= FRAME_BUFFER_SIZE
&& (nLength = m_TxQueue.Dequeue (TempBuffer)) > 0)
{
#ifdef TCP_DEBUG
CLogger::Get ()->Write (FromTCP, LogDebug, "Transfering %u bytes into RT buffer", nLength);
#endif
m_RetransmissionQueue.Write (TempBuffer, nLength);
}
// pacing transmit
if ( ( m_State == TCPStateEstablished
|| m_State == TCPStateCloseWait)
&& m_TxQueue.IsEmpty ())
{
m_TxEvent.Set ();
}
if (m_bRetransmit)
{
#ifdef TCP_DEBUG
CLogger::Get ()->Write (FromTCP, LogDebug, "Retransmission (nxt %u, una %u)", m_nSND_NXT-m_nISS, m_nSND_UNA-m_nISS);
#endif
m_bRetransmit = FALSE;
m_RetransmissionQueue.Reset ();
m_nSND_NXT = m_nSND_UNA;
}
u32 nBytesAvail;
u32 nWindowLeft;
while ( (nBytesAvail = m_RetransmissionQueue.GetBytesAvailable ()) > 0
&& (nWindowLeft = m_nSND_UNA+m_nSND_WND-m_nSND_NXT) > 0)
{
nLength = min (nBytesAvail, nWindowLeft);
nLength = min (nLength, m_nSND_MSS);
#ifdef TCP_DEBUG
CLogger::Get ()->Write (FromTCP, LogDebug, "Transfering %u bytes into TX buffer", nLength);
#endif
assert (nLength <= FRAME_BUFFER_SIZE);
m_RetransmissionQueue.Read (TempBuffer, nLength);
unsigned nFlags = TCP_FLAG_ACK;
if (m_TxQueue.IsEmpty ())
{
nFlags |= TCP_FLAG_PUSH;
}
SendSegment (nFlags, m_nSND_NXT, m_nRCV_NXT, TempBuffer, nLength);
m_RTOCalculator.SegmentSent (m_nSND_NXT, nLength);
m_nSND_NXT += nLength;
StartTimer (TCPTimerRetransmission, m_RTOCalculator.GetRTO ());
}
}
int CTCPConnection::PacketReceived (const void *pPacket,
unsigned nLength,
CIPAddress &rSenderIP,
CIPAddress &rReceiverIP,
int nProtocol)
{
if (nProtocol != IPPROTO_TCP)
{
return 0;
}
if (nLength < sizeof (TTCPHeader))
{
return -1;
}
assert (pPacket != 0);
TTCPHeader *pHeader = (TTCPHeader *) pPacket;
if (m_nOwnPort != be2le16 (pHeader->nDestPort))
{
return 0;
}
if (m_State != TCPStateListen)
{
if ( m_ForeignIP != rSenderIP
|| m_nForeignPort != be2le16 (pHeader->nSourcePort))
{
return 0;
}
}
else
{
if (!(pHeader->nDataOffsetFlags & TCP_FLAG_SYN))
{
return 0;
}
m_Checksum.SetDestinationAddress (rSenderIP);
}
if (m_Checksum.Calculate (pPacket, nLength) != CHECKSUM_OK)
{
return 0;
}
u16 nFlags = pHeader->nDataOffsetFlags;
u32 nDataOffset = TCP_DATA_OFFSET (pHeader->nDataOffsetFlags)*4;
u32 nDataLength = nLength-nDataOffset;
// Current Segment Variables
u32 nSEG_SEQ = be2le32 (pHeader->nSequenceNumber);
u32 nSEG_ACK = be2le32 (pHeader->nAcknowledgmentNumber);
u32 nSEG_LEN = nDataLength;
if (nFlags & TCP_FLAG_SYN)
{
nSEG_LEN++;
}
if (nFlags & TCP_FLAG_FIN)
{
nSEG_LEN++;
}
u32 nSEG_WND = be2le16 (pHeader->nWindow);
//u16 nSEG_UP = be2le16 (pHeader->nUrgentPointer);
//u32 nSEG_PRC; // segment precedence value
ScanOptions (pHeader);
#ifdef TCP_DEBUG
CLogger::Get ()->Write (FromTCP, LogDebug,
"rx %c%c%c%c%c%c, seq %u, ack %u, win %u, len %u",
nFlags & TCP_FLAG_URGENT ? 'U' : '-',
nFlags & TCP_FLAG_ACK ? 'A' : '-',
nFlags & TCP_FLAG_PUSH ? 'P' : '-',
nFlags & TCP_FLAG_RESET ? 'R' : '-',
nFlags & TCP_FLAG_SYN ? 'S' : '-',
nFlags & TCP_FLAG_FIN ? 'F' : '-',
nSEG_SEQ-m_nIRS,
nFlags & TCP_FLAG_ACK ? nSEG_ACK-m_nISS : 0,
nSEG_WND,
nDataLength);
DumpStatus ();
#endif
boolean bAcceptable = FALSE;
// RFC 793 section 3.9 "SEGMENT ARRIVES"
switch (m_State)
{
case TCPStateClosed:
if (nFlags & TCP_FLAG_RESET)
{
// ignore
}
else if (!(nFlags & TCP_FLAG_ACK))
{
m_ForeignIP.Set (rSenderIP);
m_nForeignPort = be2le16 (pHeader->nSourcePort);
m_Checksum.SetDestinationAddress (rSenderIP);
SendSegment (TCP_FLAG_RESET | TCP_FLAG_ACK, 0, nSEG_SEQ+nSEG_LEN);
}
else
{
m_ForeignIP.Set (rSenderIP);
m_nForeignPort = be2le16 (pHeader->nSourcePort);
m_Checksum.SetDestinationAddress (rSenderIP);
SendSegment (TCP_FLAG_RESET, nSEG_ACK);
}
break;
case TCPStateListen:
if (nFlags & TCP_FLAG_RESET)
{
// ignore
}
else if (nFlags & TCP_FLAG_ACK)
{
m_ForeignIP.Set (rSenderIP);
m_nForeignPort = be2le16 (pHeader->nSourcePort);
m_Checksum.SetDestinationAddress (rSenderIP);
SendSegment (TCP_FLAG_RESET, nSEG_ACK);
}
else if (nFlags & TCP_FLAG_SYN)
{
if (s_nConnections >= TCP_MAX_CONNECTIONS)
{
m_ForeignIP.Set (rSenderIP);
m_nForeignPort = be2le16 (pHeader->nSourcePort);
m_Checksum.SetDestinationAddress (rSenderIP);
SendSegment (TCP_FLAG_RESET | TCP_FLAG_ACK, 0, nSEG_SEQ+nSEG_LEN);
break;
}
m_nRCV_NXT = nSEG_SEQ+1;
m_nIRS = nSEG_SEQ;
m_nSND_WND = nSEG_WND;
m_nSND_WL1 = nSEG_SEQ;
m_nSND_WL2 = nSEG_ACK;
assert (nSEG_LEN > 0);
if (nDataLength > 0)
{
m_RxQueue.Enqueue ((u8 *) pPacket+nDataOffset, nDataLength);
}
m_nISS = CalculateISN ();
m_RTOCalculator.Initialize (m_nISS);
m_ForeignIP.Set (rSenderIP);
m_nForeignPort = be2le16 (pHeader->nSourcePort);
m_Checksum.SetDestinationAddress (rSenderIP);
SendSegment (TCP_FLAG_SYN | TCP_FLAG_ACK, m_nISS, m_nRCV_NXT);
m_RTOCalculator.SegmentSent (m_nISS);
m_nSND_NXT = m_nISS+1;
m_nSND_UNA = m_nISS;
NEW_STATE (TCPStateSynReceived);
m_Event.Set ();
}
break;
case TCPStateSynSent:
if (nFlags & TCP_FLAG_ACK)
{
if (!bwh (m_nISS, nSEG_ACK, m_nSND_NXT))
{
if (!(nFlags & TCP_FLAG_RESET))
{
SendSegment (TCP_FLAG_RESET, nSEG_ACK);
}
return 1;
}
else if (bwlh (m_nSND_UNA, nSEG_ACK, m_nSND_NXT))
{
bAcceptable = TRUE;
}
}
if (nFlags & TCP_FLAG_RESET)
{
if (bAcceptable)
{
NEW_STATE (TCPStateClosed);
m_bSendSYN = FALSE;
m_nErrno = -1;
m_Event.Set ();
}
break;
}
if ( (nFlags & TCP_FLAG_ACK)
&& !bAcceptable)
{
break;
}
if (nFlags & TCP_FLAG_SYN)
{
m_nRCV_NXT = nSEG_SEQ+1;
m_nIRS = nSEG_SEQ;
if (nFlags & TCP_FLAG_ACK)
{
m_RTOCalculator.SegmentAcknowledged (nSEG_ACK);
if (nSEG_ACK-m_nSND_UNA > 1)
{
m_RetransmissionQueue.Advance (nSEG_ACK-m_nSND_UNA-1);
}
m_nSND_UNA = nSEG_ACK;
}
if (gt (m_nSND_UNA, m_nISS))
{
NEW_STATE (TCPStateEstablished);
m_bSendSYN = FALSE;
StopTimer (TCPTimerRetransmission);
// next transmission starts with this count
m_nRetransmissionCount = MAX_RETRANSMISSIONS;
m_Event.Set ();
// RFC 1122 section 4.2.2.20 (c)
m_nSND_WND = nSEG_WND;
m_nSND_WL1 = nSEG_SEQ;
m_nSND_WL2 = nSEG_ACK;
SendSegment (TCP_FLAG_ACK, m_nSND_NXT, m_nRCV_NXT);
if ( (nFlags & TCP_FLAG_FIN) // other controls?
|| nDataLength > 0)
{
goto StepSix;
}
break;
}
else
{
NEW_STATE (TCPStateSynReceived);
m_bSendSYN = FALSE;
SendSegment (TCP_FLAG_SYN | TCP_FLAG_ACK, m_nISS, m_nRCV_NXT);
m_RTOCalculator.SegmentSent (m_nISS);
m_nRetransmissionCount = MAX_RETRANSMISSIONS;
StartTimer (TCPTimerRetransmission, m_RTOCalculator.GetRTO ());
if ( (nFlags & TCP_FLAG_FIN) // other controls?
|| nDataLength > 0)
{
if (nFlags & TCP_FLAG_FIN)
{
SendSegment (TCP_FLAG_RESET, m_nSND_NXT);
NEW_STATE (TCPStateClosed);
m_nErrno = -1;
m_Event.Set ();
}
if (nDataLength > 0)
{
m_RxQueue.Enqueue ((u8 *) pPacket+nDataOffset, nDataLength);
}
break;
}
}
}
break;
case TCPStateSynReceived:
case TCPStateEstablished:
case TCPStateFinWait1:
case TCPStateFinWait2:
case TCPStateCloseWait:
case TCPStateClosing:
case TCPStateLastAck:
case TCPStateTimeWait:
// step 1 ( check sequence number)
if (m_nRCV_WND > 0)
{
if (nSEG_LEN == 0)
{
if (bwl (m_nRCV_NXT, nSEG_SEQ, m_nRCV_NXT+m_nRCV_WND))
{
bAcceptable = TRUE;
}
}
else
{
if ( bwl (m_nRCV_NXT, nSEG_SEQ, m_nRCV_NXT+m_nRCV_WND)
|| bwl (m_nRCV_NXT, nSEG_SEQ+nSEG_LEN-1, m_nRCV_NXT+m_nRCV_WND))
{
bAcceptable = TRUE;
}
}
}
else
{
if (nSEG_LEN == 0)
{
if (nSEG_SEQ == m_nRCV_NXT)
{
bAcceptable = TRUE;
}
}
}
if ( !bAcceptable
&& m_State != TCPStateSynReceived)
{
SendSegment (TCP_FLAG_ACK, m_nSND_NXT, m_nRCV_NXT);
break;
}
// step 2 (check RST bit)
if (nFlags & TCP_FLAG_RESET)
{
switch (m_State)
{
case TCPStateSynReceived:
m_RetransmissionQueue.Flush ();
if (!m_bActiveOpen)
{
NEW_STATE (TCPStateListen);
return 1;
}
else
{
m_nErrno = -1;
NEW_STATE (TCPStateClosed);
m_Event.Set ();
return 1;
}
break;
case TCPStateEstablished:
case TCPStateFinWait1:
case TCPStateFinWait2:
case TCPStateCloseWait:
m_nErrno = -1;
m_RetransmissionQueue.Flush ();
m_TxQueue.Flush ();
m_RxQueue.Flush ();
NEW_STATE (TCPStateClosed);
m_Event.Set ();
return 1;
case TCPStateClosing:
case TCPStateLastAck:
case TCPStateTimeWait:
NEW_STATE (TCPStateClosed);
m_Event.Set ();
return 1;
default:
UNEXPECTED_STATE ();
return 1;
}
}
// step 3 (check security and precedence, not supported)
// step 4 (check SYN bit)
if (nFlags & TCP_FLAG_SYN)
{
// RFC 1122 section 4.2.2.20 (e)
if ( m_State == TCPStateSynReceived
&& !m_bActiveOpen)
{
NEW_STATE (TCPStateListen);
return 1;
}
SendSegment (TCP_FLAG_RESET, m_nSND_NXT);
m_nErrno = -1;
m_RetransmissionQueue.Flush ();
m_TxQueue.Flush ();
m_RxQueue.Flush ();
NEW_STATE (TCPStateClosed);
m_Event.Set ();
return 1;
}
// step 5 (check ACK field)
if (!(nFlags & TCP_FLAG_ACK))
{
return 1;
}
switch (m_State)
{
case TCPStateSynReceived:
if (bwlh (m_nSND_UNA, nSEG_ACK, m_nSND_NXT))
{
// RFC 1122 section 4.2.2.20 (f)
m_nSND_WND = nSEG_WND;
m_nSND_WL1 = nSEG_SEQ;
m_nSND_WL2 = nSEG_ACK;
m_nSND_UNA = nSEG_ACK; // got ACK for SYN
m_RTOCalculator.SegmentAcknowledged (nSEG_ACK);
NEW_STATE (TCPStateEstablished);
// next transmission starts with this count
m_nRetransmissionCount = MAX_RETRANSMISSIONS;
}
else
{
SendSegment (TCP_FLAG_RESET, nSEG_ACK);
}
break;
case TCPStateEstablished:
case TCPStateFinWait1:
case TCPStateFinWait2:
case TCPStateCloseWait:
case TCPStateClosing:
if (bwh (m_nSND_UNA, nSEG_ACK, m_nSND_NXT))
{
m_RTOCalculator.SegmentAcknowledged (nSEG_ACK);
unsigned nBytesAck = nSEG_ACK-m_nSND_UNA;
m_nSND_UNA = nSEG_ACK;
if (nSEG_ACK == m_nSND_NXT) // all segments are acknowledged
{
StopTimer (TCPTimerRetransmission);
// next transmission starts with this count
m_nRetransmissionCount = MAX_RETRANSMISSIONS;
}
if ( m_State == TCPStateFinWait1
|| m_State == TCPStateClosing)
{
nBytesAck--; // acknowledged FIN does not count
m_bFINQueued = FALSE;
}
if ( m_State == TCPStateEstablished
&& nBytesAck == 1)
{
nBytesAck--;
}
if (nBytesAck > 0)
{
m_RetransmissionQueue.Advance (nBytesAck);
}
// update send window
if ( lt (m_nSND_WL1, nSEG_SEQ)
|| ( m_nSND_WL1 == nSEG_SEQ
&& le (m_nSND_WL2, nSEG_ACK)))
{
m_nSND_WND = nSEG_WND;
m_nSND_WL1 = nSEG_SEQ;
m_nSND_WL2 = nSEG_ACK;
}
}
else if (le (nSEG_ACK, m_nSND_UNA)) // RFC 1122 section 4.2.2.20 (g)
{
// ignore duplicate ACK ...
// RFC 1122 section 4.2.2.20 (g)
if (bwlh (m_nSND_UNA, nSEG_ACK, m_nSND_NXT))
{
// ... but update send window
if ( lt (m_nSND_WL1, nSEG_SEQ)
|| ( m_nSND_WL1 == nSEG_SEQ
&& le (m_nSND_WL2, nSEG_ACK)))
{
m_nSND_WND = nSEG_WND;
m_nSND_WL1 = nSEG_SEQ;
m_nSND_WL2 = nSEG_ACK;
}
}
}
else if (gt (nSEG_ACK, m_nSND_NXT))
{
SendSegment (TCP_FLAG_ACK, m_nSND_NXT, m_nRCV_NXT);
return 1;
}
switch (m_State)
{
case TCPStateEstablished:
case TCPStateCloseWait:
break;
case TCPStateFinWait1:
if (nSEG_ACK == m_nSND_NXT) // if our FIN is now acknowledged
{
m_RTOCalculator.SegmentAcknowledged (nSEG_ACK);
m_bFINQueued = FALSE;
StopTimer (TCPTimerRetransmission);
NEW_STATE (TCPStateFinWait2);
StartTimer (TCPTimerTimeWait, HZ_FIN_TIMEOUT);
}
else
{
break;
}
// fall through
case TCPStateFinWait2:
if (m_RetransmissionQueue.IsEmpty ())
{
m_Event.Set ();
}
break;
case TCPStateClosing:
if (nSEG_ACK == m_nSND_NXT) // if our FIN is now acknowledged
{
m_RTOCalculator.SegmentAcknowledged (nSEG_ACK);
m_bFINQueued = FALSE;
StopTimer (TCPTimerRetransmission);
NEW_STATE (TCPStateTimeWait);
StartTimer (TCPTimerTimeWait, HZ_TIMEWAIT);
}
break;
default:
UNEXPECTED_STATE ();
break;
}
break;
case TCPStateLastAck:
if (nSEG_ACK == m_nSND_NXT) // if our FIN is now acknowledged
{
m_bFINQueued = FALSE;
NEW_STATE (TCPStateClosed);
m_Event.Set ();
return 1;
}
break;
case TCPStateTimeWait:
if (nSEG_ACK == m_nSND_NXT) // if our FIN is now acknowledged
{
m_bFINQueued = FALSE;
SendSegment (TCP_FLAG_ACK, m_nSND_NXT, m_nRCV_NXT);
StartTimer (TCPTimerTimeWait, HZ_TIMEWAIT);
}
break;
default:
UNEXPECTED_STATE ();
break;
}
// step 6 (check URG bit, not supported)
StepSix:
// step 7 (process text segment)
if (nSEG_LEN == 0)
{
return 1;
}
switch (m_State)
{
case TCPStateEstablished:
case TCPStateFinWait1:
case TCPStateFinWait2:
if (nSEG_SEQ == m_nRCV_NXT)
{
if (nDataLength > 0)
{
m_RxQueue.Enqueue ((u8 *) pPacket+nDataOffset, nDataLength);
m_nRCV_NXT += nDataLength;
// m_nRCV_WND should be adjusted here (section 3.7)
// following ACK could be piggybacked with data
SendSegment (TCP_FLAG_ACK, m_nSND_NXT, m_nRCV_NXT);
if (nFlags & TCP_FLAG_PUSH)
{
m_Event.Set ();
}
}
}
else
{
SendSegment (TCP_FLAG_ACK, m_nSND_NXT, m_nRCV_NXT);
return 1;
}
break;
case TCPStateSynReceived: // this state not in RFC 793
case TCPStateCloseWait:
case TCPStateClosing:
case TCPStateLastAck:
case TCPStateTimeWait:
break;
default:
UNEXPECTED_STATE ();
break;
}
// step 8 (check FIN bit)
if ( m_State == TCPStateClosed
|| m_State == TCPStateListen
|| m_State == TCPStateSynSent)
{
return 1;
}
if (!(nFlags & TCP_FLAG_FIN))
{
return 1;
}
// connection is closing
m_nRCV_NXT++;
SendSegment (TCP_FLAG_ACK, m_nSND_NXT, m_nRCV_NXT);
switch (m_State)
{
case TCPStateSynReceived:
case TCPStateEstablished:
NEW_STATE (TCPStateCloseWait);
m_Event.Set ();
break;
case TCPStateFinWait1:
if (nSEG_ACK == m_nSND_NXT) // if our FIN is now acknowledged
{
m_bFINQueued = FALSE;
StopTimer (TCPTimerRetransmission);
StopTimer (TCPTimerUser);
NEW_STATE (TCPStateTimeWait);
StartTimer (TCPTimerTimeWait, HZ_TIMEWAIT);
}
else
{
NEW_STATE (TCPStateClosing);
}
break;
case TCPStateFinWait2:
StopTimer (TCPTimerRetransmission);
StopTimer (TCPTimerUser);
NEW_STATE (TCPStateTimeWait);
StartTimer (TCPTimerTimeWait, HZ_TIMEWAIT);
break;
case TCPStateCloseWait:
case TCPStateClosing:
case TCPStateLastAck:
break;
case TCPStateTimeWait:
StartTimer (TCPTimerTimeWait, HZ_TIMEWAIT);
break;
default:
UNEXPECTED_STATE ();
break;
}
break;
}
return 1;
}
int CTCPConnection::NotificationReceived (TICMPNotificationType Type,
CIPAddress &rSenderIP,
CIPAddress &rReceiverIP,
u16 nSendPort,
u16 nReceivePort,
int nProtocol)
{
if (nProtocol != IPPROTO_TCP)
{
return 0;
}
if (m_State < TCPStateSynSent)
{
return 0;
}
if ( m_ForeignIP != rSenderIP
|| m_nForeignPort != nSendPort)
{
return 0;
}
assert (m_pNetConfig != 0);
if ( rReceiverIP != *m_pNetConfig->GetIPAddress ()
|| m_nOwnPort != nReceivePort)
{
return 0;
}
m_nErrno = -1;
StopTimer (TCPTimerRetransmission);
NEW_STATE (TCPStateTimeWait);
StartTimer (TCPTimerTimeWait, HZ_TIMEWAIT);
m_Event.Set ();
return 1;
}
boolean CTCPConnection::SendSegment (unsigned nFlags, u32 nSequenceNumber, u32 nAcknowledgmentNumber,
const void *pData, unsigned nDataLength)
{
unsigned nDataOffset = 5;
assert (nDataOffset * 4 == sizeof (TTCPHeader));
if (nFlags & TCP_FLAG_SYN)
{
nDataOffset++;
}
unsigned nHeaderLength = nDataOffset * 4;
unsigned nPacketLength = nHeaderLength + nDataLength; // may wrap
assert (nPacketLength >= nHeaderLength);
assert (nHeaderLength <= FRAME_BUFFER_SIZE);
u8 TxBuffer[FRAME_BUFFER_SIZE];
TTCPHeader *pHeader = (TTCPHeader *) TxBuffer;
pHeader->nSourcePort = le2be16 (m_nOwnPort);
pHeader->nDestPort = le2be16 (m_nForeignPort);
pHeader->nSequenceNumber = le2be32 (nSequenceNumber);
pHeader->nAcknowledgmentNumber = nFlags & TCP_FLAG_ACK ? le2be32 (nAcknowledgmentNumber) : 0;
pHeader->nDataOffsetFlags = (nDataOffset << TCP_DATA_OFFSET_SHIFT) | nFlags;
pHeader->nWindow = le2be16 (m_nRCV_WND);
pHeader->nUrgentPointer = le2be16 (m_nSND_UP);
if (nFlags & TCP_FLAG_SYN)
{
TTCPOption *pOption = (TTCPOption *) pHeader->Options;
pOption->nKind = TCP_OPTION_MSS;
pOption->nLength = 4;
pOption->Data[0] = TCP_CONFIG_MSS >> 8;
pOption->Data[1] = TCP_CONFIG_MSS & 0xFF;
}
if (nDataLength > 0)
{
assert (pData != 0);
memcpy (TxBuffer+nHeaderLength, pData, nDataLength);
}
pHeader->nChecksum = 0; // must be 0 for calculation
pHeader->nChecksum = m_Checksum.Calculate (TxBuffer, nPacketLength);
#ifdef TCP_DEBUG
CLogger::Get ()->Write (FromTCP, LogDebug,
"tx %c%c%c%c%c%c, seq %u, ack %u, win %u, len %u",
nFlags & TCP_FLAG_URGENT ? 'U' : '-',
nFlags & TCP_FLAG_ACK ? 'A' : '-',
nFlags & TCP_FLAG_PUSH ? 'P' : '-',
nFlags & TCP_FLAG_RESET ? 'R' : '-',
nFlags & TCP_FLAG_SYN ? 'S' : '-',
nFlags & TCP_FLAG_FIN ? 'F' : '-',
nSequenceNumber-m_nISS,
nFlags & TCP_FLAG_ACK ? nAcknowledgmentNumber-m_nIRS : 0,
m_nRCV_WND,
nDataLength);
#endif
assert (m_pNetworkLayer != 0);
return m_pNetworkLayer->Send (m_ForeignIP, TxBuffer, nPacketLength, IPPROTO_TCP);
}
void CTCPConnection::ScanOptions (TTCPHeader *pHeader)
{
assert (pHeader != 0);
unsigned nDataOffset = TCP_DATA_OFFSET (pHeader->nDataOffsetFlags)*4;
u8 *pHeaderEnd = (u8 *) pHeader+nDataOffset;
TTCPOption *pOption = (TTCPOption *) pHeader->Options;
while ((u8 *) pOption+2 <= pHeaderEnd)
{
switch (pOption->nKind)
{
case TCP_OPTION_END_OF_LIST:
return;
case TCP_OPTION_NOP:
pOption = (TTCPOption *) ((u8 *) pOption+1);
break;
case TCP_OPTION_MSS:
if ( pOption->nLength == 4
&& (u8 *) pOption+4 <= pHeaderEnd)
{
u32 nMSS = (u16) pOption->Data[0] << 8 | pOption->Data[1];
// RFC 1122 section 4.2.2.6
nMSS = min (nMSS+20, MSS_S) - TCP_HEADER_SIZE - IP_OPTION_SIZE;
if (nMSS >= 10) // self provided sanity check
{
m_nSND_MSS = (u16) nMSS;
}
}
// fall through
default:
pOption = (TTCPOption *) ((u8 *) pOption+pOption->nLength);
break;
}
}
}
u32 CTCPConnection::CalculateISN (void)
{
assert (m_pTimer != 0);
return ( m_pTimer->GetTime () * HZ
+ m_pTimer->GetTicks () % HZ)
* (TCP_MAX_WINDOW / TCP_QUIET_TIME / HZ);
}
void CTCPConnection::StartTimer (unsigned nTimer, unsigned nHZ)
{
assert (nTimer < TCPTimerUnknown);
assert (nHZ > 0);
assert (m_pTimer != 0);
StopTimer (nTimer);
m_hTimer[nTimer] = m_pTimer->StartKernelTimer (nHZ, TimerStub, (void *) (uintptr) nTimer, this);
}
void CTCPConnection::StopTimer (unsigned nTimer)
{
assert (nTimer < TCPTimerUnknown);
assert (m_pTimer != 0);
m_TimerSpinLock.Acquire ();
if (m_hTimer[nTimer] != 0)
{
m_pTimer->CancelKernelTimer (m_hTimer[nTimer]);
m_hTimer[nTimer] = 0;
}
m_TimerSpinLock.Release ();
}
void CTCPConnection::TimerHandler (unsigned nTimer)
{
assert (nTimer < TCPTimerUnknown);
m_TimerSpinLock.Acquire ();
if (m_hTimer[nTimer] == 0) // timer was stopped in the meantime
{
m_TimerSpinLock.Release ();
return;
}
m_hTimer[nTimer] = 0;
m_TimerSpinLock.Release ();
switch (nTimer)
{
case TCPTimerRetransmission:
m_RTOCalculator.RetransmissionTimerExpired ();
if (m_nRetransmissionCount-- == 0)
{
m_bTimedOut = TRUE;
break;
}
switch (m_State)
{
case TCPStateClosed:
case TCPStateListen:
case TCPStateFinWait2:
case TCPStateTimeWait:
UNEXPECTED_STATE ();
break;
case TCPStateSynSent:
case TCPStateSynReceived:
assert (!m_bSendSYN);
m_bSendSYN = TRUE;
break;
case TCPStateEstablished:
case TCPStateCloseWait:
assert (!m_bRetransmit);
m_bRetransmit = TRUE;
break;
case TCPStateFinWait1:
case TCPStateClosing:
case TCPStateLastAck:
assert (!m_bFINQueued);
m_bFINQueued = TRUE;
break;
}
break;
case TCPTimerTimeWait:
NEW_STATE (TCPStateClosed);
break;
case TCPTimerUser:
case TCPTimerUnknown:
assert (0);
break;
}
}
void CTCPConnection::TimerStub (TKernelTimerHandle hTimer, void *pParam, void *pContext)
{
CTCPConnection *pThis = (CTCPConnection *) pContext;
assert (pThis != 0);
unsigned nTimer = (unsigned) (uintptr) pParam;
assert (nTimer < TCPTimerUnknown);
pThis->TimerHandler (nTimer);
}
#ifndef NDEBUG
void CTCPConnection::DumpStatus (void)
{
CLogger::Get ()->Write (FromTCP, LogDebug,
"sta %u, una %u, snx %u, swn %u, rnx %u, rwn %u, fprt %u",
m_State,
m_nSND_UNA-m_nISS,
m_nSND_NXT-m_nISS,
m_nSND_WND,
m_nRCV_NXT-m_nIRS,
m_nRCV_WND,
(unsigned) m_nForeignPort);
}
TTCPState CTCPConnection::NewState (TTCPState State, unsigned nLine)
{
const static char *StateName[] = // must match TTCPState
{
"CLOSED",
"LISTEN",
"SYN-SENT",
"SYN-RECEIVED",
"ESTABLISHED",
"FIN-WAIT-1",
"FIN-WAIT-2",
"CLOSE-WAIT",
"CLOSING",
"LAST-ACK",
"TIME-WAIT"
};
assert (m_State < sizeof StateName / sizeof StateName[0]);
assert (State < sizeof StateName / sizeof StateName[0]);
CLogger::Get ()->Write (FromTCP, LogDebug, "State %s -> %s at line %u", StateName[m_State], StateName[State], nLine);
return m_State = State;
}
void CTCPConnection::UnexpectedState (unsigned nLine)
{
DumpStatus ();
CLogger::Get ()->Write (FromTCP, LogPanic, "Unexpected state %u at line %u", m_State, nLine);
}
#endif
| rsta2/circle | lib/net/tcpconnection.cpp | C++ | gpl-3.0 | 34,730 |
#include "template_components.h"
#include <QtGui/QSpacerItem>
TemplateComponents::TemplateComponents(const QSharedPointer<const Template>& templ,
QWidget *parent)
: QWidget(parent), templ(templ)
{
ui.setupUi(this);
QList<FoodComponent> components = templ->getComponents();
for (QList<FoodComponent>::iterator i = components.begin(); i != components.end(); ++i)
{
componentWidgetGroups.append(ComponentWidgetGroup(i->getFoodAmount(), this));
}
ui.componentLayout->addItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding),
ui.componentLayout->rowCount(), 0);
}
TemplateComponents::~TemplateComponents()
{
}
QSharedPointer<FoodCollection> TemplateComponents::getCollection() const
{
QSharedPointer<FoodCollection> collection = FoodCollection::createFoodCollection(templ->getDisplayName());
for (QList<ComponentWidgetGroup>::const_iterator i = componentWidgetGroups.begin();
i != componentWidgetGroups.end(); ++i)
{
collection->addComponent(i->getFoodAmount());
}
return collection;
}
TemplateComponents::ComponentWidgetGroup::ComponentWidgetGroup
(FoodAmount foodAmount, TemplateComponents* parent)
: food(foodAmount.getFood()), lblFoodName(new QLabel(parent)),
txtAmount(new QLineEdit(parent)), cbUnit(new QComboBox(parent)),
chkIncludeRefuse(new QCheckBox(parent))
{
int row = parent->ui.componentLayout->rowCount();
parent->ui.componentLayout->addWidget(lblFoodName, row, 0);
parent->ui.componentLayout->addWidget(txtAmount, row, 1);
parent->ui.componentLayout->addWidget(cbUnit, row, 2);
parent->ui.componentLayout->addWidget(chkIncludeRefuse, row, 3);
lblFoodName->setText(food->getDisplayName());
lblFoodName->setWordWrap(true);
txtAmount->setText(QString::number(foodAmount.getAmount()));
txtAmount->setMinimumWidth(50);
txtAmount->setMaximumWidth(80);
txtAmount->setAlignment(Qt::AlignRight);
QMap<QString, QSharedPointer<const Unit> > unitsToShow;
QList<Unit::Dimensions::Dimension> validDimensions = food->getValidDimensions();
for (QList<Unit::Dimensions::Dimension>::const_iterator i = validDimensions.begin();
i != validDimensions.end(); ++i)
{
QVector<QSharedPointer<const Unit> > units = Unit::getAllUnits(*i);
for (QVector<QSharedPointer<const Unit> >::const_iterator i = units.begin();
i != units.end(); ++i)
{
unitsToShow.insert((*i)->getName(), *i);
}
}
for (QMap<QString, QSharedPointer<const Unit> >::iterator i = unitsToShow.begin();
i != unitsToShow.end(); ++i)
{
cbUnit->addItem(i.value()->getNameAndAbbreviation(),
i.value()->getAbbreviation());
}
cbUnit->setCurrentIndex(cbUnit->findData(foodAmount.getUnit()->getAbbreviation()));
chkIncludeRefuse->setText("Including inedible parts");
chkIncludeRefuse->setChecked
(foodAmount.includesRefuse() && foodAmount.getFood()->getPercentRefuse() > 0);
chkIncludeRefuse->setEnabled(foodAmount.getFood()->getPercentRefuse() > 0);
}
FoodAmount TemplateComponents::ComponentWidgetGroup::getFoodAmount() const
{
return FoodAmount(food, txtAmount->text().toDouble(),
Unit::getUnit(cbUnit->itemData(cbUnit->currentIndex()).toString()),
!chkIncludeRefuse->isEnabled() || chkIncludeRefuse->isChecked());
}
| tylermchenry/nutrition_tracker | application/src/widgets/template_components.cpp | C++ | gpl-3.0 | 3,460 |
#define BOOST_TEST_MODULE segmentize tests
#include <boost/test/unit_test.hpp>
#include <ostream>
#include "segmentize.hpp"
#include "bg_operators.hpp"
using namespace std;
BOOST_AUTO_TEST_SUITE(segmentize_tests)
void print_result(const vector<std::pair<linestring_type_fp, bool>>& result) {
cout << result;
}
BOOST_AUTO_TEST_CASE(abuts) {
vector<pair<linestring_type_fp, bool>> ms = {
{{{0,0}, {2,2}}, true},
{{{1,1}, {2,0}}, true},
};
const auto& result = segmentize::segmentize_paths(ms);
BOOST_CHECK_EQUAL(result.size(), 3UL);
}
BOOST_AUTO_TEST_CASE(x_shape) {
vector<pair<linestring_type_fp, bool>> ms = {
{{{0,10000}, {10000,9000}}, true},
{{{10000,10000}, {0,0}}, true},
};
const auto& result = segmentize::segmentize_paths(ms);
BOOST_CHECK_EQUAL(result.size(), 4UL);
}
BOOST_AUTO_TEST_CASE(plus_shape) {
vector<pair<linestring_type_fp, bool>> ms = {
{{{1,2}, {3,2}}, true},
{{{2,1}, {2,3}}, true},
};
const auto& result = segmentize::segmentize_paths(ms);
BOOST_CHECK_EQUAL(result.size(), 4UL);
}
BOOST_AUTO_TEST_CASE(touching_no_overlap) {
vector<pair<linestring_type_fp, bool>> ms = {
{{{1,20}, {40,50}}, true},
{{{40,50}, {80,90}}, true},
};
const auto& result = segmentize::segmentize_paths(ms);
BOOST_CHECK_EQUAL(result.size(), 2UL);
}
BOOST_AUTO_TEST_CASE(parallel_with_overlap) {
vector<pair<linestring_type_fp, bool>> ms = {
{{{10,10}, {0,0}}, false},
{{{9,9}, {20,20}}, true},
{{{30,30}, {15,15}}, true},
};
const auto& result = segmentize::segmentize_paths(ms);
BOOST_CHECK_EQUAL(result.size(), 7UL);
//print_result(result);
}
BOOST_AUTO_TEST_CASE(parallel_with_overlap_directed) {
vector<pair<linestring_type_fp, bool>> ms = {
{{{10,10}, {0,0}}, true},
{{{9,9}, {20,20}}, false},
{{{30,30}, {15,15}}, false},
};
const auto& result = segmentize::segmentize_paths(ms);
BOOST_CHECK_EQUAL(result.size(), 7UL);
//print_result(result);
}
BOOST_AUTO_TEST_CASE(sort_segments) {
vector<pair<linestring_type_fp, bool>> ms = {
{{{10,10}, {13,-4}}, true},
{{{13,-4}, {10,10}}, true},
{{{13,-4}, {10,10}}, true},
{{{10, 10}, {13, -4}}, true},
{{{10, 10}, {13, -4}}, true},
};
const auto& result = segmentize::segmentize_paths(ms);
BOOST_CHECK_EQUAL(result.size(), 5UL);
//print_result(result);
}
BOOST_AUTO_TEST_SUITE_END()
| pcb2gcode/pcb2gcode | segmentize_tests.cpp | C++ | gpl-3.0 | 2,382 |
<?php
/**
* Simple product add to cart
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.1.0
*/
global $woocommerce, $product;
if ( ! $product->is_purchasable() ) return;
?>
<?php
// Availability
$availability = $product->get_availability();
if ($availability['availability']) :
echo apply_filters( 'woocommerce_stock_html', '<p class="stock '.$availability['class'].'">'.$availability['availability'].'</p>', $availability['availability'] );
endif;
?>
<?php if ( $product->is_in_stock() && is_shop_enabled() ) : ?>
<?php do_action('woocommerce_before_add_to_cart_form'); ?>
<form action="<?php echo esc_url( $product->add_to_cart_url() ); ?>" class="cart" method="post" enctype='multipart/form-data'>
<?php do_action('woocommerce_before_add_to_cart_button'); ?>
<?php
if ( ! $product->is_sold_individually() ){
?><label><?php _e( 'Quantity', 'yit' ) ?></label><?php
woocommerce_quantity_input( array(
'min_value' => apply_filters( 'woocommerce_quantity_input_min', 1, $product ),
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product )
) );
}
$label = apply_filters( 'single_simple_add_to_cart_text', yit_get_option( 'add-to-cart-text' ) );
?>
<button type="submit" class="single_add_to_cart_button button alt"><?php echo $label ?></button>
<?php do_action('woocommerce_after_add_to_cart_button'); ?>
</form>
<?php do_action('woocommerce_after_add_to_cart_form'); ?>
<?php endif; ?> | zgomotos/Bazar | woocommerce/single-product/add-to-cart/simple.php | PHP | gpl-3.0 | 1,617 |
/**
* dfs 找 LCA. 只有一次查询,所以不需要 tarjan 或者 rmq
* 个人感觉 rmq 好理解一些,dfs标号一下然后转化成区间最小值。( u v 之间最短路径上深度最小的节点)
*/
using namespace std;
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode *dfs(TreeNode *root, TreeNode* p, TreeNode *q) {
if(!root)
return NULL;
if(root == p)
return root;
if(root == q)
return root;
TreeNode *u = dfs(root->left, p, q);
TreeNode *v = dfs(root->right, p, q);
if(u == NULL) {
u = v; v = NULL;
}
if(v)
return root;
return u;
}
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
return dfs(root, p, q);
}
};
| ShengRang/c4f | leetcode/lowest-common-ancestor-of-a-binary-tree.cc | C++ | gpl-3.0 | 998 |
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using NFluent;
using SmallWorld.BusinessEntities.Football.DeedDetectors;
using SmallWorld.BusinessEntities.Interfaces.Football.Agents;
namespace SmallWorld.BusinessEntities.UnitTests.Football.DeedDetectors
{
[TestClass]
public class MoveDetectorTest
{
[TestMethod]
public void When_Detect_Then_Return_MoveDeed_For_All_SensedPlayer_With_Origin_As_Origin()
{
var moveDetector = new MoveDetector();
var origin = new Mock<IFootballPlayer>();
var playerOne = new Mock<IFootballPlayer>();
var playerTwo = new Mock<IFootballPlayer>();
var sensedPlayers = new List<IFootballPlayer>
{
playerOne.Object, playerTwo.Object
};
var result = moveDetector.Detect(origin.Object, sensedPlayers);
foreach (var tmpFootballDeed in result)
{
Check.That(tmpFootballDeed.Player).IsSameReferenceThan(origin.Object);
}
}
}
}
| cerobe/SmallWorld | Tests/SmallWorld.BusinessEntities.UnitTests/Football/DeedDetectors/MoveDetectorTest.cs | C# | gpl-3.0 | 1,136 |
/*
* Symphony - A modern community (forum/SNS/blog) platform written in Java.
* Copyright (C) 2012-2017, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.b3log.symphony.service;
import java.util.List;
import java.util.Locale;
import javax.inject.Inject;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.event.Event;
import org.b3log.latke.event.EventException;
import org.b3log.latke.event.EventManager;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.User;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.repository.annotation.Transactional;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.Ids;
import org.b3log.symphony.event.EventTypes;
import org.b3log.symphony.model.Article;
import org.b3log.symphony.model.Comment;
import org.b3log.symphony.model.Common;
import org.b3log.symphony.model.Liveness;
import org.b3log.symphony.model.Notification;
import org.b3log.symphony.model.Option;
import org.b3log.symphony.model.Pointtransfer;
import org.b3log.symphony.model.Reward;
import org.b3log.symphony.model.Role;
import org.b3log.symphony.model.Tag;
import org.b3log.symphony.model.UserExt;
import org.b3log.symphony.repository.ArticleRepository;
import org.b3log.symphony.repository.CommentRepository;
import org.b3log.symphony.repository.NotificationRepository;
import org.b3log.symphony.repository.OptionRepository;
import org.b3log.symphony.repository.TagArticleRepository;
import org.b3log.symphony.repository.TagRepository;
import org.b3log.symphony.repository.UserRepository;
import org.b3log.symphony.util.Emotions;
import org.b3log.symphony.util.Symphonys;
import org.json.JSONObject;
/**
* Comment management service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.12.10.19, Feb 2, 2017
* @since 0.2.0
*/
@Service
public class CommentMgmtService {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(CommentMgmtService.class.getName());
/**
* Comment repository.
*/
@Inject
private CommentRepository commentRepository;
/**
* Article repository.
*/
@Inject
private ArticleRepository articleRepository;
/**
* Option repository.
*/
@Inject
private OptionRepository optionRepository;
/**
* Tag repository.
*/
@Inject
private TagRepository tagRepository;
/**
* Tag-Article repository.
*/
@Inject
private TagArticleRepository tagArticleRepository;
/**
* User repository.
*/
@Inject
private UserRepository userRepository;
/**
* Notification repository.
*/
@Inject
private NotificationRepository notificationRepository;
/**
* Event manager.
*/
@Inject
private EventManager eventManager;
/**
* Language service.
*/
@Inject
private LangPropsService langPropsService;
/**
* Pointtransfer management service.
*/
@Inject
private PointtransferMgmtService pointtransferMgmtService;
/**
* Reward management service.
*/
@Inject
private RewardMgmtService rewardMgmtService;
/**
* Reward query service.
*/
@Inject
private RewardQueryService rewardQueryService;
/**
* Notification management service.
*/
@Inject
private NotificationMgmtService notificationMgmtService;
/**
* Liveness management service.
*/
@Inject
private LivenessMgmtService livenessMgmtService;
/**
* Removes a comment specified with the given comment id.
*
* @param commentId the given comment id
*/
@Transactional
public void removeComment(final String commentId) {
try {
final JSONObject comment = commentRepository.get(commentId);
if (null == comment) {
return;
}
final String articleId = comment.optString(Comment.COMMENT_ON_ARTICLE_ID);
final JSONObject article = articleRepository.get(articleId);
article.put(Article.ARTICLE_COMMENT_CNT, article.optInt(Article.ARTICLE_COMMENT_CNT) - 1);
// Just clear latest time and commenter name, do not get the real latest comment to update
article.put(Article.ARTICLE_LATEST_CMT_TIME, 0);
article.put(Article.ARTICLE_LATEST_CMTER_NAME, "");
articleRepository.update(articleId, article);
final String commentAuthorId = comment.optString(Comment.COMMENT_AUTHOR_ID);
final JSONObject commenter = userRepository.get(commentAuthorId);
commenter.put(UserExt.USER_COMMENT_COUNT, commenter.optInt(UserExt.USER_COMMENT_COUNT) - 1);
userRepository.update(commentAuthorId, commenter);
commentRepository.remove(comment.optString(Keys.OBJECT_ID));
final JSONObject commentCntOption = optionRepository.get(Option.ID_C_STATISTIC_CMT_COUNT);
commentCntOption.put(Option.OPTION_VALUE, commentCntOption.optInt(Option.OPTION_VALUE) - 1);
optionRepository.update(Option.ID_C_STATISTIC_CMT_COUNT, commentCntOption);
notificationRepository.removeByDataId(commentId);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Removes a comment error [id=" + commentId + "]", e);
}
}
/**
* A user specified by the given sender id thanks the author of a comment specified by the given comment id.
*
* @param commentId the given comment id
* @param senderId the given sender id
* @throws ServiceException service exception
*/
public void thankComment(final String commentId, final String senderId) throws ServiceException {
try {
final JSONObject comment = commentRepository.get(commentId);
if (null == comment) {
return;
}
if (Comment.COMMENT_STATUS_C_INVALID == comment.optInt(Comment.COMMENT_STATUS)) {
return;
}
final JSONObject sender = userRepository.get(senderId);
if (null == sender) {
return;
}
if (UserExt.USER_STATUS_C_VALID != sender.optInt(UserExt.USER_STATUS)) {
return;
}
final String receiverId = comment.optString(Comment.COMMENT_AUTHOR_ID);
final JSONObject receiver = userRepository.get(receiverId);
if (null == receiver) {
return;
}
if (UserExt.USER_STATUS_C_VALID != receiver.optInt(UserExt.USER_STATUS)) {
return;
}
if (receiverId.equals(senderId)) {
throw new ServiceException(langPropsService.get("thankSelfLabel"));
}
final int rewardPoint = Symphonys.getInt("pointThankComment");
if (rewardQueryService.isRewarded(senderId, commentId, Reward.TYPE_C_COMMENT)) {
return;
}
final String rewardId = Ids.genTimeMillisId();
if (Comment.COMMENT_ANONYMOUS_C_PUBLIC == comment.optInt(Comment.COMMENT_ANONYMOUS)) {
final boolean succ = null != pointtransferMgmtService.transfer(senderId, receiverId,
Pointtransfer.TRANSFER_TYPE_C_COMMENT_REWARD, rewardPoint, rewardId, System.currentTimeMillis());
if (!succ) {
throw new ServiceException(langPropsService.get("transferFailLabel"));
}
}
final JSONObject reward = new JSONObject();
reward.put(Keys.OBJECT_ID, rewardId);
reward.put(Reward.SENDER_ID, senderId);
reward.put(Reward.DATA_ID, commentId);
reward.put(Reward.TYPE, Reward.TYPE_C_COMMENT);
rewardMgmtService.addReward(reward);
final JSONObject notification = new JSONObject();
notification.put(Notification.NOTIFICATION_USER_ID, receiverId);
notification.put(Notification.NOTIFICATION_DATA_ID, rewardId);
notificationMgmtService.addCommentThankNotification(notification);
livenessMgmtService.incLiveness(senderId, Liveness.LIVENESS_THANK);
} catch (final RepositoryException e) {
LOGGER.log(Level.ERROR, "Thanks a comment[id=" + commentId + "] failed", e);
throw new ServiceException(e);
}
}
/**
* Adds a comment with the specified request json object.
*
* @param requestJSONObject the specified request json object, for example, <pre>
* {
* "commentContent": "",
* "commentAuthorId": "",
* "commentOnArticleId": "",
* "commentOriginalCommentId": "", // optional
* "clientCommentId": "" // optional,
* "commentAuthorName": "" // If from client
* "commenter": {
* // User model
* },
* "commentIP": "", // optional, default to ""
* "commentUA": "", // optional, default to ""
* "commentAnonymous": int, // optional, default to 0 (public)
* "userCommentViewMode": int
* }
* </pre>, see {@link Comment} for more details
*
* @return generated comment id
* @throws ServiceException service exception
*/
public synchronized String addComment(final JSONObject requestJSONObject) throws ServiceException {
final long currentTimeMillis = System.currentTimeMillis();
final JSONObject commenter = requestJSONObject.optJSONObject(Comment.COMMENT_T_COMMENTER);
final String commentAuthorId = requestJSONObject.optString(Comment.COMMENT_AUTHOR_ID);
final boolean fromClient = requestJSONObject.has(Comment.COMMENT_CLIENT_COMMENT_ID);
final String articleId = requestJSONObject.optString(Comment.COMMENT_ON_ARTICLE_ID);
final String ip = requestJSONObject.optString(Comment.COMMENT_IP);
String ua = requestJSONObject.optString(Comment.COMMENT_UA);
final int commentAnonymous = requestJSONObject.optInt(Comment.COMMENT_ANONYMOUS);
final int commentViewMode = requestJSONObject.optInt(UserExt.USER_COMMENT_VIEW_MODE);
if (currentTimeMillis - commenter.optLong(UserExt.USER_LATEST_CMT_TIME) < Symphonys.getLong("minStepCmtTime")
&& !Role.ROLE_ID_C_ADMIN.equals(commenter.optString(User.USER_ROLE))
&& !UserExt.DEFAULT_CMTER_ROLE.equals(commenter.optString(User.USER_ROLE))) {
LOGGER.log(Level.WARN, "Adds comment too frequent [userName={0}]", commenter.optString(User.USER_NAME));
throw new ServiceException(langPropsService.get("tooFrequentCmtLabel"));
}
final String commenterName = commenter.optString(User.USER_NAME);
JSONObject article = null;
try {
// check if admin allow to add comment
final JSONObject option = optionRepository.get(Option.ID_C_MISC_ALLOW_ADD_COMMENT);
if (!"0".equals(option.optString(Option.OPTION_VALUE))) {
throw new ServiceException(langPropsService.get("notAllowAddCommentLabel"));
}
final int balance = commenter.optInt(UserExt.USER_POINT);
if (Comment.COMMENT_ANONYMOUS_C_ANONYMOUS == commentAnonymous) {
final int anonymousPoint = Symphonys.getInt("anonymous.point");
if (balance < anonymousPoint) {
String anonymousEnabelPointLabel = langPropsService.get("anonymousEnabelPointLabel");
anonymousEnabelPointLabel
= anonymousEnabelPointLabel.replace("${point}", String.valueOf(anonymousPoint));
throw new ServiceException(anonymousEnabelPointLabel);
}
}
article = articleRepository.get(articleId);
if (!fromClient && !TuringQueryService.ROBOT_NAME.equals(commenterName)) {
int pointSum = Pointtransfer.TRANSFER_SUM_C_ADD_COMMENT;
// Point
final String articleAuthorId = article.optString(Article.ARTICLE_AUTHOR_ID);
if (articleAuthorId.equals(commentAuthorId)) {
pointSum = Pointtransfer.TRANSFER_SUM_C_ADD_SELF_ARTICLE_COMMENT;
}
if (balance - pointSum < 0) {
throw new ServiceException(langPropsService.get("insufficientBalanceLabel"));
}
}
} catch (final RepositoryException e) {
throw new ServiceException(e);
}
final int articleAnonymous = article.optInt(Article.ARTICLE_ANONYMOUS);
final Transaction transaction = commentRepository.beginTransaction();
try {
article.put(Article.ARTICLE_COMMENT_CNT, article.optInt(Article.ARTICLE_COMMENT_CNT) + 1);
article.put(Article.ARTICLE_LATEST_CMTER_NAME, commenter.optString(User.USER_NAME));
if (Comment.COMMENT_ANONYMOUS_C_ANONYMOUS == commentAnonymous) {
article.put(Article.ARTICLE_LATEST_CMTER_NAME, UserExt.ANONYMOUS_USER_NAME);
}
article.put(Article.ARTICLE_LATEST_CMT_TIME, currentTimeMillis);
final String ret = Ids.genTimeMillisId();
final JSONObject comment = new JSONObject();
comment.put(Keys.OBJECT_ID, ret);
String content = requestJSONObject.optString(Comment.COMMENT_CONTENT).
replace("_esc_enter_88250_", "<br/>"); // Solo client escape
comment.put(Comment.COMMENT_AUTHOR_ID, commentAuthorId);
comment.put(Comment.COMMENT_ON_ARTICLE_ID, articleId);
if (fromClient) {
comment.put(Comment.COMMENT_CLIENT_COMMENT_ID, requestJSONObject.optString(Comment.COMMENT_CLIENT_COMMENT_ID));
// Appends original commenter name
final String authorName = requestJSONObject.optString(Comment.COMMENT_T_AUTHOR_NAME);
content += " <i class='ft-small'>by " + authorName + "</i>";
}
final String originalCmtId = requestJSONObject.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID);
comment.put(Comment.COMMENT_ORIGINAL_COMMENT_ID, originalCmtId);
if (StringUtils.isNotBlank(originalCmtId)) {
final JSONObject originalCmt = commentRepository.get(originalCmtId);
final int originalCmtReplyCnt = originalCmt.optInt(Comment.COMMENT_REPLY_CNT);
originalCmt.put(Comment.COMMENT_REPLY_CNT, originalCmtReplyCnt + 1);
commentRepository.update(originalCmtId, originalCmt);
}
content = Emotions.toAliases(content);
// content = StringUtils.trim(content) + " "; https://github.com/b3log/symphony/issues/389
content = content.replace(langPropsService.get("uploadingLabel", Locale.SIMPLIFIED_CHINESE), "");
content = content.replace(langPropsService.get("uploadingLabel", Locale.US), "");
comment.put(Comment.COMMENT_CONTENT, content);
comment.put(Comment.COMMENT_CREATE_TIME, System.currentTimeMillis());
comment.put(Comment.COMMENT_SHARP_URL, "/article/" + articleId + "#" + ret);
comment.put(Comment.COMMENT_STATUS, Comment.COMMENT_STATUS_C_VALID);
comment.put(Comment.COMMENT_IP, ip);
if (StringUtils.length(ua) > Common.MAX_LENGTH_UA) {
LOGGER.log(Level.WARN, "UA is too long [" + ua + "]");
ua = StringUtils.substring(ua, 0, Common.MAX_LENGTH_UA);
}
comment.put(Comment.COMMENT_UA, ua);
comment.put(Comment.COMMENT_ANONYMOUS, commentAnonymous);
final JSONObject cmtCntOption = optionRepository.get(Option.ID_C_STATISTIC_CMT_COUNT);
final int cmtCnt = cmtCntOption.optInt(Option.OPTION_VALUE);
cmtCntOption.put(Option.OPTION_VALUE, String.valueOf(cmtCnt + 1));
articleRepository.update(articleId, article); // Updates article comment count, latest commenter name and time
optionRepository.update(Option.ID_C_STATISTIC_CMT_COUNT, cmtCntOption); // Updates global comment count
// Updates tag comment count and User-Tag relation
final String tagsString = article.optString(Article.ARTICLE_TAGS);
final String[] tagStrings = tagsString.split(",");
for (int i = 0; i < tagStrings.length; i++) {
final String tagTitle = tagStrings[i].trim();
final JSONObject tag = tagRepository.getByTitle(tagTitle);
tag.put(Tag.TAG_COMMENT_CNT, tag.optInt(Tag.TAG_COMMENT_CNT) + 1);
tag.put(Tag.TAG_RANDOM_DOUBLE, Math.random());
tagRepository.update(tag.optString(Keys.OBJECT_ID), tag);
}
// Updates user comment count, latest comment time
commenter.put(UserExt.USER_COMMENT_COUNT, commenter.optInt(UserExt.USER_COMMENT_COUNT) + 1);
commenter.put(UserExt.USER_LATEST_CMT_TIME, currentTimeMillis);
userRepository.update(commenter.optString(Keys.OBJECT_ID), commenter);
comment.put(Comment.COMMENT_GOOD_CNT, 0);
comment.put(Comment.COMMENT_BAD_CNT, 0);
comment.put(Comment.COMMENT_SCORE, 0D);
comment.put(Comment.COMMENT_REPLY_CNT, 0);
// Adds the comment
final String commentId = commentRepository.add(comment);
// Updates tag-article relation stat.
final List<JSONObject> tagArticleRels = tagArticleRepository.getByArticleId(articleId);
for (final JSONObject tagArticleRel : tagArticleRels) {
tagArticleRel.put(Article.ARTICLE_LATEST_CMT_TIME, currentTimeMillis);
tagArticleRel.put(Article.ARTICLE_COMMENT_CNT, article.optInt(Article.ARTICLE_COMMENT_CNT));
tagArticleRepository.update(tagArticleRel.optString(Keys.OBJECT_ID), tagArticleRel);
}
transaction.commit();
if (!fromClient && Comment.COMMENT_ANONYMOUS_C_PUBLIC == commentAnonymous
&& Article.ARTICLE_ANONYMOUS_C_PUBLIC == articleAnonymous
&& !TuringQueryService.ROBOT_NAME.equals(commenterName)) {
// Point
final String articleAuthorId = article.optString(Article.ARTICLE_AUTHOR_ID);
if (articleAuthorId.equals(commentAuthorId)) {
pointtransferMgmtService.transfer(commentAuthorId, Pointtransfer.ID_C_SYS,
Pointtransfer.TRANSFER_TYPE_C_ADD_COMMENT, Pointtransfer.TRANSFER_SUM_C_ADD_SELF_ARTICLE_COMMENT,
commentId, System.currentTimeMillis());
} else {
pointtransferMgmtService.transfer(commentAuthorId, articleAuthorId,
Pointtransfer.TRANSFER_TYPE_C_ADD_COMMENT, Pointtransfer.TRANSFER_SUM_C_ADD_COMMENT,
commentId, System.currentTimeMillis());
}
livenessMgmtService.incLiveness(commentAuthorId, Liveness.LIVENESS_COMMENT);
}
// Event
final JSONObject eventData = new JSONObject();
eventData.put(Comment.COMMENT, comment);
eventData.put(Common.FROM_CLIENT, fromClient);
eventData.put(Article.ARTICLE, article);
eventData.put(UserExt.USER_COMMENT_VIEW_MODE, commentViewMode);
try {
eventManager.fireEventAsynchronously(new Event<JSONObject>(EventTypes.ADD_COMMENT_TO_ARTICLE, eventData));
} catch (final EventException e) {
LOGGER.log(Level.ERROR, e.getMessage(), e);
}
return ret;
} catch (final RepositoryException e) {
if (transaction.isActive()) {
transaction.rollback();
}
LOGGER.log(Level.ERROR, "Adds a comment failed", e);
throw new ServiceException(e);
}
}
/**
* Updates the specified comment by the given comment id.
*
* @param commentId the given comment id
* @param comment the specified comment
* @throws ServiceException service exception
*/
public void updateComment(final String commentId, final JSONObject comment) throws ServiceException {
final Transaction transaction = commentRepository.beginTransaction();
try {
String content = comment.optString(Comment.COMMENT_CONTENT);
content = Emotions.toAliases(content);
content = StringUtils.trim(content) + " ";
content = content.replace(langPropsService.get("uploadingLabel", Locale.SIMPLIFIED_CHINESE), "");
content = content.replace(langPropsService.get("uploadingLabel", Locale.US), "");
comment.put(Comment.COMMENT_CONTENT, content);
commentRepository.update(commentId, comment);
transaction.commit();
} catch (final RepositoryException e) {
if (transaction.isActive()) {
transaction.rollback();
}
LOGGER.log(Level.ERROR, "Updates a comment[id=" + commentId + "] failed", e);
throw new ServiceException(e);
}
}
}
| gaozhenhong/symphony | src/main/java/org/b3log/symphony/service/CommentMgmtService.java | Java | gpl-3.0 | 22,223 |
/*
* Copyright (C) 2010-2019 The ESPResSo project
*
* This file is part of ESPResSo.
*
* ESPResSo is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ESPResSo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** \file
* %Lattice Boltzmann implementation on GPUs.
*
* Implementation in lbgpu.cpp.
*/
#ifndef LBGPU_HPP
#define LBGPU_HPP
#include "config.hpp"
#ifdef CUDA
#include "OptionalCounter.hpp"
#include <utils/Vector.hpp>
#include <utils/index.hpp>
#include <cstddef>
#include <cstdint>
#include <vector>
/* For the D3Q19 model most functions have a separate implementation
* where the coefficients and the velocity vectors are hardcoded
* explicitly. This saves a lot of multiplications with 1's and 0's
* thus making the code more efficient. */
#define LBQ 19
/** Parameters for the lattice Boltzmann system for GPU. */
struct LB_parameters_gpu {
/** number density (LB units) */
float rho;
/** mu (LJ units) */
float mu;
/** viscosity (LJ) units */
float viscosity;
/** relaxation rate of shear modes */
float gamma_shear;
/** relaxation rate of bulk modes */
float gamma_bulk;
/** */
float gamma_odd;
float gamma_even;
/** flag determining whether gamma_shear, gamma_odd, and gamma_even are
* calculated from gamma_shear in such a way to yield a TRT LB with minimized
* slip at bounce-back boundaries
*/
bool is_TRT;
float bulk_viscosity;
/** lattice spacing (LJ units) */
float agrid;
/** time step for fluid propagation (LJ units)
* Note: Has to be larger than MD time step!
*/
float tau;
/** MD timestep */
float time_step;
Utils::Array<unsigned int, 3> dim;
unsigned int number_of_nodes;
#ifdef LB_BOUNDARIES_GPU
unsigned int number_of_boundnodes;
#endif
/** to calculate and print out physical values */
int calc_val;
int external_force_density;
Utils::Array<float, 3> ext_force_density;
unsigned int reinit;
// Thermal energy
float kT;
};
/* this structure is almost duplicated for memory efficiency. When the stress
tensor element are needed at every timestep, this features should be
explicitly switched on */
struct LB_rho_v_pi_gpu {
/** density of the node */
float rho;
/** velocity of the node */
Utils::Array<float, 3> v;
/** pressure tensor */
Utils::Array<float, 6> pi;
};
struct LB_node_force_density_gpu {
Utils::Array<float, 3> *force_density;
#if defined(VIRTUAL_SITES_INERTIALESS_TRACERS) || defined(EK_DEBUG)
// We need the node forces for the velocity interpolation at the virtual
// particles' position. However, LBM wants to reset them immediately
// after the LBM update. This variable keeps a backup
Utils::Array<float, 3> *force_density_buf;
#endif
};
/************************************************************/
/** \name Exported Variables */
/************************************************************/
/**@{*/
/** Switch indicating momentum exchange between particles and fluid */
extern LB_parameters_gpu lbpar_gpu;
extern std::vector<LB_rho_v_pi_gpu> host_values;
#ifdef ELECTROKINETICS
extern LB_node_force_density_gpu node_f;
extern bool ek_initialized;
#endif
extern OptionalCounter rng_counter_fluid_gpu;
extern OptionalCounter rng_counter_coupling_gpu;
/**@}*/
/************************************************************/
/** \name Exported Functions */
/************************************************************/
/**@{*/
/** Conserved quantities for the lattice Boltzmann system. */
struct LB_rho_v_gpu {
/** density of the node */
float rho;
/** velocity of the node */
Utils::Array<float, 3> v;
};
void lb_GPU_sanity_checks();
void lb_get_device_values_pointer(LB_rho_v_gpu **pointer_address);
void lb_get_boundary_force_pointer(float **pointer_address);
void lb_get_para_pointer(LB_parameters_gpu **pointer_address);
void lattice_boltzmann_update_gpu();
/** Perform a full initialization of the lattice Boltzmann system.
* All derived parameters and the fluid are reset to their default values.
*/
void lb_init_gpu();
/** (Re-)initialize the derived parameters for the lattice Boltzmann system.
* The current state of the fluid is unchanged.
*/
void lb_reinit_parameters_gpu();
/** (Re-)initialize the fluid. */
void lb_reinit_fluid_gpu();
/** Reset the forces on the fluid nodes */
void reset_LB_force_densities_GPU(bool buffer = true);
void lb_init_GPU(const LB_parameters_gpu &lbpar_gpu);
void lb_integrate_GPU();
void lb_get_values_GPU(LB_rho_v_pi_gpu *host_values);
void lb_print_node_GPU(unsigned single_nodeindex,
LB_rho_v_pi_gpu *host_print_values);
#ifdef LB_BOUNDARIES_GPU
void lb_init_boundaries_GPU(std::size_t n_lb_boundaries,
unsigned number_of_boundnodes,
int *host_boundary_node_list,
int *host_boundary_index_list,
float *lb_bounday_velocity);
#endif
void lb_set_agrid_gpu(double agrid);
template <std::size_t no_of_neighbours>
void lb_calc_particle_lattice_ia_gpu(bool couple_virtual, double friction);
void lb_calc_fluid_mass_GPU(double *mass);
void lb_calc_fluid_momentum_GPU(double *host_mom);
void lb_get_boundary_flag_GPU(unsigned int single_nodeindex,
unsigned int *host_flag);
void lb_get_boundary_flags_GPU(unsigned int *host_bound_array);
void lb_set_node_velocity_GPU(unsigned single_nodeindex, float *host_velocity);
void lb_set_node_rho_GPU(unsigned single_nodeindex, float host_rho);
void reinit_parameters_GPU(LB_parameters_gpu *lbpar_gpu);
void lb_reinit_extern_nodeforce_GPU(LB_parameters_gpu *lbpar_gpu);
void lb_reinit_GPU(LB_parameters_gpu *lbpar_gpu);
void lb_gpu_get_boundary_forces(std::vector<double> &forces);
void lb_save_checkpoint_GPU(float *host_checkpoint_vd);
void lb_load_checkpoint_GPU(float const *host_checkpoint_vd);
void lb_lbfluid_set_population(const Utils::Vector3i &, float[LBQ]);
void lb_lbfluid_get_population(const Utils::Vector3i &, float[LBQ]);
template <std::size_t no_of_neighbours>
void lb_get_interpolated_velocity_gpu(double const *positions,
double *velocities, int length);
void linear_velocity_interpolation(double const *positions, double *velocities,
int length);
void quadratic_velocity_interpolation(double const *positions,
double *velocities, int length);
Utils::Array<float, 6> stress_tensor_GPU();
uint64_t lb_fluid_get_rng_state_gpu();
void lb_fluid_set_rng_state_gpu(uint64_t counter);
uint64_t lb_coupling_get_rng_state_gpu();
void lb_coupling_set_rng_state_gpu(uint64_t counter);
/** Calculate the node index from its coordinates */
inline unsigned int calculate_node_index(LB_parameters_gpu const &lbpar,
Utils::Vector3i const &coord) {
return static_cast<unsigned>(
Utils::get_linear_index(coord, Utils::Vector3i(lbpar_gpu.dim)));
}
/**@}*/
#endif /* CUDA */
#endif /* LBGPU_HPP */
| fweik/espresso | src/core/grid_based_algorithms/lbgpu.hpp | C++ | gpl-3.0 | 7,560 |
/*
* Copyright (C) 2000 - 2011 TagServlet Ltd
*
* This file is part of Open BlueDragon (OpenBD) CFML Server Engine.
*
* OpenBD is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Free Software Foundation,version 3.
*
* OpenBD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenBD. If not, see http://www.gnu.org/licenses/
*
* Additional permission under GNU GPL version 3 section 7
*
* If you modify this Program, or any covered work, by linking or combining
* it with any of the JARS listed in the README.txt (or a modified version of
* (that library), containing parts covered by the terms of that JAR, the
* licensors of this Program grant you additional permission to convey the
* resulting work.
* README.txt @ http://www.openbluedragon.org/license/README.txt
*
* http://openbd.org/
*
* $Id: CronSetDirectory.java 1765 2011-11-04 07:55:52Z alan $
*/
package org.alanwilliamson.openbd.plugin.crontab;
import com.naryx.tagfusion.cfm.engine.cfArgStructData;
import com.naryx.tagfusion.cfm.engine.cfBooleanData;
import com.naryx.tagfusion.cfm.engine.cfData;
import com.naryx.tagfusion.cfm.engine.cfSession;
import com.naryx.tagfusion.cfm.engine.cfmRunTimeException;
import com.naryx.tagfusion.expression.function.functionBase;
public class CronSetDirectory extends functionBase {
private static final long serialVersionUID = 1L;
public CronSetDirectory(){ min = max = 1; setNamedParams( new String[]{ "directory" } ); }
public String[] getParamInfo(){
return new String[]{
"uri directory - will be created if not exists",
};
}
public java.util.Map getInfo(){
return makeInfo(
"system",
"Sets the URI directory that the cron tasks will run from. Calling this function will enable the crontab scheduler to start. This persists across server restarts",
ReturnType.BOOLEAN );
}
public cfData execute(cfSession _session, cfArgStructData argStruct ) throws cfmRunTimeException {
CronExtension.setRootPath( getNamedStringParam(argStruct, "directory", null ) );
return cfBooleanData.TRUE;
}
}
| OpenBD/openbd-core | src/org/alanwilliamson/openbd/plugin/crontab/CronSetDirectory.java | Java | gpl-3.0 | 2,444 |
package com.gentasaurus.ubahfood.inventory;
import com.gentasaurus.ubahfood.init.ModBlocks;
import com.gentasaurus.ubahfood.item.crafting.SCMCraftingManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ContainerSCM extends Container
{
/** The crafting matrix inventory (3x3). */
public InventoryCrafting craftMatrix;
public IInventory craftResult;
private World worldObj;
private int posX;
private int posY;
private int posZ;
public ContainerSCM(InventoryPlayer invPlayer, World world, int x, int y, int z)
{
craftMatrix = new InventoryCrafting(this, 3, 1);
craftResult = new InventoryCraftResult();
worldObj = world;
posX = x;
posY = y;
posZ = z;
this.addSlotToContainer(new SlotSCM(invPlayer.player, craftMatrix, craftResult, 0, 124, 35));
int i;
int i1;
for (i = 0; i < 3; i++)
{
for (i1 = 0; i1 < 1; i1++)
{
this.addSlotToContainer(new Slot(this.craftMatrix, i1 + i * 1, 57 + i1 * 18, 17 + i * 18));
}
}
for (i = 0; i < 3; ++i)
{
for (i1 = 0; i1 < 9; ++i1)
{
this.addSlotToContainer(new Slot(invPlayer, i1 + i * 9 + 9, 8 + i1 * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
}
this.onCraftMatrixChanged(craftMatrix);
}
/**
* Callback for when the crafting matrix is changed.
*/
public void onCraftMatrixChanged(IInventory p_75130_1_)
{
craftResult.setInventorySlotContents(0, SCMCraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
}
/**
* Called when the container is closed.
*/
public void onContainerClosed(EntityPlayer p_75134_1_)
{
super.onContainerClosed(p_75134_1_);
if (!this.worldObj.isRemote)
{
for (int i = 0; i < 3; ++i)
{
ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);
if (itemstack != null)
{
p_75134_1_.dropPlayerItemWithRandomChoice(itemstack, false);
}
}
}
}
public boolean canInteractWith(EntityPlayer p_75145_1_)
{
return this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.snowConeMachine ? false : p_75145_1_.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;
}
/**
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
*/
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_)
{
return null;
}
public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_)
{
return p_94530_2_.inventory != this.craftResult && super.func_94530_a(p_94530_1_, p_94530_2_);
}
} | gentasaurus/UbahFood | src/main/java/com/gentasaurus/ubahfood/inventory/ContainerSCM.java | Java | gpl-3.0 | 3,263 |
#include "prism/animation.h"
#include <stdlib.h>
#include "prism/log.h"
#include "prism/datastructures.h"
#include "prism/memoryhandler.h"
#include "prism/system.h"
#include "prism/timer.h"
#include "prism/stlutil.h"
using namespace std;
static struct {
int mIsPaused;
} gPrismAnimationData;
int getDurationInFrames(Duration tDuration){
return (int)(tDuration * getInverseFramerateFactor());
}
int handleDurationAndCheckIfOver(Duration* tNow, Duration tDuration) {
if(gPrismAnimationData.mIsPaused) return 0;
(*tNow)++;
return isDurationOver(*tNow, tDuration);
}
int isDurationOver(Duration tNow, Duration tDuration) {
if (tNow >= getDurationInFrames(tDuration)) {
return 1;
}
return 0;
}
int handleTickDurationAndCheckIfOver(Tick * tNow, Tick tDuration)
{
if (gPrismAnimationData.mIsPaused) return 0;
(*tNow)++;
return isTickDurationOver(*tNow, tDuration);
}
int isTickDurationOver(Tick tNow, Tick tDuration)
{
if (tNow >= tDuration) {
return 1;
}
return 0;
}
AnimationResult animateWithoutLoop(Animation* tAnimation) {
AnimationResult ret = ANIMATION_CONTINUING;
if (handleDurationAndCheckIfOver(&tAnimation->mNow, tAnimation->mDuration)) {
tAnimation->mNow = 0;
tAnimation->mFrame++;
if (tAnimation->mFrame >= tAnimation->mFrameAmount) {
tAnimation->mFrame = tAnimation->mFrameAmount-1;
tAnimation->mNow = getDurationInFrames(tAnimation->mDuration);
ret = ANIMATION_OVER;
}
}
return ret;
}
void animate(Animation* tAnimation) {
AnimationResult ret = animateWithoutLoop(tAnimation);
if(ret == ANIMATION_OVER){
resetAnimation(tAnimation);
}
}
void resetAnimation(Animation* tAnimation) {
tAnimation->mNow = 0;
tAnimation->mFrame = 0;
}
Animation createAnimation(int tFrameAmount, Duration tDuration) {
Animation ret = createEmptyAnimation();
ret.mFrameAmount = tFrameAmount;
ret.mDuration = tDuration;
return ret;
}
Animation createEmptyAnimation(){
Animation ret;
ret.mFrame = 0;
ret.mFrameAmount = 0;
ret.mNow = 0;
ret.mDuration = 1000000000;
return ret;
}
Animation createOneFrameAnimation(){
Animation ret = createEmptyAnimation();
ret.mFrameAmount = 1;
return ret;
}
void pauseDurationHandling() {
gPrismAnimationData.mIsPaused = 1;
}
void resumeDurationHandling() {
gPrismAnimationData.mIsPaused = 0;
}
double getDurationPercentage(Duration tNow, Duration tDuration)
{
int duration = getDurationInFrames(tDuration);
return tNow / (double)duration;
}
static struct{
map<int, AnimationHandlerElement> mList;
int mIsLoaded;
} gAnimationHandler;
void setupAnimationHandler(){
if(gAnimationHandler.mIsLoaded){
logWarning("Setting up non-empty animation handler; Cleaning up.");
shutdownAnimationHandler();
}
gAnimationHandler.mList.clear();
gAnimationHandler.mIsLoaded = 1;
}
static int updateAndRemoveCB(void* tCaller, AnimationHandlerElement& tData) {
(void) tCaller;
AnimationHandlerElement* cur = &tData;
AnimationResult res = animateWithoutLoop(&cur->mAnimation);
if(res == ANIMATION_OVER) {
if(cur->mCB != NULL) {
cur->mCB(cur->mCaller);
}
if(cur->mIsLooped) {
resetAnimation(&cur->mAnimation);
} else {
return 1;
}
}
return 0;
}
void updateAnimationHandler(){
stl_int_map_remove_predicate(gAnimationHandler.mList, updateAndRemoveCB);
}
static Position getAnimationPositionWithAllReferencesIncluded(AnimationHandlerElement* cur) {
Position p = cur->mPosition;
if (cur->mScreenPositionReference != NULL) {
p = vecAdd(p, vecScale(*cur->mScreenPositionReference, -1));
}
if (cur->mBasePositionReference != NULL) {
p = vecAdd(p, *(cur->mBasePositionReference));
}
return p;
}
static void drawAnimationHandlerCB(void* tCaller, AnimationHandlerElement& tData) {
(void) tCaller;
AnimationHandlerElement* cur = &tData;
if (!cur->mIsVisible) return;
int frame = cur->mAnimation.mFrame;
Position p = getAnimationPositionWithAllReferencesIncluded(cur);
if (cur->mIsRotated) {
Position rPosition = cur->mRotationEffectCenter;
rPosition = vecAdd(rPosition, p);
setDrawingRotationZ(cur->mRotationZ, rPosition);
}
if(cur->mIsScaled) {
Position sPosition = cur->mScaleEffectCenter;
sPosition = vecAdd(sPosition, p);
scaleDrawing3D(cur->mScale, sPosition);
}
if (cur->mHasBaseColor) {
setDrawingBaseColorAdvanced(cur->mBaseColor.x, cur->mBaseColor.y, cur->mBaseColor.z);
}
if (cur->mHasTransparency) {
setDrawingTransparency(cur->mTransparency);
}
Rectangle texturePos = cur->mTexturePosition;
if(cur->mInversionState.x) {
Position center = vecAdd(cur->mCenter, p);
double deltaX = center.x - p.x;
double nRightX = center.x + deltaX;
double nLeftX = nRightX - abs(cur->mTexturePosition.bottomRight.x - cur->mTexturePosition.topLeft.x);
p.x = nLeftX;
texturePos.topLeft.x = cur->mTexturePosition.bottomRight.x;
texturePos.bottomRight.x = cur->mTexturePosition.topLeft.x;
}
if (cur->mInversionState.y) {
Position center = vecAdd(cur->mCenter, p);
double deltaY = center.y - p.y;
double nDownY = center.y + deltaY;
double nUpY = nDownY - abs(cur->mTexturePosition.bottomRight.y - cur->mTexturePosition.topLeft.y);
p.y = nUpY;
texturePos.topLeft.y = cur->mTexturePosition.bottomRight.y;
texturePos.bottomRight.y = cur->mTexturePosition.topLeft.y;
}
drawSprite(cur->mTextureData[frame], p, texturePos);
if(cur->mIsScaled || cur->mIsRotated || cur->mHasBaseColor || cur->mHasTransparency) {
setDrawingParametersToIdentity();
}
}
void drawHandledAnimations() {
stl_int_map_map(gAnimationHandler.mList, drawAnimationHandlerCB);
}
static void emptyAnimationHandler(){
gAnimationHandler.mList.clear();
}
static AnimationHandlerElement* playAnimationInternal(const Position& tPosition, TextureData* tTextures, const Animation& tAnimation, const Rectangle& tTexturePosition, AnimationPlayerCB tOptionalCB, void* tCaller, int tIsLooped){
AnimationHandlerElement e;
e.mCaller = tCaller;
e.mCB = tOptionalCB;
e.mIsLooped = tIsLooped;
e.mPosition = tPosition;
e.mTexturePosition = tTexturePosition;
e.mTextureData = tTextures;
e.mAnimation = tAnimation;
e.mScreenPositionReference = NULL;
e.mBasePositionReference = NULL;
e.mIsScaled = 0;
e.mIsRotated = 0;
e.mHasBaseColor = 0;
e.mHasTransparency = 0;
e.mCenter = Vector3D(0,0,0);
e.mInversionState = Vector3DI(0,0,0);
e.mIsVisible = 1;
int id = stl_int_map_push_back(gAnimationHandler.mList, e);
auto& element = gAnimationHandler.mList[id];
element.mID = id;
return &element;
}
AnimationHandlerElement* playAnimation(const Position& tPosition, TextureData* tTextures, const Animation& tAnimation, const Rectangle& tTexturePosition, AnimationPlayerCB tOptionalCB, void* tCaller){
return playAnimationInternal(tPosition, tTextures, tAnimation, tTexturePosition, tOptionalCB, tCaller, 0);
}
AnimationHandlerElement* playAnimationLoop(const Position& tPosition, TextureData* tTextures, const Animation& tAnimation, const Rectangle& tTexturePosition){
return playAnimationInternal(tPosition, tTextures, tAnimation, tTexturePosition, NULL, NULL, 1);
}
AnimationHandlerElement* playOneFrameAnimationLoop(const Position& tPosition, TextureData* tTextures) {
Animation anim = createOneFrameAnimation();
Rectangle rect = makeRectangleFromTexture(tTextures[0]);
return playAnimationLoop(tPosition, tTextures, anim, rect);
}
void changeAnimation(AnimationHandlerElement* e, TextureData* tTextures, const Animation& tAnimation, const Rectangle& tTexturePosition) {
e->mTexturePosition = tTexturePosition;
e->mTextureData = tTextures;
e->mAnimation = tAnimation;
}
void setAnimationScreenPositionReference(AnimationHandlerElement* e, Position* tScreenPositionReference) {
e->mScreenPositionReference = tScreenPositionReference;
}
void setAnimationBasePositionReference(AnimationHandlerElement* e, Position* tBasePositionReference) {
e->mBasePositionReference = tBasePositionReference;
}
void setAnimationScale(AnimationHandlerElement* e, const Vector3D& tScale, const Position& tCenter) {
e->mIsScaled = 1;
e->mScaleEffectCenter = tCenter;
e->mScale = tScale;
}
void setAnimationSize(AnimationHandlerElement* e, const Vector3D& tSize, const Position& tCenter) {
e->mIsScaled = 1;
e->mScaleEffectCenter = tCenter;
double dx = tSize.x / e->mTextureData[0].mTextureSize.x;
double dy = tSize.y / e->mTextureData[0].mTextureSize.y;
e->mScale = Vector3D(dx, dy, 1);
}
static void setAnimationRotationZ_internal(AnimationHandlerElement* e, double tAngle, const Vector3D& tCenter) {
e->mIsRotated = 1;
e->mRotationEffectCenter = tCenter;
e->mRotationZ = tAngle;
}
void setAnimationRotationZ(AnimationHandlerElement* e, double tAngle, const Position& tCenter) {
setAnimationRotationZ_internal(e, tAngle, tCenter);
}
static void setAnimationColor_internal(AnimationHandlerElement* e, double r, double g, double b) {
e->mHasBaseColor = 1;
e->mBaseColor = Vector3D(r, g, b);
}
void setAnimationColor(AnimationHandlerElement* e, double r, double g, double b) {
setAnimationColor_internal(e, r, g, b);
}
void setAnimationColorType(AnimationHandlerElement* e, Color tColor)
{
double r, g, b;
getRGBFromColor(tColor, &r, &g, &b);
setAnimationColor(e, r, g, b);
}
void setAnimationTransparency(AnimationHandlerElement* e, double a) {
e->mHasTransparency = 1;
e->mTransparency = a;
}
void setAnimationVisibility(AnimationHandlerElement* e, int tIsVisible)
{
e->mIsVisible = tIsVisible;
}
void setAnimationCenter(AnimationHandlerElement* e, const Position& tCenter) {
e->mCenter = tCenter;
}
void setAnimationCB(AnimationHandlerElement* e, AnimationPlayerCB tCB, void* tCaller) {
e->mCB = tCB;
e->mCaller = tCaller;
}
void setAnimationPosition(AnimationHandlerElement* e, const Position& tPosition) {
e->mPosition = tPosition;
}
void setAnimationTexturePosition(AnimationHandlerElement* e, const Rectangle& tTexturePosition)
{
e->mTexturePosition = tTexturePosition;
}
void setAnimationLoop(AnimationHandlerElement* e, int tIsLooping) {
e->mIsLooped = tIsLooping;
}
void removeAnimationCB(AnimationHandlerElement* e) {
setAnimationCB(e, NULL, NULL);
}
typedef struct {
AnimationHandlerElement* mElement;
Vector3D mColor;
Duration mDuration;
} AnimationColorIncrease;
static void increaseAnimationColor(void* tCaller) {
AnimationColorIncrease* e = (AnimationColorIncrease*)tCaller;
e->mColor = vecAdd(e->mColor, Vector3D(1.0 / e->mDuration, 1.0 / e->mDuration, 1.0 / e->mDuration));
if (e->mColor.x >= 1) e->mColor = Vector3D(1, 1, 1);
setAnimationColor(e->mElement, e->mColor.x, e->mColor.y, e->mColor.z);
if (e->mColor.x >= 1) { freeMemory(e); }
else addTimerCB(0,increaseAnimationColor, e);
}
void fadeInAnimation(AnimationHandlerElement* tElement, Duration tDuration) {
AnimationColorIncrease* e = (AnimationColorIncrease*)allocMemory(sizeof(AnimationColorIncrease));
e->mElement = tElement;
e->mColor = Vector3D(0, 0, 0);
e->mDuration = tDuration;
addTimerCB(0, increaseAnimationColor, e);
setAnimationColor(tElement, e->mColor.x, e->mColor.y, e->mColor.z);
}
void inverseAnimationVertical(AnimationHandlerElement* e) {
e->mInversionState.x ^= 1;
}
void inverseAnimationHorizontal(AnimationHandlerElement* e) {
e->mInversionState.y ^= 1;
}
void setAnimationVerticalInversion(AnimationHandlerElement* e, int tValue) {
e->mInversionState.x = tValue;
}
void setAnimationHorizontalInversion(AnimationHandlerElement* e, int tValue) {
e->mInversionState.y = tValue;
}
typedef struct {
double mAngle;
Vector3D mCenter;
} ScreenRotationZ;
static void setScreenRotationZForSingleAnimation(ScreenRotationZ* tRot, AnimationHandlerElement& tData) {
AnimationHandlerElement* e = &tData;
const auto p = getAnimationPositionWithAllReferencesIncluded(e);
const auto center = vecSub(tRot->mCenter, p);
setAnimationRotationZ_internal(e, tRot->mAngle, center);
}
void setAnimationHandlerScreenRotationZ(double tAngle, const Vector3D& tCenter)
{
ScreenRotationZ rot;
rot.mAngle = tAngle;
rot.mCenter = tCenter;
stl_int_map_map(gAnimationHandler.mList, setScreenRotationZForSingleAnimation, &rot);
}
typedef struct {
double r;
double g;
double b;
} AnimationHandlerScreenTint;
static void setAnimationHandlerScreenTintSingle(AnimationHandlerScreenTint* tTint, AnimationHandlerElement& tData) {
AnimationHandlerElement* e = &tData;
setAnimationColor_internal(e, tTint->r, tTint->g, tTint->b);
}
void setAnimationHandlerScreenTint(double r, double g, double b)
{
AnimationHandlerScreenTint tint;
tint.r = r;
tint.g = g;
tint.b = b;
stl_int_map_map(gAnimationHandler.mList, setAnimationHandlerScreenTintSingle, &tint);
}
void resetAnimationHandlerScreenTint()
{
setAnimationHandlerScreenTint(1, 1, 1);
}
double* getAnimationTransparencyReference(AnimationHandlerElement* e)
{
return &e->mTransparency;
}
Position* getAnimationPositionReference(AnimationHandlerElement* e) {
return &e->mPosition;
}
void removeHandledAnimation(AnimationHandlerElement* e) {
gAnimationHandler.mList.erase(e->mID);
}
int isHandledAnimation(AnimationHandlerElement* e) {
return stl_map_contains(gAnimationHandler.mList, e->mID);
}
void shutdownAnimationHandler(){
emptyAnimationHandler();
gAnimationHandler.mList.clear();
gAnimationHandler.mIsLoaded = 0;
}
| CaptainDreamcast/libtari | animation.cpp | C++ | gpl-3.0 | 13,226 |
/*
* Copyright (c) 2011-2013 Lp digital system
*
* This file is part of BackBee.
*
* BackBee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* BackBee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BackBee. If not, see <http://www.gnu.org/licenses/>.
*/
define(['Core', 'Core/Renderer', 'BackBone'], function (Core, Renderer, Backbone) {
'use strict';
var HiddenView = Backbone.View.extend({
initialize: function (template, formTag, element) {
this.el = formTag;
this.template = template;
this.element = element;
this.bindEvents();
},
bindEvents: function () {
var self = this;
Core.Mediator.subscribe('before:form:submit', function (form) {
if (form.attr('id') === self.el) {
var element = form.find('.element_' + self.element.getKey()),
input = element.find('input[name="' + self.element.getKey() + '"]'),
span = element.find('span.updated'),
oldValue = self.element.value;
if (input.val() !== oldValue) {
span.text('updated');
} else {
span.text('');
}
}
});
},
/**
* Render the template into the DOM with the Renderer
* @returns {String} html
*/
render: function () {
return Renderer.render(this.template, {element: this.element});
}
});
return HiddenView;
}); | ndufreche/BbCoreJs | src/tb/component/formbuilder/form/element/views/form.element.view.hidden.js | JavaScript | gpl-3.0 | 2,067 |
/*
RWImporter
Copyright (C) 2017 Martin Smith
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rw_snippet.h"
#include <QXmlStreamWriter>
#include <QBuffer>
#include <QDebug>
#include <QModelIndex>
#include <QMetaEnum>
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QCoreApplication>
#include "datafield.h"
#include "rw_domain.h"
#include "rw_facet.h"
static QMetaEnum snip_type_enum = QMetaEnum::fromType<RWFacet::SnippetType>();
static QMetaEnum snip_veracity_enum = QMetaEnum::fromType<RWContentsItem::SnippetVeracity>();
static QMetaEnum snip_style_enum = QMetaEnum::fromType<RWContentsItem::SnippetStyle>();
static QMetaEnum snip_purpose_enum = QMetaEnum::fromType<RWContentsItem::SnippetPurpose>();
const int NAME_TYPE_LENGTH = 50;
const QString DEFAULT_IMAGE_NAME("image.png");
const char *DEFAULT_IMAGE_FORMAT = "PNG";
#define CONTENTS_TOKEN "contents"
RWSnippet::RWSnippet(RWFacet *facet, RWContentsItem *parent) :
RWContentsItem(facet, parent),
facet(facet)
{
}
static QString to_gregorian(const QString &from)
{
// TODO - Realm Works does not like "gregorian" fields in this format!
/* Must be [Y]YYYY-MM-DD hh:mm:ss[ BCE]
* year limit is 20000 */
if (from.length() >= 19) return from;
// If no time in the field, then simply append midnight time */
if (from.length() == 10 || from.length() == 11) return from + " 00:00:00";
qWarning() << "INVALID DATE FORMAT:" << from << "(should be [Y]YYYY-MM-DD HH:MM:SS)";
return from;
}
void RWSnippet::writeToContents(QXmlStreamWriter *writer, const QModelIndex &index) const
{
Q_UNUSED(index);
bool bold = false;
// Ignore date snippets if no data available
const QString start_date = startDate().valueString(index);
if ((facet->snippetType() == RWFacet::Date_Game || facet->snippetType() == RWFacet::Date_Range) && start_date.isEmpty())
{
return;
}
writer->writeStartElement("snippet");
{
const QString user_text = contentsText().valueString(index);
const QString gm_dir = gmDirections().valueString(index);
const QVariant asset = filename().value(index);
const QString finish_date = finishDate().valueString(index);
QString digits = number().valueString(index);
if (!structure->id().isEmpty()) writer->writeAttribute("facet_id", structure->id());
writer->writeAttribute("type", snip_type_enum.valueToKey(facet->snippetType()));
if (snippetVeracity() != RWContentsItem::Truth) writer->writeAttribute("veracity", snip_veracity_enum.valueToKey(snippetVeracity()));
if (snippetStyle() != RWContentsItem::Normal) writer->writeAttribute("style", snip_style_enum.valueToKey(snippetStyle()));
if (snippetPurpose() != RWContentsItem::Story_Only) writer->writeAttribute("purpose", snip_purpose_enum.valueToKey(snippetPurpose()));
if (isRevealed()) writer->writeAttribute("is_revealed", "true");
if (!gm_dir.isEmpty())
{
RWFacet::SnippetType ft = facet->snippetType();
writer->writeAttribute("purpose",
((ft == RWFacet::Multi_Line || ft == RWFacet::Labeled_Text ||
ft == RWFacet::Tag_Standard ||
ft == RWFacet::Numeric) && user_text.isEmpty() && p_tags.valueString(index).isEmpty()) ? "Directions_Only" : "Both");
}
#if 0
QString label_text = p_label_text.valueString(index);
if (id().isEmpty() && facet->snippetType() == Labeled_Text && !label_text.isEmpty())
{
// For locally added snippets of the Labeled_Text variety
writer->writeAttribute("label", label_text);
}
#endif
//
// CHILDREN have to be in a specific order:
// contents | smart_image | ext_object | game_date | date_range
// annotation
// gm_directions
// X x (link | dlink)
// X x tag_assign
// Maybe an ANNOTATION or CONTENTS
if (!user_text.isEmpty() || !asset.isNull() || !start_date.isEmpty() || !digits.isEmpty())
{
bool check_annotation = true;
switch (facet->snippetType())
{
case RWFacet::Multi_Line:
case RWFacet::Labeled_Text:
{
QString text;
for (auto para: user_text.split("\n\n"))
text.append(xmlParagraph(xmlSpan(para, bold)));
writer->writeTextElement(CONTENTS_TOKEN, text);
// No annotation for these two snippet types
check_annotation = false;
break;
}
case RWFacet::Tag_Standard:
case RWFacet::Hybrid_Tag:
// annotation done later
break;
case RWFacet::Numeric:
if (!digits.isEmpty())
{
bool ok;
#if 1
digits.toFloat(&ok);
if (!ok)
qWarning() << tr("Non-numeric characters in numeric field: %1").arg(digits);
else
writer->writeTextElement(CONTENTS_TOKEN, digits);
#else
const QLocale &locale = QLocale::system();
locale.toFloat(digits, &ok);
if (!ok)
qWarning() << tr("Non-numeric characters in numeric field: %1").arg(digits);
else
{
// Handle locale details:
// Remove occurrences of the group character;
// Replace the locale's decimal point with the ISO '.' character
digits.remove(locale.groupSeparator());
digits.replace(locale.decimalPoint(),'.');
writer->writeTextElement(CONTENTS_TOKEN, digits);
}
#endif
}
break;
// There are a lot of snippet types which have an ext_object child (which has an asset child)
case RWFacet::Foreign:
write_ext_object(writer, "Foreign", asset);
break;
case RWFacet::Statblock: // this might require an .rtf file?
write_ext_object(writer, "Statblock", asset);
break;
case RWFacet::Portfolio: // requires a HeroLab portfolio
write_ext_object(writer, "Portfolio", asset);
break;
case RWFacet::Picture:
write_ext_object(writer, "Picture", asset);
break;
case RWFacet::Rich_Text:
write_ext_object(writer, "Rich_Text", asset);
break;
case RWFacet::PDF:
write_ext_object(writer, "PDF", asset);
break;
case RWFacet::Audio:
write_ext_object(writer, "Audio", asset);
break;
case RWFacet::Video:
write_ext_object(writer, "Video", asset);
break;
case RWFacet::HTML:
write_ext_object(writer, "HTML", asset);
break;
case RWFacet::Smart_Image:
// Slightly different format since it has a smart_image child (which has an asset child)
write_smart_image(writer, asset);
break;
case RWFacet::Date_Game:
writer->writeStartElement("game_date");
//writer->writeAttribute("canonical", start_date);
writer->writeAttribute("gregorian", to_gregorian(start_date));
writer->writeEndElement();
break;
case RWFacet::Date_Range:
writer->writeStartElement("date_range");
//writer->writeAttribute("canonical_start", start_date);
writer->writeAttribute("gregorian_start", to_gregorian(start_date));
//writer->writeAttribute("canonical_end", finish_date);
writer->writeAttribute("gregorian_end", to_gregorian(finish_date));
writer->writeEndElement();
break;
case RWFacet::Tag_Multi_Domain:
qFatal("RWSnippet::writeToContents: invalid snippet type: %d", facet->snippetType());
} /* switch snippet type */
if (check_annotation && !user_text.isEmpty())
{
writer->writeTextElement("annotation", xmlParagraph(xmlSpan(user_text, /*bold*/ false)));
}
}
// Maybe some GM directions
if (!gm_dir.isEmpty())
{
writer->writeTextElement("gm_directions", xmlParagraph(xmlSpan(gm_dir, /*bold*/ false)));
}
// Maybe one or more TAG_ASSIGN (to be entered AFTER the contents/annotation)
QString tag_names = p_tags.valueString(index);
if (!tag_names.isEmpty())
{
// Find the domain to use
QString domain_id = structure->attributes().value("domain_id").toString();
RWDomain *domain = RWDomain::getDomainById(domain_id);
if (domain)
{
for (auto tag_name: tag_names.split(","))
{
QString tag_id = domain->tagId(tag_name.trimmed());
if (!tag_id.isEmpty())
{
writer->writeStartElement("tag_assign");
writer->writeAttribute("tag_id", tag_id);
writer->writeAttribute("type","Indirect");
writer->writeAttribute("is_auto_assign", "true");
writer->writeEndElement();
}
else
qWarning() << "No TAG defined for" << tag_name.trimmed() << "in DOMAIN" << domain->name();
}
}
else if (!domain_id.isEmpty())
qWarning() << "DOMAIN not found for" << domain_id << "on FACET" << structure->id();
else
qWarning() << "domain_id does not exist on FACET" << structure->id();
}
}
writer->writeEndElement(); // snippet
}
void RWSnippet::write_asset(QXmlStreamWriter *writer, const QVariant &asset) const
{
const int FILENAME_TYPE_LENGTH = 200;
// Images can be put inside immediately
if (asset.type() == QVariant::Image)
{
QImage image = asset.value<QImage>();
writer->writeStartElement("asset");
writer->writeAttribute("filename", DEFAULT_IMAGE_NAME.right(FILENAME_TYPE_LENGTH));
QByteArray databytes;
QBuffer buffer(&databytes);
buffer.open(QIODevice::WriteOnly);
image.save(&buffer, DEFAULT_IMAGE_FORMAT);
writer->writeTextElement(CONTENTS_TOKEN, databytes.toBase64());
writer->writeEndElement(); // asset
return;
}
QFile file(asset.toString());
QUrl url(asset.toString());
if (file.open(QFile::ReadOnly))
{
QFileInfo info(file);
writer->writeStartElement("asset");
writer->writeAttribute("filename", info.fileName().right(FILENAME_TYPE_LENGTH));
//writer->writeAttribute("thumbnail_size", info.fileName());
QByteArray contents = file.readAll();
writer->writeTextElement(CONTENTS_TOKEN, contents.toBase64());
//writer->writeTextElement("thumbnail", thumbnail.toBase64());
//writer->writeTextElement("summary", thing.toBase64());
//writer->writeTextElement("url", filename);
writer->writeEndElement(); // asset
}
else if (url.isValid())
{
static QNetworkAccessManager *nam = nullptr;
if (nam == nullptr)
{
nam = new QNetworkAccessManager;
nam->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
}
QNetworkRequest request(url);
QNetworkReply *reply = nam->get(request);
while (!reply->isFinished())
{
qApp->processEvents(QEventLoop::WaitForMoreEvents);
}
if (reply->error() != QNetworkReply::NoError)
{
qWarning() << "Failed to locate URL:" << asset.toString();
}
// A redirect has ContentType of "text/html; charset=UTF-8, image/png"
// which is an ordered comma-separated list of types.
// So we need to check the LAST type which will be for readAll()
else if (reply->header(QNetworkRequest::ContentTypeHeader).toString().split(',').last().trimmed().startsWith("image/"))
{
QString tempname = QFileInfo(url.path()).baseName() + '.' + reply->header(QNetworkRequest::ContentTypeHeader).toString().split("/").last();
writer->writeStartElement("asset");
writer->writeAttribute("filename", tempname.right(FILENAME_TYPE_LENGTH));
QByteArray contents = reply->readAll();
writer->writeTextElement(CONTENTS_TOKEN, contents.toBase64());
//writer->writeTextElement("url", filename);
writer->writeEndElement(); // asset
}
else
{
// A redirect has QPair("Content-Type","text/html; charset=UTF-8, image/png")
// note the comma-separated list of content types (legal?)
// the body of the message is actually PNG binary data.
// QPair("Server","Microsoft-IIS/8.5, Microsoft-IIS/8.5") so maybe ISS sent wrong content type
qWarning() << "Only URLs to images are supported (not" << reply->header(QNetworkRequest::ContentTypeHeader) << ")! Check source at" << asset.toString();
//if (reply->header(QNetworkRequest::ContentTypeHeader).toString().startsWith("text/"))
// qWarning() << "Body =" << reply->readAll();
//qWarning() << "Raw Header List =" << reply->rawHeaderPairs();
}
reply->deleteLater();
}
else
{
#if 1
qWarning() << "File/URL does not exist:" + asset.toString();
#else
QString message = "File/URL does not exist: " + asset.toString();
static QMessageBox *warning = nullptr;
if (warning == nullptr)
{
warning = new QMessageBox;
warning->setText("Issues encountered during GENERATE:\n");
}
warning->setText(warning->text() + '\n' + message);
warning->show();
#endif
}
}
/**
* @brief RWSnippet::write_ext_object
* @param writer
* @param exttype one of Foreign, Statblock, Portfolio, Picture, Rich_Text, PDF, Audio, Video, HTML
* @param filename
*/
void RWSnippet::write_ext_object(QXmlStreamWriter *writer, const QString &exttype, const QVariant &asset) const
{
if (asset.isNull()) return;
writer->writeStartElement("ext_object");
if (asset.type() == QVariant::String)
writer->writeAttribute("name", QFileInfo(asset.toString()).fileName().right(NAME_TYPE_LENGTH));
else
// What name to use for QImage?
writer->writeAttribute("name", DEFAULT_IMAGE_NAME.right(NAME_TYPE_LENGTH));
writer->writeAttribute("type", exttype);
write_asset(writer, asset);
writer->writeEndElement();
}
void RWSnippet::write_smart_image(QXmlStreamWriter *writer, const QVariant &asset) const
{
if (asset.isNull()) return;
writer->writeStartElement("smart_image");
writer->writeAttribute("name", QFileInfo(asset.toString()).fileName().right(NAME_TYPE_LENGTH));
write_asset(writer, asset);
// write_overlay (0-1)
// write_subset_mask (0-1)
// write_superset_mask (0-1)
// write_map_pan (0+)
writer->writeEndElement();
}
QDataStream &operator<<(QDataStream &stream, const RWSnippet &snippet)
{
//qDebug() << " RWSnippet<<" << snippet.structure->name();
// write base class items
stream << *dynamic_cast<const RWContentsItem*>(&snippet);
// write this class items
stream << snippet.p_tags;
stream << snippet.p_label_text;
stream << snippet.p_filename;
stream << snippet.p_start_date;
stream << snippet.p_finish_date;
stream << snippet.p_number;
return stream;
}
QDataStream &operator>>(QDataStream &stream, RWSnippet &snippet)
{
//qDebug() << " RWSnippet>>" << snippet.structure->name();
// read base class items
stream >> *dynamic_cast<RWContentsItem*>(&snippet);
// read this class items
stream >> snippet.p_tags;
stream >> snippet.p_label_text;
stream >> snippet.p_filename;
stream >> snippet.p_start_date;
stream >> snippet.p_finish_date;
stream >> snippet.p_number;
return stream;
}
| farling42/csv2rw | rw_snippet.cpp | C++ | gpl-3.0 | 17,289 |
#include "podcastclient.h"
QStringList PodcastClient::getFeedsFromSettings()
{
QStringList resultList = settings.value("feeds").toStringList();
if(resultList.isEmpty())
{
QString string = settings.value("feeds").toString();
if(!string.isEmpty())
resultList.push_back(string);
}
return resultList;
}
PodcastClient::PodcastClient(QObject *parent) : QObject(parent)
{
if(settings.value("NumDownloads").isNull())
settings.setValue("NumDownloads",10);
if(settings.value("Dest").isNull())
settings.setValue("Dest",".");
else
{
if(!QDir(settings.value("Dest").toString()).exists())
{
settings.setValue("Dest",",");
}
}
downloader.setMaxConnections(settings.value("NumDownloads").toInt());
foreach(QString url, getFeedsFromSettings())
{
Podcast* podcast = new Podcast(QUrl(url), &downloader, this);
podcast->setTargetFolder(QDir(settings.value("Dest").toString()));
podcasts.push_back(podcast);
connect(podcast,&Podcast::done,this,&PodcastClient::podcastDone);
connect(podcast,&Podcast::writingFailed,this,&PodcastClient::podcastWritingFailed);
}
}
bool PodcastClient::downloadAll()
{
if(podcasts.isEmpty())
{
out << "No podcasts in list. Done." << endl;
return true;
}
finishedCtr = 0;
foreach(Podcast* podcast, podcasts)
{
podcast->update();
}
return false;
}
bool PodcastClient::addPodcast(const QUrl &url, const QString &mode)
{
podcasts.clear();
finishedCtr = 0;
if(!url.isValid())
{
out << "Invalid URL." << endl;
return true;
}
if(mode=="last" || mode.isEmpty())
{
Podcast* podcast = new Podcast(url, &downloader, this);
podcasts.push_back(podcast);
connect(podcast,&Podcast::done,this,&PodcastClient::podcastDone);
podcast->init(true);
QStringList feeds;
foreach(QString url, getFeedsFromSettings())
{
feeds.push_back(url);
}
feeds.push_back(url.toString());
settings.setValue("feeds",feeds);
return false;
}
else if(mode=="all")
{
QStringList feeds;
foreach(QString url, getFeedsFromSettings())
{
feeds.push_back(url);
}
feeds.push_back(url.toString());
settings.setValue("feeds",feeds);
return true;
}
else if(mode=="none")
{
Podcast* podcast = new Podcast(url, &downloader, this);
podcasts.push_back(podcast);
connect(podcast,&Podcast::done,this,&PodcastClient::podcastDone);
podcast->init(false);
QStringList feeds;
foreach(QString url, getFeedsFromSettings())
{
feeds.push_back(url);
}
feeds.push_back(url.toString());
settings.setValue("feeds",feeds);
return false;
}
else
{
out << "Invalid adding mode: " << mode << endl;
out << "Modes are: last, all, none" << endl;
return true;
}
}
void PodcastClient::removePodcast(const QUrl &url)
{
QStringList feeds;
foreach(QString url, getFeedsFromSettings())
{
feeds.push_back(url);
}
feeds.removeAll(url.toString());
if(feeds.isEmpty())
settings.remove("feeds");
else
settings.setValue("feeds",feeds);
}
void PodcastClient::setDest(const QString &dest)
{
QDir dir(dest);
settings.setValue("Dest",dest);
settings.sync();
if(!dir.exists())
{
out << "Target directory does not exist." << endl;
}
}
QString PodcastClient::getDest()
{
return settings.value("Dest").toString();
}
void PodcastClient::list()
{
foreach(QString url, getFeedsFromSettings())
{
out << url << endl;
}
}
void PodcastClient::setMaxDownloads(int num)
{
downloader.setMaxConnections(num);
settings.setValue("NumDownloads",num);
settings.sync();
}
int PodcastClient::getMaxDownloads()
{
return downloader.getMaxConnections();
}
void PodcastClient::podcastDone()
{
finishedCtr++;
if(finishedCtr==podcasts.size())
{
settings.sync();
QCoreApplication::exit(0);
}
}
void PodcastClient::podcastWritingFailed()
{
out << "Aborting downloads..." << endl;
foreach(Podcast* podcast, podcasts)
{
podcast->abort();
}
}
| R-Rudolph/minicatcher | podcastclient.cpp | C++ | gpl-3.0 | 4,030 |
package org.epilot.ccf.codec;
import org.apache.mina.common.ByteBuffer;
import org.epilot.ccf.core.code.AbstractMessageEncode;
import org.epilot.ccf.core.protocol.Message;
import org.epilot.ccf.core.protocol.MessageBody;
import org.epilot.ccf.core.protocol.MessageHeader;
import org.epilot.ccf.core.util.ByteBufferDataHandle;
public class MessageEncode extends AbstractMessageEncode {
private String serviceName;
public MessageEncode(String serviceName) {
this.serviceName = serviceName;
}
protected void encodeMessage(GameMessageDataHandle messageDataHandle,Message message,ByteBuffer buffer) {
ByteBufferDataHandle byteBufferDataHandle =new ByteBufferDataHandle(buffer);
MessageHeader header = message.getHeader();
MessageBody body = message.getBody();
if(header ==null)//无消息头
{
return;
}
messageDataHandle.getHeaderBuffer(serviceName,header, byteBufferDataHandle);
if(body !=null)
{
messageDataHandle.getBodyBuffer(String.valueOf(header.getProtocolId()),body, byteBufferDataHandle);
}
}
@Override
protected void encodeMessage(DefaultMessageDataHandle messageDataHandle,
Message message, ByteBuffer buffer) {
}
}
| bozhbo12/demo-spring-server | spring-game/src/main/java/org/epilot/ccf/codec/MessageEncode.java | Java | gpl-3.0 | 1,193 |
var _i_x_n_annotation_format_8h =
[
[ "IXNAnnotationFormat", "_i_x_n_annotation_format_8h.html#a607464fe85fc01c26df0c51826fd4841", [
[ "IXNAnnotationFormatPlainString", "_i_x_n_annotation_format_8h.html#a607464fe85fc01c26df0c51826fd4841a7b4fb91d85f0776a7abe6e0623f6b0fc", null ],
[ "IXNAnnotationFormatJson", "_i_x_n_annotation_format_8h.html#a607464fe85fc01c26df0c51826fd4841a91b8ae8f1bcb5c68a714026c4674231d", null ],
[ "IXNAnnotationFormatOsc", "_i_x_n_annotation_format_8h.html#a607464fe85fc01c26df0c51826fd4841a611da1ac0a3eccbea277aad5ca3d57f1", null ]
] ]
]; | BrainModes/BM.Muse | libmuse_5.8.0/ios/doc/_i_x_n_annotation_format_8h.js | JavaScript | gpl-3.0 | 590 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dal.SOFD
{
public interface IRepo<IEntity>
{
IQueryable<IEntity> Query { get; }
}
}
| SkanderborgKommune/RollekatelogJSON | Dal.SOFD/IRepo.cs | C# | gpl-3.0 | 231 |
package com.baeldung.iteratorguide;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
public class IteratorGuide {
public static void main(String[] args) {
List<String> items = new ArrayList<>();
items.add("ONE");
items.add("TWO");
items.add("THREE");
Iterator<String> iter = items.iterator();
while (iter.hasNext()) {
String next = iter.next();
System.out.println(next);
iter.remove();
}
ListIterator<String> listIterator = items.listIterator();
while(listIterator.hasNext()) {
String nextWithIndex = items.get(listIterator.nextIndex());
String next = listIterator.next();
if( "ONE".equals(next)) {
listIterator.set("SWAPPED");
}
}
listIterator.add("FOUR");
while(listIterator.hasPrevious()) {
String previousWithIndex = items.get(listIterator.previousIndex());
String previous = listIterator.previous();
System.out.println(previous);
}
listIterator.forEachRemaining(e -> {
System.out.println(e);
});
}
}
| Niky4000/UsefulUtils | projects/tutorials-master/tutorials-master/core-java-modules/core-java-collections/src/main/java/com/baeldung/iteratorguide/IteratorGuide.java | Java | gpl-3.0 | 1,260 |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SPCtoMML
{
public partial class Form2 : Form
{
/// <summary>
/// Callback for updating progress
/// </summary>
private Func<double> updateProgressHandler;
/// <summary>
/// Initializes the form.
/// </summary>
/// <param name="updateProgress">The callback for updating progress bar ratio.</param>
public Form2(Func<double> updateProgress)
{
InitializeComponent();
this.Text = Program.GetProgramName();
this.updateProgressHandler = updateProgress;
}
public void UpdateHandler(Func<double> updateProgress)
{
this.updateProgressHandler = updateProgress;
}
/// <summary>
/// Updates the progress dialog status.
/// </summary>
/// <param name="status">The new status to use.</param>
public void UpdateStatus(string status)
{
this.label1.Text = status;
}
/// <summary>
/// Updates the progress bar.
/// </summary>
/// <param name="ratio">The progress ratio.</param>
public void UpdateProgress(double ratio)
{
try
{
this.progressBar1.Value = (int)Math.Round(ratio * 1000);
}
catch
{
this.progressBar1.Value = 0;
}
}
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (updateProgressHandler != null)
{
UpdateProgress(updateProgressHandler());
}
}
}
}
| VitorVilela7/SPCtoMML | SPCtoMML/Form2.cs | C# | gpl-3.0 | 1,633 |
#coding=UTF-8
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext
from pyspark.sql.types import *
from datetime import date, datetime, timedelta
import sys, re, os
st = datetime.now()
conf = SparkConf().setAppName('PROC_A_SUBJECT_D002015').setMaster(sys.argv[2])
sc = SparkContext(conf = conf)
sc.setLogLevel('WARN')
if len(sys.argv) > 5:
if sys.argv[5] == "hive":
sqlContext = HiveContext(sc)
else:
sqlContext = SQLContext(sc)
hdfs = sys.argv[3]
dbname = sys.argv[4]
#处理需要使用的日期
etl_date = sys.argv[1]
#etl日期
V_DT = etl_date
#上一日日期
V_DT_LD = (date(int(etl_date[0:4]), int(etl_date[4:6]), int(etl_date[6:8])) + timedelta(-1)).strftime("%Y%m%d")
#月初日期
V_DT_FMD = date(int(etl_date[0:4]), int(etl_date[4:6]), 1).strftime("%Y%m%d")
#上月末日期
V_DT_LMD = (date(int(etl_date[0:4]), int(etl_date[4:6]), 1) + timedelta(-1)).strftime("%Y%m%d")
#10位日期
V_DT10 = (date(int(etl_date[0:4]), int(etl_date[4:6]), int(etl_date[6:8]))).strftime("%Y-%m-%d")
V_STEP = 0
ACRM_F_CI_ASSET_BUSI_PROTO = sqlContext.read.parquet(hdfs+'/ACRM_F_CI_ASSET_BUSI_PROTO/*')
ACRM_F_CI_ASSET_BUSI_PROTO.registerTempTable("ACRM_F_CI_ASSET_BUSI_PROTO")
#任务[21] 001-01::
V_STEP = V_STEP + 1
sql = """
SELECT CAST(A.CUST_ID AS VARCHAR(32)) AS CUST_ID
,CAST('' AS VARCHAR(20)) AS ORG_ID --插入的空值,包顺龙2017/05/13
,CAST('D002015' AS VARCHAR(20)) AS INDEX_CODE
,CAST(SUM(TAKE_CGT_LINE) AS DECIMAL(22,2)) AS INDEX_VALUE
,CAST(SUBSTR(V_DT, 1, 7) AS VARCHAR(7)) AS YEAR_MONTH
,CAST(V_DT AS DATE) AS ETL_DATE
,CAST(A.CUST_TYP AS VARCHAR(5)) AS CUST_TYPE
,CAST(A.FR_ID AS VARCHAR(5)) AS FR_ID
FROM ACRM_F_CI_ASSET_BUSI_PROTO A
WHERE A.BAL > 0
AND A.LN_APCL_FLG = 'N'
AND(A.PRODUCT_ID LIKE '1010%'
OR A.PRODUCT_ID LIKE '1030%'
OR A.PRODUCT_ID LIKE '1040%'
OR A.PRODUCT_ID LIKE '1050%'
OR A.PRODUCT_ID LIKE '1060%'
OR A.PRODUCT_ID LIKE '1070%'
OR A.PRODUCT_ID LIKE '2010%'
OR A.PRODUCT_ID LIKE '2020%'
OR A.PRODUCT_ID LIKE '2030%'
OR A.PRODUCT_ID LIKE '2040%'
OR A.PRODUCT_ID LIKE '2050%')
GROUP BY A.CUST_ID
,A.CUST_TYP
,A.FR_ID """
sql = re.sub(r"\bV_DT\b", "'"+V_DT10+"'", sql)
ACRM_A_TARGET_D002015 = sqlContext.sql(sql)
ACRM_A_TARGET_D002015.registerTempTable("ACRM_A_TARGET_D002015")
dfn="ACRM_A_TARGET_D002015/"+V_DT+".parquet"
ACRM_A_TARGET_D002015.cache()
nrows = ACRM_A_TARGET_D002015.count()
ACRM_A_TARGET_D002015.write.save(path=hdfs + '/' + dfn, mode='overwrite')
ACRM_A_TARGET_D002015.unpersist()
ACRM_F_CI_ASSET_BUSI_PROTO.unpersist()
ret = os.system("hdfs dfs -rm -r /"+dbname+"/ACRM_A_TARGET_D002015/"+V_DT_LD+".parquet")
et = datetime.now()
print("Step %d start[%s] end[%s] use %d seconds, insert ACRM_A_TARGET_D002015 lines %d") % (V_STEP, st.strftime("%H:%M:%S"), et.strftime("%H:%M:%S"), (et-st).seconds, nrows)
| cysuncn/python | spark/crm/PROC_A_SUBJECT_D002015.py | Python | gpl-3.0 | 3,179 |
/*
ID: zhou.yo1
PROG: palsquare
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
const char* digits = "0123456789ABCDEFGHIJKLMN";
void to_base( int num, int base, char* out )
{
char* p = out;
while( num )
{
*p++ = digits[ num % base ];
num /= base;
}
*p = '\0';
reverse( out, p );
//cout << out << endl;
}
bool is_pal( char* in, int len )
{
for(int i = 0; i < len/2; ++i )
{
if( in[i] != in[len-1-i] ) return false;
}
return true;
}
int main()
{
ifstream fin( "palsquare.in" );
ofstream out( "palsquare.out" );
int base;
fin >> base;
char N[256];
char S[256];
for(int i = 1; i <= 300; ++i )
{
to_base(i, base, N);
to_base(i*i, base, S);
if( is_pal(S, strlen(S)) )
{
out << N << ' ' << S << endl;
}
}
return 0;
}
| zhouyouyi/puzzles | usaco/palsquare.cc | C++ | gpl-3.0 | 1,092 |
// Author:
// Noah Ablaseau <nablaseau@hotmail.com>
//
// Copyright (c) 2017
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
using System.Configuration;
using System.Drawing;
namespace linerider.IO.ffmpeg
{
public static class FFMPEG
{
private const int MaximumBuffers = 25;
private static bool inited = false;
public static bool HasExecutable
{
get
{
return File.Exists(ffmpeg_path);
}
}
public static string ffmpeg_dir
{
get
{
string dir = Program.UserDirectory + "ffmpeg" + Path.DirectorySeparatorChar;
if (OpenTK.Configuration.RunningOnMacOS)
dir += "mac" + Path.DirectorySeparatorChar;
else if (OpenTK.Configuration.RunningOnWindows)
dir += "win" + Path.DirectorySeparatorChar;
else if (OpenTK.Configuration.RunningOnUnix)
{
dir += "linux" + Path.DirectorySeparatorChar;
}
else
{
return null;
}
return dir;
}
}
public static string ffmpeg_path
{
get
{
var dir = ffmpeg_dir;
if (dir == null)
return null;
if (OpenTK.Configuration.RunningOnWindows)
return dir + "ffmpeg.exe";
else
return dir + "ffmpeg";
}
}
static FFMPEG()
{
}
private static void TryInitialize()
{
if (inited)
return;
inited = true;
if (ffmpeg_path == null)
throw new Exception("Unable to detect platform for ffmpeg");
MakeffmpegExecutable();
}
public static string ConvertSongToOgg(string file, Func<string, bool> stdout)
{
TryInitialize();
if (!file.EndsWith(".ogg", true, Program.Culture))
{
var par = new IO.ffmpeg.FFMPEGParameters();
par.AddOption("i", "\"" + file + "\"");
par.OutputFilePath = file.Remove(file.IndexOf(".", StringComparison.Ordinal)) + ".ogg";
if (File.Exists(par.OutputFilePath))
{
if (File.Exists(file))
{
File.Delete(par.OutputFilePath);
}
else
{
return par.OutputFilePath;
}
}
Execute(par, stdout);
file = par.OutputFilePath;
}
return file;
}
public static void Execute(FFMPEGParameters parameters, Func<string, bool> stdout)
{
TryInitialize();
if (String.IsNullOrWhiteSpace(ffmpeg_path))
{
throw new Exception("Path to FFMPEG executable cannot be null");
}
if (parameters == null)
{
throw new Exception("FFMPEG parameters cannot be completely null");
}
using (Process ffmpegProcess = new Process())
{
ProcessStartInfo info = new ProcessStartInfo(ffmpeg_path)
{
Arguments = parameters.ToString(),
WorkingDirectory = Path.GetDirectoryName(ffmpeg_dir),
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = false,
RedirectStandardError = false
};
info.RedirectStandardOutput = true;
info.RedirectStandardError = true;
ffmpegProcess.StartInfo = info;
ffmpegProcess.Start();
if (stdout != null)
{
while (true)
{
string str = "";
try
{
str = ffmpegProcess.StandardError.ReadLine();
}
catch
{
Console.WriteLine("stdout log failed");
break;
//ignored
}
if (ffmpegProcess.HasExited)
break;
if (str == null)
str = "";
if (!stdout.Invoke(str))
{
ffmpegProcess.Kill();
return;
}
}
}
else
{
/*if (debug)
{
string processOutput = ffmpegProcess.StandardError.ReadToEnd();
}*/
ffmpegProcess.WaitForExit();
}
}
}
private static void MakeffmpegExecutable()
{
if (OpenTK.Configuration.RunningOnUnix)
{
try
{
using (Process chmod = new Process())
{
ProcessStartInfo info = new ProcessStartInfo("/bin/chmod")
{
Arguments = "+x ffmpeg",
WorkingDirectory = Path.GetDirectoryName(ffmpeg_dir),
UseShellExecute = false,
};
chmod.StartInfo = info;
chmod.Start();
if (!chmod.WaitForExit(1000))
{
chmod.Close();
}
}
}
catch (Exception e)
{
linerider.Utils.ErrorLog.WriteLine(
"chmod error on ffmpeg" + Environment.NewLine + e.ToString());
}
}
}
}
} | jealouscloud/linerider-advanced | src/IO/ffmpeg/FFMPEG.cs | C# | gpl-3.0 | 6,950 |
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: http://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
Espo.define('Views.EmailAccount.Record.Edit', ['Views.Record.Edit', 'Views.EmailAccount.Record.Detail'], function (Dep, Detail) {
return Dep.extend({
afterRender: function () {
Dep.prototype.afterRender.call(this);
Detail.prototype.initSslFieldListening.call(this);
},
});
});
| lucasmattos/crm | client/src/views/email-account/record/edit.js | JavaScript | gpl-3.0 | 1,286 |
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include "../../drawing/drawing.h"
#include "../../interface/viewport.h"
#include "../../paint/map_element/map_element.h"
#include "../../paint/paint.h"
#include "../../paint/supports.h"
#include "../../sprites.h"
#include "../../world/map.h"
#include "../../world/sprite.h"
#include "../ride_data.h"
#include "../track_data.h"
#include "../track_paint.h"
/** rct2: 0x008A6370 */
static void looping_rc_track_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15006, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15007, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15008, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15009, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
else
{
switch (direction)
{
case 0:
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15004, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15005, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
}
static void looping_rc_track_station(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
static const uint32 imageIds[4][2] = {
{ 15016, SPR_STATION_BASE_B_SW_NE },
{ 15017, SPR_STATION_BASE_B_NW_SE },
{ 15016, SPR_STATION_BASE_B_SW_NE },
{ 15017, SPR_STATION_BASE_B_NW_SE },
};
sub_98197C_rotated(session, direction, imageIds[direction][0] | session->TrackColours[SCHEME_TRACK], 0, 0, 32, 20, 1,
height, 0, 6, height + 3);
sub_98196C_rotated(session, direction, imageIds[direction][1] | session->TrackColours[SCHEME_MISC], 0, 0, 32, 32, 1,
height);
track_paint_util_draw_station_metal_supports_2(session, direction, height, session->TrackColours[SCHEME_SUPPORTS], 0);
track_paint_util_draw_station(session, rideIndex, trackSequence, direction, height, mapElement);
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_6);
paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
}
/** rct2: 0x008A6380 */
static void looping_rc_track_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15060, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15061, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15062, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15063, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15032, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15033, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15034, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15035, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
}
/** rct2: 0x008A6390 */
static void looping_rc_track_60_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15076, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15077, 0, 0, 32, 1, 98, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15078, 0, 0, 32, 1, 98, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15079, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 32, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15048, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15049, 0, 0, 32, 1, 98, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15050, 0, 0, 32, 1, 98, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15051, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 32, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 56, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 104, 0x20);
}
/** rct2: 0x008A63A0 */
static void looping_rc_track_flat_to_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15052, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15053, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15054, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15055, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 3, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15024, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15025, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15026, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15027, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 3, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
}
/** rct2: 0x008A63B0 */
static void looping_rc_track_25_deg_up_to_60_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15064, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15065, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15068, 0, 0, 32, 1, 66, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15066, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15069, 0, 0, 32, 1, 66, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15067, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 12, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15036, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15037, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15040, 0, 0, 32, 1, 66, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15038, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15041, 0, 0, 32, 1, 66, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15039, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 12, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 24, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
}
/** rct2: 0x008A63C0 */
static void looping_rc_track_60_deg_up_to_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15070, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15071, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15074, 0, 0, 32, 1, 66, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15072, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15075, 0, 0, 32, 1, 66, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15073, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 20, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15042, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15043, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15046, 0, 0, 32, 1, 66, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15044, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15047, 0, 0, 32, 1, 66, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15045, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 20, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 24, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
}
/** rct2: 0x008A63D0 */
static void looping_rc_track_25_deg_up_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15056, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15057, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15058, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15059, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 6, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15028, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15029, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15030, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15031, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 6, height, session->TrackColours[SCHEME_SUPPORTS]);
}
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_12);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 40, 0x20);
}
/** rct2: 0x008A63E0 */
static void looping_rc_track_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
looping_rc_track_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A63F0 */
static void looping_rc_track_60_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
looping_rc_track_60_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6400 */
static void looping_rc_track_flat_to_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
looping_rc_track_25_deg_up_to_flat(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6410 */
static void looping_rc_track_25_deg_down_to_60_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_60_deg_up_to_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6420 */
static void looping_rc_track_60_deg_down_to_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_25_deg_up_to_60_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6430 */
static void looping_rc_track_25_deg_down_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
looping_rc_track_flat_to_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6440 */
static void looping_rc_track_left_quarter_turn_5(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15183, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15188, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15193, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15178, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15182, 0, 0, 32, 16, 3, height, 0, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15187, 0, 0, 32, 16, 3, height, 0, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15192, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15177, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15181, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15186, 0, 0, 16, 16, 3, height, 16, 16,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15191, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15176, 0, 0, 16, 16, 3, height, 0, 0,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 4:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 5:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15180, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15185, 0, 0, 16, 32, 3, height, 0, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15190, 0, 0, 16, 32, 3, height, 0, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15175, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 6:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15179, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15184, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15189, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15174, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 2:
paint_util_push_tunnel_right(session, height, TUNNEL_0);
break;
case 3:
paint_util_push_tunnel_left(session, height, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A6450 */
static void looping_rc_track_right_quarter_turn_5(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];
looping_rc_track_left_quarter_turn_5(session, rideIndex, trackSequence, (direction - 1) & 3, height, mapElement);
}
/** rct2: 0x008A6460 */
static void looping_rc_track_flat_to_left_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15080, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15092, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15081, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15093, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15082, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15083, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
}
/** rct2: 0x008A6470 */
static void looping_rc_track_flat_to_right_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15084, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15085, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15086, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15094, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15087, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15095, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
}
/** rct2: 0x008A6480 */
static void looping_rc_track_left_bank_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15086, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15094, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15087, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15095, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15084, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15085, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
}
/** rct2: 0x008A6490 */
static void looping_rc_track_right_bank_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15082, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15083, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15080, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15092, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15081, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15093, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
}
/** rct2: 0x008A64A0 */
static void looping_rc_track_banked_left_quarter_turn_5(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15203, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15214, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15208, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15213, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15198, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15202, 0, 0, 32, 16, 3, height, 0, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15207, 0, 0, 32, 16, 1, height, 0, 0,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15212, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15197, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15201, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15206, 0, 0, 16, 16, 1, height, 16, 16,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15211, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15196, 0, 0, 16, 16, 3, height, 0, 0,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 4:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 5:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15200, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15205, 0, 0, 16, 32, 1, height, 0, 0,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15210, 0, 0, 16, 32, 3, height, 0, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15195, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 6:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15199, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15204, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15209, 0, 0, 20, 32, 3, height, 6, 0,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15215, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15194, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 2:
paint_util_push_tunnel_right(session, height, TUNNEL_0);
break;
case 3:
paint_util_push_tunnel_left(session, height, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A64B0 */
static void looping_rc_track_banked_right_quarter_turn_5(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];
looping_rc_track_banked_left_quarter_turn_5(session, rideIndex, trackSequence, (direction - 1) & 3, height, mapElement);
}
/** rct2: 0x008A64C0 */
static void looping_rc_track_left_bank_to_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15096, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15112, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15097, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15113, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15098, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15099, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 3, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
}
/** rct2: 0x008A64D0 */
static void looping_rc_track_right_bank_to_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15100, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15101, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15102, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15114, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15103, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15115, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 3, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
}
/** rct2: 0x008A64E0 */
static void looping_rc_track_25_deg_up_to_left_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15104, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15116, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15105, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15117, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15106, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15107, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 6, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_12);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 40, 0x20);
}
/** rct2: 0x008A64F0 */
static void looping_rc_track_25_deg_up_to_right_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15108, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15109, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15110, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15118, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15111, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15119, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 6, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_12);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 40, 0x20);
}
/** rct2: 0x008A6500 */
static void looping_rc_track_left_bank_to_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_25_deg_up_to_right_bank(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6510 */
static void looping_rc_track_right_bank_to_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_25_deg_up_to_left_bank(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6520 */
static void looping_rc_track_25_deg_down_to_left_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_right_bank_to_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6530 */
static void looping_rc_track_25_deg_down_to_right_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_left_bank_to_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6540 */
static void looping_rc_track_left_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15088, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15089, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15090, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15091, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
}
/** rct2: 0x008A6550 */
static void looping_rc_track_right_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
looping_rc_track_left_bank(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6560 */
static void looping_rc_track_left_quarter_turn_5_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15296, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15301, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15306, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15311, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15297, 0, 0, 32, 16, 3, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15302, 0, 0, 32, 16, 3, height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15307, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15312, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15298, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15303, 0, 0, 16, 16, 3, height, 16, 16,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15308, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15313, 0, 0, 16, 16, 3, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 64, 0x20);
break;
case 4:
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 5:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15299, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15304, 0, 0, 16, 32, 3, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15309, 0, 0, 16, 32, 3, height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15314, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 6:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15300, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15305, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15310, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15315, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 2:
paint_util_push_tunnel_right(session, height + 8, TUNNEL_2);
break;
case 3:
paint_util_push_tunnel_left(session, height + 8, TUNNEL_2);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
}
}
/** rct2: 0x008A6570 */
static void looping_rc_track_right_quarter_turn_5_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15276, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15281, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15286, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15291, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15277, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15282, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15287, 0, 0, 32, 16, 3, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15292, 0, 0, 32, 16, 3, height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15278, 0, 0, 16, 16, 3, height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15283, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15288, 0, 0, 16, 16, 3, height, 16, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15293, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 64, 0x20);
break;
case 4:
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 5:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15279, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15284, 0, 0, 16, 32, 3, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15289, 0, 0, 16, 32, 3, height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15294, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 6:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15280, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15285, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15290, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15295, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 0:
paint_util_push_tunnel_right(session, height + 8, TUNNEL_2);
break;
case 1:
paint_util_push_tunnel_left(session, height + 8, TUNNEL_2);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
}
}
/** rct2: 0x008A6580 */
static void looping_rc_track_left_quarter_turn_5_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];
looping_rc_track_right_quarter_turn_5_25_deg_up(session, rideIndex, trackSequence, (direction + 1) & 3, height, mapElement);
}
/** rct2: 0x008A6590 */
static void looping_rc_track_right_quarter_turn_5_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];
looping_rc_track_left_quarter_turn_5_25_deg_up(session, rideIndex, trackSequence, (direction - 1) & 3, height, mapElement);
}
/** rct2: 0x008A65A0 */
static void looping_rc_track_s_bend_left(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15260, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15264, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15263, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15267, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15261, 0, 0, 32, 26, 3, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 5, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15265, 0, 0, 32, 26, 3, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 6, 1, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15262, 0, 0, 32, 26, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15266, 0, 0, 32, 26, 3, height, 0, 6,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15262, 0, 0, 32, 26, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15266, 0, 0, 32, 26, 3, height, 0, 6,
height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15261, 0, 0, 32, 26, 3, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 5, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15265, 0, 0, 32, 26, 3, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 6, 1, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15263, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15267, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15260, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15264, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 1:
paint_util_push_tunnel_right(session, height, TUNNEL_0);
break;
case 2:
paint_util_push_tunnel_left(session, height, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A65B0 */
static void looping_rc_track_s_bend_right(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15268, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15272, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15271, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15275, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15269, 0, 0, 32, 26, 3, height, 0, 6,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 8, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15273, 0, 0, 32, 26, 3, height, 0, 6,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 7, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15270, 0, 0, 32, 26, 3, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15274, 0, 0, 32, 26, 3, height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15270, 0, 0, 32, 26, 3, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15274, 0, 0, 32, 26, 3, height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15269, 0, 0, 32, 26, 3, height, 0, 6,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 8, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15273, 0, 0, 32, 26, 3, height, 0, 6,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 7, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15271, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15275, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15268, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15272, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 1:
paint_util_push_tunnel_right(session, height, TUNNEL_0);
break;
case 2:
paint_util_push_tunnel_left(session, height, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A65C0 */
static void looping_rc_track_left_vertical_loop(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15348, 0, 6, 32, 20, 3, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15356, 0, 6, 32, 20, 3, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15355, 0, 6, 32, 20, 3, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15363, 0, 6, 32, 20, 7, height);
break;
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15349, 0, 0, 32, 26, 3, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15357, 0, 14, 32, 2, 63, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15354, 0, 6, 32, 26, 3, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15362, 0, 6, 32, 26, 3, height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15350, 16, 0, 3, 16, 119, height, 16,
0, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK_CENTRED, 1, 0, height - 8,
session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15364, 16, 0, 3, 16, 119, height, 16,
0, height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15358, 12, 0, 3, 16, 119, height, 12,
0, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK_ALT_CENTRED, 0, 0, height - 8,
session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15366, 12, 0, 3, 16, 119, height, 12,
0, height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15353, 10, 16, 4, 16, 119, height, 10,
16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK, 2, 0, height - 8, session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15365, 10, 16, 4, 16, 119, height, 10,
16, height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15361, 16, 16, 2, 16, 119, height, 16,
16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK_ALT, 3, 0, height - 8,
session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15367, 16, 16, 2, 16, 119, height, 16,
16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 168, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15351, 0, 0, 32, 16, 3, height + 32);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15359, 0, 0, 32, 16, 3, height + 32);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15352, 0, 16, 32, 16, 3, height + 32);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15360, 0, 16, 32, 16, 3, height + 32);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 4:
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 5:
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 6:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15352, 0, 16, 32, 16, 3, height + 32);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15360, 0, 16, 32, 16, 3, height + 32);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15351, 0, 0, 32, 16, 3, height + 32);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15359, 0, 0, 32, 16, 3, height + 32);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 7:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15353, 10, 16, 4, 16, 119, height, 10,
16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK, 2, 0, height - 8, session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15365, 10, 16, 4, 16, 119, height, 10,
16, height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15361, 16, 16, 2, 16, 119, height, 16,
16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK_ALT, 3, 0, height - 8,
session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15367, 16, 16, 2, 16, 119, height, 16,
16, height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15350, 16, 0, 3, 16, 119, height, 16,
0, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK_CENTRED, 1, 0, height - 8,
session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15364, 16, 0, 3, 16, 119, height, 16,
0, height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15358, 12, 0, 3, 16, 119, height, 12,
0, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK_ALT_CENTRED, 0, 0, height - 8,
session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15366, 12, 0, 3, 16, 119, height, 12,
0, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 168, 0x20);
break;
case 8:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15354, 0, 6, 32, 26, 3, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15362, 0, 6, 32, 26, 3, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15349, 0, 0, 32, 26, 3, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15357, 0, 14, 32, 2, 63, height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 9:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15355, 0, 6, 32, 20, 3, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15363, 0, 6, 32, 20, 7, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15348, 0, 6, 32, 20, 3, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15356, 0, 6, 32, 20, 3, height);
break;
}
switch (direction)
{
case 1:
paint_util_push_tunnel_right(session, height - 8, TUNNEL_1);
break;
case 2:
paint_util_push_tunnel_left(session, height - 8, TUNNEL_1);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
}
}
/** rct2: 0x008A65D0 */
static void looping_rc_track_right_vertical_loop(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15383, 0, 6, 32, 20, 7, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15375, 0, 6, 32, 20, 3, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15376, 0, 6, 32, 20, 3, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15368, 0, 6, 32, 20, 3, height);
break;
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15382, 0, 6, 32, 26, 3, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15374, 0, 6, 32, 26, 3, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15377, 0, 14, 32, 2, 63, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15369, 0, 0, 32, 26, 3, height);
break;
}
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15381, 16, 16, 2, 16, 119, height, 16,
16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK, 3, 0, height - 8, session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15384, 16, 16, 2, 16, 119, height, 16,
16, height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15373, 10, 16, 4, 16, 119, height, 10,
16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK_ALT, 1, 0, height - 8,
session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15386, 10, 16, 4, 16, 119, height, 10,
16, height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15378, 12, 0, 3, 16, 119, height, 12,
0, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK_CENTRED, 0, 0, height - 8,
session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15385, 12, 0, 3, 16, 119, height, 12,
0, height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15370, 16, 0, 2, 16, 119, height, 16,
0, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK_ALT_CENTRED, 2, 0, height - 8,
session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15387, 16, 0, 2, 16, 119, height, 16,
0, height);
break;
}
paint_util_set_general_support_height(session, height + 168, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15380, 0, 16, 32, 16, 3, height + 32);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15372, 0, 16, 32, 16, 3, height + 32);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15379, 0, 0, 32, 16, 3, height + 32);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15371, 0, 0, 32, 16, 3, height + 32);
break;
}
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 4:
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 5:
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 6:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15379, 0, 0, 32, 16, 3, height + 32);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15371, 0, 0, 32, 16, 3, height + 32);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15380, 0, 16, 32, 16, 3, height + 32);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15372, 0, 16, 32, 16, 3, height + 32);
break;
}
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 7:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15378, 12, 0, 3, 16, 119, height, 12,
0, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK_CENTRED, 0, 0, height - 8,
session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15385, 12, 0, 3, 16, 119, height, 12,
0, height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15370, 16, 0, 2, 16, 119, height, 16,
0, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK_ALT_CENTRED, 2, 0, height - 8,
session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15387, 16, 0, 2, 16, 119, height, 16,
0, height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15381, 16, 16, 2, 16, 119, height, 16,
16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK, 3, 0, height - 8, session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15384, 16, 16, 2, 16, 119, height, 16,
16, height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15373, 10, 16, 4, 16, 119, height, 10,
16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_THICK_ALT, 1, 0, height - 8,
session->TrackColours[SCHEME_TRACK]);
sub_98199C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15386, 10, 16, 4, 16, 119, height, 10,
16, height);
break;
}
paint_util_set_general_support_height(session, height + 168, 0x20);
break;
case 8:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15377, 0, 14, 32, 2, 63, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15369, 0, 0, 32, 26, 3, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15382, 0, 6, 32, 26, 3, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15374, 0, 6, 32, 26, 3, height);
break;
}
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 9:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15376, 0, 6, 32, 20, 3, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15368, 0, 6, 32, 20, 3, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15383, 0, 6, 32, 20, 7, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15375, 0, 6, 32, 20, 3, height);
break;
}
switch (direction)
{
case 1:
paint_util_push_tunnel_right(session, height - 8, TUNNEL_1);
break;
case 2:
paint_util_push_tunnel_left(session, height - 8, TUNNEL_1);
break;
}
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
}
track_paint_util_right_vertical_loop_segments(session, direction, trackSequence);
}
/** rct2: 0x008A6630 */
static void looping_rc_track_left_quarter_turn_3(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15125, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15128, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15131, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15122, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15124, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15127, 0, 0, 16, 16, 3, height, 0, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15130, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15121, 0, 0, 16, 16, 3, height, 16, 16,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15123, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15126, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15129, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15120, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 2:
paint_util_push_tunnel_right(session, height, TUNNEL_0);
break;
case 3:
paint_util_push_tunnel_left(session, height, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A6640 */
static void looping_rc_track_right_quarter_turn_3(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];
looping_rc_track_left_quarter_turn_3(session, rideIndex, trackSequence, (direction - 1) & 3, height, mapElement);
}
/** rct2: 0x008A6650 */
static void looping_rc_track_left_quarter_turn_3_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15137, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15144, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15140, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15143, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15134, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15136, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15139, 0, 0, 16, 16, 1, height, 0, 0,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15142, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15133, 0, 0, 16, 16, 3, height, 16, 16,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15135, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15138, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15141, 0, 0, 20, 32, 3, height, 6, 0,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15145, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15132, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 2:
paint_util_push_tunnel_right(session, height, TUNNEL_0);
break;
case 3:
paint_util_push_tunnel_left(session, height, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A6660 */
static void looping_rc_track_right_quarter_turn_3_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];
looping_rc_track_left_quarter_turn_3_bank(session, rideIndex, trackSequence, (direction - 1) & 3, height, mapElement);
}
/** rct2: 0x008A6670 */
static void looping_rc_track_left_quarter_turn_3_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15327, 0, 6, 32, 20, 3, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15329, 0, 6, 32, 20, 3, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15331, 0, 6, 32, 20, 3, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15325, 0, 6, 32, 20, 3, height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 2:
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15326, 6, 0, 20, 32, 3, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15328, 6, 0, 20, 32, 3, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15330, 6, 0, 20, 32, 3, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15324, 6, 0, 20, 32, 3, height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 2:
paint_util_push_tunnel_right(session, height + 8, TUNNEL_2);
break;
case 3:
paint_util_push_tunnel_left(session, height + 8, TUNNEL_2);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
}
}
/** rct2: 0x008A6680 */
static void looping_rc_track_right_quarter_turn_3_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15316, 0, 6, 32, 20, 3, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15318, 0, 6, 32, 20, 3, height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15320, 0, 6, 32, 20, 3, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15322, 0, 6, 32, 20, 3, height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 2:
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15317, 6, 0, 20, 32, 3, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15319, 6, 0, 20, 32, 3, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15321, 6, 0, 20, 32, 3, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 10, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15323, 6, 0, 20, 32, 3, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
switch (direction)
{
case 0:
paint_util_push_tunnel_right(session, height + 8, TUNNEL_2);
break;
case 1:
paint_util_push_tunnel_left(session, height + 8, TUNNEL_2);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
}
}
/** rct2: 0x008A6690 */
static void looping_rc_track_left_quarter_turn_3_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];
looping_rc_track_right_quarter_turn_3_25_deg_up(session, rideIndex, trackSequence, (direction + 1) & 3, height, mapElement);
}
/** rct2: 0x008A66A0 */
static void looping_rc_track_right_quarter_turn_3_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];
looping_rc_track_left_quarter_turn_3_25_deg_up(session, rideIndex, trackSequence, (direction - 1) & 3, height, mapElement);
}
/** rct2: 0x008A66B0 */
static void looping_rc_track_left_half_banked_helix_up_small(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15165, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15172, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15168, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15171, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15162, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 2, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15164, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15167, 0, 0, 16, 16, 1, height, 0, 0,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15170, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15161, 0, 0, 16, 16, 3, height, 16, 16,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15163, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15166, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15169, 0, 0, 20, 32, 3, height, 6, 0,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15173, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15160, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 6, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 2:
paint_util_push_tunnel_right(session, height + 8, TUNNEL_0);
break;
case 3:
paint_util_push_tunnel_left(session, height + 8, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 4:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15162, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15165, 0, 0, 20, 32, 3, height, 6, 0,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15172, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15168, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15171, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 2, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 0:
paint_util_push_tunnel_right(session, height, TUNNEL_0);
break;
case 1:
paint_util_push_tunnel_left(session, height, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 5:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 6:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15161, 0, 0, 16, 16, 3, height, 16, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15164, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15167, 0, 0, 16, 16, 1, height, 0, 0,
height + 27);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15170, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 7:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15160, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15163, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15166, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15169, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15173, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 6, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A66C0 */
static void looping_rc_track_right_half_banked_helix_up_small(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15146, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15149, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15152, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15155, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15159, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 2, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15147, 0, 0, 16, 16, 3, height, 16, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15150, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15153, 0, 0, 16, 16, 1, height, 0, 0,
height + 27);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15156, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15148, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15151, 0, 0, 20, 32, 3, height, 6, 0,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15158, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15154, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15157, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 6, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 0:
paint_util_push_tunnel_right(session, height + 8, TUNNEL_0);
break;
case 1:
paint_util_push_tunnel_left(session, height + 8, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 4:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15149, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15152, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15155, 0, 0, 20, 32, 3, height, 6, 0,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15159, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15146, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 2, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 2:
paint_util_push_tunnel_right(session, height, TUNNEL_0);
break;
case 3:
paint_util_push_tunnel_left(session, height, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 5:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 6:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15150, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15153, 0, 0, 16, 16, 1, height, 0, 0,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15156, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15147, 0, 0, 16, 16, 3, height, 16, 16,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 7:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15151, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15158, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15154, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15157, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15148, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 6, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A66D0 */
static void looping_rc_track_left_half_banked_helix_down_small(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
if (trackSequence >= 4)
{
trackSequence -= 4;
direction = (direction - 1) & 3;
}
trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];
looping_rc_track_right_half_banked_helix_up_small(session, rideIndex, trackSequence, (direction + 1) & 3, height,
mapElement);
}
/** rct2: 0x008A66E0 */
static void looping_rc_track_right_half_banked_helix_down_small(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
if (trackSequence >= 4)
{
trackSequence -= 4;
direction = (direction + 1) & 3;
}
trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];
looping_rc_track_left_half_banked_helix_up_small(session, rideIndex, trackSequence, (direction - 1) & 3, height,
mapElement);
}
/** rct2: 0x008A66F0 */
static void looping_rc_track_left_half_banked_helix_up_large(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15247, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15258, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15252, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15257, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15242, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 1, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15246, 0, 0, 32, 16, 3, height, 0, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15251, 0, 0, 32, 16, 1, height, 0, 0,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15256, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15241, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15245, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15250, 0, 0, 16, 16, 1, height, 16, 16,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15255, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15240, 0, 0, 16, 16, 3, height, 0, 0,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 4:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 5:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15244, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15249, 0, 0, 16, 32, 1, height, 0, 0,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15254, 0, 0, 16, 32, 3, height, 0, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15239, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 6:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15243, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15248, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15253, 0, 0, 20, 32, 3, height, 6, 0,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15259, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15238, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 7, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 2:
paint_util_push_tunnel_right(session, height + 8, TUNNEL_0);
break;
case 3:
paint_util_push_tunnel_left(session, height + 8, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 7:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15242, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15247, 0, 0, 20, 32, 3, height, 6, 0,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15258, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15252, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15257, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 1, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 0:
paint_util_push_tunnel_right(session, height, TUNNEL_0);
break;
case 1:
paint_util_push_tunnel_left(session, height, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 8:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 9:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15241, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15246, 0, 0, 16, 32, 3, height, 0, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15251, 0, 0, 16, 32, 1, height, 0, 0,
height + 27);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15256, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 10:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15240, 0, 0, 16, 16, 3, height, 0, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15245, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15250, 0, 0, 16, 16, 1, height, 16, 16,
height + 27);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15255, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 11:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 12:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15239, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15244, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15249, 0, 0, 32, 16, 1, height, 0, 0,
height + 27);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15254, 0, 0, 32, 16, 3, height, 0, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 13:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15238, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15243, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15248, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15253, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15259, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 7, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A6700 */
static void looping_rc_track_right_half_banked_helix_up_large(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15216, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15221, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15226, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15231, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15237, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 1, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15217, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15222, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15227, 0, 0, 32, 16, 1, height, 0, 0,
height + 27);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15232, 0, 0, 32, 16, 3, height, 0, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15218, 0, 0, 16, 16, 3, height, 0, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15223, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15228, 0, 0, 16, 16, 1, height, 16, 16,
height + 27);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15233, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 4:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 5:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15219, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15224, 0, 0, 16, 32, 3, height, 0, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15229, 0, 0, 16, 32, 1, height, 0, 0,
height + 27);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15234, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 6:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15220, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15225, 0, 0, 20, 32, 3, height, 6, 0,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15236, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15230, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15235, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 7, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 0:
paint_util_push_tunnel_right(session, height + 8, TUNNEL_0);
break;
case 1:
paint_util_push_tunnel_left(session, height + 8, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 7:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15221, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15226, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15231, 0, 0, 20, 32, 3, height, 6, 0,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15237, 0, 0, 1, 32, 26, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15216, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 1, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 2:
paint_util_push_tunnel_right(session, height, TUNNEL_0);
break;
case 3:
paint_util_push_tunnel_left(session, height, TUNNEL_0);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 8:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 9:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15222, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15227, 0, 0, 16, 32, 1, height, 0, 0,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15232, 0, 0, 16, 32, 3, height, 0, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15217, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 10:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15223, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15228, 0, 0, 16, 16, 1, height, 16, 16,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15233, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15218, 0, 0, 16, 16, 3, height, 0, 0,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 11:
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 12:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15224, 0, 0, 32, 16, 3, height, 0, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15229, 0, 0, 32, 16, 1, height, 0, 0,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15234, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15219, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 13:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15225, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15236, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15230, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15235, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15220, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 7, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A6710 */
static void looping_rc_track_left_half_banked_helix_down_large(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
if (trackSequence >= 7)
{
trackSequence -= 7;
direction = (direction - 1) & 3;
}
trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];
looping_rc_track_right_half_banked_helix_up_large(session, rideIndex, trackSequence, (direction + 1) & 3, height,
mapElement);
}
/** rct2: 0x008A6720 */
static void looping_rc_track_right_half_banked_helix_down_large(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
if (trackSequence >= 7)
{
trackSequence -= 7;
direction = (direction + 1) & 3;
}
trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];
looping_rc_track_left_half_banked_helix_up_large(session, rideIndex, trackSequence, (direction - 1) & 3, height,
mapElement);
}
/** rct2: 0x008A6750 */
static void looping_rc_track_left_quarter_turn_1_60_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15341, 0, 0, 28, 28, 3, height, 2, 2,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15345, 0, 0, 28, 28, 1, height, 2, 2,
height + 99);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15342, 0, 0, 28, 28, 3, height, 2, 2,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15346, 0, 0, 28, 28, 1, height, 2, 2,
height + 99);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15343, 0, 0, 28, 28, 3, height, 2, 2,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15347, 0, 0, 28, 28, 1, height, 2, 2,
height + 99);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15340, 0, 0, 28, 28, 3, height, 2, 2,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15344, 0, 0, 28, 28, 1, height, 2, 2,
height + 99);
break;
}
track_paint_util_left_quarter_turn_1_tile_tunnel(session, direction, height, -8, TUNNEL_1, +56, TUNNEL_2);
paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 104, 0x20);
}
/** rct2: 0x008A6730 */
static void looping_rc_track_right_quarter_turn_1_60_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15332, 0, 0, 28, 28, 3, height, 2, 2,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15336, 0, 0, 28, 28, 1, height, 2, 2,
height + 99);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15333, 0, 0, 28, 28, 3, height, 2, 2,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15337, 0, 0, 28, 28, 1, height, 2, 2,
height + 99);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15334, 0, 0, 28, 28, 3, height, 2, 2,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15338, 0, 0, 2, 28, 59, height, 28, 2,
height + 2);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15335, 0, 0, 28, 28, 3, height, 2, 2,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15339, 0, 0, 28, 28, 1, height, 2, 2,
height + 99);
break;
}
track_paint_util_right_quarter_turn_1_tile_tunnel(session, direction, height, -8, TUNNEL_1, +56, TUNNEL_2);
paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 104, 0x20);
}
/** rct2: 0x008A6740 */
static void looping_rc_track_left_quarter_turn_1_60_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_right_quarter_turn_1_60_deg_up(session, rideIndex, trackSequence, (direction + 1) & 3, height, mapElement);
}
/** rct2: 0x008A6760 */
static void looping_rc_track_right_quarter_turn_1_60_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_left_quarter_turn_1_60_deg_up(session, rideIndex, trackSequence, (direction - 1) & 3, height, mapElement);
}
/** rct2: 0x008A6770 */
static void looping_rc_track_brakes(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15012, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15014, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 1:
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15013, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15015, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
}
/** rct2: 0x008A6A40 */
static void looping_rc_track_25_deg_up_left_banked(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15594, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15595, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15596, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15597, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
}
/** rct2: 0x008A6A50 */
static void looping_rc_track_25_deg_up_right_banked(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15598, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15599, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15600, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15601, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
}
/** rct2: 0x008A6780 */
static void looping_rc_track_on_ride_photo(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_MISC] | SPR_STATION_BASE_D, 0, 0, 32, 32, 1,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 5, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 8, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15004, 0, 0, 32, 20, 0, height, 0, 6,
height + 3);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_MISC] | SPR_STATION_BASE_D, 0, 0, 32, 32, 1,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 6, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 7, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15005, 0, 0, 32, 20, 0, height, 0, 6,
height + 3);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_MISC] | SPR_STATION_BASE_D, 0, 0, 32, 32, 1,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 5, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 8, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15004, 0, 0, 32, 20, 0, height, 0, 6,
height + 3);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_MISC] | SPR_STATION_BASE_D, 0, 0, 32, 32, 1,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 6, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 7, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15005, 0, 0, 32, 20, 0, height, 0, 6,
height + 3);
break;
}
track_paint_util_onride_photo_paint(session, direction, height + 3, mapElement);
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
}
/** rct2: 0x008A6A60 */
static void looping_rc_track_25_deg_down_left_banked(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_25_deg_up_right_banked(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6A70 */
static void looping_rc_track_25_deg_down_right_banked(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_25_deg_up_left_banked(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6860 */
static void looping_rc_track_left_eighth_to_diag(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15526, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15530, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15534, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15538, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15527, 0, 0, 32, 16, 3, height, 0, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15531, 0, 0, 34, 16, 3, height, 0, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15535, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15539, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15528, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15532, 0, 0, 16, 16, 3, height, 16, 16,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15536, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15540, 0, 0, 16, 16, 3, height, 0, 0,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 4:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15529, 0, 0, 16, 16, 3, height, 16, 16,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15533, 0, 0, 16, 18, 3, height, 0, 16,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15537, 0, 0, 16, 16, 3, height, 0, 0,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15541, 0, 0, 16, 16, 3, height, 16, 0,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A6870 */
static void looping_rc_track_right_eighth_to_diag(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15510, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15514, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15518, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15522, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15511, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15515, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15519, 0, 0, 34, 16, 3, height, 0, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15523, 0, 0, 32, 16, 3, height, 0, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15512, 0, 0, 16, 16, 3, height, 0, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15516, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15520, 0, 0, 28, 28, 3, height, 4, 4,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15524, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 4:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15513, 0, 0, 16, 16, 3, height, 16, 0,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15517, 0, 0, 16, 16, 3, height, 0, 0,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15521, 0, 0, 16, 18, 3, height, 0, 16,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15525, 0, 0, 16, 16, 3, height, 16, 16,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A6880 */
static void looping_rc_track_left_eighth_to_orthogonal(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
trackSequence = mapLeftEighthTurnToOrthogonal[trackSequence];
looping_rc_track_right_eighth_to_diag(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6890 */
static void looping_rc_track_right_eighth_to_orthogonal(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
trackSequence = mapLeftEighthTurnToOrthogonal[trackSequence];
looping_rc_track_left_eighth_to_diag(session, rideIndex, trackSequence, (direction + 3) & 3, height, mapElement);
}
/** rct2: 0x008A68A0 */
static void looping_rc_track_left_eighth_bank_to_diag(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15558, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15562, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15566, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15570, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15559, 0, 0, 32, 16, 3, height, 0, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15563, 0, 0, 34, 16, 0, height, 0, 0,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15567, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15571, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15560, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15564, 0, 0, 16, 16, 0, height, 16, 16,
height + 27);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15568, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15572, 0, 0, 16, 16, 3, height, 0, 0,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 4:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15561, 0, 0, 16, 16, 3, height, 16, 16,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15565, 0, 0, 16, 18, 0, height, 0, 16,
height + 27);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15569, 0, 0, 16, 16, 3, height, 0, 0,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15573, 0, 0, 16, 16, 3, height, 16, 0,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A68B0 */
static void looping_rc_track_right_eighth_bank_to_diag(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15542, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15546, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15550, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15554, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15543, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15547, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15551, 0, 0, 34, 16, 0, height, 0, 0,
height + 27);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15555, 0, 0, 32, 16, 3, height, 0, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15544, 0, 0, 16, 16, 3, height, 0, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15548, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15552, 0, 0, 28, 28, 0, height, 4, 4,
height + 27);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15556, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 4:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15545, 0, 0, 16, 16, 3, height, 16, 0,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15549, 0, 0, 16, 16, 3, height, 0, 0,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15553, 0, 0, 16, 18, 0, height, 0, 16,
height + 27);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15557, 0, 0, 16, 16, 3, height, 16, 16,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A68C0 */
static void looping_rc_track_left_eighth_bank_to_orthogonal(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
trackSequence = mapLeftEighthTurnToOrthogonal[trackSequence];
looping_rc_track_right_eighth_bank_to_diag(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A68D0 */
static void looping_rc_track_right_eighth_bank_to_orthogonal(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
trackSequence = mapLeftEighthTurnToOrthogonal[trackSequence];
looping_rc_track_left_eighth_bank_to_diag(session, rideIndex, trackSequence, (direction + 3) & 3, height, mapElement);
}
/** rct2: 0x008A6790 */
static void looping_rc_track_diag_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15451, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15423, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15448, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15420, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15450, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15422, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15449, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15421, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A67C0 */
static void looping_rc_track_diag_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15463, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15435, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15460, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15432, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15462, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15434, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15461, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15433, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
}
}
/** rct2: 0x008A67F0 */
static void looping_rc_track_diag_60_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15475, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15447, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 104, 0x20);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15472, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15444, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 104, 0x20);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15474, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15446, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 104, 0x20);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 36, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15473, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 36, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 36, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 36, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 36, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15445, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 36, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 36, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 36, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 104, 0x20);
break;
}
}
/** rct2: 0x008A67A0 */
static void looping_rc_track_diag_flat_to_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15455, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15427, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15452, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15424, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15454, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15426, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15453, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15425, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
}
}
/** rct2: 0x008A67D0 */
static void looping_rc_track_diag_25_deg_up_to_60_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15467, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15439, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15464, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15436, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15466, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15438, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 16, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15465, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 16, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 16, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 16, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 16, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15437, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 16, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 16, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 16, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
}
}
/** rct2: 0x008A67E0 */
static void looping_rc_track_diag_60_deg_up_to_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15471, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15443, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15468, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15440, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15470, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15442, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 21, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15469, -16, -16, 16, 16, 3, height,
0, 0, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 21, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 21, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 21, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 21, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15441, -16, -16, 16, 16, 3, height,
0, 0, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 21, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 21, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 21, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
}
}
/** rct2: 0x008A67B0 */
static void looping_rc_track_diag_25_deg_up_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15459, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15431, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15456, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15428, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15458, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15430, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15457, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15429, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
}
}
/** rct2: 0x008A6820 */
static void looping_rc_track_diag_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15461, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15433, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15462, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15434, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15460, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15432, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15463, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15435, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
}
}
/** rct2: 0x008A6850 */
static void looping_rc_track_diag_60_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15473, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15445, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 104, 0x20);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15474, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15446, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 104, 0x20);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15472, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15444, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 104, 0x20);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 28, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15475, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 28, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 28, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 28, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 28, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15447, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 28, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 28, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 28, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 104, 0x20);
break;
}
}
/** rct2: 0x008A6800 */
static void looping_rc_track_diag_flat_to_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15457, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15429, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15458, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15430, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15456, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15428, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15459, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15431, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 4, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
break;
}
paint_util_set_general_support_height(session, height + 56, 0x20);
}
/** rct2: 0x008A6830 */
static void looping_rc_track_diag_25_deg_down_to_60_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15469, -16, -16, 16, 16, 3, height,
0, 0, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15441, -16, -16, 16, 16, 3, height,
0, 0, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15470, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15442, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15468, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15440, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 17, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15471, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 17, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 17, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 17, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 17, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15443, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 17, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 17, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 17, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
}
}
/** rct2: 0x008A6840 */
static void looping_rc_track_diag_60_deg_down_to_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15465, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15437, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15466, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15438, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15464, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15436, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15467, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15439, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 8, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
}
}
/** rct2: 0x008A6810 */
static void looping_rc_track_diag_25_deg_down_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15453, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15425, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 1:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15454, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15426, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 2:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15452, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
else
{
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15424, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 3:
if (track_element_is_lift_hill(mapElement))
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15455, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
else
{
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15427, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height,
session->TrackColours[SCHEME_SUPPORTS]);
break;
}
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
}
}
/** rct2: 0x008A6900 */
static void looping_rc_track_diag_flat_to_left_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15503, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15500, -16, -16, 32, 32, 3, height,
-16, -16, height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15504, -16, -16, 32, 32, 0, height,
-16, -16, height + 27);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15502, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15501, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A6910 */
static void looping_rc_track_diag_flat_to_right_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15508, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15505, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15507, -16, -16, 32, 32, 3, height,
-16, -16, height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15509, -16, -16, 32, 32, 0, height,
-16, -16, height + 27);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15506, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A6920 */
static void looping_rc_track_diag_left_bank_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15506, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15507, -16, -16, 32, 32, 3, height,
-16, -16, height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15509, -16, -16, 32, 32, 0, height,
-16, -16, height + 27);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15505, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15508, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A6930 */
static void looping_rc_track_diag_right_bank_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15501, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15502, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15500, -16, -16, 32, 32, 3, height,
-16, -16, height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15504, -16, -16, 32, 32, 0, height,
-16, -16, height + 27);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15503, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A6960 */
static void looping_rc_track_diag_left_bank_to_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15493, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15490, -16, -16, 32, 32, 3, height,
-16, -16, height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15494, -16, -16, 32, 32, 0, height,
-16, -16, height + 35);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15492, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 3:
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15491, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
}
}
/** rct2: 0x008A6970 */
static void looping_rc_track_diag_right_bank_to_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15498, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15495, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15497, -16, -16, 32, 32, 3, height,
-16, -16, height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15499, -16, -16, 32, 32, 0, height,
-16, -16, height + 35);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 3:
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15496, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
}
}
/** rct2: 0x008A6940 */
static void looping_rc_track_diag_25_deg_up_to_left_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15483, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15480, -16, -16, 32, 32, 3, height,
-16, -16, height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15484, -16, -16, 32, 32, 0, height,
-16, -16, height + 35);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15482, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 3:
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15481, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
}
}
/** rct2: 0x008A6950 */
static void looping_rc_track_diag_25_deg_up_to_right_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15488, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15485, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15487, -16, -16, 32, 32, 3, height,
-16, -16, height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15489, -16, -16, 32, 32, 0, height,
-16, -16, height + 35);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 3:
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15486, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
}
}
/** rct2: 0x008A6980 */
static void looping_rc_track_diag_left_bank_to_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15486, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15487, -16, -16, 32, 32, 3, height,
-16, -16, height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15489, -16, -16, 32, 32, 0, height,
-16, -16, height + 35);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15485, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
break;
case 3:
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15488, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
break;
}
paint_util_set_general_support_height(session, height + 56, 0x20);
}
/** rct2: 0x008A6990 */
static void looping_rc_track_diag_right_bank_to_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15481, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15482, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15480, -16, -16, 32, 32, 3, height,
-16, -16, height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15484, -16, -16, 32, 32, 0, height,
-16, -16, height + 35);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
break;
case 3:
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15483, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 4, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
break;
}
paint_util_set_general_support_height(session, height + 56, 0x20);
}
/** rct2: 0x008A69A0 */
static void looping_rc_track_diag_25_deg_down_to_left_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15496, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15497, -16, -16, 32, 32, 3, height,
-16, -16, height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15499, -16, -16, 32, 32, 0, height,
-16, -16, height + 35);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15495, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 3:
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15498, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
}
}
/** rct2: 0x008A69B0 */
static void looping_rc_track_diag_25_deg_down_to_right_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15491, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15492, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15490, -16, -16, 32, 32, 3, height,
-16, -16, height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15494, -16, -16, 32, 32, 0, height,
-16, -16, height + 35);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
case 3:
switch (direction)
{
case 0:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15493, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_b_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
break;
}
}
/** rct2: 0x008A68E0 */
static void looping_rc_track_diag_left_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15479, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15476, -16, -16, 32, 32, 0, height,
-16, -16, height + 27);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15478, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15477, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A68F0 */
static void looping_rc_track_diag_right_bank(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15477, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 1:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15478, -16, -16, 32, 32, 3, height,
-16, -16, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 2:
switch (direction)
{
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15476, -16, -16, 32, 32, 0, height,
-16, -16, height + 27);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
case 3:
switch (direction)
{
case 0:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 1, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15479, -16, -16, 32, 32, 3, height,
-16, -16, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 0, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 2, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 3, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
break;
}
}
/** rct2: 0x008A6C00 */
static void looping_rc_track_block_brakes(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15012, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15014, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
case 1:
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15013, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15015, 0, 0, 32, 1, 26, height, 0, 27,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
}
/** rct2: 0x008A6BC0 */
static void looping_rc_track_left_banked_quarter_turn_3_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15689, 0, 6, 32, 20, 3, height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15691, 0, 6, 32, 1, 34, height, 0, 27,
height);
break;
case 2:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15693, 0, 6, 32, 20, 3, height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15687, 0, 6, 32, 20, 3, height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 2:
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15688, 6, 0, 20, 32, 3, height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15690, 6, 0, 1, 32, 34, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15692, 6, 0, 1, 32, 34, height, 27, 0,
height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15686, 6, 0, 20, 32, 3, height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 2:
paint_util_push_tunnel_right(session, height + 8, TUNNEL_2);
break;
case 3:
paint_util_push_tunnel_left(session, height + 8, TUNNEL_2);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
}
}
/** rct2: 0x008A6BD0 */
static void looping_rc_track_right_banked_quarter_turn_3_25_deg_up(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15678, 0, 6, 32, 20, 3, height);
break;
case 1:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15680, 0, 6, 32, 20, 3, height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15682, 0, 6, 32, 1, 34, height, 0, 27,
height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15684, 0, 6, 32, 20, 3, height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 2:
paint_util_set_general_support_height(session, height + 56, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15679, 6, 0, 20, 32, 3, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15681, 6, 0, 1, 32, 34, height, 27, 0,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15683, 6, 0, 1, 32, 34, height, 27, 0,
height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 10, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15685, 6, 0, 20, 32, 3, height);
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
break;
}
switch (direction)
{
case 0:
paint_util_push_tunnel_right(session, height + 8, TUNNEL_2);
break;
case 1:
paint_util_push_tunnel_left(session, height + 8, TUNNEL_2);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
}
}
/** rct2: 0x008A6BE0 */
static void looping_rc_track_left_banked_quarter_turn_3_25_deg_down(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];
looping_rc_track_right_banked_quarter_turn_3_25_deg_up(session, rideIndex, trackSequence, (direction + 1) & 3, height,
mapElement);
}
/** rct2: 0x008A6BF0 */
static void looping_rc_track_right_banked_quarter_turn_3_25_deg_down(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];
looping_rc_track_left_banked_quarter_turn_3_25_deg_up(session, rideIndex, trackSequence, (direction - 1) & 3, height,
mapElement);
}
/** rct2: 0x008A6B80 */
static void looping_rc_track_left_banked_quarter_turn_5_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15658, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15663, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15668, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15673, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15659, 0, 0, 32, 16, 3, height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15664, 0, 0, 1, 1, 34, height, 30, 30,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15669, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15674, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15660, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15665, 0, 0, 1, 1, 34, height, 30, 30,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15670, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15675, 0, 0, 16, 16, 3, height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 64, 0x20);
break;
case 4:
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 5:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15661, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15666, 0, 0, 1, 1, 34, height, 30, 30,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15671, 0, 0, 1, 32, 34, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15676, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 6:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15662, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15667, 0, 0, 1, 32, 34, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15672, 0, 0, 1, 32, 34, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15677, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 2:
paint_util_push_tunnel_right(session, height + 8, TUNNEL_2);
break;
case 3:
paint_util_push_tunnel_left(session, height + 8, TUNNEL_2);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
}
}
/** rct2: 0x008A6B90 */
static void looping_rc_track_right_banked_quarter_turn_5_25_deg_up(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
switch (trackSequence)
{
case 0:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15638, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15643, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15648, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15653, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 1:
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 2:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15639, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15644, 0, 0, 32, 16, 3, height, 0, 16,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15649, 0, 0, 1, 1, 34, height, 30, 30,
height);
break;
case 3:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15654, 0, 0, 32, 16, 3, height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 3:
switch (direction)
{
case 0:
sub_98196C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15640, 0, 0, 16, 16, 3, height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15645, 0, 0, 16, 16, 3, height, 16, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15650, 0, 0, 1, 1, 34, height, 30, 30,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15655, 0, 0, 16, 16, 3, height, 0, 16,
height);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 64, 0x20);
break;
case 4:
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 5:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15641, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15646, 0, 0, 1, 32, 34, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15651, 0, 0, 1, 1, 34, height, 30, 30,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15656, 0, 0, 16, 32, 3, height, 16, 0,
height);
break;
}
paint_util_set_segment_support_height(
session,
paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D0 | SEGMENT_D4, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
case 6:
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15642, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15647, 0, 0, 1, 32, 34, height, 27, 0,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15652, 0, 0, 1, 32, 34, height, 27, 0,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15657, 0, 0, 20, 32, 3, height, 6, 0,
height);
break;
}
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
switch (direction)
{
case 0:
paint_util_push_tunnel_right(session, height + 8, TUNNEL_2);
break;
case 1:
paint_util_push_tunnel_left(session, height + 8, TUNNEL_2);
break;
}
paint_util_set_segment_support_height(
session, paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_D4, direction), 0xFFFF, 0);
paint_util_set_general_support_height(session, height + 72, 0x20);
break;
}
}
/** rct2: 0x008A6BA0 */
static void looping_rc_track_left_banked_quarter_turn_5_25_deg_down(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];
looping_rc_track_right_banked_quarter_turn_5_25_deg_up(session, rideIndex, trackSequence, (direction + 1) & 3, height,
mapElement);
}
/** rct2: 0x008A6BB0 */
static void looping_rc_track_right_banked_quarter_turn_5_25_deg_down(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];
looping_rc_track_left_banked_quarter_turn_5_25_deg_up(session, rideIndex, trackSequence, (direction - 1) & 3, height,
mapElement);
}
/** rct2: 0x008A6A80 */
static void looping_rc_track_25_deg_up_to_left_banked_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15602, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15603, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15610, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15604, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15605, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
}
/** rct2: 0x008A6A90 */
static void looping_rc_track_25_deg_up_to_right_banked_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15606, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15607, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15608, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15611, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15609, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
}
/** rct2: 0x008A6AA0 */
static void looping_rc_track_left_banked_25_deg_up_to_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15612, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15613, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15620, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15614, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15615, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
}
/** rct2: 0x008A6AB0 */
static void looping_rc_track_right_banked_25_deg_up_to_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15616, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15617, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15618, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15621, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15619, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 8, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_1);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 56, 0x20);
}
/** rct2: 0x008A6AC0 */
static void looping_rc_track_25_deg_down_to_left_banked_25_deg_down(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
looping_rc_track_right_banked_25_deg_up_to_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height,
mapElement);
}
/** rct2: 0x008A6AD0 */
static void looping_rc_track_25_deg_down_to_right_banked_25_deg_down(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
looping_rc_track_left_banked_25_deg_up_to_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height,
mapElement);
}
/** rct2: 0x008A6AE0 */
static void looping_rc_track_left_banked_25_deg_down_to_25_deg_down(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
looping_rc_track_25_deg_up_to_right_banked_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height,
mapElement);
}
/** rct2: 0x008A6AF0 */
static void looping_rc_track_right_banked_25_deg_down_to_25_deg_down(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
looping_rc_track_25_deg_up_to_left_banked_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height,
mapElement);
}
/** rct2: 0x008A6B00 */
static void looping_rc_track_left_banked_flat_to_left_banked_25_deg_up(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15622, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15623, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15624, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15625, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 3, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
}
/** rct2: 0x008A6B10 */
static void looping_rc_track_right_banked_flat_to_right_banked_25_deg_up(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15626, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15627, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15628, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15629, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 3, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
}
/** rct2: 0x008A6B40 */
static void looping_rc_track_left_banked_25_deg_up_to_left_banked_flat(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15630, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15631, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15632, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15633, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 6, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_12);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 40, 0x20);
}
/** rct2: 0x008A6B50 */
static void looping_rc_track_right_banked_25_deg_up_to_right_banked_flat(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15634, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15635, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15636, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15637, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 6, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_12);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 40, 0x20);
}
/** rct2: 0x008A6B60 */
static void looping_rc_track_left_banked_flat_to_left_banked_25_deg_down(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
looping_rc_track_right_banked_25_deg_up_to_right_banked_flat(session, rideIndex, trackSequence, (direction + 2) & 3, height,
mapElement);
}
/** rct2: 0x008A6B70 */
static void looping_rc_track_right_banked_flat_to_right_banked_25_deg_down(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
looping_rc_track_left_banked_25_deg_up_to_left_banked_flat(session, rideIndex, trackSequence, (direction + 2) & 3, height,
mapElement);
}
/** rct2: 0x008A6B20 */
static void looping_rc_track_left_banked_25_deg_down_to_left_banked_flat(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
looping_rc_track_right_banked_flat_to_right_banked_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height,
mapElement);
}
/** rct2: 0x008A6B30 */
static void looping_rc_track_right_banked_25_deg_down_to_right_banked_flat(paint_session * session, uint8 rideIndex,
uint8 trackSequence, uint8 direction, sint32 height,
rct_map_element * mapElement)
{
looping_rc_track_left_banked_flat_to_left_banked_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height,
mapElement);
}
/** rct2: 0x008A69C0 */
static void looping_rc_track_flat_to_left_banked_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15574, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15575, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15582, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15576, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15577, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 3, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
}
/** rct2: 0x008A69D0 */
static void looping_rc_track_flat_to_right_banked_25_deg_up(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15578, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15579, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15580, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15583, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15581, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 3, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_2);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 48, 0x20);
}
/** rct2: 0x008A69E0 */
static void looping_rc_track_left_banked_25_deg_up_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15584, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15585, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15592, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15586, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15587, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 6, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_12);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 40, 0x20);
}
/** rct2: 0x008A69F0 */
static void looping_rc_track_right_banked_25_deg_up_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
switch (direction)
{
case 0:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15588, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 1:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15589, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15590, 0, 0, 32, 20, 3, height, 0, 6,
height);
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15593, 0, 0, 32, 1, 34, height, 0, 27,
height);
break;
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | 15591, 0, 0, 32, 20, 3, height, 0, 6,
height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 6, height, session->TrackColours[SCHEME_SUPPORTS]);
}
if (direction == 0 || direction == 3)
{
paint_util_push_tunnel_rotated(session, direction, height - 8, TUNNEL_0);
}
else
{
paint_util_push_tunnel_rotated(session, direction, height + 8, TUNNEL_12);
}
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 40, 0x20);
}
/** rct2: 0x008A6A00 */
static void looping_rc_track_flat_to_left_banked_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_right_banked_25_deg_up_to_flat(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6A10 */
static void looping_rc_track_flat_to_right_banked_25_deg_down(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_left_banked_25_deg_up_to_flat(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6A20 */
static void looping_rc_track_left_banked_25_deg_down_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_flat_to_right_banked_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
/** rct2: 0x008A6A30 */
static void looping_rc_track_right_banked_25_deg_down_to_flat(paint_session * session, uint8 rideIndex, uint8 trackSequence,
uint8 direction, sint32 height, rct_map_element * mapElement)
{
looping_rc_track_flat_to_left_banked_25_deg_up(session, rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
}
static void looping_rc_track_booster(paint_session * session, uint8 rideIndex, uint8 trackSequence, uint8 direction,
sint32 height, rct_map_element * mapElement)
{
if (!is_csg_loaded())
{
looping_rc_track_brakes(session, rideIndex, trackSequence, direction, height, mapElement);
return;
}
uint32 sprite_ne_sw = SPR_CSG_BEGIN + 55679;
uint32 sprite_nw_se = SPR_CSG_BEGIN + 55680;
switch (direction)
{
case 0:
case 2:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | sprite_ne_sw, 0, 0, 32, 20, 3, height, 0,
6, height);
break;
case 1:
case 3:
sub_98197C_rotated(session, direction, session->TrackColours[SCHEME_TRACK] | sprite_nw_se, 0, 0, 32, 20, 3, height, 0,
6, height);
break;
}
if (track_paint_util_should_paint_supports(session->MapPosition))
{
metal_a_supports_paint_setup(session, METAL_SUPPORTS_TUBES, 4, 0, height, session->TrackColours[SCHEME_SUPPORTS]);
}
paint_util_push_tunnel_rotated(session, direction, height, TUNNEL_0);
paint_util_set_segment_support_height(session, paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction),
0xFFFF, 0);
paint_util_set_general_support_height(session, height + 32, 0x20);
}
TRACK_PAINT_FUNCTION get_track_paint_function_looping_rc(sint32 trackType, sint32 direction)
{
switch (trackType)
{
case TRACK_ELEM_FLAT:
return looping_rc_track_flat;
case TRACK_ELEM_END_STATION:
case TRACK_ELEM_BEGIN_STATION:
case TRACK_ELEM_MIDDLE_STATION:
return looping_rc_track_station;
case TRACK_ELEM_25_DEG_UP:
return looping_rc_track_25_deg_up;
case TRACK_ELEM_60_DEG_UP:
return looping_rc_track_60_deg_up;
case TRACK_ELEM_FLAT_TO_25_DEG_UP:
return looping_rc_track_flat_to_25_deg_up;
case TRACK_ELEM_25_DEG_UP_TO_60_DEG_UP:
return looping_rc_track_25_deg_up_to_60_deg_up;
case TRACK_ELEM_60_DEG_UP_TO_25_DEG_UP:
return looping_rc_track_60_deg_up_to_25_deg_up;
case TRACK_ELEM_25_DEG_UP_TO_FLAT:
return looping_rc_track_25_deg_up_to_flat;
case TRACK_ELEM_25_DEG_DOWN:
return looping_rc_track_25_deg_down;
case TRACK_ELEM_60_DEG_DOWN:
return looping_rc_track_60_deg_down;
case TRACK_ELEM_FLAT_TO_25_DEG_DOWN:
return looping_rc_track_flat_to_25_deg_down;
case TRACK_ELEM_25_DEG_DOWN_TO_60_DEG_DOWN:
return looping_rc_track_25_deg_down_to_60_deg_down;
case TRACK_ELEM_60_DEG_DOWN_TO_25_DEG_DOWN:
return looping_rc_track_60_deg_down_to_25_deg_down;
case TRACK_ELEM_25_DEG_DOWN_TO_FLAT:
return looping_rc_track_25_deg_down_to_flat;
case TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES:
return looping_rc_track_left_quarter_turn_5;
case TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES:
return looping_rc_track_right_quarter_turn_5;
case TRACK_ELEM_FLAT_TO_LEFT_BANK:
return looping_rc_track_flat_to_left_bank;
case TRACK_ELEM_FLAT_TO_RIGHT_BANK:
return looping_rc_track_flat_to_right_bank;
case TRACK_ELEM_LEFT_BANK_TO_FLAT:
return looping_rc_track_left_bank_to_flat;
case TRACK_ELEM_RIGHT_BANK_TO_FLAT:
return looping_rc_track_right_bank_to_flat;
case TRACK_ELEM_BANKED_LEFT_QUARTER_TURN_5_TILES:
return looping_rc_track_banked_left_quarter_turn_5;
case TRACK_ELEM_BANKED_RIGHT_QUARTER_TURN_5_TILES:
return looping_rc_track_banked_right_quarter_turn_5;
case TRACK_ELEM_LEFT_BANK_TO_25_DEG_UP:
return looping_rc_track_left_bank_to_25_deg_up;
case TRACK_ELEM_RIGHT_BANK_TO_25_DEG_UP:
return looping_rc_track_right_bank_to_25_deg_up;
case TRACK_ELEM_25_DEG_UP_TO_LEFT_BANK:
return looping_rc_track_25_deg_up_to_left_bank;
case TRACK_ELEM_25_DEG_UP_TO_RIGHT_BANK:
return looping_rc_track_25_deg_up_to_right_bank;
case TRACK_ELEM_LEFT_BANK_TO_25_DEG_DOWN:
return looping_rc_track_left_bank_to_25_deg_down;
case TRACK_ELEM_RIGHT_BANK_TO_25_DEG_DOWN:
return looping_rc_track_right_bank_to_25_deg_down;
case TRACK_ELEM_25_DEG_DOWN_TO_LEFT_BANK:
return looping_rc_track_25_deg_down_to_left_bank;
case TRACK_ELEM_25_DEG_DOWN_TO_RIGHT_BANK:
return looping_rc_track_25_deg_down_to_right_bank;
case TRACK_ELEM_LEFT_BANK:
return looping_rc_track_left_bank;
case TRACK_ELEM_RIGHT_BANK:
return looping_rc_track_right_bank;
case TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_25_DEG_UP:
return looping_rc_track_left_quarter_turn_5_25_deg_up;
case TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_25_DEG_UP:
return looping_rc_track_right_quarter_turn_5_25_deg_up;
case TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_25_DEG_DOWN:
return looping_rc_track_left_quarter_turn_5_25_deg_down;
case TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_25_DEG_DOWN:
return looping_rc_track_right_quarter_turn_5_25_deg_down;
case TRACK_ELEM_S_BEND_LEFT:
return looping_rc_track_s_bend_left;
case TRACK_ELEM_S_BEND_RIGHT:
return looping_rc_track_s_bend_right;
case TRACK_ELEM_LEFT_VERTICAL_LOOP:
return looping_rc_track_left_vertical_loop;
case TRACK_ELEM_RIGHT_VERTICAL_LOOP:
return looping_rc_track_right_vertical_loop;
case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES:
return looping_rc_track_left_quarter_turn_3;
case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES:
return looping_rc_track_right_quarter_turn_3;
case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_BANK:
return looping_rc_track_left_quarter_turn_3_bank;
case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_BANK:
return looping_rc_track_right_quarter_turn_3_bank;
case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_25_DEG_UP:
return looping_rc_track_left_quarter_turn_3_25_deg_up;
case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_25_DEG_UP:
return looping_rc_track_right_quarter_turn_3_25_deg_up;
case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_25_DEG_DOWN:
return looping_rc_track_left_quarter_turn_3_25_deg_down;
case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_25_DEG_DOWN:
return looping_rc_track_right_quarter_turn_3_25_deg_down;
case TRACK_ELEM_LEFT_HALF_BANKED_HELIX_UP_SMALL:
return looping_rc_track_left_half_banked_helix_up_small;
case TRACK_ELEM_RIGHT_HALF_BANKED_HELIX_UP_SMALL:
return looping_rc_track_right_half_banked_helix_up_small;
case TRACK_ELEM_LEFT_HALF_BANKED_HELIX_DOWN_SMALL:
return looping_rc_track_left_half_banked_helix_down_small;
case TRACK_ELEM_RIGHT_HALF_BANKED_HELIX_DOWN_SMALL:
return looping_rc_track_right_half_banked_helix_down_small;
case TRACK_ELEM_LEFT_HALF_BANKED_HELIX_UP_LARGE:
return looping_rc_track_left_half_banked_helix_up_large;
case TRACK_ELEM_RIGHT_HALF_BANKED_HELIX_UP_LARGE:
return looping_rc_track_right_half_banked_helix_up_large;
case TRACK_ELEM_LEFT_HALF_BANKED_HELIX_DOWN_LARGE:
return looping_rc_track_left_half_banked_helix_down_large;
case TRACK_ELEM_RIGHT_HALF_BANKED_HELIX_DOWN_LARGE:
return looping_rc_track_right_half_banked_helix_down_large;
case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE_60_DEG_UP:
return looping_rc_track_left_quarter_turn_1_60_deg_up;
case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE_60_DEG_UP:
return looping_rc_track_right_quarter_turn_1_60_deg_up;
case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE_60_DEG_DOWN:
return looping_rc_track_left_quarter_turn_1_60_deg_down;
case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE_60_DEG_DOWN:
return looping_rc_track_right_quarter_turn_1_60_deg_down;
case TRACK_ELEM_BRAKES:
return looping_rc_track_brakes;
case TRACK_ELEM_25_DEG_UP_LEFT_BANKED:
return looping_rc_track_25_deg_up_left_banked;
case TRACK_ELEM_25_DEG_UP_RIGHT_BANKED:
return looping_rc_track_25_deg_up_right_banked;
case TRACK_ELEM_ON_RIDE_PHOTO:
return looping_rc_track_on_ride_photo;
case TRACK_ELEM_25_DEG_DOWN_LEFT_BANKED:
return looping_rc_track_25_deg_down_left_banked;
case TRACK_ELEM_25_DEG_DOWN_RIGHT_BANKED:
return looping_rc_track_25_deg_down_right_banked;
case TRACK_ELEM_LEFT_EIGHTH_TO_DIAG:
return looping_rc_track_left_eighth_to_diag;
case TRACK_ELEM_RIGHT_EIGHTH_TO_DIAG:
return looping_rc_track_right_eighth_to_diag;
case TRACK_ELEM_LEFT_EIGHTH_TO_ORTHOGONAL:
return looping_rc_track_left_eighth_to_orthogonal;
case TRACK_ELEM_RIGHT_EIGHTH_TO_ORTHOGONAL:
return looping_rc_track_right_eighth_to_orthogonal;
case TRACK_ELEM_LEFT_EIGHTH_BANK_TO_DIAG:
return looping_rc_track_left_eighth_bank_to_diag;
case TRACK_ELEM_RIGHT_EIGHTH_BANK_TO_DIAG:
return looping_rc_track_right_eighth_bank_to_diag;
case TRACK_ELEM_LEFT_EIGHTH_BANK_TO_ORTHOGONAL:
return looping_rc_track_left_eighth_bank_to_orthogonal;
case TRACK_ELEM_RIGHT_EIGHTH_BANK_TO_ORTHOGONAL:
return looping_rc_track_right_eighth_bank_to_orthogonal;
case TRACK_ELEM_DIAG_FLAT:
return looping_rc_track_diag_flat;
case TRACK_ELEM_DIAG_25_DEG_UP:
return looping_rc_track_diag_25_deg_up;
case TRACK_ELEM_DIAG_60_DEG_UP:
return looping_rc_track_diag_60_deg_up;
case TRACK_ELEM_DIAG_FLAT_TO_25_DEG_UP:
return looping_rc_track_diag_flat_to_25_deg_up;
case TRACK_ELEM_DIAG_25_DEG_UP_TO_60_DEG_UP:
return looping_rc_track_diag_25_deg_up_to_60_deg_up;
case TRACK_ELEM_DIAG_60_DEG_UP_TO_25_DEG_UP:
return looping_rc_track_diag_60_deg_up_to_25_deg_up;
case TRACK_ELEM_DIAG_25_DEG_UP_TO_FLAT:
return looping_rc_track_diag_25_deg_up_to_flat;
case TRACK_ELEM_DIAG_25_DEG_DOWN:
return looping_rc_track_diag_25_deg_down;
case TRACK_ELEM_DIAG_60_DEG_DOWN:
return looping_rc_track_diag_60_deg_down;
case TRACK_ELEM_DIAG_FLAT_TO_25_DEG_DOWN:
return looping_rc_track_diag_flat_to_25_deg_down;
case TRACK_ELEM_DIAG_25_DEG_DOWN_TO_60_DEG_DOWN:
return looping_rc_track_diag_25_deg_down_to_60_deg_down;
case TRACK_ELEM_DIAG_60_DEG_DOWN_TO_25_DEG_DOWN:
return looping_rc_track_diag_60_deg_down_to_25_deg_down;
case TRACK_ELEM_DIAG_25_DEG_DOWN_TO_FLAT:
return looping_rc_track_diag_25_deg_down_to_flat;
case TRACK_ELEM_DIAG_FLAT_TO_LEFT_BANK:
return looping_rc_track_diag_flat_to_left_bank;
case TRACK_ELEM_DIAG_FLAT_TO_RIGHT_BANK:
return looping_rc_track_diag_flat_to_right_bank;
case TRACK_ELEM_DIAG_LEFT_BANK_TO_FLAT:
return looping_rc_track_diag_left_bank_to_flat;
case TRACK_ELEM_DIAG_RIGHT_BANK_TO_FLAT:
return looping_rc_track_diag_right_bank_to_flat;
case TRACK_ELEM_DIAG_LEFT_BANK_TO_25_DEG_UP:
return looping_rc_track_diag_left_bank_to_25_deg_up;
case TRACK_ELEM_DIAG_RIGHT_BANK_TO_25_DEG_UP:
return looping_rc_track_diag_right_bank_to_25_deg_up;
case TRACK_ELEM_DIAG_25_DEG_UP_TO_LEFT_BANK:
return looping_rc_track_diag_25_deg_up_to_left_bank;
case TRACK_ELEM_DIAG_25_DEG_UP_TO_RIGHT_BANK:
return looping_rc_track_diag_25_deg_up_to_right_bank;
case TRACK_ELEM_DIAG_LEFT_BANK_TO_25_DEG_DOWN:
return looping_rc_track_diag_left_bank_to_25_deg_down;
case TRACK_ELEM_DIAG_RIGHT_BANK_TO_25_DEG_DOWN:
return looping_rc_track_diag_right_bank_to_25_deg_down;
case TRACK_ELEM_DIAG_25_DEG_DOWN_TO_LEFT_BANK:
return looping_rc_track_diag_25_deg_down_to_left_bank;
case TRACK_ELEM_DIAG_25_DEG_DOWN_TO_RIGHT_BANK:
return looping_rc_track_diag_25_deg_down_to_right_bank;
case TRACK_ELEM_DIAG_LEFT_BANK:
return looping_rc_track_diag_left_bank;
case TRACK_ELEM_DIAG_RIGHT_BANK:
return looping_rc_track_diag_right_bank;
case TRACK_ELEM_BLOCK_BRAKES:
return looping_rc_track_block_brakes;
case TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_3_TILE_25_DEG_UP:
return looping_rc_track_left_banked_quarter_turn_3_25_deg_up;
case TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_3_TILE_25_DEG_UP:
return looping_rc_track_right_banked_quarter_turn_3_25_deg_up;
case TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_3_TILE_25_DEG_DOWN:
return looping_rc_track_left_banked_quarter_turn_3_25_deg_down;
case TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_3_TILE_25_DEG_DOWN:
return looping_rc_track_right_banked_quarter_turn_3_25_deg_down;
case TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_5_TILE_25_DEG_UP:
return looping_rc_track_left_banked_quarter_turn_5_25_deg_up;
case TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_5_TILE_25_DEG_UP:
return looping_rc_track_right_banked_quarter_turn_5_25_deg_up;
case TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_5_TILE_25_DEG_DOWN:
return looping_rc_track_left_banked_quarter_turn_5_25_deg_down;
case TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_5_TILE_25_DEG_DOWN:
return looping_rc_track_right_banked_quarter_turn_5_25_deg_down;
case TRACK_ELEM_25_DEG_UP_TO_LEFT_BANKED_25_DEG_UP:
return looping_rc_track_25_deg_up_to_left_banked_25_deg_up;
case TRACK_ELEM_25_DEG_UP_TO_RIGHT_BANKED_25_DEG_UP:
return looping_rc_track_25_deg_up_to_right_banked_25_deg_up;
case TRACK_ELEM_LEFT_BANKED_25_DEG_UP_TO_25_DEG_UP:
return looping_rc_track_left_banked_25_deg_up_to_25_deg_up;
case TRACK_ELEM_RIGHT_BANKED_25_DEG_UP_TO_25_DEG_UP:
return looping_rc_track_right_banked_25_deg_up_to_25_deg_up;
case TRACK_ELEM_25_DEG_DOWN_TO_LEFT_BANKED_25_DEG_DOWN:
return looping_rc_track_25_deg_down_to_left_banked_25_deg_down;
case TRACK_ELEM_25_DEG_DOWN_TO_RIGHT_BANKED_25_DEG_DOWN:
return looping_rc_track_25_deg_down_to_right_banked_25_deg_down;
case TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_25_DEG_DOWN:
return looping_rc_track_left_banked_25_deg_down_to_25_deg_down;
case TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_25_DEG_DOWN:
return looping_rc_track_right_banked_25_deg_down_to_25_deg_down;
case TRACK_ELEM_LEFT_BANKED_FLAT_TO_LEFT_BANKED_25_DEG_UP:
return looping_rc_track_left_banked_flat_to_left_banked_25_deg_up;
case TRACK_ELEM_RIGHT_BANKED_FLAT_TO_RIGHT_BANKED_25_DEG_UP:
return looping_rc_track_right_banked_flat_to_right_banked_25_deg_up;
case TRACK_ELEM_LEFT_BANKED_25_DEG_UP_TO_LEFT_BANKED_FLAT:
return looping_rc_track_left_banked_25_deg_up_to_left_banked_flat;
case TRACK_ELEM_RIGHT_BANKED_25_DEG_UP_TO_RIGHT_BANKED_FLAT:
return looping_rc_track_right_banked_25_deg_up_to_right_banked_flat;
case TRACK_ELEM_LEFT_BANKED_FLAT_TO_LEFT_BANKED_25_DEG_DOWN:
return looping_rc_track_left_banked_flat_to_left_banked_25_deg_down;
case TRACK_ELEM_RIGHT_BANKED_FLAT_TO_RIGHT_BANKED_25_DEG_DOWN:
return looping_rc_track_right_banked_flat_to_right_banked_25_deg_down;
case TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_LEFT_BANKED_FLAT:
return looping_rc_track_left_banked_25_deg_down_to_left_banked_flat;
case TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_RIGHT_BANKED_FLAT:
return looping_rc_track_right_banked_25_deg_down_to_right_banked_flat;
case TRACK_ELEM_FLAT_TO_LEFT_BANKED_25_DEG_UP:
return looping_rc_track_flat_to_left_banked_25_deg_up;
case TRACK_ELEM_FLAT_TO_RIGHT_BANKED_25_DEG_UP:
return looping_rc_track_flat_to_right_banked_25_deg_up;
case TRACK_ELEM_LEFT_BANKED_25_DEG_UP_TO_FLAT:
return looping_rc_track_left_banked_25_deg_up_to_flat;
case TRACK_ELEM_RIGHT_BANKED_25_DEG_UP_TO_FLAT:
return looping_rc_track_right_banked_25_deg_up_to_flat;
case TRACK_ELEM_FLAT_TO_LEFT_BANKED_25_DEG_DOWN:
return looping_rc_track_flat_to_left_banked_25_deg_down;
case TRACK_ELEM_FLAT_TO_RIGHT_BANKED_25_DEG_DOWN:
return looping_rc_track_flat_to_right_banked_25_deg_down;
case TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_FLAT:
return looping_rc_track_left_banked_25_deg_down_to_flat;
case TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_FLAT:
return looping_rc_track_right_banked_25_deg_down_to_flat;
case TRACK_ELEM_BOOSTER:
return looping_rc_track_booster;
}
return NULL;
}
| gDanix/OpenRCT2 | src/openrct2/ride/coaster/LoopingRollerCoaster.cpp | C++ | gpl-3.0 | 404,229 |
<?php
/**
* @link https://github.com/old-town/workflow-doctrine
* @author Malofeykin Andrey <and-rey2@yandex.ru>
*/
namespace OldTown\Workflow\Spi\Doctrine\EntityRepository\Exception;
use OldTown\Workflow\Spi\Doctrine\Exception\ExceptionInterface as ParentExceptionInterface;
/**
* Interface ExceptionInterface
*
* @package OldTown\Workflow\Spi\Doctrine\EntityRepository\Exception
*/
interface ExceptionInterface extends ParentExceptionInterface
{
}
| old-town/workflow-doctrine | src/EntityRepository/Exception/ExceptionInterface.php | PHP | gpl-3.0 | 464 |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: GnssLogTime.cpp
* Author: markov
*/
#include <boost/date_time/posix_time/posix_time.hpp>
#include "gnss_functions.hpp"
#include "GnssLogTime.hpp"
#include "common_functions.hpp"
GnssLogTime::GnssLogTime() {
week_ = 0;
milliseconds_ = 0;
}
GnssLogTime::GnssLogTime(unsigned short week, unsigned int milliseconds) {
week_ = week;
milliseconds_ = milliseconds;
utcTime_ = getLogTime(week_, milliseconds_);
}
GnssLogTime::GnssLogTime(const GnssLogTime& gnssLogTime) : stringUtcTime_(gnssLogTime.stringUtcTime_),
stringIsoTime_(gnssLogTime.stringIsoTime_)
{
week_ = gnssLogTime.week_;
milliseconds_ = gnssLogTime.milliseconds_;
utcTime_ = gnssLogTime.utcTime_;
}
GnssLogTime::~GnssLogTime() {
}
GnssLogTime& GnssLogTime::operator=(const GnssLogTime& b) {
week_ = b.week_;
milliseconds_ = b.milliseconds_;
utcTime_ = b.utcTime_;
stringUtcTime_ = b.stringUtcTime_;
stringIsoTime_ = b.stringIsoTime_;
return *this;
}
bool GnssLogTime::operator==(const GnssLogTime& b) const {
return ((week_ == b.week_) && (milliseconds_ == b.milliseconds_));
}
bool GnssLogTime::operator!=(const GnssLogTime& b) const {
return ((week_ != b.week_) || (milliseconds_ != b.milliseconds_));
}
bool GnssLogTime::operator<(const GnssLogTime& b) const {
return ((week_ < b.week_) || (milliseconds_ < b.milliseconds_));
}
bool GnssLogTime::operator>(const GnssLogTime& b) const {
return ((week_ >= b.week_) && (milliseconds_ > b.milliseconds_));
}
bool GnssLogTime::operator<=(const GnssLogTime& b) const {
return ((*this < b) || (*this == b));
}
bool GnssLogTime::operator>=(const GnssLogTime& b) const {
return ((*this > b) || (*this == b));
}
PTime
GnssLogTime::getUtcTime() {
//return UTC time in ptime variable
return utcTime_;
}
std::string
GnssLogTime::getStringUtcTime() {
//return UTC time in string format
if (stringUtcTime_.empty()) {
stringUtcTime_ = pTimeToSimpleString(utcTime_);
}
return stringUtcTime_;
}
std::string GnssLogTime::getStringIsoTime() {
//return UTS time in ISO extended string
if (stringIsoTime_.empty()) {
stringIsoTime_ = pTimeToIsoString(utcTime_);
}
return stringIsoTime_;
}
unsigned short
GnssLogTime::getWeek() {
return week_;
}
unsigned int
GnssLogTime::getMilliseconds() {
return milliseconds_;
}
| arch1tect0r/iono_zond_post_processing | src/common/GnssLogTime.cpp | C++ | gpl-3.0 | 2,745 |
package com.kraz.minehr.items;
import com.kraz.minehr.MineHr;
import com.kraz.minehr.reference.Reference;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemHoe;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class HorizonHoe extends ItemHoe {
public HorizonHoe() {
super(MineHr.HorizonToolMaterial);
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon(Reference.MOD_ID + ":" + this.getUnlocalizedName().substring(5));
}
}
| npomroy/MineHr | src/main/java/com/kraz/minehr/items/HorizonHoe.java | Java | gpl-3.0 | 614 |
package com.taobao.api.response;
import com.taobao.api.TaobaoResponse;
import com.taobao.api.internal.mapping.ApiField;
/**
* TOP API: taobao.logistics.consign.order.createandsend response.
*
* @author auto create
* @since 1.0, null
*/
public class LogisticsConsignOrderCreateandsendResponse extends TaobaoResponse {
private static final long serialVersionUID = 2877278252382584596L;
/**
* 是否成功
*/
@ApiField("is_success")
private Boolean isSuccess;
/**
* 订单ID
*/
@ApiField("order_id")
private Long orderId;
/**
* 结果描述
*/
@ApiField("result_desc")
private String resultDesc;
public Boolean getIsSuccess() {
return this.isSuccess;
}
public Long getOrderId() {
return this.orderId;
}
public String getResultDesc() {
return this.resultDesc;
}
public void setIsSuccess(Boolean isSuccess) {
this.isSuccess = isSuccess;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public void setResultDesc(String resultDesc) {
this.resultDesc = resultDesc;
}
}
| kuiwang/my-dev | src/main/java/com/taobao/api/response/LogisticsConsignOrderCreateandsendResponse.java | Java | gpl-3.0 | 1,165 |
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.voicecrystal.pixeldungeonlegends.actors.hero;
import com.watabou.utils.Bundle;
public enum HeroSubClass {
NONE( null, null ),
GLADIATOR( "gladiator",
"A successful attack with a melee weapon allows the _Gladiator_ to start a combo, " +
"in which every next successful hit inflicts more damage." ),
BERSERKER( "berserker",
"When severely wounded, the _Berserker_ enters a state of wild fury " +
"significantly increasing his damage output." ),
WARLOCK( "warlock",
"After killing an enemy the _Warlock_ consumes its soul. " +
"It heals his wounds and satisfies his hunger." ),
BATTLEMAGE( "battlemage",
"When fighting with a wand in his hands, the _Battlemage_ inflicts additional damage depending " +
"on the current number of charges. Every successful hit restores 1 charge to this wand." ),
ASSASSIN( "assassin",
"When performing a surprise attack, the _Assassin_ inflicts additional damage to his target." ),
FREERUNNER( "freerunner",
"The _Freerunner_ can move almost twice faster, than most of the monsters. When he " +
"is running, the Freerunner is much harder to hit. For that he must be unencumbered and not starving." ),
SNIPER( "sniper",
"_Snipers_ are able to detect weak points in an enemy's armor, " +
"effectively ignoring it when using a missile weapon." ),
WARDEN( "warden",
"Having a strong connection with forces of nature gives _Wardens_ an ability to gather dewdrops and " +
"seeds from plants. Also trampling a high grass grants them a temporary armor buff." );
private String title;
private String desc;
private HeroSubClass( String title, String desc ) {
this.title = title;
this.desc = desc;
}
public String title() {
return title;
}
public String desc() {
return desc;
}
private static final String SUBCLASS = "subClass";
public void storeInBundle( Bundle bundle ) {
bundle.put( SUBCLASS, toString() );
}
public static HeroSubClass restoreInBundle( Bundle bundle ) {
String value = bundle.getString( SUBCLASS );
try {
return valueOf( value );
} catch (Exception e) {
return NONE;
}
}
}
| Cerement/pixel-dungeon-legends | java/com/voicecrystal/pixeldungeonlegends/actors/hero/HeroSubClass.java | Java | gpl-3.0 | 2,845 |
<?php
/**
* TrcIMPLAN Índice Básico de Colonias
*
* Copyright (C) 2016 Guillermo Valdes Lozano
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package TrcIMPLAN
*/
namespace IBCTorreon;
/**
* Clase VillaJardin
*/
class VillaJardin extends \IBCBase\PublicacionWeb {
/**
* Constructor
*/
public function __construct() {
// Título, autor y fecha
$this->nombre = 'Villa Jardin';
$this->autor = 'IMPLAN Torreón Staff';
$this->fecha = '2016-09-02 12:55:35';
// El nombre del archivo a crear (obligatorio) y rutas relativas a las imágenes
$this->archivo = 'villa-jardin';
$this->imagen = '../imagenes/imagen.jpg';
$this->imagen_previa = '../imagenes/imagen-previa.jpg';
// La descripción y claves dan información a los buscadores y redes sociales
$this->descripcion = 'Colonia Villa Jardin de IBC Torreón.';
$this->claves = 'IMPLAN, Torreon, Desagregación';
// El directorio en la raíz donde se guardará el archivo HTML
$this->directorio = 'ibc-torreon';
// Opción del menú Navegación a poner como activa cuando vea esta publicación
$this->nombre_menu = 'IBC > IBC Torreón';
// Para el Organizador
$this->categorias = array();
$this->fuentes = array();
$this->regiones = array();
} // constructor
/**
* Datos
*
* @return array Arreglo asociativo
*/
public function datos() {
return array(
'Demografía' => array(
'Población total' => '548',
'Porcentaje de población masculina' => '46.41',
'Porcentaje de población femenina' => '53.59',
'Porcentaje de población de 0 a 14 años' => '11.60',
'Porcentaje de población de 15 a 64 años' => '63.71',
'Porcentaje de población de 65 y más años' => '13.63',
'Porcentaje de población no especificada' => '11.06',
'Fecundidad promedio' => '1.93',
'Porcentaje de población nacida en otro estado' => '24.29',
'Porcentaje de población con discapacidad' => '4.61'
),
'Educación' => array(
'Grado Promedio de Escolaridad' => '14.01',
'Grado Promedio de Escolaridad masculina' => '14.57',
'Grado Promedio de Escolaridad femenina' => '13.51'
),
'Características Económicas' => array(
'Población Económicamente Activa' => '52.20',
'Población Económicamente Activa masculina' => '63.52',
'Población Económicamente Activa femenina' => '36.48',
'Población Ocupada' => '93.39',
'Población Ocupada masculina' => '63.47',
'Población Ocupada femenina' => '36.53',
'Población Desocupada' => '6.61',
'Derechohabiencia' => '72.90'
),
'Viviendas' => array(
'Hogares' => '154',
'Hogares Jefatura masculina' => '80.29',
'Hogares Jefatura femenina' => '19.71',
'Ocupación por Vivienda' => '3.56',
'Viviendas con Electricidad' => '99.72',
'Viviendas con Agua' => '100.00',
'Viviendas con Drenaje' => '99.72',
'Viviendas con Televisión' => '89.25',
'Viviendas con Automóvil' => '84.62',
'Viviendas con Computadora' => '72.81',
'Viviendas con Celular' => '82.00',
'Viviendas con Internet' => '68.86'
),
'Unidades Económicas' => array(
'Total Actividades Económicas' => '52',
'Primer actividad nombre' => 'Otros servicios, excepto Gobierno',
'Primer actividad porcentaje' => '15.38',
'Segunda actividad nombre' => 'Inmobiliarios',
'Segunda actividad porcentaje' => '13.46',
'Tercera actividad nombre' => 'Comercio Menudeo',
'Tercera actividad porcentaje' => '11.54',
'Cuarta actividad nombre' => 'Salud',
'Cuarta actividad porcentaje' => '7.69',
'Quinta actividad nombre' => 'Profesionales, Científicos, Técnicos',
'Quinta actividad porcentaje' => '7.69'
)
);
} // datos
} // Clase VillaJardin
?>
| TRCIMPLAN/beta | lib/IBCTorreon/VillaJardin.php | PHP | gpl-3.0 | 5,207 |
/**General utility methods collection (not all self developed). */
package de.konradhoeffner.commons; | AKSW/cubeqa | src/main/java/de/konradhoeffner/commons/package-info.java | Java | gpl-3.0 | 101 |
package listener;
/**
* Created by pengshu on 2016/11/11.
*/
public class IndexManager implements EntryListener {
/**
* 博客文章被创建
*
* @param entryevent
*/
@Override
public void entryAdded(EntryEvent entryevent) {
System.out.println("IndexManager 处理 博客文章被创建事件。");
}
/**
* 博客文章被删除
*
* @param entryevent
*/
@Override
public void entryDeleted(EntryEvent entryevent) {
System.out.println("IndexManager 处理 博客文章被删除事件。");
}
/**
* 博客文章被修改
*
* @param entryevent
*/
@Override
public void entryModified(EntryEvent entryevent) {
System.out.println("IndexManager 处理 博客文章被修改事件。");
}
}
| gaoju9963/MyProject | user/src/main/java/listener/IndexManager.java | Java | gpl-3.0 | 819 |
<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google+ data class for the Joomla Platform.
*
* @since 12.3
*/
class JGoogleDataPlus extends JGoogleData
{
/**
* @var JGoogleDataPlusPeople Google+ API object for people.
* @since 12.3
*/
protected $people;
/**
* @var JGoogleDataPlusActivities Google+ API object for people.
* @since 12.3
*/
protected $activities;
/**
* @var JGoogleDataPlusComments Google+ API object for people.
* @since 12.3
*/
protected $comments;
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 12.3
*/
public function __construct(Registry $options = null, JGoogleAuth $auth = null)
{
// Setup the default API url if not already set.
$options->def('api.url', 'https://www.googleapis.com/plus/v1/');
parent::__construct($options, $auth);
if (isset($this->auth) && !$this->auth->getOption('scope'))
{
$this->auth->setOption('scope', 'https://www.googleapis.com/auth/plus.me');
}
}
/**
* Magic method to lazily create API objects
*
* @param string $name Name of property to retrieve
*
* @return JGoogleDataPlus Google+ API object (people, activities, comments).
*
* @since 12.3
*/
public function __get($name)
{
switch ($name)
{
case 'people':
if ($this->people == null)
{
$this->people = new JGoogleDataPlusPeople($this->options, $this->auth);
}
return $this->people;
case 'activities':
if ($this->activities == null)
{
$this->activities = new JGoogleDataPlusActivities($this->options, $this->auth);
}
return $this->activities;
case 'comments':
if ($this->comments == null)
{
$this->comments = new JGoogleDataPlusComments($this->options, $this->auth);
}
return $this->comments;
}
}
}
| MasiaArmato/coplux | libraries/joomla/google/data/plus.php | PHP | gpl-3.0 | 2,261 |
<?php
namespace Smartling\Jobs;
use Smartling\ApiWrapperInterface;
use Smartling\Base\ExportedAPI;
use Smartling\Helpers\ArrayHelper;
use Smartling\Queue\QueueInterface;
use Smartling\Settings\SettingsManager;
use Smartling\Submissions\SubmissionManager;
class DownloadTranslationJob extends JobAbstract
{
public const JOB_HOOK_NAME = 'smartling-download-task';
private QueueInterface $queue;
public function __construct(
ApiWrapperInterface $api,
SettingsManager $settingsManager,
SubmissionManager $submissionManager,
string $jobRunInterval,
int $workerTTL,
QueueInterface $queue
) {
parent::__construct($api, $settingsManager, $submissionManager, $jobRunInterval, $workerTTL);
$this->queue = $queue;
}
public function getJobHookName(): string
{
return self::JOB_HOOK_NAME;
}
public function run(): void
{
$this->getLogger()->info('Started Translation Download Job.');
$this->processDownloadQueue();
$this->getLogger()->info('Finished Translation Download Job.');
}
private function processDownloadQueue(): void
{
while (false !== ($submissionId = $this->queue->dequeue(QueueInterface::QUEUE_NAME_DOWNLOAD_QUEUE))) {
$submissionId = ArrayHelper::first($submissionId);
$result = $this->submissionManager->find(['id' => $submissionId]);
if (0 < count($result)) {
$entity = ArrayHelper::first($result);
} else {
$this->getLogger()
->warning(vsprintf('Got submission id=%s that does not exists in database. Skipping.', [$submissionId]));
continue;
}
do_action(ExportedAPI::ACTION_SMARTLING_DOWNLOAD_TRANSLATION, $entity);
$this->placeLockFlag(true);
}
}
}
| Smartling/wordpress-localization-plugin | inc/Smartling/Jobs/DownloadTranslationJob.php | PHP | gpl-3.0 | 1,886 |
"""1.5 : Migrating work unity
Revision ID: 1212f113f03b
Revises: 1f07ae132ac8
Create Date: 2013-01-21 11:53:56.598914
"""
# revision identifiers, used by Alembic.
revision = '1212f113f03b'
down_revision = '1f07ae132ac8'
from alembic import op
import sqlalchemy as sa
UNITIES = dict(NONE="",
HOUR=u"heure(s)",
DAY=u"jour(s)",
WEEK=u"semaine(s)",
MONTH=u"mois",
FEUIL=u"feuillet(s)",
PACK=u"forfait")
UNITS = (u"heure(s)",
u"jour(s)", u"semaine(s)", u"mois", u"forfait", u"feuillet(s)",)
def translate_unity(unity):
return UNITIES.get(unity, UNITIES["NONE"])
def translate_inverse(unity):
for key, value in UNITIES.items():
if unity == value:
return key
else:
return u"NONE"
def upgrade():
from autonomie.models.task import WorkUnit
from autonomie.models.task.estimation import EstimationLine
from autonomie.models.task.invoice import InvoiceLine
from autonomie.models.task.invoice import CancelInvoiceLine
from autonomie_base.models.base import DBSESSION
# Adding some characters to the Lines
for table in "estimation_line", "invoice_line", "cancelinvoice_line":
op.alter_column(table, "unity", type_=sa.String(100))
for value in UNITS:
unit = WorkUnit(label=value)
DBSESSION().add(unit)
for factory in (EstimationLine, InvoiceLine, CancelInvoiceLine):
for line in factory.query():
line.unity = translate_unity(line.unity)
DBSESSION().merge(line)
def downgrade():
from autonomie.models.task import WorkUnit
from autonomie.models.task.estimation import EstimationLine
from autonomie.models.task.invoice import InvoiceLine
from autonomie.models.task.invoice import CancelInvoiceLine
from autonomie_base.models.base import DBSESSION
for factory in (EstimationLine, InvoiceLine, CancelInvoiceLine):
for line in factory.query():
line.unity = translate_inverse(line.unity)
DBSESSION().merge(line)
for value in WorkUnit.query():
DBSESSION().delete(value)
| CroissanceCommune/autonomie | autonomie/alembic/versions/1_5_migrating_work_u_1212f113f03b.py | Python | gpl-3.0 | 2,158 |
package com.actelion.research.orbit.imageAnalysis.components.icons;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.lang.ref.WeakReference;
import java.util.Base64;
import java.util.Stack;
import javax.imageio.ImageIO;
import javax.swing.SwingUtilities;
import javax.swing.plaf.UIResource;
import org.pushingpixels.neon.api.icon.ResizableIcon;
import org.pushingpixels.neon.api.icon.ResizableIconUIResource;
/**
* This class has been automatically generated using <a
* href="https://github.com/kirill-grouchnikov/radiance">Photon SVG transcoder</a>.
*/
public class toggle_markup implements ResizableIcon {
private Shape shape = null;
private GeneralPath generalPath = null;
private Paint paint = null;
private Stroke stroke = null;
private Shape clip = null;
private Stack<AffineTransform> transformsStack = new Stack<>();
private void _paint0(Graphics2D g,float origAlpha) {
transformsStack.push(g.getTransform());
//
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
transformsStack.push(g.getTransform());
g.transform(new AffineTransform(1.0666667222976685f, 0.0f, 0.0f, 1.0666667222976685f, -0.0f, -0.0f));
// _0
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
transformsStack.push(g.getTransform());
g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, -343.7007751464844f));
// _0_0
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
transformsStack.push(g.getTransform());
g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f));
// _0_0_0
paint = new Color(255, 0, 255, 255);
stroke = new BasicStroke(25.0f,0,0,4.0f,null,0.0f);
shape = new Rectangle2D.Double(86.42857360839844, 424.5050964355469, 187.14285278320312, 205.0);
g.setPaint(paint);
g.setStroke(stroke);
g.draw(shape);
g.setTransform(transformsStack.pop());
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
transformsStack.push(g.getTransform());
g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f));
// _0_0_1
paint = new Color(0, 255, 255, 255);
stroke = new BasicStroke(25.0f,0,0,4.0f,null,0.0f);
if (generalPath == null) {
generalPath = new GeneralPath();
} else {
generalPath.reset();
}
generalPath.moveTo(450.7143f, 462.36224f);
generalPath.lineTo(425.0f, 703.7908f);
generalPath.lineTo(236.42857f, 766.6479f);
generalPath.lineTo(96.42857f, 826.6479f);
generalPath.lineTo(84.28571f, 947.3622f);
generalPath.lineTo(412.85715f, 1023.0765f);
generalPath.lineTo(482.85715f, 902.3622f);
generalPath.lineTo(620.0f, 989.5051f);
generalPath.lineTo(637.8571f, 420.93365f);
generalPath.closePath();
shape = generalPath;
g.setPaint(paint);
g.setStroke(stroke);
g.draw(shape);
g.setTransform(transformsStack.pop());
g.setTransform(transformsStack.pop());
g.setTransform(transformsStack.pop());
g.setTransform(transformsStack.pop());
}
@SuppressWarnings("unused")
private void innerPaint(Graphics2D g) {
float origAlpha = 1.0f;
Composite origComposite = g.getComposite();
if (origComposite instanceof AlphaComposite) {
AlphaComposite origAlphaComposite =
(AlphaComposite)origComposite;
if (origAlphaComposite.getRule() == AlphaComposite.SRC_OVER) {
origAlpha = origAlphaComposite.getAlpha();
}
}
_paint0(g, origAlpha);
shape = null;
generalPath = null;
paint = null;
stroke = null;
clip = null;
transformsStack.clear();
}
/**
* Returns the X of the bounding box of the original SVG image.
*
* @return The X of the bounding box of the original SVG image.
*/
public static double getOrigX() {
return 75.46253967285156;
}
/**
* Returns the Y of the bounding box of the original SVG image.
*
* @return The Y of the bounding box of the original SVG image.
*/
public static double getOrigY() {
return 65.65621185302734;
}
/**
* Returns the width of the bounding box of the original SVG image.
*
* @return The width of the bounding box of the original SVG image.
*/
public static double getOrigWidth() {
return 618.7836303710938;
}
/**
* Returns the height of the bounding box of the original SVG image.
*
* @return The height of the bounding box of the original SVG image.
*/
public static double getOrigHeight() {
return 674.2141723632812;
}
/** The current width of this resizable icon. */
private int width;
/** The current height of this resizable icon. */
private int height;
/**
* Creates a new transcoded SVG image. This is marked as private to indicate that app
* code should be using the {@link #of(int, int)} method to obtain a pre-configured instance.
*/
private toggle_markup() {
this.width = (int) getOrigWidth();
this.height = (int) getOrigHeight();
}
@Override
public int getIconHeight() {
return height;
}
@Override
public int getIconWidth() {
return width;
}
@Override
public synchronized void setDimension(Dimension newDimension) {
this.width = newDimension.width;
this.height = newDimension.height;
}
@Override
public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g2d.translate(x, y);
double coef1 = (double) this.width / getOrigWidth();
double coef2 = (double) this.height / getOrigHeight();
double coef = Math.min(coef1, coef2);
g2d.clipRect(0, 0, this.width, this.height);
g2d.scale(coef, coef);
g2d.translate(-getOrigX(), -getOrigY());
if (coef1 != coef2) {
if (coef1 < coef2) {
int extraDy = (int) ((getOrigWidth() - getOrigHeight()) / 2.0);
g2d.translate(0, extraDy);
} else {
int extraDx = (int) ((getOrigHeight() - getOrigWidth()) / 2.0);
g2d.translate(extraDx, 0);
}
}
Graphics2D g2ForInner = (Graphics2D) g2d.create();
innerPaint(g2ForInner);
g2ForInner.dispose();
g2d.dispose();
}
/**
* Returns a new instance of this icon with specified dimensions.
*
* @param width Required width of the icon
* @param height Required height of the icon
* @return A new instance of this icon with specified dimensions.
*/
public static ResizableIcon of(int width, int height) {
toggle_markup base = new toggle_markup();
base.width = width;
base.height = height;
return base;
}
/**
* Returns a new {@link UIResource} instance of this icon with specified dimensions.
*
* @param width Required width of the icon
* @param height Required height of the icon
* @return A new {@link UIResource} instance of this icon with specified dimensions.
*/
public static ResizableIconUIResource uiResourceOf(int width, int height) {
toggle_markup base = new toggle_markup();
base.width = width;
base.height = height;
return new ResizableIconUIResource(base);
}
/**
* Returns a factory that returns instances of this icon on demand.
*
* @return Factory that returns instances of this icon on demand.
*/
public static Factory factory() {
return toggle_markup::new;
}
}
| mstritt/orbit-image-analysis | src/main/java/com/actelion/research/orbit/imageAnalysis/components/icons/toggle_markup.java | Java | gpl-3.0 | 7,640 |
/*
* This file is part of the demos-linux package.
* Copyright (C) 2011-2022 Mark Veltzer <mark.veltzer@gmail.com>
*
* demos-linux is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* demos-linux is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with demos-linux. If not, see <http://www.gnu.org/licenses/>.
*/
#include <firstinclude.h>
#include <stdlib.h> // for malloc(3), free(3), EXIT_SUCCESS
#include <iostream> // for std::cout, std::endl
/*
* This example shows how to use the C++ operator new placement
* operator.
*
* Things we learn:
* 1. How to write your own placement function.
* 2. Regular constructor gets called after the placement.
* 3. Releasing of space could be overridden too.
* 4. This could be used for caching and real time considerations for instance.
* 5. Even if you allocate an array the delete[] is NOT called so
* your regular delete operator needs to know how to do the job
* both for arrays and for single elements (if you want arrays
* at all that is...).
*
* TODO:
* - show in place construction (calling the constructor on an otherwise
* allocated block of ram)
*/
class A {
public:
float val;
A(void) {
val=-7.6;
}
A(double ival) {
val=ival;
}
void *operator new(size_t size, double val) {
std::cout << "in new operator" << std::endl;
std::cout << "size is " << size << std::endl;
void *pointer=malloc(size);
std::cout << "pointer is " << pointer << std::endl;
// next two lines have no effect since the constructor
// will be called and will override it
// A *p=(A *)pointer;
// p->val=val;
return(pointer);
}
// this is for allocating arrays, the size that you get
// is SizeOfObject*NumOfObjects...
void *operator new[] (const size_t size) {
std::cout << "in new[] operator" << std::endl;
std::cout << "size is " << size << std::endl;
void *pointer=malloc(size);
std::cout << "pointer is " << pointer << std::endl;
return(pointer);
}
// notice that this does NOT get called...
void operator delete[] (void *pointer) {
std::cout << "in delete[] operator" << std::endl;
std::cout << "pointer is " << pointer << std::endl;
free(pointer);
}
void* operator new(size_t size) {
std::cout << "in new operator" << std::endl;
std::cout << "size is " << size << std::endl;
// void *pointer=new char[size];
void *pointer=malloc(size);
std::cout << "pointer is " << pointer << std::endl;
return(pointer);
}
void operator delete(void *pointer) {
std::cout << "in delete operator" << std::endl;
std::cout << "pointer is " << pointer << std::endl;
free(pointer);
}
};
int main(int argc, char** argv, char** envp) {
std::cout << "heap no arguments example" << std::endl;
A* a=new A();
std::cout << "a->val is " << a->val << std::endl;
#pragma GCC diagnostic ignored "-Wmismatched-new-delete"
delete a;
std::cout << "heap arguments example" << std::endl;
A* b=new(5.5)A();
std::cout << "b->val is " << b->val << std::endl;
#pragma GCC diagnostic ignored "-Wmismatched-new-delete"
delete b;
std::cout << "many heap no arguments example" << std::endl;
const unsigned int num_objs=5;
A* e=new A[num_objs];
for(unsigned int i=0; i<num_objs; i++) {
std::cout << i << " " << "e->val is " << e[i].val << std::endl;
}
delete[] e;
// the next two examples are stack examples in which case neither
// the new nor the delete operator will be called (memory is stack
// memory).
// could you write a C++ object which can be used ONLY on the stack
// or conversly ONLY on the heap using this property ?!?
std::cout << "stack no arguments example" << std::endl;
A c;
std::cout << "c.val is " << c.val << std::endl;
std::cout << "stack arguments example" << std::endl;
A d(6.7);
std::cout << "d.val is " << d.val << std::endl;
return EXIT_SUCCESS;
}
| veltzer/demos-linux | src/examples/lang_cpp/placement.cc | C++ | gpl-3.0 | 4,246 |
var Connection = require("./db/db-connection").Connection;
var Tables = require("./db/tables");
const R = require("ramda");
var QUERY_MATCHES = {
$or: [
{percent_name: {$gt: 0.9}},
{
distance: {$lt: 1}
},
{
percent_name: {$gt: 0.8},
distance: {$lt: 30}
},
{
percent_name: {$gt: 0.8},
percent_address_phonetic: 1,
distance: {$lt: 50}
}
]
};
var connection = new Connection();
connection.connect()
.then(connection.collection.bind(connection, Tables.FUZZY_MATCHES_FB))
.then(coll=> {
return coll.find(QUERY_MATCHES).toArray()
})
.then(matches=> {
var promises = matches.map(match=> {
return Promise.resolve(R.filter(item=>(item.id_p1 == match.id_p1 || item.id_p2 == match.id_p1), matches)).then(response=> {
return {
id: match.id_p1.toString(),
name: match.name_p1,
response: R.compose(
R.sortBy(R.identity),
R.uniq,
R.flatten,
R.map(place=> {
return [place.id_p1.toString(), place.id_p2.toString()]
})
)(response)
}
})
});
return Promise.all(promises);
})
.then(matches=> {
matches = R.groupBy(item=>item.id, matches);
matches = Object.keys(matches).map((key)=> {
var get_ids = R.compose(
R.reduce((prev, id)=> {
prev.id_facebook.push(id);
return prev;
}, {id_facebook: [], id_google: [], id_opendata: [], id_imprese: []}),
R.sortBy(R.identity),
R.uniq,
R.flatten
, R.map(R.prop("response"))
);
var ids = get_ids(matches[key]);
return Object.assign({
name: matches[key][0].name
}, ids)
});
var uniq_matches = [];
for (var i = 0; i < matches.length; i++) {
var match = matches[i];
var found = R.find(nm=> {
var has_fb = match.id_facebook.filter(id=>nm.id_facebook.includes(id)).length;
return has_fb;
})(uniq_matches);
if (!found) {
uniq_matches.push(match);
}else {
found.id_facebook=R.uniq(found.id_facebook.concat(match.id_facebook));
}
}
var fuzzyMatchColl = connection.db.collection(Tables.FUZZY_MATCHES_FB_ONE_TO_MANY);
return fuzzyMatchColl.drop().then(_=>{
return fuzzyMatchColl.insertMany(uniq_matches);
})
})
.then(_=> {
connection.db.close();
console.log("DONE");
process.exit(0);
})
.catch(_=> {
console.log(_);
connection.db.close();
process.exit(1);
}); | marcog83/cesena-online-demo | dati-jobs/fuzzy-match-fb-places-step_2.js | JavaScript | gpl-3.0 | 3,057 |
///////////////////////////////////////////////////////////////////////////////
//
//
//
//
///////////////////////////////////////////////////////////////////////////////
// Includes
#include "include/mdShared.h"
#include "include/mdBreakPoint.h"
#include "include/mdSpy.h"
#include "include/mdSymbol.h"
#include "include/mdSymbolPair.h"
#include "include/mdListLine.h"
#include "include/mdSection.h"
#include "include/mdSpiesPanel.h"
#include "include/mdFrmMain.h"
#include "include/mdApp.h"
#include "include/mdEmu.h"
#include "include/mdProject.h"
///////////////////////////////////////////////////////////////////////////////
// Events
///////////////////////////////////////////////////////////////////////////////
mdProject::mdProject()
{
AddDefaultSymbols();
}
mdProject::~mdProject()
{
ClearAllSpies();
ClearAllBreakPoints();
ClearAllSymbols();
}
///////////////////////////////////////////////////////////////////////////////
// Gestion des symboles
///////////////////////////////////////////////////////////////////////////////
void mdProject::AddDefaultSymbols()
{
// Ajoute des symboles par défaut
wxString b;
b=_T("VDP_DATA");
InsertSymbol(NULL,b,0xc00000,0,false);
b=_T("VDP_DATA");
InsertSymbol(NULL,b,0xc00002,0,false);
b=_T("VDP_CTRL");
InsertSymbol(NULL,b,0xc00004,0,false);
b=_T("VDP_CTRL");
InsertSymbol(NULL,b,0xc00006,0,false);
b=_T("HV_COUNTER");
InsertSymbol(NULL,b,0xc00008,0,false);
b=_T("HV_COUNTER");
InsertSymbol(NULL,b,0xc0000a,0,false);
b=_T("HV_COUNTER");
InsertSymbol(NULL,b,0xc0000c,0,false);
b=_T("HV_COUNTER");
InsertSymbol(NULL,b,0xc0000e,0,false);
b=_T("SN76489_PSG");
InsertSymbol(NULL,b,0xc00011,0,false);
b=_T("SN76489_PSG");
InsertSymbol(NULL,b,0xc00013,0,false);
b=_T("SN76489_PSG");
InsertSymbol(NULL,b,0xc00015,0,false);
b=_T("SN76489_PSG");
InsertSymbol(NULL,b,0xc00017,0,false);
b=_T("Z80_BUSREQ");
InsertSymbol(NULL,b,0xa11100,0,false);
b=_T("Z80_RESET");
InsertSymbol(NULL,b,0xa11200,0,false);
b=_T("MD_VERSION");
InsertSymbol(NULL,b,0xa10001,0,false);
b=_T("DATA_PORT_A");
InsertSymbol(NULL,b,0xa10003,0,false);
b=_T("DATA_PORT_B");
InsertSymbol(NULL,b,0xa10005,0,false);
b=_T("DATA_PORT_C");
InsertSymbol(NULL,b,0xa10007,0,false);
b=_T("CTRL_PORT_A");
InsertSymbol(NULL,b,0xa10009,0,false);
b=_T("CTRL_PORT_B");
InsertSymbol(NULL,b,0xa1000b,0,false);
b=_T("CTRL_PORT_C");
InsertSymbol(NULL,b,0xa1000d,0,false);
b=_T("TxDATA_PORT_A");
InsertSymbol(NULL,b,0xa10000,0,false);
b=_T("RxDATA_PORT_A");
InsertSymbol(NULL,b,0xa10011,0,false);
b=_T("S_CTRL_PORT_A");
InsertSymbol(NULL,b,0xa10013,0,false);
b=_T("TxDATA_PORT_B");
InsertSymbol(NULL,b,0xa10015,0,false);
b=_T("RxDATA_PORT_B");
InsertSymbol(NULL,b,0xa10017,0,false);
b=_T("S_CTRL_PORT_B");
InsertSymbol(NULL,b,0xa10019,0,false);
b=_T("TxDATA_PORT_C");
InsertSymbol(NULL,b,0xa1001b,0,false);
b=_T("RxDATA_PORT_C");
InsertSymbol(NULL,b,0xa1001d,0,false);
b=_T("S_CTRL_PORT_C");
InsertSymbol(NULL,b,0xa1001f,0,false);
DumpFile_Rom=_T("");
DumpFile_68kRam=_T("");
DumpFile_Z80Ram=_T("");
DumpFile_CRam=_T("");
DumpFile_VRam=_T("");
DumpFile_VSRam=_T("");
}
void mdProject::ClearAllSymbols(void)
{
mdSymbolList::iterator it;
for( it = m_Symbols.begin(); it != m_Symbols.end(); ++it )
{ mdSymbolPair *s=(mdSymbolPair*) it->second;
if(s!=NULL)
{
if(s->Label!=NULL)
delete(s->Label);
if(s->Variable!=NULL)
delete(s->Variable);
delete(s);
}
}
m_Symbols.clear();
}
int mdProject::CountSymbols(void)
{
return m_Symbols.size();
}
mdSymbol* mdProject::GetSymbol(int type,int pc)
{
mdSymbolPair *sp=GetSymbolPair(pc);
if(sp!=NULL)
{ if(type==0)
return sp->Variable;
else
return sp->Label;
}
return NULL;
}
mdSymbolPair* mdProject::GetSymbolPair(int pc)
{
mdSymbolList::iterator it;
it=m_Symbols.find(pc);
if(it!=m_Symbols.end())
{ return (mdSymbolPair*) it->second;
}
return NULL;
}
mdSymbol* mdProject::InsertSymbol(mdSection *Section_ID,wxString &Name,unsigned int Address,int Type,bool UserCreated)
{
mdSymbol *s=new mdSymbol();
s->Section=Section_ID;
s->Address=Address;
s->Name=Name;
s->UserCreated=UserCreated;
// vérifie si on a un symbol racine
mdSymbolPair *sp=GetSymbolPair(Address);
if(sp==NULL)
{ sp=new mdSymbolPair();
if(Type==0)
sp->Variable=s;
else
sp->Label=s;
m_Symbols[Address]=sp;
}
else
{ if(Type==0)
{ if(sp->Variable!=NULL)
delete(sp->Variable);
sp->Variable=s;
}
else
{ if(sp->Label!=NULL)
delete(sp->Label);
sp->Label=s;
}
}
return s;
}
bool mdProject::CheckSymbolPairExist(int pc)
{
mdBreakPointList::iterator it;
it=m_BreakPoints.find(pc);
if(it!=m_BreakPoints.end())
return true;
return false;
}
char* mdProject::GetSymbolName(int pc)
{
mdSymbolPair *sp=NULL;
mdSymbolList::iterator it;
it=m_Symbols.find(pc);
if(it!=m_Symbols.end())
{ sp=(mdSymbolPair*) it->second;
if(sp->Label!=NULL)
return (char*)sp->Label->Name.c_str();
if(sp->Variable!=NULL)
return (char*)sp->Variable->Name.c_str();
}
return NULL;
}
char* mdProject::GetSymbolLabelName(int pc)
{
mdSymbolPair *sp=NULL;
mdSymbolList::iterator it;
it=m_Symbols.find(pc);
if(it!=m_Symbols.end())
{ sp=(mdSymbolPair*) it->second;
if(sp->Label!=NULL)
return (char*)sp->Label->Name.c_str();
else
{
if(sp->Variable!=NULL)
return (char*)sp->Variable->Name.c_str();
}
}
return NULL;
}
char* mdProject::GetSymbolVariableName(int pc)
{
mdSymbolPair *sp=NULL;
mdSymbolList::iterator it;
it=m_Symbols.find(pc);
if(it!=m_Symbols.end())
{ sp=(mdSymbolPair*) it->second;
if(sp->Variable!=NULL)
return (char*)sp->Variable->Name.c_str();
}
return NULL;
}
void mdProject::RemoveSymbol(int type,int pc)
{
//m_Spies.erase(IntIndex);
mdSymbolPair *sp=GetSymbolPair(pc);
if(sp!=NULL)
{
if(type==0)
{ if(sp->Variable!=NULL)
{ if(sp->Variable->UserCreated==true)
{ delete(sp->Variable);
sp->Variable=NULL;
}
}
}
if(type==1)
{ if(sp->Label!=NULL)
{ delete(sp->Label);
sp->Label=NULL;
}
}
if(sp->Label==NULL && sp->Variable==NULL)
{ m_Symbols.erase(pc);
delete(sp);
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Gestion des watchers
///////////////////////////////////////////////////////////////////////////////
mdSpy* mdProject::InsertSpy( int IntIndex,
mdSection *Section,
wxString &name,
unsigned int address,
int length,
bool isfromarray)
{
mdSpy *Spy=new mdSpy();
Spy->SetName(name);
Spy->SetAddress(address,true);
Spy->m_Symbol->Section=Section;
Spy->m_Length=length;
Spy->m_ListIndex=IntIndex;
Spy->m_IsFromArray=isfromarray;
Spy->m_Value=0;
m_Spies[IntIndex]=Spy;
return Spy;
}
mdSpy* mdProject::GetSpy(int IntIndex)
{ return (mdSpy*)m_Spies[IntIndex];
}
void mdProject::RemoveSpy(int IntIndex)
{
m_Spies.erase(IntIndex);
}
void mdProject::ClearAllSpies(void)
{
mdSpiesList::iterator it;
for( it = m_Spies.begin(); it != m_Spies.end(); ++it )
{ mdSpy *s=(mdSpy*) it->second;
if(s!=NULL)
delete(s);
}
m_Spies.clear();
}
int mdProject::CountSpies(void)
{
return m_Spies.size();
}
///////////////////////////////////////////////////////////////////////////////
// Gestion des BerakPoints
///////////////////////////////////////////////////////////////////////////////
mdBreakPoint* mdProject::InsertBreakPoint(int IntIndex)
{
mdBreakPointList::iterator it;
it=m_BreakPoints.find(IntIndex);
if(it==m_BreakPoints.end())
{ mdBreakPoint *bk=new mdBreakPoint();
bk->m_Hits=0;
bk->m_Enabled=TRUE;
m_BreakPoints[IntIndex]=bk;
return bk;
}
return NULL;
}
bool mdProject::CheckGotBreakPoint(int pc)
{
mdBreakPointList::iterator it;
it=m_BreakPoints.find(pc);
if(it!=m_BreakPoints.end())
return true;
return false;
}
void mdProject::RemoveBreakPoint(int IntIndex)
{
m_BreakPoints.erase(IntIndex);
}
int mdProject::CountBreakPoint(void)
{
return m_BreakPoints.size();
}
void mdProject::ClearAllBreakPoints(void)
{
mdBreakPointList::iterator it;
for( it = m_BreakPoints.begin(); it != m_BreakPoints.end(); ++it )
{ mdBreakPoint *s=(mdBreakPoint*) it->second;
if(s!=NULL)
delete(s);
}
m_BreakPoints.clear();
}
mdBreakPoint* mdProject::GetBreakPoint(int pc)
{
return(mdBreakPoint*) m_BreakPoints[pc];
}
int mdProject::ExecuteBreakPoint(int pc)
{
mdBreakPointList::iterator it;
it=m_BreakPoints.find(pc);
if(it!=m_BreakPoints.end())
{ // trouver breakpoint incrémente le hits
mdBreakPoint *value =(mdBreakPoint*) it->second;
if(value->m_Enabled==true)
{ value->m_Hits++;
return 1;
}
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// Load les symboles et étiquettes
///////////////////////////////////////////////////////////////////////////////
int mdProject::LoadSymbols(int type,wxString& FileName)
{
// nasm pour commencer
wxString str="";
wxTextFile file;
file.Open(FileName);
int etat=-1;
int ligne_cnt=0;
wxString Section="";
ClearAllSymbols();
AddDefaultSymbols();
for ( str = file.GetFirstLine(); !file.Eof(); str = file.GetNextLine() )
{
if(ligne_cnt==0)
{
switch(etat)
{
case -1:
{
// traite le fichier
if(str.Contains(" Section ")==true)
{ // doit virer
etat=1;
Section=str.BeforeLast('\'');
Section=Section.AfterFirst('\'');
ligne_cnt=5;
}
else
{
if(str.Contains("Value Type Class Symbol Refs Line File")==true)
{ etat=1;
Section=_T("");
ligne_cnt=2;
}
}
}break;
case 1:
{
if(str.Trim().Length()==0)
etat=-1;
else
{ wxString var_name="";
wxString taille=str.SubString(12,18);
wxString index=str.SubString(0,9);
long value=0;
int addr_index= index.ToLong(&value,16);
int addresse=value;
taille=taille.Trim();
var_name=str.SubString(25,48);
var_name=var_name.Trim(true);
if(taille.Trim().Length()>0)
{
int size=0;
if(taille.CmpNoCase("byte")==0)
{ size=1;
}
if(taille.CmpNoCase("word")==0)
{ size=2;
}
if(taille.CmpNoCase("long")==0)
{ size=4;
}
if(size>0)
{
if(Section.CmpNoCase("vars")==0)
{ addresse = 0xff0000 + value; }
// attribue une section
gFrmMain->GetSpiesPanel()->InsertSpy(NULL,var_name,addresse,size,1,false);
}
}
else
{
// étiquette
InsertSymbol(NULL,var_name,value,1,false);
}
}
}break;
}
}
else
{ ligne_cnt--; }
}
file.Close();
return 0;
}
int mdProject::LoadList(wxString& FileName)
{
//// nasm pour commencer
//wxString str="";
//wxTextFile file;
//file.Open(FileName);
//int nbligne=file.GetLineCount();
//for ( str = file.GetFirstLine(); !file.Eof(); str = file.GetNextLine() )
//{
// wxString *s=new wxString(str);
//}
//file.Close();
return 0;
}
| pascalorama/megadrive-studio | mdstudio/src/mdProject.cpp | C++ | gpl-3.0 | 11,136 |