code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 3
942
| language
stringclasses 30
values | license
stringclasses 15
values | size
int32 3
1.05M
|
---|---|---|---|---|---|
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 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Description of create_links_stl</title>
<meta name="keywords" content="create_links_stl">
<meta name="description" content="%%%%%%%%%%%%%%%%%">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="m2html v1.5 © 2003-2005 Guillaume Flandin">
<meta name="robots" content="index, follow">
<link type="text/css" rel="stylesheet" href="../../../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../../../index.html">Home</a> > <a href="../../../index.html">arte3.1.4</a> > <a href="#">robots</a> > <a href="#">MITSUBISHI</a> > <a href="index.html">PA-10</a> > create_links_stl.m</div>
<!--<table width="100%"><tr><td align="left"><a href="../../../../index.html"><img alt="<" border="0" src="../../../../left.png"> Master index</a></td>
<td align="right"><a href="index.html">Index for arte3.1.4/robots/MITSUBISHI/PA-10 <img alt=">" border="0" src="../../../../right.png"></a></td></tr></table>-->
<h1>create_links_stl
</h1>
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../../../up.png"></a></h2>
<div class="box"><strong>%%%%%%%%%%%%%%%%%</strong></div>
<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../../../up.png"></a></h2>
<div class="box"><strong>This is a script file. </strong></div>
<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../../../up.png"></a></h2>
<div class="fragment"><pre class="comment">%%%%%%%%%%%%%%%%%
LINK 0: BASE
%%%%%%%%%%%%%%%%%</pre></div>
<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../../../matlabicon.gif)">
<li><a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a> SURF2STL Write STL file from surface data.</li></ul>
This function is called by:
<ul style="list-style-image:url(../../../../matlabicon.gif)">
</ul>
<!-- crossreference -->
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../../../up.png"></a></h2>
<div class="fragment"><pre>0001 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0002 <span class="comment">% LINK 0: BASE</span>
0003 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0004 filename=<span class="string">'link0.stl'</span>; <span class="comment">%base</span>
0005 cyl_radius=0.075;
0006 cyl_height = 0.290;
0007 precision = 10; <span class="comment">% increase to obtain a more accurate drawing</span>
0008
0009 <span class="comment">%create a unit height cylinder with 100 points. Radius 75</span>
0010 [X,Y,Z] = cylinder([cyl_radius], precision);
0011 <span class="comment">%Multiply Z by height</span>
0012 Z=Z*cyl_height;
0013
0014 <span class="comment">%Save in stl format, create new file</span>
0015 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, Z, <span class="string">'ascii'</span>, <span class="string">'w'</span>);
0016
0017 <span class="comment">%now create a disk, bottom</span>
0018 radius = linspace(0,cyl_radius,precision); <span class="comment">% For ten rings</span>
0019 theta = (pi/180)*[0:15:360]; <span class="comment">% For eight angles</span>
0020 [R,T] = meshgrid(radius,theta); <span class="comment">% Make radius/theta grid</span>
0021 X = R.*cos(T); <span class="comment">% Convert grid to cartesian coordintes</span>
0022 Y = R.*sin(T);
0023
0024 <span class="comment">%append this solid to already created file, bottom disk</span>
0025 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, 0.*X, <span class="string">'ascii'</span>, <span class="string">'a+'</span>);
0026 <span class="comment">%top disk</span>
0027 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, cyl_height.*ones(size(X,1), size(X,2)), <span class="string">'ascii'</span>, <span class="string">'a+'</span>);
0028
0029
0030 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0031 <span class="comment">% LINK 1</span>
0032 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0033 filename=<span class="string">'link1.stl'</span>;
0034 cyl_radius=0.05;
0035 cyl_height = 0.150;
0036
0037 <span class="comment">%create a unit height cylinder with 100 points. Radius 75</span>
0038 [X,Y,Z] = cylinder([cyl_radius], precision);
0039 <span class="comment">% draw Z correspondingly</span>
0040 Z(1,:)=Z(1,:) -cyl_height/2;
0041 Z(2,:)=Z(2,:).*(cyl_height/2);
0042
0043 <span class="comment">%Save in stl format, create new file</span>
0044 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, Z, <span class="string">'ascii'</span>, <span class="string">'w'</span>);
0045
0046 <span class="comment">%now create a disk, bottom</span>
0047 radius = linspace(0,cyl_radius,precision); <span class="comment">% For ten rings</span>
0048 theta = (pi/180)*[0:15:360]; <span class="comment">% For eight angles</span>
0049 [R,T] = meshgrid(radius,theta); <span class="comment">% Make radius/theta grid</span>
0050 X = R.*cos(T); <span class="comment">% Convert grid to cartesian coordintes</span>
0051 Y = R.*sin(T);
0052
0053 <span class="comment">%append this solid to already created file, bottom disk</span>
0054 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, (-cyl_height/2).*ones(size(X,1), size(X,2)), <span class="string">'ascii'</span>, <span class="string">'a+'</span>);
0055 <span class="comment">%top disk</span>
0056 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, (cyl_height/2).*ones(size(X,1), size(X,2)), <span class="string">'ascii'</span>, <span class="string">'a+'</span>);
0057
0058
0059 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0060 <span class="comment">% LINK 2</span>
0061 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0062 filename=<span class="string">'link2.stl'</span>;
0063 <span class="comment">%cylinder 1</span>
0064 cyl_radius=0.03;
0065 cyl_height = 0.1;
0066 [X,Y,Z] = cylinder([cyl_radius], precision);
0067 <span class="comment">% draw Z correspondingly</span>
0068 Z(1,:)=Z(1,:) -cyl_height/2;
0069 Z(2,:)=Z(2,:).*(cyl_height/2);
0070
0071 <span class="comment">%Save in stl format, create new file</span>
0072 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, Z, <span class="string">'ascii'</span>, <span class="string">'w'</span>);
0073
0074 cyl_radius=0.05;
0075 cyl_height = 0.450;
0076 <span class="comment">%draw arm, swap X and Z</span>
0077 [Z,Y,X] = cylinder([cyl_radius cyl_radius*0.8], precision);
0078 <span class="comment">% draw Z correspondingly</span>
0079 X(1,:)=X(1,:) -cyl_height;
0080 X(2,:)=X(2,:).*0;
0081
0082 <span class="comment">%surf(X, Y, Z)</span>
0083
0084 <span class="comment">%Save in stl format, create new file</span>
0085 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, Z, <span class="string">'ascii'</span>, <span class="string">'a+'</span>);
0086
0087
0088
0089 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0090 <span class="comment">% LINK 3</span>
0091 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0092 filename=<span class="string">'link3.stl'</span>;
0093 <span class="comment">%cylinder 1</span>
0094 <span class="comment">% cyl_radius=0.03;</span>
0095 <span class="comment">% cyl_height = 0.1;</span>
0096 <span class="comment">% [X,Y,Z] = cylinder([cyl_radius], precision);</span>
0097 <span class="comment">% % draw Z correspondingly</span>
0098 <span class="comment">% Z(1,:)=Z(1,:) -cyl_height/2;</span>
0099 <span class="comment">% Z(2,:)=Z(2,:).*(cyl_height/2);</span>
0100 <span class="comment">%</span>
0101 <span class="comment">% %Save in stl format, create new file</span>
0102 <span class="comment">% surf2stl(filename, X, Y, Z, 'ascii', 'w');</span>
0103
0104 cyl_radius=0.04;
0105 cyl_height = 0.50;
0106 <span class="comment">%draw arm, swap X and Z</span>
0107 [X, Y, Z] = cylinder([cyl_radius cyl_radius*0.8], precision);
0108 <span class="comment">% draw Z correspondingly</span>
0109
0110 Z(2,:)=Z(2,:).*(cyl_height);
0111
0112 <span class="comment">%Save in stl format, create new file</span>
0113 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, Z, <span class="string">'ascii'</span>, <span class="string">'a+'</span>);
0114
0115
0116 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0117 <span class="comment">% LINK 4</span>
0118 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0119 filename=<span class="string">'link4.stl'</span>;
0120
0121 cyl_radius=0.03;
0122 cyl_height = 0.07;
0123 <span class="comment">%draw arm, swap X and Z</span>
0124 [X, Y, Z] = cylinder([cyl_radius], precision);
0125 <span class="comment">% draw Z correspondingly</span>
0126 Z(1,:)=Z(1,:) -cyl_height/2;
0127 Z(2,:)=Z(2,:).*(cyl_height/2);
0128
0129 <span class="comment">%Save in stl format, create new file</span>
0130 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, Z, <span class="string">'ascii'</span>, <span class="string">'w'</span>);
0131
0132
0133
0134 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0135 <span class="comment">% LINK 5</span>
0136 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0137 filename=<span class="string">'link5.stl'</span>;
0138
0139 cyl_radius=0.03;
0140 cyl_height = 0.07;
0141 <span class="comment">%draw arm, swap X and Z</span>
0142 [X, Y, Z] = cylinder([cyl_radius], precision);
0143 <span class="comment">% draw Z correspondingly</span>
0144 Z(2,:)=Z(2,:).*(cyl_height);
0145
0146 <span class="comment">%Save in stl format, create new file</span>
0147 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, Z, <span class="string">'ascii'</span>, <span class="string">'w'</span>);
0148
0149
0150
0151 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0152 <span class="comment">% LINK 6</span>
0153 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
0154 filename=<span class="string">'link6.stl'</span>;
0155
0156 cyl_radius=0.05;
0157 cyl_height = 0.01;
0158 <span class="comment">%draw arm, swap X and Z</span>
0159 [X, Y, Z] = cylinder([cyl_radius], precision);
0160 <span class="comment">% draw Z correspondingly</span>
0161 Z(1,:)=Z(1,:) -cyl_height;
0162 Z(2,:)=Z(2,:).*0;
0163 <span class="comment">%Save in stl format, create new file</span>
0164 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, Z, <span class="string">'ascii'</span>, <span class="string">'w'</span>);
0165
0166 <span class="comment">%now create a disk, bottom</span>
0167 radius = linspace(0,cyl_radius,precision);
0168 theta = (pi/180)*[0:15:360];
0169 [R,T] = meshgrid(radius,theta); <span class="comment">% Make radius/theta grid</span>
0170 X = R.*cos(T);
0171 Y = R.*sin(T);
0172
0173 <span class="comment">%append this solid to already created file, bottom disk</span>
0174 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, (-cyl_height).*ones(size(X,1), size(X,2)), <span class="string">'ascii'</span>, <span class="string">'a+'</span>);
0175 <span class="comment">%append this solid to already created file, bottom disk</span>
0176 <a href="../../../../arte3.1.4/tools/surf2stl/surf2stl.html" class="code" title="function surf2stl(filename,x,y,z,mode,writemode)">surf2stl</a>(filename, X, Y, 0.*ones(size(X,1), size(X,2)), <span class="string">'ascii'</span>, <span class="string">'a+'</span>);</pre></div>
<hr><address>Generated on Wed 29-May-2013 19:30:18 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> © 2005</address>
</body>
</html> | Dechcaudron/octARTE | doc/arte3.1.4/robots/MITSUBISHI/PA-10/create_links_stl.html | HTML | gpl-3.0 | 13,068 |
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 |
// This file was generated based on /usr/local/share/uno/Packages/Fuse.Controls.Navigation/1.3.1/Transition.uno.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Uno.Int.h>
namespace g{
namespace Fuse{
namespace Triggers{
// public enum TransitionMode :181
uEnumType* TransitionMode_typeof();
}}} // ::g::Fuse::Triggers
| gncvalente/18app | dist/ios/include/Fuse.Triggers.TransitionMode.h | C | gpl-3.0 | 364 |
#include <unistd.h>
#include <sys/stat.h>
int remove(const char *pathname) {
struct stat buf;
stat(pathname, &buf);
if (S_ISDIR(buf.st_mode)) {
return rmdir(pathname);
} else {
return unlink(pathname);
}
}
| TacOS-team/tacos | libs/libc/stdio/remove.c | C | gpl-3.0 | 216 |
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 |
/*!
* \file in_memory_configuration.h
* \brief A ConfigurationInterface for testing purposes.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
*
* This implementation accepts configuration parameters upon instantiation and
* it is intended to be used in unit testing.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR 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.
*
* GNSS-SDR 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 GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_IN_MEMORY_CONFIGURATION_H_
#define GNSS_SDR_IN_MEMORY_CONFIGURATION_H_
#include <map>
#include <memory>
#include <string>
#include "configuration_interface.h"
class StringConverter;
/*!
* \brief This class is an implementation of the interface ConfigurationInterface.
*
* This implementation accepts configuration parameters upon instantiation and
* it is intended to be used in unit testing.
*/
class InMemoryConfiguration : public ConfigurationInterface
{
public:
InMemoryConfiguration();
virtual ~InMemoryConfiguration();
std::string property(std::string property_name, std::string default_value);
bool property(std::string property_name, bool default_value);
long property(std::string property_name, long default_value);
int property(std::string property_name, int default_value);
unsigned int property(std::string property_name, unsigned int default_value);
float property(std::string property_name, float default_value);
double property(std::string property_name, double default_value);
void set_property(std::string property_name, std::string value);
bool is_present(std::string property_name);
private:
std::map<std::string, std::string> properties_;
std::unique_ptr<StringConverter> converter_;
};
#endif /*GNSS_SDR_IN_MEMORY_CONFIGURATION_H_*/
| taroz/gnss-sdr | src/core/receiver/in_memory_configuration.h | C | gpl-3.0 | 2,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 |
/*=================================================================================*/
/* File: bayes_MonoExpAnalysisBinned.h */
/*---------------------------------------------------------------------------------*/
/* Purpose: Header file for bayes_MonoExpAnalysisBinned.c. */
/*---------------------------------------------------------------------------------*/
/* References: [1] - "Bayesian data analysis and parameter inference and */
/* applications to imaging based on photon counting", */
/* ACC Coolen, KCL, December 8th 2006. */
/*---------------------------------------------------------------------------------*/
/* Notes: None. */
/*=================================================================================*/
/* Revision history: */
/*---------------------------------------------------------------------------------*/
/* Date | Modification */
/*---------------------------------------------------------------------------------*/
/* 090424 | Creation, mrowley. */
/*---------------------------------------------------------------------------------*/
/* | */
/*=================================================================================*/
#ifndef BAYES_MONO_EXP_RAPID_ANALYSIS_H
#define BAYES_MONO_EXP_RAPID_ANALYSIS_H
int bayes_RapidMonoExpDirectMostProbW0W1( int *data,
int nbins,
int fitstart,
int nphotons,
double *w0,
double *w1,
float *val,
BayesInstrRsp_t *instr,
float interval,
float modulationperiod,
float alpha,
BayesRapidMonoExpValueStore_t *grid,
BayesAveErrDistn_t *distr);
int bayes_RapidMonoExpAvgAndErrors( int *data,
int nbins,
int fitstart,
int nphotons,
double *w0_mp,
double *w1_mp,
double *w0_ave,
double *w1_ave,
double *dw0,
double *dw1,
BayesInstrRsp_t *instr,
float interval,
float modulationperiod,
float alpha,
float precision,
int p,/* hmm, this is actually nphotons */
int quick,
BayesAveErrDistn_t *distr,
BayesRapidMonoExpValueStore_t *grid,
float *value);
#if 0
int bayes_RapidMonoExpIndirectMostProbableW0W1( int *data,
int nbins,
int nphotons,
float *w0,
float *w1,
//float *val,
float delay,
float width,
float interval,
float modulationperiod,
float alpha,
BayesRapidMonoExpValueStore_t *grid);
#endif
#endif /* BAYES_MONO_EXP_RAPID_ANALYSIS_H */
| slim-curve/slim-curve | src/main/c/bayes/bayes_MonoExpRapidAnalysis.h | C | gpl-3.0 | 5,266 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>SUMO - Simulation of Urban MObility: NBTrafficLightLogicCont.h File Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<link href="../../doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="../../main.html"><span>Main Page</span></a></li>
<li><a href="../../pages.html"><span>Related Pages</span></a></li>
<li><a href="../../modules.html"><span>Modules</span></a></li>
<li><a href="../../annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="../../files.html"><span>Files</span></a></li>
<li><a href="../../dirs.html"><span>Directories</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="../../files.html"><span>File List</span></a></li>
<li><a href="../../globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="../../dir_75b82e7e4a5feb05200b9ad7adf06257.html">home</a> » <a class="el" href="../../dir_46b8f36974b309f038ffc35aa047a32b.html">boni</a> » <a class="el" href="../../dir_52e5be8ca53cec2b5437a8ba83e8e4f0.html">Desktop</a> » <a class="el" href="../../dir_7de3ce0f65e0314f747915173f89e60e.html">DanielTouched</a> » <a class="el" href="../../dir_a0096e276045b3ff0719c75e0b3c59bf.html">sumo-0.14.0</a> » <a class="el" href="../../dir_e9b8d709919855cd07b0394009af2578.html">src</a> » <a class="el" href="../../dir_fef730b7af99b175e444dabf8b9377e8.html">netbuild</a>
</div>
</div>
<div class="contents">
<h1>NBTrafficLightLogicCont.h File Reference</h1><code>#include <<a class="el" href="../../db/d16/config_8h_source.html">config.h</a>></code><br/>
<code>#include <map></code><br/>
<code>#include <string></code><br/>
<code>#include "<a class="el" href="../../dc/da1/_n_b_traffic_light_definition_8h_source.html">NBTrafficLightDefinition.h</a>"</code><br/>
<p><a href="../../d3/dd9/_n_b_traffic_light_logic_cont_8h_source.html">Go to the source code of this file.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d5e/class_n_b_traffic_light_logic_cont.html">NBTrafficLightLogicCont</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">A container for traffic light definitions and built programs. <a href="../../d9/d5e/class_n_b_traffic_light_logic_cont.html#_details">More...</a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<dl class="author"><dt><b>Author:</b></dt><dd>Daniel Krajzewicz </dd>
<dd>
Jakob Erdmann </dd>
<dd>
Michael Behrisch </dd></dl>
<dl class="date"><dt><b>Date:</b></dt><dd>Sept 2002 </dd></dl>
<dl class="version"><dt><b>Version:</b></dt><dd></dd></dl>
<dl class="rcs"><dt><b>Id</b></dt><dd><a class="el" href="../../d3/dd9/_n_b_traffic_light_logic_cont_8h.html">NBTrafficLightLogicCont.h</a> 11671 2012-01-07 20:14:30Z behrisch </dd></dl>
<p>Definition in file <a class="el" href="../../d3/dd9/_n_b_traffic_light_logic_cont_8h_source.html">NBTrafficLightLogicCont.h</a>.</p>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Tue Jul 17 12:16:15 2012 for SUMO - Simulation of Urban MObility by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
| smendez-hi/SUMO-hib | docs/doxygen/d3/dd9/_n_b_traffic_light_logic_cont_8h.html | HTML | gpl-3.0 | 3,983 |
/**
******************************************************************************
* @file BSP/Inc/main.h
* @author MCD Application Team
* @version V1.2.6
* @date 06-May-2016
* @brief Header for main.c module
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
/* Includes ------------------------------------------------------------------*/
#include "stdio.h"
#include "stm32f429i_discovery.h"
#include "stm32f429i_discovery_ts.h"
#include "stm32f429i_discovery_io.h"
#include "stm32f429i_discovery_lcd.h"
#include "stm32f429i_discovery_gyroscope.h"
#ifdef EE_M24LR64
#include "stm32f429i_discovery_eeprom.h"
#endif /*EE_M24LR64*/
/* Exported types ------------------------------------------------------------*/
typedef struct
{
void (*DemoFunc)(void);
uint8_t DemoName[50];
uint32_t DemoIndex;
}BSP_DemoTypedef;
extern const unsigned char stlogo[];
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
#define COUNT_OF_EXAMPLE(x) (sizeof(x)/sizeof(BSP_DemoTypedef))
/* Exported functions ------------------------------------------------------- */
void Joystick_demo (void);
void Touchscreen_demo (void);
void LCD_demo (void);
void MEMS_demo (void);
void Log_demo(void);
#ifdef EE_M24LR64
void EEPROM_demo (void);
#endif /*EE_M24LR64*/
void SD_demo (void);
void Touchscreen_Calibration (void);
uint16_t Calibration_GetX(uint16_t x);
uint16_t Calibration_GetY(uint16_t y);
uint8_t IsCalibrationDone(void);
uint8_t CheckForUserInput(void);
void Toggle_Leds(void);
#endif /* __MAIN_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| gnitnaw/stm32_linux | Projects/Examples/BSP/Inc/main.h | C | gpl-3.0 | 3,670 |
/*
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 |
{% extends "base.html" %}
{% block content %}
<p>
<h2>What is NLGIS?</h2>
In the nineteenth century there were more than 800 municipalities in the Netherlands, where today only about 450 remain. The NLGIS (Netherlands Geographic Information System) project is an effort to plot data for these municipalities on historically accurate municipality <a href="/site?code=TXGE&year=1986">boundaries</a> for the period 1812 - 1997.
</p>
<table border=0 valign=top width="100%">
<tr>
<td width="48%">
<h2>Key Features</h2>
The project's aim is twofold: to allow non-GIS experts to easily plot data on historical maps and to disseminate information on the maps and the underlying data from the Historical Database of Dutch Municipalities (HDNG). We do so in the following manner:
<li>Upload your own datasets and visualize the data on historically accurate map boundaries</li>
<li>Get access to the map of Netherlands on the <a href="/site?code=TXGE&year=1982&province=Noord-Holland">provincial level</a></li>
<li>Download the map in Vector (<a href="/download?year=1982&province=&code=TXGE&format=SVG">SVG</a>, <a href="/download?year=1982&province=&code=TXGE&format=shapefile">ShapeFile</a>) or Raster quality (<a href="/download?year=1982&code=TXGE">PNG</a>, <a href="/download?year=1982&province=&code=TXGE&format=PDF">PDF</a>)</li>
<li>Integrate the map with your data with popular public map services like Google Maps or Leaflet</li>
<li>Use NLGIS <a href="/developers">public Data and Geo APIs</a> and shapefiles to build your own map visualization</li>
<li>Customize your map selecting projection, colormap, data categories, number of colors, etc</li>
<li>Use <a href="/index">NLGIS datasets</a> free of charge to do your own research</li>
<table>
<tr>
<td><br/><a href="https://iisg.amsterdam"><img src="/static/socialhistory.png"></a></td>
</tr>
</table>
</td>
<td width=2%"></td>
<td width="50%">
<p>
<a href="/site?year=1889&code=VIB1"><img width=300px height=400px src="/static/map1.png"></a>
<a href="/site?code=TXGE&year=1982"><img width=300px height=400px src="/static/map2.png"></a>
</td>
</tr>
</table>
{% endblock %}
| IISH/nlgis2 | web/demo/templates/menu_start.html | HTML | gpl-3.0 | 2,136 |
<div class='fossil-doc' data-title='fileutil - file utilities'>
<style>
HTML {
background: #FFFFFF;
color: black;
}
BODY {
background: #FFFFFF;
color: black;
}
DIV.doctools {
margin-left: 10%;
margin-right: 10%;
}
DIV.doctools H1,DIV.doctools H2 {
margin-left: -5%;
}
H1, H2, H3, H4 {
margin-top: 1em;
font-family: sans-serif;
font-size: large;
color: #005A9C;
background: transparent;
text-align: left;
}
H1.doctools_title {
text-align: center;
}
UL,OL {
margin-right: 0em;
margin-top: 3pt;
margin-bottom: 3pt;
}
UL LI {
list-style: disc;
}
OL LI {
list-style: decimal;
}
DT {
padding-top: 1ex;
}
UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL {
font: normal 12pt/14pt sans-serif;
list-style: none;
}
LI.doctools_section, LI.doctools_subsection {
list-style: none;
margin-left: 0em;
text-indent: 0em;
padding: 0em;
}
PRE {
display: block;
font-family: monospace;
white-space: pre;
margin: 0%;
padding-top: 0.5ex;
padding-bottom: 0.5ex;
padding-left: 1ex;
padding-right: 1ex;
width: 100%;
}
PRE.doctools_example {
color: black;
background: #f5dcb3;
border: 1px solid black;
}
UL.doctools_requirements LI, UL.doctools_syntax LI {
list-style: none;
margin-left: 0em;
text-indent: 0em;
padding: 0em;
}
DIV.doctools_synopsis {
color: black;
background: #80ffff;
border: 1px solid black;
font-family: serif;
margin-top: 1em;
margin-bottom: 1em;
}
UL.doctools_syntax {
margin-top: 1em;
border-top: 1px solid black;
}
UL.doctools_requirements {
margin-bottom: 1em;
border-bottom: 1px solid black;
}
</style>
<hr> [
<a href="../../../../toc.html">Main Table Of Contents</a>
| <a href="../../../toc.html">Table Of Contents</a>
| <a href="../../../../index.html">Keyword Index</a>
| <a href="../../../../toc0.html">Categories</a>
| <a href="../../../../toc1.html">Modules</a>
| <a href="../../../../toc2.html">Applications</a>
] <hr>
<div class="doctools">
<h1 class="doctools_title">fileutil(n) 1.15 tcllib "file utilities"</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>fileutil - Procedures implementing some file utilities</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
<li class="doctools_section"><a href="#section1">Description</a></li>
<li class="doctools_section"><a href="#section2">Warnings and Incompatibilities</a></li>
<li class="doctools_section"><a href="#section3">Bugs, Ideas, Feedback</a></li>
<li class="doctools_section"><a href="#keywords">Keywords</a></li>
<li class="doctools_section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8</b></li>
<li>package require <b class="pkgname">fileutil <span class="opt">?1.15?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">::fileutil::lexnormalize</b> <i class="arg">path</i></a></li>
<li><a href="#2"><b class="cmd">::fileutil::fullnormalize</b> <i class="arg">path</i></a></li>
<li><a href="#3"><b class="cmd">::fileutil::test</b> <i class="arg">path</i> <i class="arg">codes</i> <span class="opt">?<i class="arg">msgvar</i>?</span> <span class="opt">?<i class="arg">label</i>?</span></a></li>
<li><a href="#4"><b class="cmd">::fileutil::cat</b> (<span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i>)...</a></li>
<li><a href="#5"><b class="cmd">::fileutil::writeFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">data</i></a></li>
<li><a href="#6"><b class="cmd">::fileutil::appendToFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">data</i></a></li>
<li><a href="#7"><b class="cmd">::fileutil::insertIntoFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">at</i> <i class="arg">data</i></a></li>
<li><a href="#8"><b class="cmd">::fileutil::removeFromFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">at</i> <i class="arg">n</i></a></li>
<li><a href="#9"><b class="cmd">::fileutil::replaceInFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">at</i> <i class="arg">n</i> <i class="arg">data</i></a></li>
<li><a href="#10"><b class="cmd">::fileutil::updateInPlace</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">cmd</i></a></li>
<li><a href="#11"><b class="cmd">::fileutil::fileType</b> <i class="arg">filename</i></a></li>
<li><a href="#12"><b class="cmd">::fileutil::find</b> <span class="opt">?<i class="arg">basedir</i> <span class="opt">?<i class="arg">filtercmd</i>?</span>?</span></a></li>
<li><a href="#13"><b class="cmd">::fileutil::findByPattern</b> <i class="arg">basedir</i> <span class="opt">?<b class="option">-regexp</b>|<b class="option">-glob</b>?</span> <span class="opt">?<b class="option">--</b>?</span> <i class="arg">patterns</i></a></li>
<li><a href="#14"><b class="cmd">::fileutil::foreachLine</b> <i class="arg">var filename cmd</i></a></li>
<li><a href="#15"><b class="cmd">::fileutil::grep</b> <i class="arg">pattern</i> <span class="opt">?<i class="arg">files</i>?</span></a></li>
<li><a href="#16"><b class="cmd">::fileutil::install</b> <span class="opt">?<b class="option">-m</b> <i class="arg">mode</i>?</span> <i class="arg">source</i> <i class="arg">destination</i></a></li>
<li><a href="#17"><b class="cmd">::fileutil::stripN</b> <i class="arg">path</i> <i class="arg">n</i></a></li>
<li><a href="#18"><b class="cmd">::fileutil::stripPwd</b> <i class="arg">path</i></a></li>
<li><a href="#19"><b class="cmd">::fileutil::stripPath</b> <i class="arg">prefix</i> <i class="arg">path</i></a></li>
<li><a href="#20"><b class="cmd">::fileutil::jail</b> <i class="arg">jail</i> <i class="arg">path</i></a></li>
<li><a href="#21"><b class="cmd">::fileutil::touch</b> <span class="opt">?<b class="option">-a</b>?</span> <span class="opt">?<b class="option">-c</b>?</span> <span class="opt">?<b class="option">-m</b>?</span> <span class="opt">?<b class="option">-r</b> <i class="arg">ref_file</i>?</span> <span class="opt">?<b class="option">-t</b> <i class="arg">time</i>?</span> <i class="arg">filename</i> <span class="opt">?<i class="arg">...</i>?</span></a></li>
<li><a href="#22"><b class="cmd">::fileutil::tempdir</b></a></li>
<li><a href="#23"><b class="cmd">::fileutil::tempdir</b> <i class="arg">path</i></a></li>
<li><a href="#24"><b class="cmd">::fileutil::tempdirReset</b></a></li>
<li><a href="#25"><b class="cmd">::fileutil::tempfile</b> <span class="opt">?<i class="arg">prefix</i>?</span></a></li>
<li><a href="#26"><b class="cmd">::fileutil::maketempdir</b> <span class="opt">?<b class="option">-prefix</b> <i class="arg">str</i>?</span> <span class="opt">?<b class="option">-suffix</b> <i class="arg">str</i>?</span> <span class="opt">?<b class="option">-dir</b> <i class="arg">str</i>?</span></a></li>
<li><a href="#27"><b class="cmd">::fileutil::relative</b> <i class="arg">base</i> <i class="arg">dst</i></a></li>
<li><a href="#28"><b class="cmd">::fileutil::relativeUrl</b> <i class="arg">base</i> <i class="arg">dst</i></a></li>
</ul>
</div>
</div>
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2>
<p>This package provides implementations of standard unix utilities.</p>
<dl class="doctools_definitions">
<dt><a name="1"><b class="cmd">::fileutil::lexnormalize</b> <i class="arg">path</i></a></dt>
<dd><p>This command performs purely lexical normalization on the <i class="arg">path</i> and returns
the changed path as its result. Symbolic links in the path are <em>not</em> resolved.</p>
<p>Examples:</p>
<pre class="doctools_example">
fileutil::lexnormalize /foo/./bar
=> /foo/bar
fileutil::lexnormalize /foo/../bar
=> /bar
</pre>
</dd>
<dt><a name="2"><b class="cmd">::fileutil::fullnormalize</b> <i class="arg">path</i></a></dt>
<dd><p>This command resolves all symbolic links in the <i class="arg">path</i> and returns
the changed path as its result.
In contrast to the builtin <b class="cmd">file normalize</b> this command
resolves a symbolic link in the last element of the path as well.</p></dd>
<dt><a name="3"><b class="cmd">::fileutil::test</b> <i class="arg">path</i> <i class="arg">codes</i> <span class="opt">?<i class="arg">msgvar</i>?</span> <span class="opt">?<i class="arg">label</i>?</span></a></dt>
<dd><p>A command for the testing of several properties of a <i class="arg">path</i>. The
properties to test for are specified in <i class="arg">codes</i>, either as a list
of keywords describing the properties, or as a string where each
letter is a shorthand for a property to test. The recognized keywords,
shorthands, and associated properties are shown in the list below. The
tests are executed in the order given to the command.</p>
<p>The result of the command is a boolean value. It will be true if and
only if the <i class="arg">path</i> passes all the specified tests.
In the case of the <i class="arg">path</i> not passing one or more test the first
failing test will leave a message in the variable referenced by
<i class="arg">msgvar</i>, if such is specified. The message will be prefixed with
<i class="arg">label</i>, if it is specified.
<em>Note</em> that the variabled referenced by <i class="arg">msgvar</i> is not touched at
all if all the tests pass.</p>
<dl class="doctools_definitions">
<dt><em>r</em>ead</dt>
<dd><p><b class="cmd">file readable</b></p></dd>
<dt><em>w</em>rite</dt>
<dd><p><b class="cmd">file writable</b></p></dd>
<dt><em>e</em>xists</dt>
<dd><p><b class="cmd">file exists</b></p></dd>
<dt>e<em>x</em>ec</dt>
<dd><p><b class="cmd">file executable</b></p></dd>
<dt><em>f</em>ile</dt>
<dd><p><b class="cmd">file isfile</b></p></dd>
<dt><em>d</em>ir</dt>
<dd><p><b class="cmd">file isdirectory</b></p></dd>
</dl></dd>
<dt><a name="4"><b class="cmd">::fileutil::cat</b> (<span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i>)...</a></dt>
<dd><p>A tcl implementation of the UNIX <b class="syscmd"><a href="../../../../index.html#key314">cat</a></b> command. Returns the
contents of the specified file(s). The arguments are files to read,
with interspersed options configuring the process. If there are
problems reading any of the files, an error will occur, and no data
will be returned.</p>
<p>The options accepted are <b class="option">-encoding</b>, <b class="option">-translation</b>,
<b class="option">-eofchar</b>, and <b class="option">--</b>. With the exception of the last all
options take a single value as argument, as specified by the tcl
builtin command <b class="cmd">fconfigure</b>. The <b class="option">--</b> has to be used to
terminate option processing before a file if that file's name begins
with a dash.</p>
<p>Each file can have its own set of options coming before it, and for
anything not specified directly the defaults are inherited from the
options of the previous file. The first file inherits the system
default for unspecified options.</p></dd>
<dt><a name="5"><b class="cmd">::fileutil::writeFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">data</i></a></dt>
<dd><p>The command replaces the current contents of the specified <i class="arg">file</i>
with <i class="arg">data</i>, with the process configured by the options. The
command accepts the same options as <b class="cmd">::fileutil::cat</b>. The
specification of a non-existent file is legal and causes the command
to create the file (and all required but missing directories).</p></dd>
<dt><a name="6"><b class="cmd">::fileutil::appendToFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">data</i></a></dt>
<dd><p>This command is like <b class="cmd">::fileutil::writeFile</b>, except that the
previous contents of <i class="arg">file</i> are not replaced, but appended to. The
command accepts the same options as <b class="cmd">::fileutil::cat</b></p></dd>
<dt><a name="7"><b class="cmd">::fileutil::insertIntoFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">at</i> <i class="arg">data</i></a></dt>
<dd><p>This comment is similar to <b class="cmd">::fileutil::appendToFile</b>, except that
the new data is not appended at the end, but inserted at a specified
location within the file. In further contrast this command has to be
given the path to an existing file. It will not create a missing file,
but throw an error instead.</p>
<p>The specified location <i class="arg">at</i> has to be an integer number in the
range <b class="const">0</b> ... [file size <i class="arg">file</i>]. <b class="const">0</b> will cause
insertion of the new data before the first character of the existing
content, whereas [file size <i class="arg">file</i>] causes insertion after
the last character of the existing content, i.e. appending.</p>
<p>The command accepts the same options as <b class="cmd">::fileutil::cat</b>.</p></dd>
<dt><a name="8"><b class="cmd">::fileutil::removeFromFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">at</i> <i class="arg">n</i></a></dt>
<dd><p>This command is the complement to <b class="cmd">::fileutil::insertIntoFile</b>, removing <i class="arg">n</i> characters from the <i class="arg">file</i>, starting at location <i class="arg">at</i>.
The specified location <i class="arg">at</i> has to be an integer number in the
range <b class="const">0</b> ... [file size <i class="arg">file</i>] - <i class="arg">n</i>. <b class="const">0</b>
will cause the removal of the new data to start with the first
character of the existing content,
whereas [file size <i class="arg">file</i>] - <i class="arg">n</i> causes the removal of
the tail of the existing content, i.e. the truncation of the file.</p>
<p>The command accepts the same options as <b class="cmd">::fileutil::cat</b>.</p></dd>
<dt><a name="9"><b class="cmd">::fileutil::replaceInFile</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">at</i> <i class="arg">n</i> <i class="arg">data</i></a></dt>
<dd><p>This command is a combination of <b class="cmd">::fileutil::removeFromFile</b> and
<b class="cmd">::fileutil::insertIntoFile</b>. It first removes the part of the
contents specified by the arguments <i class="arg">at</i> and <i class="arg">n</i>, and then
inserts <i class="arg">data</i> at the given location, effectively replacing the
removed by content with <i class="arg">data</i>.
All constraints imposed on <i class="arg">at</i> and <i class="arg">n</i> by
<b class="cmd">::fileutil::removeFromFile</b> and <b class="cmd">::fileutil::insertIntoFile</b>
are obeyed.</p>
<p>The command accepts the same options as <b class="cmd">::fileutil::cat</b>.</p></dd>
<dt><a name="10"><b class="cmd">::fileutil::updateInPlace</b> <span class="opt">?<i class="arg">options</i>?</span> <i class="arg">file</i> <i class="arg">cmd</i></a></dt>
<dd><p>This command can be seen as the generic core functionality of
<b class="cmd">::fileutil::replaceInFile</b>.
It first reads the contents of the specified <i class="arg">file</i>, then runs the
command prefix <i class="arg">cmd</i> with that data appended to it, and at last
writes the result of that invokation back as the new contents of the
file.</p>
<p>If the executed command throws an error the <i class="arg">file</i> is not changed.</p>
<p>The command accepts the same options as <b class="cmd">::fileutil::cat</b>.</p></dd>
<dt><a name="11"><b class="cmd">::fileutil::fileType</b> <i class="arg">filename</i></a></dt>
<dd><p>An implementation of the UNIX <b class="syscmd"><a href="../../../../index.html#key31">file</a></b> command, which uses
various heuristics to guess the type of a file. Returns a list
specifying as much type information as can be determined about the
file, from most general (eg, "binary" or "text") to most specific (eg,
"gif"). For example, the return value for a GIF file would be "binary
graphic gif". The command will detect the following types of files:
directory, empty, binary, text, script (with interpreter), executable
elf, executable dos, executable ne, executable pe, graphic gif, graphic
jpeg, graphic png, graphic tiff, graphic bitmap, html, xml (with doctype
if available), message pgp, binary pdf, text ps, text eps, binary
gravity_wave_data_frame, compressed bzip, compressed gzip, compressed
zip, compressed tar, audio wave, audio mpeg, and link. It further
detects doctools, doctoc, and docidx documentation files, and
tklib diagrams.</p></dd>
<dt><a name="12"><b class="cmd">::fileutil::find</b> <span class="opt">?<i class="arg">basedir</i> <span class="opt">?<i class="arg">filtercmd</i>?</span>?</span></a></dt>
<dd><p>An implementation of the unix command <b class="syscmd"><a href="../../../../index.html#key630">find</a></b>. Adapted from the
Tcler's Wiki. Takes at most two arguments, the path to the directory
to start searching from and a command to use to evaluate interest in
each file. The path defaults to "<b class="file">.</b>", i.e. the current
directory. The command defaults to the empty string, which means that
all files are of interest. The command takes care <em>not</em> to
lose itself in infinite loops upon encountering circular link
structures. The result of the command is a list containing the paths
to the interesting files.</p>
<p>The <i class="arg">filtercmd</i>, if specified, is interpreted as a command prefix
and one argument is added to it, the name of the file or directory
find is currently looking at. Note that this name is <em>not</em> fully
qualified. It has to be joined it with the result of <b class="cmd">pwd</b> to get
an absolute filename.</p>
<p>The result of <i class="arg">filtercmd</i> is a boolean value that indicates if the
current file should be included in the list of interesting files.</p>
<p>Example:</p>
<pre class="doctools_example">
# find .tcl files
package require fileutil
proc is_tcl {name} {return [string match *.tcl $name]}
set tcl_files [fileutil::find . is_tcl]
</pre>
</dd>
<dt><a name="13"><b class="cmd">::fileutil::findByPattern</b> <i class="arg">basedir</i> <span class="opt">?<b class="option">-regexp</b>|<b class="option">-glob</b>?</span> <span class="opt">?<b class="option">--</b>?</span> <i class="arg">patterns</i></a></dt>
<dd><p>This command is based upon the <b class="package">TclX</b> command
<b class="cmd">recursive_glob</b>, except that it doesn't allow recursion over more
than one directory at a time. It uses <b class="cmd">::fileutil::find</b>
internally and is thus able to and does follow symbolic links,
something the <b class="package">TclX</b> command does not do. First argument is
the directory to start the search in, second argument is a list of
<i class="arg">patterns</i>. The command returns a list of all files reachable
through <i class="arg">basedir</i> whose names match at least one of the
patterns. The options before the pattern-list determine the style of
matching, either regexp or glob. glob-style matching is the default if
no options are given. Usage of the option <b class="option">--</b> stops option
processing. This allows the use of a leading '-' in the patterns.</p></dd>
<dt><a name="14"><b class="cmd">::fileutil::foreachLine</b> <i class="arg">var filename cmd</i></a></dt>
<dd><p>The command reads the file <i class="arg">filename</i> and executes the script
<i class="arg">cmd</i> for every line in the file. During the execution of the
script the variable <i class="arg">var</i> is set to the contents of the current
line. The return value of this command is the result of the last
invocation of the script <i class="arg">cmd</i> or the empty string if the file was
empty.</p></dd>
<dt><a name="15"><b class="cmd">::fileutil::grep</b> <i class="arg">pattern</i> <span class="opt">?<i class="arg">files</i>?</span></a></dt>
<dd><p>Implementation of <b class="syscmd"><a href="../../../../index.html#key316">grep</a></b>. Adapted from the Tcler's Wiki. The
first argument defines the <i class="arg">pattern</i> to search for. This is
followed by a list of <i class="arg">files</i> to search through. The list is
optional and <b class="const">stdin</b> will be used if it is missing. The result
of the procedures is a list containing the matches. Each match is a
single element of the list and contains filename, number and contents
of the matching line, separated by a colons.</p></dd>
<dt><a name="16"><b class="cmd">::fileutil::install</b> <span class="opt">?<b class="option">-m</b> <i class="arg">mode</i>?</span> <i class="arg">source</i> <i class="arg">destination</i></a></dt>
<dd><p>The <b class="cmd">install</b> command is similar in functionality to the <b class="syscmd">install</b>
command found on many unix systems, or the shell script
distributed with many source distributions (unix/install-sh in the Tcl
sources, for example). It copies <i class="arg">source</i>, which can be either a
file or directory to <i class="arg">destination</i>, which should be a directory,
unless <i class="arg">source</i> is also a single file. The <span class="opt">?-m?</span> option lets
the user specify a unix-style mode (either octal or symbolic - see
<b class="cmd">file attributes</b>.</p></dd>
<dt><a name="17"><b class="cmd">::fileutil::stripN</b> <i class="arg">path</i> <i class="arg">n</i></a></dt>
<dd><p>Removes the first <i class="arg">n</i> elements from the specified <i class="arg">path</i> and
returns the modified path. If <i class="arg">n</i> is greater than the number of
components in <i class="arg">path</i> an empty string is returned. The number of
components in a given path may be determined by performing
<b class="cmd">llength</b> on the list returned by <b class="cmd">file split</b>.</p></dd>
<dt><a name="18"><b class="cmd">::fileutil::stripPwd</b> <i class="arg">path</i></a></dt>
<dd><p>If, and only if the <i class="arg">path</i> is inside of the directory returned by
[<b class="cmd">pwd</b>] (or the current working directory itself) it is made
relative to that directory. In other words, the current working
directory is stripped from the <i class="arg">path</i>. The possibly modified path
is returned as the result of the command. If the current working
directory itself was specified for <i class="arg">path</i> the result is the string
"<b class="const">.</b>".</p></dd>
<dt><a name="19"><b class="cmd">::fileutil::stripPath</b> <i class="arg">prefix</i> <i class="arg">path</i></a></dt>
<dd><p>If, and only of the <i class="arg">path</i> is inside of the directory
"<b class="file">prefix</b>" (or the prefix directory itself) it is made relative to
that directory. In other words, the prefix directory is stripped from
the <i class="arg">path</i>. The possibly modified path is returned as the result
of the command.
If the prefix directory itself was specified for <i class="arg">path</i> the result
is the string "<b class="const">.</b>".</p></dd>
<dt><a name="20"><b class="cmd">::fileutil::jail</b> <i class="arg">jail</i> <i class="arg">path</i></a></dt>
<dd><p>This command ensures that the <i class="arg">path</i> is not escaping the directory
<i class="arg">jail</i>. It always returns an absolute path derived from <i class="arg">path</i>
which is within <i class="arg">jail</i>.</p>
<p>If <i class="arg">path</i> is an absolute path and already within <i class="arg">jail</i> it is
returned unmodified.</p>
<p>An absolute path outside of <i class="arg">jail</i> is stripped of its root element
and then put into the <i class="arg">jail</i> by prefixing it with it. The same
happens if <i class="arg">path</i> is relative, except that nothing is stripped of
it. Before adding the <i class="arg">jail</i> prefix the <i class="arg">path</i> is lexically
normalized to prevent the caller from using <b class="const">..</b> segments in
<i class="arg">path</i> to escape the jail.</p></dd>
<dt><a name="21"><b class="cmd">::fileutil::touch</b> <span class="opt">?<b class="option">-a</b>?</span> <span class="opt">?<b class="option">-c</b>?</span> <span class="opt">?<b class="option">-m</b>?</span> <span class="opt">?<b class="option">-r</b> <i class="arg">ref_file</i>?</span> <span class="opt">?<b class="option">-t</b> <i class="arg">time</i>?</span> <i class="arg">filename</i> <span class="opt">?<i class="arg">...</i>?</span></a></dt>
<dd><p>Implementation of <b class="syscmd"><a href="../../../../index.html#key317">touch</a></b>. Alter the atime and mtime of the
specified files. If <b class="option">-c</b>, do not create files if they do not
already exist. If <b class="option">-r</b>, use the atime and mtime from
<i class="arg">ref_file</i>. If <b class="option">-t</b>, use the integer clock value
<i class="arg">time</i>. It is illegal to specify both <b class="option">-r</b> and
<b class="option">-t</b>. If <b class="option">-a</b>, only change the atime. If <b class="option">-m</b>,
only change the mtime.</p>
<p><em>This command is not available for Tcl versions less than 8.3.</em></p></dd>
<dt><a name="22"><b class="cmd">::fileutil::tempdir</b></a></dt>
<dd><p>The command returns the path of a directory where the caller can
place temporary files, such as "<b class="file">/tmp</b>" on Unix systems. The
algorithm we use to find the correct directory is as follows:</p>
<ol class="doctools_enumerated">
<li><p>The directory set by an invokation of <b class="cmd">::fileutil::tempdir</b> with
an argument. If this is present it is tried exclusively and none of
the following item are tried.</p></li>
<li><p>The directory named in the TMPDIR environment variable.</p></li>
<li><p>The directory named in the TEMP environment variable.</p></li>
<li><p>The directory named in the TMP environment variable.</p></li>
<li><p>A platform specific location:</p>
<dl class="doctools_definitions">
<dt>Windows</dt>
<dd><p>"<b class="file">C:\TEMP</b>", "<b class="file">C:\TMP</b>", "<b class="file">\TEMP</b>",
and "<b class="file">\TMP</b>" are tried in that order.</p></dd>
<dt>(classic) Macintosh</dt>
<dd><p>The TRASH_FOLDER environment variable is used. This is most likely
not correct.</p></dd>
<dt>Unix</dt>
<dd><p>The directories "<b class="file">/tmp</b>", "<b class="file">/var/tmp</b>", and "<b class="file">/usr/tmp</b>" are
tried in that order.</p></dd>
</dl>
</li>
</ol>
<p>The algorithm utilized is mainly that used in the Python standard
library. The exception is the first item, the ability to have the
search overridden by a user-specified directory.</p></dd>
<dt><a name="23"><b class="cmd">::fileutil::tempdir</b> <i class="arg">path</i></a></dt>
<dd><p>In this mode the command sets the <i class="arg">path</i> as the first and only
directory to try as a temp. directory. See the previous item for the
use of the set directory. The command returns the empty string.</p></dd>
<dt><a name="24"><b class="cmd">::fileutil::tempdirReset</b></a></dt>
<dd><p>Invoking this command clears the information set by the
last call of [<b class="cmd">::fileutil::tempdir</b> <i class="arg">path</i>].
See the last item too.</p></dd>
<dt><a name="25"><b class="cmd">::fileutil::tempfile</b> <span class="opt">?<i class="arg">prefix</i>?</span></a></dt>
<dd><p>The command generates a temporary file name suitable for writing to,
and the associated file. The file name will be unique, and the file
will be writable and contained in the appropriate system specific temp
directory. The name of the file will be returned as the result of the
command.</p>
<p>The code was taken from <a href="http://wiki.tcl.tk/772">http://wiki.tcl.tk/772</a>, attributed to
Igor Volobouev and anon.</p></dd>
<dt><a name="26"><b class="cmd">::fileutil::maketempdir</b> <span class="opt">?<b class="option">-prefix</b> <i class="arg">str</i>?</span> <span class="opt">?<b class="option">-suffix</b> <i class="arg">str</i>?</span> <span class="opt">?<b class="option">-dir</b> <i class="arg">str</i>?</span></a></dt>
<dd><p>The command generates a temporary directory suitable for writing to.
The directory name will be unique, and the directory will be writable
and contained in the appropriate system specific temp directory. The
name of the directory will be returned as the result of the command.</p>
<p>The three options can used to tweak the behaviour of the command:</p>
<dl class="doctools_options">
<dt><b class="option">-prefix</b> str</dt>
<dd><p>The initial, fixed part of the directory name. Defaults to <b class="const">tmp</b> if not specified.</p></dd>
<dt><b class="option">-suffix</b> str</dt>
<dd><p>The fixed tail of the directory. Defaults to the empty string if not specified.</p></dd>
<dt><b class="option">-dir</b> str</dt>
<dd><p>The directory to place the new directory into. Defaults to the result of <b class="cmd">fileutil::tempdir</b> if not specified.</p></dd>
</dl>
<p>The initial code for this was supplied by <a href="mailto:[email protected]">Miguel Martinez Lopez</a>.</p></dd>
<dt><a name="27"><b class="cmd">::fileutil::relative</b> <i class="arg">base</i> <i class="arg">dst</i></a></dt>
<dd><p>This command takes two directory paths, both either absolute or relative
and computes the path of <i class="arg">dst</i> relative to <i class="arg">base</i>. This relative
path is returned as the result of the command. As implied in the previous
sentence, the command is not able to compute this relationship between the
arguments if one of the paths is absolute and the other relative.</p>
<p><em>Note:</em> The processing done by this command is purely lexical.
Symbolic links are <em>not</em> taken into account.</p></dd>
<dt><a name="28"><b class="cmd">::fileutil::relativeUrl</b> <i class="arg">base</i> <i class="arg">dst</i></a></dt>
<dd><p>This command takes two file paths, both either absolute or relative
and computes the path of <i class="arg">dst</i> relative to <i class="arg">base</i>, as seen
from inside of the <i class="arg">base</i>. This is the algorithm how a browser
resolves a relative link found in the currently shown file.</p>
<p>The computed relative path is returned as the result of the command.
As implied in the previous sentence, the command is not able to compute
this relationship between the arguments if one of the paths is absolute
and the other relative.</p>
<p><em>Note:</em> The processing done by this command is purely lexical.
Symbolic links are <em>not</em> taken into account.</p></dd>
</dl>
</div>
<div id="section2" class="doctools_section"><h2><a name="section2">Warnings and Incompatibilities</a></h2>
<dl class="doctools_definitions">
<dt><b class="const">1.14.9</b></dt>
<dd><p>In this version <b class="cmd">fileutil::find</b>'s broken system for handling
symlinks was replaced with one working correctly and properly
enumerating all the legal non-cyclic paths under a base directory.</p>
<p>While correct this means that certain pathological directory
hierarchies with cross-linked sym-links will now take about O(n**2)
time to enumerate whereas the original broken code managed O(n) due to
its brokenness.</p>
<p>A concrete example and extreme case is the "<b class="file">/sys</b>"
hierarchy under Linux where some hundred devices exist under both
"<b class="file">/sys/devices</b>" and "<b class="file">/sys/class</b>" with the two sub-hierarchies
linking to the other, generating millions of legal paths to enumerate.
The structure, reduced to three devices, roughly looks like</p>
<pre class="doctools_example">
/sys/class/tty/tty0 --> ../../dev/tty0
/sys/class/tty/tty1 --> ../../dev/tty1
/sys/class/tty/tty2 --> ../../dev/tty1
/sys/dev/tty0/bus
/sys/dev/tty0/subsystem --> ../../class/tty
/sys/dev/tty1/bus
/sys/dev/tty1/subsystem --> ../../class/tty
/sys/dev/tty2/bus
/sys/dev/tty2/subsystem --> ../../class/tty
</pre>
<p>The command <b class="cmd">fileutil::find</b> currently has no way to escape
this. When having to handle such a pathological hierarchy It is
recommended to switch to package <b class="package">fileutil::traverse</b> and the
same-named command it provides, and then use the <b class="option">-prefilter</b>
option to prevent the traverser from following symbolic links, like so:</p>
<pre class="doctools_example">
package require fileutil::traverse
proc NoLinks {fileName} {
if {[string equal [file type $fileName] link]} {
return 0
}
return 1
}
fileutil::traverse T /sys/devices -prefilter NoLinks
T foreach p {
puts $p
}
T destroy
</pre>
</dd>
</dl>
</div>
<div id="section3" class="doctools_section"><h2><a name="section3">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>fileutil</em> of the
<a href="http://core.tcl.tk/tcllib/reportlist">Tcllib Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
</div>
<div id="keywords" class="doctools_section"><h2><a name="keywords">Keywords</a></h2>
<p><a href="../../../../index.html#key314">cat</a>, <a href="../../../../index.html#key115">file utilities</a>, <a href="../../../../index.html#key316">grep</a>, <a href="../../../../index.html#key315">temp file</a>, <a href="../../../../index.html#key313">test</a>, <a href="../../../../index.html#key317">touch</a>, <a href="../../../../index.html#key117">type</a></p>
</div>
<div id="category" class="doctools_section"><h2><a name="category">Category</a></h2>
<p>Programming tools</p>
</div>
</div>
| donomii/svarmr | tcltk/share/doc/tcllib/tcllib/files/modules/fileutil/fileutil.html | HTML | gpl-3.0 | 34,323 |
/*
Copyright (C) 2004 Jacquelin POTIER <[email protected]>
Dynamic aspect ratio code Copyright (C) 2004 Jacquelin POTIER <[email protected]>
originally based from APISpy32 v2.1 from Yariv Kaplan @ WWW.INTERNALS.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; version 2 of the License.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//-----------------------------------------------------------------------------
// Object: exported structs (needed for overriding api)
//-----------------------------------------------------------------------------
#pragma once
#include <windows.h>
#include "registers.h"
// assume that structs share between WinAPIOverride and the FakeAPI dll
// will have the same alignment
#pragma pack(push)
#pragma pack(4)
typedef struct tagPrePostApiCallHookInfos
{
PBYTE Rbp;
PBYTE ReturnAddress;
HMODULE CallingModuleHandle;
BOOL OverridingModulesFiltersSuccessfullyChecked;
}PRE_POST_API_CALL_HOOK_INFOS,*PPRE_POST_API_CALL_HOOK_INFOS;
#pragma pack(pop)
#ifdef _WIN64
// StackParameters : adjusted stack parameters (no shadow for x64, only parameters passed through stack)
typedef BOOL (__stdcall *pfPreApiCallCallBack)(PBYTE StackParameters,REGISTERS* pBeforeCallRegisters,XMM_REGISTERS* pBeforeCallXmmRegisters,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos,PVOID UserParam);// return FALSE to stop pre api call chain functions
// StackParameters : adjusted stack parameters (no shadow for x64, only parameters passed through stack)
typedef BOOL (__stdcall *pfPostApiCallCallBack)(PBYTE StackParameters,REGISTERS* pBeforeCallRegisters,XMM_REGISTERS* pBeforeCallXmmRegisters,REGISTERS* pAfterCallRegisters,XMM_REGISTERS* pAfterCallXmmRegisters,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos,PVOID UserParam);// return FALSE to stop calling post api call chain functions
#else
typedef BOOL (__stdcall *pfPreApiCallCallBack)(PBYTE StackParameters,REGISTERS* pBeforeCallRegisters,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos,PVOID UserParam);// return FALSE to stop pre api call chain functions
typedef BOOL (__stdcall *pfPostApiCallCallBack)(PBYTE StackParameters,REGISTERS* pBeforeCallRegisters,REGISTERS* pAfterCallRegisters,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos,PVOID UserParam);// return FALSE to stop calling post api call chain functions
#endif
typedef BOOL (__stdcall *pfCOMObjectCreationCallBack)(CLSID* pClsid,IID* pIid,PVOID pInterface,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos);// return FALSE to stop calling post api call chain functions
typedef BOOL (__stdcall *pfCOMObjectDeletionCallBack)(CLSID* pClsid,PVOID pIUnknownInterface,PVOID pInterfaceReturnedAtObjectCreation,PRE_POST_API_CALL_HOOK_INFOS* pHookInfos);// return FALSE to stop calling post api call chain functions
| uholeschak/ediabaslib | Tools/Win32Override/_Common_Files/ExportedStructs.h | C | gpl-3.0 | 3,256 |
/*
* $Id: channel_manager.h 44 2011-02-15 12:32:29Z kaori $
*
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CHANNEL_MANAGER_H_
# define CHANNEL_MANAGER_H_
#include <time.h>
#include "query_parser.h"
#include "cachemodel_manager.h"
#include "auxtrans_manager.h"
/** maximum length of channel identifier*/
#define MAX_LENOFCID 30
/** Channel parameters*/
typedef struct channel_param{
cachemodel_param_t *cachemodel; /**< reference pointer to the cache model*/
char cid[MAX_LENOFCID]; /**< channel identifier*/
cnew_transport_t aux; /**< auxiliary transport*/
/* - a record of the client's capabilities and preferences to the extent that the server queues requests*/
time_t start_tm; /**< starting time*/
struct channel_param *next; /**< pointer to the next channel*/
} channel_param_t;
/** Channel list parameters*/
typedef struct channellist_param{
channel_param_t *first; /**< first channel pointer of the list*/
channel_param_t *last; /**< last channel pointer of the list*/
} channellist_param_t;
/**
* generate a channel list
*
* @return pointer to the generated channel list
*/
channellist_param_t * gene_channellist(void);
/**
* generate a channel under the channel list
*
* @param[in] query_param query parameters
* @param[in] auxtrans auxiliary transport
* @param[in] cachemodel reference cachemodel
* @param[in] channellist channel list pointer
* @return pointer to the generated channel
*/
channel_param_t * gene_channel( query_param_t query_param, auxtrans_param_t auxtrans, cachemodel_param_t *cachemodel, channellist_param_t *channellist);
/**
* set channel variable parameters
*
* @param[in] query_param query parameters
* @param[in,out] channel pointer to the modifying channel
*/
void set_channel_variable_param( query_param_t query_param, channel_param_t *channel);
/**
* delete a channel
*
* @param[in] channel address of the deleting channel pointer
* @param[in,out] channellist channel list pointer
*/
void delete_channel( channel_param_t **channel, channellist_param_t *channellist);
/**
* delete channel list
*
* @param[in,out] channellist address of the channel list pointer
*/
void delete_channellist( channellist_param_t **channellist);
/**
* print all channel parameters
*
* @param[in] channellist channel list pointer
*/
void print_allchannel( channellist_param_t *channellist);
/**
* search a channel by channel ID
*
* @param[in] cid channel identifier
* @param[in] channellist channel list pointer
* @return found channel pointer
*/
channel_param_t * search_channel( char cid[], channellist_param_t *channellist);
#endif /* !CHANNEL_MANAGER_H_ */
| droidapps/pdfreader4Android | deps/openjpeg-1.5.1/applications/jpip/libopenjpip/channel_manager.h | C | gpl-3.0 | 4,258 |
#ifndef PLANG_TOKENIZER
#define PLANG_TOKENIZER
#include <map>
#include <vector>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
class PlangTokenizer {
// Input buffer
std::string m_input;
// Current possition in input buffer
std::size_t m_input_pos;
// Currently read element from input
int m_ch;
// Counterss
int m_input_line; // Which line it is in the source code (0, 1,2,3...)
int m_input_column; // Which column it is in the source code (0, 1,2,3...)
// Simple input + counters initializer
void input_init() {
m_input.clear();
m_input_pos = 0;
// Counters
m_input_line = 0;
m_input_column = 0;
}
public:
// Return counter with current line
int get_line() {
return m_input_line;
}
// Return counter with current column
int get_column() {
return m_input_column;
}
// Returns nth line of input
std::string get_line_str(const int line) {
std::string::iterator b = m_input.begin();
std::string::iterator e = m_input.end();
for (int i = 0 ; i < line ; ++i) {
b = std::find(b, e, '\n');
}
return std::string(b, std::find(b, e, '\n'));
}
// Token values
struct TokenValue {
std::string s;
int i;
float f;
} m_token_value;
// Token types outputed by tokenizer
struct Token {
enum {
// Language values
END = -1, // EOF!
ID = -2,
INT = -3,
FLT = -4,
STR = -5,
// Language keywords
RETURN = -100,
IF = -200,
ELSE = -201,
AS = -202,
};
}; // Last read token
// Mapping between keyword and token
std::map<std::string, int> m_keyword_token_map = {
{"return", Token::RETURN},
{"if", Token::IF},
{"else", Token::ELSE},
{"as", Token::AS},
};
// Load all characters from input
void load_input(const char *input, int size) {
input_init();
m_input = std::string(input, input + size);
}
// Load from string input
void load_input(const char *input) {
input_init();
m_input = std::string(input);
}
// Return next element of input buffer
int get_next_consume() {
if (m_input_pos == m_input.size())
return Token::END;
return m_input[m_input_pos++];
}
// Get next element from the input and store it
// in m_ch temporary value buffer to use after call
int get_next() {
m_ch = get_next_consume();
// Collect some counter statistics
m_input_column++;
if (m_ch == '\n') {
m_input_column = 0;
m_input_line++;
}
return m_ch;
}
// Sneak-peak next token
int get_next_preview() {
if (m_input_pos == m_input.size())
return Token::END;
return m_input[m_input_pos];
}
// like isalpha checks if c is in set of allowed
// identifier charset
int isidchar(int c) {
return std::isalpha(c) || std::isdigit(c) || c == '_';
}
// Parse input and get next token
int get_token_val() {
while (std::isspace(get_next())) {
// Skipping all whitespaces
}
if (m_ch == Token::END)
return Token::END;
if (std::isalpha(m_ch)) {
// ID: alphanumeric
// KEYWORD: alphanumeric
m_token_value.s = m_ch;
while (isidchar(get_next_preview())) {
m_token_value.s += get_next();
}
// If identifier is a keyword return keyword token
if (m_keyword_token_map.find(m_token_value.s) != m_keyword_token_map.end()) {
return m_keyword_token_map.at(m_token_value.s);
}
// Generic identifier
return Token::ID;
} else if (std::isdigit(m_ch)) {
// INT: plain integer
m_token_value.s = m_ch;
while (std::isdigit(get_next_preview())) {
m_token_value.s += get_next();
}
m_token_value.i = std::atoi(m_token_value.s.c_str());
return Token::INT;
}
// Return read character
m_token_value.s = m_ch;
return m_ch;
}
// Get next token and saves int vaue in the buffer
int get_token() {
return get_token_val();
}
const TokenValue& get_token_value() {
return m_token_value;
}
};
#endif
| PrzemekWirkus/plang | include/plang_tokenizer.h | C | gpl-3.0 | 4,712 |
// Author:
// Noah Ablaseau <[email protected]>
//
// 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 |
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Change log:
* 06/29/95 - Modified to handle flow control for writing (Tuyen Nguyen)
* Modified for MP, 1996 by Tuyen Nguyen
* Modified, April 9, 1997 by Tuyen Nguyen for MacOSX.
*/
#define RESOLVE_DBG
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/param.h>
#include <machine/spl.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/filedesc.h>
#include <sys/fcntl.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <netat/sysglue.h>
#include <netat/appletalk.h>
#include <netat/at_pcb.h>
#include <netat/ddp.h>
#include <netat/adsp.h>
#include <netat/adsp_internal.h>
#ifdef notdefn
struct adsp_debug adsp_dtable[1025];
int ad_entry = 0;
#endif
int
adspAllocateCCB(gref)
register gref_t *gref; /* READ queue */
{
gbuf_t *ccb_mp;
register CCBPtr sp;
if (!(ccb_mp = gbuf_alloc(sizeof(CCB), PRI_LO))) {
return (0);
}
bzero((caddr_t) gbuf_rptr(ccb_mp), sizeof(CCB));
gbuf_wset(ccb_mp,sizeof(CCB));
gref->info = (caddr_t) ccb_mp;
sp = (CCBPtr)gbuf_rptr(((gbuf_t *)gref->info));
sp->pid = gref->pid; /* save the caller process pointer */
sp->gref = gref; /* save a back pointer to the WRITE queue */
sp->sp_mp = ccb_mp; /* and its message block */
return 1;
}
int
adspRelease(gref)
register gref_t *gref; /* READ queue */
{
register CCBPtr sp;
if (gref->info) {
sp = (CCBPtr)gbuf_rptr(((gbuf_t *)gref->info));
/* Tells completion routine of close */
/* packet to remove us. */
if (sp->state == sPassive || sp->state == sClosed ||
sp->state == sOpening || sp->state == sListening) {
if (sp->state == sListening)
CompleteQueue(&sp->opb, errAborted);
sp->removing = 1; /* Prevent allowing another dspClose. */
DoClose(sp, errAborted, 0); /* will remove CCB */
return 0;
} else { /* sClosing & sOpen */
sp->state = sClosing;
}
if (CheckOkToClose(sp)) { /* going to close */
sp->sendCtl = B_CTL_CLOSE; /* Send close advice */
} else {
CheckSend(sp); /* try one more time to send out data */
if (sp->state != sClosed)
sp->sendCtl = B_CTL_CLOSE; /* Setup to send close advice */
}
CheckSend(sp); /* and force out the close */
sp->removing = 1; /* Prevent allowing another dspClose. */
sp->state = sClosed;
DoClose(sp, errAborted, 0); /* to closed and remove CCB */
}
return 0;
}
int
adspWriteHandler(gref, mp)
gref_t *gref; /* WRITE queue */
gbuf_t *mp;
{
register ioc_t *iocbp;
register struct adspcmd *ap;
int error, flag;
void *sp;
switch(gbuf_type(mp)) {
case MSG_DATA:
if (gref->info == 0) {
gbuf_freem(mp);
return(STR_IGNORE);
}
/*
* Fill in the global stuff
*/
ap = (struct adspcmd *)gbuf_rptr(mp);
ap->gref = gref;
ap->ioc = 0;
ap->mp = mp;
sp = (void *)gbuf_rptr(((gbuf_t *)gref->info));
switch(ap->csCode) {
case dspWrite:
if ((error = adspWrite(sp, ap)))
gbuf_freem(mp);
return(STR_IGNORE);
case dspAttention:
if ((error = adspAttention(sp, (CCBPtr)ap)))
gbuf_freem(mp);
return(STR_IGNORE);
}
case MSG_IOCTL:
if (gref->info == 0) {
adspioc_ack(EPROTOTYPE, mp, gref);
return(STR_IGNORE);
}
iocbp = (ioc_t *) gbuf_rptr(mp);
if (ADSP_IOCTL(iocbp->ioc_cmd)) {
iocbp->ioc_count = sizeof(*ap) - 1;
if (gbuf_cont(mp) == 0) {
adspioc_ack(EINVAL, mp, gref);
return(STR_IGNORE);
}
ap = (struct adspcmd *) gbuf_rptr(gbuf_cont(mp));
ap->gref = gref;
ap->ioc = (caddr_t) mp;
ap->mp = gbuf_cont(mp); /* request head */
ap->ioResult = 0;
if ((gref->info == 0) && ((iocbp->ioc_cmd != ADSPOPEN) &&
(iocbp->ioc_cmd != ADSPCLLISTEN))) {
ap->ioResult = errState;
adspioc_ack(EINVAL, mp, gref);
return(STR_IGNORE);
}
} else
return(STR_PUTNEXT); /* pass it on down */
sp = (void *)gbuf_rptr(((gbuf_t *)gref->info));
switch(iocbp->ioc_cmd) {
case ADSPOPEN:
case ADSPCLLISTEN:
ap->socket = ((CCBPtr)sp)->localSocket;
flag = (adspMode(ap) == ocAccept) ? 1 : 0;
if (flag && ap->socket) {
if (adspDeassignSocket((CCBPtr)sp) >= 0)
ap->socket = 0;
}
if ((ap->socket == 0) &&
((ap->socket =
(at_socket)adspAssignSocket(gref, flag)) == 0)) {
adspioc_ack(EADDRNOTAVAIL, mp, gref);
return(STR_IGNORE);
}
ap->csCode = iocbp->ioc_cmd == ADSPOPEN ? dspInit : dspCLInit;
if ((error = adspInit(sp, ap)) == 0) {
switch(ap->csCode) {
case dspInit:
/* and open the connection */
ap->csCode = dspOpen;
error = adspOpen(sp, ap);
break;
case dspCLInit:
/* ADSPCLLISTEN */
ap->csCode = dspCLListen;
error = adspCLListen(sp, ap);
break;
}
}
if (error)
adspioc_ack(error, mp, gref); /* if this failed req complete */
return(STR_IGNORE);
case ADSPCLOSE:
ap->csCode = dspClose;
if ((error = adspClose(sp, ap))) {
adspioc_ack(error, mp, gref);
break;
}
break;
case ADSPCLREMOVE:
ap->csCode = dspCLRemove;
error = adspClose(sp, ap);
adspioc_ack(error, mp, gref);
return(STR_IGNORE);
case ADSPCLDENY:
ap->csCode = dspCLDeny;
if ((error = adspCLDeny(sp, (CCBPtr)ap))) {
adspioc_ack(error, mp, gref);
}
return(STR_IGNORE);
case ADSPSTATUS:
ap->csCode = dspStatus;
if ((error = adspStatus(sp, ap))) {
adspioc_ack(error, mp, gref);
}
return(STR_IGNORE);
case ADSPREAD:
ap->csCode = dspRead;
if ((error = adspRead(sp, ap))) {
adspioc_ack(error, mp, gref);
}
return(STR_IGNORE);
case ADSPATTENTION:
ap->csCode = dspAttention;
if ((error = adspReadAttention((CCBPtr)sp, ap))) {
adspioc_ack(error, mp, gref);
}
return(STR_IGNORE);
case ADSPOPTIONS:
ap->csCode = dspOptions;
if ((error = adspOptions(sp, ap))) {
adspioc_ack(error, mp, gref);
}
return(STR_IGNORE);
case ADSPRESET:
ap->csCode = dspReset;
if ((error = adspReset(sp, ap))) {
adspioc_ack(error, mp, gref);
}
return(STR_IGNORE);
case ADSPNEWCID:
ap->csCode = dspNewCID;
if ((error = adspNewCID(sp, ap))) {
adspioc_ack(error, mp, gref);
}
return(STR_IGNORE);
default:
return(STR_PUTNEXT); /* pass it on down */
}
return(STR_IGNORE);
case MSG_PROTO:
default:
gbuf_freem(mp);
}
return(STR_IGNORE);
}
int
adspReadHandler(gref, mp)
gref_t *gref;
gbuf_t *mp;
{
int error;
switch(gbuf_type(mp)) {
case MSG_DATA:
if ((error = adspPacket(gref, mp))) {
gbuf_freem(mp);
}
break;
case MSG_IOCTL:
default:
return(STR_PUTNEXT);
break;
}
return(STR_IGNORE);
}
/*
* adsp_sendddp()
*
* Description:
* This procedure a formats a DDP datagram header and calls the
* DDP module to queue it for routing and transmission according to
* the DDP parameters. We always take control of the datagram;
* if there is an error we free it, otherwise we pass it to the next
* layer. We don't need to set the src address fileds because the
* DDP layer fills these in for us.
*
* Calling Sequence:
* ret_status = adsp_sendddp(q, sp, mp, length, dstnetaddr, ddptype);
*
* Formal Parameters:
* sp Caller stream pointer
* mp gbuf_t chain containing the datagram to transmit
* The first mblk contains the ADSP header and space
* for the DDP header.
* length size of data portion of datagram
* dstnetaddr address of 4-byte destination internet address
* ddptype DDP protocol to assign to the datagram
*
* Completion Status:
* 0 Procedure successful completed.
* EMSGSIZE Specified datagram length is too big.
*
* Side Effects:
* NONE
*/
int
adsp_sendddp(sp, mp, length, dstnetaddr, ddptype)
CCBPtr sp;
gbuf_t *mp;
int length;
AddrUnion *dstnetaddr;
int ddptype;
{
DDPX_FRAME *ddp;
gbuf_t *mlist = mp;
if (mp == 0)
return EINVAL;
if (length > DDP_DATA_SIZE) {
gbuf_freel(mlist);
return EMSGSIZE;
}
while (mp) {
if (length == 0)
length = gbuf_msgsize(mp) - DDPL_FRAME_LEN;
/* Set up the DDP header */
ddp = (DDPX_FRAME *) gbuf_rptr(mp);
UAS_ASSIGN_HTON(ddp->ddpx_length, (length + DDPL_FRAME_LEN));
UAS_ASSIGN(ddp->ddpx_cksm, 0);
if (sp) {
if (sp->useCheckSum)
UAS_ASSIGN_HTON(ddp->ddpx_cksm, 1);
}
NET_ASSIGN(ddp->ddpx_dnet, dstnetaddr->a.net);
ddp->ddpx_dnode = dstnetaddr->a.node;
ddp->ddpx_source = sp ? sp->localSocket : ddp->ddpx_dest;
ddp->ddpx_dest = dstnetaddr->a.socket;
ddp->ddpx_type = ddptype;
length = 0;
mp = gbuf_next(mp);
}
DDP_OUTPUT(mlist);
return 0;
}
void NotifyUser(
__unused CCBPtr sp)
{
/*
pidsig(sp->pid, SIGIO);
*/
}
void UrgentUser(
__unused CCBPtr sp)
{
/*
pidsig(sp->pid, SIGURG);
*/
}
| p01arst0rm/decorum-linux | _resources/kernels/xnu-arm/bsd/netat/adsp.c | C | gpl-3.0 | 10,262 |
/************************************************************************
* 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 |
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
# config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# Use a specific assets manifest file.
config.assets.manifest = "#{Rails.root}/config/manifest.json"
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :request_id ]
# Use a different cache store in production.
config.cache_store = :memory_store
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
config.action_mailer.raise_delivery_errors = false
# Send email with Amazon Simple Email Service
config.action_mailer.delivery_method = :ses
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
# config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
| ryanjohns/passmaster | config/environments/production.rb | Ruby | gpl-3.0 | 3,780 |
#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 |
package com.tikaji.halocraft;
import com.tikaji.halocraft.common.handlers.ConfigurationHandler;
import com.tikaji.halocraft.common.proxy.IProxy;
import com.tikaji.halocraft.common.utility.Reference;
import com.tikaji.halocraft.common.utility.VersionChecker;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
/**
* Created by Jacob Williams on 6/17/2015.
*/
@Mod(modid = Reference.ModInfo.MOD_ID, name = Reference.ModInfo.MOD_NAME, version = Reference.ModInfo.VERSION)
public class HaloCraft
{
@Mod.Instance
public static HaloCraft INSTANCE;
public static boolean haveWarnedVersionIsOutOfDate = false;
@SidedProxy(clientSide = Reference.ModInfo.CLIENT_PROXY_CLASS, serverSide = Reference.ModInfo.SERVER_PROXY_CLASS)
public static IProxy proxy;
public static VersionChecker versionChecker;
public static String prependModID(String name)
{
return Reference.ModInfo.MOD_ID + ":" + name;
}
@Mod.EventHandler
public void initialize(FMLInitializationEvent event)
{
proxy.init();
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
proxy.postInit();
ConfigurationHandler.postInit();
}
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
ConfigurationHandler.init(new Configuration(event.getSuggestedConfigurationFile()));
proxy.preInit();
ConfigurationHandler.save();
}
}
| Tikaji/HaloCraft | src/main/java/com/tikaji/halocraft/HaloCraft.java | Java | gpl-3.0 | 1,665 |
<?php
/**
* @link https://github.com/old-town/workflow-doctrine
* @author Malofeykin Andrey <[email protected]>
*/
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 |
<form ng-submit="add()" name="contact_form">
<div class="row">
<div class="col s14">
<div class="input-field">
<i ng-if="config.json.help" class="material-icons tooltipped contact-tooltip" data-position="right" data-delay="50" data-tooltip="{{config.json.help}}">help</i>
<input name="input" type="text" ng-model="model" class="field" style="line-height: normal"
ng-pattern="config.pattern" id="{{config.json.type}}_input" ng-class="{'invalid': !contact_form['input'].$valid}"/>
<label for="{{config.json.type}}_input" class="active">
<span class="valign-wrapper">
<i ng-if="config.json.icon" class="material-icons left">{{config.json.icon}}</i>
<img ng-if="config.json.img" ng-src="{{config.img}}" class="contact-img"/>
{{config.json.title || config.json.type}}
</span>
</label>
</div>
</div>
<div class="col s10 contact-add">
<a class="btn" ng-if="model.length" ng-click="add()"><i class="material-icons left md-17">add</i>
<span class="hide-on-med-and-down">add</span>
</a>
</div>
</div>
</form>
| moira-alert/web | static/app/directives/templates/new-contact.html | HTML | gpl-3.0 | 1,072 |
/*
* 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 |
#ifndef Func_seq_H
#define Func_seq_H
#include "Procedure.h"
#include <string>
namespace RevLanguage {
/**
* @brief Function that creates a numerical sequence.
*
* This function is the equivalent to the 'R' function seq().
* The function creates a numerical sequence from the specified value
* to the specified value incremented by a specified value:
*
* a <- seq(from=1,to=10,by=2)
*
* Which gives:
* {1,3,5,7,9}
*
* This function is very similar to the range function except that
* it has a user specified increment (or decrement).
*
*
*
* @copyright Copyright 2009-
* @author The RevBayes Development Core Team (Sebastian Hoehna)
* @since Version 1.0, 2014-06-19
*
*/
template <typename valType>
class Func_seq : public Procedure {
public:
Func_seq();
// Basic utility functions
Func_seq* clone(void) const; //!< Clone the object
static const std::string& getClassType(void); //!< Get Rev type
static const TypeSpec& getClassTypeSpec(void); //!< Get class type spec
std::string getFunctionName(void) const; //!< Get the primary name of the function in Rev
const TypeSpec& getTypeSpec(void) const; //!< Get language type of the object
// Regular functions
const ArgumentRules& getArgumentRules(void) const; //!< Get argument rules
const TypeSpec& getReturnType(void) const; //!< Get type of return value
RevPtr<RevVariable> execute(void); //!< Execute function
protected:
};
}
#include "ArgumentRule.h"
#include "Ellipsis.h"
#include "RbUtil.h"
#include "TypedDagNode.h"
#include "TypeSpec.h"
template <typename valType>
RevLanguage::Func_seq<valType>::Func_seq() : Procedure() {
}
/* Clone object */
template <typename valType>
RevLanguage::Func_seq<valType>* RevLanguage::Func_seq<valType>::clone( void ) const {
return new Func_seq( *this );
}
/** Execute function: We rely on getValue and overloaded push_back to provide functionality */
template <typename valType>
RevLanguage::RevPtr<RevLanguage::RevVariable> RevLanguage::Func_seq<valType>::execute( void )
{
typename valType::valueType from = static_cast<const valType &>( args[0].getVariable()->getRevObject() ).getValue();
typename valType::valueType to = static_cast<const valType &>( args[1].getVariable()->getRevObject() ).getValue();
typename valType::valueType by = static_cast<const valType &>( args[2].getVariable()->getRevObject() ).getValue();
typename valType::valueType val = from;
// typename valType::valueType eps = valType::EPSILON;
typename valType::valueType eps = std::numeric_limits<typename valType::valueType>::epsilon();
ModelVector<valType> *seq = new ModelVector<valType>();
// while ( (val >= from && val <= to) || (val <= from && val >= to) )
while ( ((val - from) >= -eps && (val - to) <= eps) || ((val - from) <= eps && (val - to) >= -eps) )
{
seq->push_back( valType( val ) );
val += by;
}
return new RevVariable( seq );
}
/** Get argument rules */
template <typename valType>
const RevLanguage::ArgumentRules& RevLanguage::Func_seq<valType>::getArgumentRules( void ) const
{
static ArgumentRules argumentRules = ArgumentRules();
static bool rules_set = false;
if ( !rules_set )
{
argumentRules.push_back( new ArgumentRule( "from", valType::getClassTypeSpec(), "The first value of the sequence.", ArgumentRule::BY_VALUE, ArgumentRule::ANY ) );
argumentRules.push_back( new ArgumentRule( "to" , valType::getClassTypeSpec(), "The last value of the sequence.", ArgumentRule::BY_VALUE, ArgumentRule::ANY ) );
argumentRules.push_back( new ArgumentRule( "by" , valType::getClassTypeSpec(), "The step-size between value.", ArgumentRule::BY_VALUE, ArgumentRule::ANY ) );
rules_set = true;
}
return argumentRules;
}
/** Get Rev type of object */
template <typename valType>
const std::string& RevLanguage::Func_seq<valType>::getClassType(void)
{
static std::string rev_type = "Func_seq<" + valType::getClassType() + ">";
return rev_type;
}
/** Get class type spec describing type of object */
template <typename valType>
const RevLanguage::TypeSpec& RevLanguage::Func_seq<valType>::getClassTypeSpec(void)
{
static TypeSpec rev_type_spec = TypeSpec( getClassType(), new TypeSpec( Function::getClassTypeSpec() ) );
return rev_type_spec;
}
/**
* Get the primary Rev name for this function.
*/
template <typename valType>
std::string RevLanguage::Func_seq<valType>::getFunctionName( void ) const
{
// create a name variable that is the same for all instance of this class
std::string f_name = "seq";
return f_name;
}
/** Get type spec */
template <typename valType>
const RevLanguage::TypeSpec& RevLanguage::Func_seq<valType>::getTypeSpec( void ) const
{
static TypeSpec type_spec = getClassTypeSpec();
return type_spec;
}
/** Get return type */
template <typename valType>
const RevLanguage::TypeSpec& RevLanguage::Func_seq<valType>::getReturnType( void ) const {
return ModelVector<valType>::getClassTypeSpec();
}
#endif
| revbayes/revbayes | src/revlanguage/functions/basic/Func_seq.h | C | gpl-3.0 | 5,926 |
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 |
from runtests.mpi import MPITest
from nbodykit.lab import *
from nbodykit import setup_logging
from numpy.testing import assert_allclose
import tempfile
import os
@MPITest([1])
def test_hdf(comm):
import h5py
# fake structured array
dset = numpy.empty(1024, dtype=[('Position', ('f8', 3)), ('Mass', 'f8')])
dset['Position'] = numpy.random.random(size=(1024, 3))
dset['Mass'] = numpy.random.random(size=1024)
tmpfile = tempfile.mkstemp()[1]
with h5py.File(tmpfile , 'w') as ff:
ds = ff.create_dataset('X', data=dset) # store structured array as dataset
ds.attrs['BoxSize'] = 1.0
grp = ff.create_group('Y')
grp.create_dataset('Position', data=dset['Position']) # column as dataset
grp.create_dataset('Mass', data=dset['Mass']) # column as dataset
cosmo = cosmology.Planck15
source = HDFCatalog(tmpfile, dataset='X', attrs={"Nmesh":32}, comm=comm)
assert_allclose(source['Position'], dset['Position'])
region = source.query_range(32, 64)
assert_allclose(region['Position'], dset['Position'][32:64])
os.unlink(tmpfile)
@MPITest([1, 4])
def test_query_range(comm):
import h5py
# fake structured array
dset = numpy.empty(1024, dtype=[('Position', ('f8', 3)), ('Mass', 'f8'), ('Index', 'i8')])
dset['Index'] = numpy.arange(1024)
dset['Position'] = numpy.random.random(size=(1024, 3))
dset['Mass'] = numpy.random.random(size=1024)
if comm.rank == 0:
tmpfile = tempfile.mkstemp()[1]
with h5py.File(tmpfile , 'w') as ff:
ds = ff.create_dataset('X', data=dset) # store structured array as dataset
ds.attrs['BoxSize'] = 1.0
tmpfile = comm.bcast(tmpfile)
else:
tmpfile = comm.bcast(None)
cosmo = cosmology.Planck15
source = HDFCatalog(tmpfile, dataset='X', attrs={"Nmesh":32}, comm=comm)
correct_region = source.gslice(32, 64)
region = source.query_range(32, 64)
assert_allclose(
numpy.concatenate(comm.allgather(region['Index'].compute())),
numpy.arange(32, 64)
)
if comm.rank == 0:
os.unlink(tmpfile)
@MPITest([1])
def test_csv(comm):
with tempfile.NamedTemporaryFile() as ff:
# generate data
data = numpy.random.random(size=(100,5))
numpy.savetxt(ff, data, fmt='%.7e'); ff.seek(0)
# read nrows
names =['a', 'b', 'c', 'd', 'e']
f = CSVCatalog(ff.name, names, blocksize=100, comm=comm)
# make sure data is the same
for i, name in enumerate(names):
numpy.testing.assert_almost_equal(data[:,i], f[name].compute(), decimal=7)
# make sure all the columns are there
assert all(col in f for col in names)
@MPITest([1])
def test_stack_glob(comm):
tmpfile1 = 'test-glob-1.dat'
tmpfile2 = 'test-glob-2.dat'
# generate data
data = numpy.random.random(size=(100,5))
numpy.savetxt(tmpfile1, data, fmt='%.7e')
numpy.savetxt(tmpfile2, data, fmt='%.7e')
# read using a glob
names =['a', 'b', 'c', 'd', 'e']
f = CSVCatalog('test-glob-*', names, blocksize=100, comm=comm)
# make sure print works
print(f)
# make sure data is the same
fulldata = numpy.concatenate([data, data], axis=0)
for i, name in enumerate(names):
numpy.testing.assert_almost_equal(fulldata[:,i], f[name].compute(), decimal=7)
# make sure all the columns are there
assert all(col in f for col in names)
os.unlink(tmpfile1)
os.unlink(tmpfile2)
@MPITest([1])
def test_stack_list(comm):
tmpfile1 = 'test-list-1.dat'
tmpfile2 = 'test-list-2.dat'
# generate data
data = numpy.random.random(size=(100,5))
numpy.savetxt(tmpfile1, data, fmt='%.7e')
numpy.savetxt(tmpfile2, data, fmt='%.7e')
# read using a glob
names =['a', 'b', 'c', 'd', 'e']
f = CSVCatalog(['test-list-1.dat', 'test-list-2.dat'], names, blocksize=100, comm=comm)
# make sure print works
print(f)
# make sure data is the same
fulldata = numpy.concatenate([data, data], axis=0)
for i, name in enumerate(names):
numpy.testing.assert_almost_equal(fulldata[:,i], f[name].compute(), decimal=7)
# make sure all the columns are there
assert all(col in f for col in names)
os.unlink(tmpfile1)
os.unlink(tmpfile2)
| nickhand/nbodykit | nbodykit/source/catalog/tests/test_file.py | Python | gpl-3.0 | 4,337 |
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 |
# Changelog
## Version 0.1
First release, implement fixed 10 by 10 grid with 3 ships of length 5, no adversary.
| elrido/Battleship | CHANGELOG.md | Markdown | gpl-3.0 | 114 |
/**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 |
#ifndef _ASM_X86_UACCESS_64_H
#define _ASM_X86_UACCESS_64_H
/*
* User space memory access functions
*/
#include <linux/compiler.h>
#include <linux/errno.h>
#include <linux/lockdep.h>
#include <linux/kasan-checks.h>
#include <asm/alternative.h>
#include <asm/cpufeatures.h>
#include <asm/page.h>
/*
* Copy To/From Userspace
*/
/* Handles exceptions in both to and from, but doesn't do access_ok */
__must_check unsigned long
copy_user_enhanced_fast_string(void *to, const void *from, unsigned len);
__must_check unsigned long
copy_user_generic_string(void *to, const void *from, unsigned len);
__must_check unsigned long
copy_user_generic_unrolled(void *to, const void *from, unsigned len);
static __always_inline __must_check unsigned long
copy_user_generic(void *to, const void *from, unsigned len)
{
unsigned ret;
/*
* If CPU has ERMS feature, use copy_user_enhanced_fast_string.
* Otherwise, if CPU has rep_good feature, use copy_user_generic_string.
* Otherwise, use copy_user_generic_unrolled.
*/
alternative_call_2(copy_user_generic_unrolled,
copy_user_generic_string,
X86_FEATURE_REP_GOOD,
copy_user_enhanced_fast_string,
X86_FEATURE_ERMS,
ASM_OUTPUT2("=a" (ret), "=D" (to), "=S" (from),
"=d" (len)),
"1" (to), "2" (from), "3" (len)
: "memory", "rcx", "r8", "r9", "r10", "r11");
return ret;
}
__must_check unsigned long
copy_in_user(void __user *to, const void __user *from, unsigned len);
static __always_inline __must_check
int __copy_from_user_nocheck(void *dst, const void __user *src, unsigned size)
{
int ret = 0;
check_object_size(dst, size, false);
if (!__builtin_constant_p(size))
{
return copy_user_generic(dst, (__force void *)src, size);
}
switch (size)
{
case 1:
__uaccess_begin();
__get_user_asm(*(u8 *)dst, (u8 __user *)src,
ret, "b", "b", "=q", 1);
__uaccess_end();
return ret;
case 2:
__uaccess_begin();
__get_user_asm(*(u16 *)dst, (u16 __user *)src,
ret, "w", "w", "=r", 2);
__uaccess_end();
return ret;
case 4:
__uaccess_begin();
__get_user_asm(*(u32 *)dst, (u32 __user *)src,
ret, "l", "k", "=r", 4);
__uaccess_end();
return ret;
case 8:
__uaccess_begin();
__get_user_asm(*(u64 *)dst, (u64 __user *)src,
ret, "q", "", "=r", 8);
__uaccess_end();
return ret;
case 10:
__uaccess_begin();
__get_user_asm(*(u64 *)dst, (u64 __user *)src,
ret, "q", "", "=r", 10);
if (likely(!ret))
__get_user_asm(*(u16 *)(8 + (char *)dst),
(u16 __user *)(8 + (char __user *)src),
ret, "w", "w", "=r", 2);
__uaccess_end();
return ret;
case 16:
__uaccess_begin();
__get_user_asm(*(u64 *)dst, (u64 __user *)src,
ret, "q", "", "=r", 16);
if (likely(!ret))
__get_user_asm(*(u64 *)(8 + (char *)dst),
(u64 __user *)(8 + (char __user *)src),
ret, "q", "", "=r", 8);
__uaccess_end();
return ret;
default:
return copy_user_generic(dst, (__force void *)src, size);
}
}
static __always_inline __must_check
int __copy_from_user(void *dst, const void __user *src, unsigned size)
{
might_fault();
kasan_check_write(dst, size);
return __copy_from_user_nocheck(dst, src, size);
}
static __always_inline __must_check
int __copy_to_user_nocheck(void __user *dst, const void *src, unsigned size)
{
int ret = 0;
check_object_size(src, size, true);
if (!__builtin_constant_p(size))
{
return copy_user_generic((__force void *)dst, src, size);
}
switch (size)
{
case 1:
__uaccess_begin();
__put_user_asm(*(u8 *)src, (u8 __user *)dst,
ret, "b", "b", "iq", 1);
__uaccess_end();
return ret;
case 2:
__uaccess_begin();
__put_user_asm(*(u16 *)src, (u16 __user *)dst,
ret, "w", "w", "ir", 2);
__uaccess_end();
return ret;
case 4:
__uaccess_begin();
__put_user_asm(*(u32 *)src, (u32 __user *)dst,
ret, "l", "k", "ir", 4);
__uaccess_end();
return ret;
case 8:
__uaccess_begin();
__put_user_asm(*(u64 *)src, (u64 __user *)dst,
ret, "q", "", "er", 8);
__uaccess_end();
return ret;
case 10:
__uaccess_begin();
__put_user_asm(*(u64 *)src, (u64 __user *)dst,
ret, "q", "", "er", 10);
if (likely(!ret))
{
asm("":::"memory");
__put_user_asm(4[(u16 *)src], 4 + (u16 __user *)dst,
ret, "w", "w", "ir", 2);
}
__uaccess_end();
return ret;
case 16:
__uaccess_begin();
__put_user_asm(*(u64 *)src, (u64 __user *)dst,
ret, "q", "", "er", 16);
if (likely(!ret))
{
asm("":::"memory");
__put_user_asm(1[(u64 *)src], 1 + (u64 __user *)dst,
ret, "q", "", "er", 8);
}
__uaccess_end();
return ret;
default:
return copy_user_generic((__force void *)dst, src, size);
}
}
static __always_inline __must_check
int __copy_to_user(void __user *dst, const void *src, unsigned size)
{
might_fault();
kasan_check_read(src, size);
return __copy_to_user_nocheck(dst, src, size);
}
static __always_inline __must_check
int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
{
int ret = 0;
might_fault();
if (!__builtin_constant_p(size))
return copy_user_generic((__force void *)dst,
(__force void *)src, size);
switch (size)
{
case 1:
{
u8 tmp;
__uaccess_begin();
__get_user_asm(tmp, (u8 __user *)src,
ret, "b", "b", "=q", 1);
if (likely(!ret))
__put_user_asm(tmp, (u8 __user *)dst,
ret, "b", "b", "iq", 1);
__uaccess_end();
return ret;
}
case 2:
{
u16 tmp;
__uaccess_begin();
__get_user_asm(tmp, (u16 __user *)src,
ret, "w", "w", "=r", 2);
if (likely(!ret))
__put_user_asm(tmp, (u16 __user *)dst,
ret, "w", "w", "ir", 2);
__uaccess_end();
return ret;
}
case 4:
{
u32 tmp;
__uaccess_begin();
__get_user_asm(tmp, (u32 __user *)src,
ret, "l", "k", "=r", 4);
if (likely(!ret))
__put_user_asm(tmp, (u32 __user *)dst,
ret, "l", "k", "ir", 4);
__uaccess_end();
return ret;
}
case 8:
{
u64 tmp;
__uaccess_begin();
__get_user_asm(tmp, (u64 __user *)src,
ret, "q", "", "=r", 8);
if (likely(!ret))
__put_user_asm(tmp, (u64 __user *)dst,
ret, "q", "", "er", 8);
__uaccess_end();
return ret;
}
default:
return copy_user_generic((__force void *)dst,
(__force void *)src, size);
}
}
static __must_check __always_inline int
__copy_from_user_inatomic(void *dst, const void __user *src, unsigned size)
{
kasan_check_write(dst, size);
return __copy_from_user_nocheck(dst, src, size);
}
static __must_check __always_inline int
__copy_to_user_inatomic(void __user *dst, const void *src, unsigned size)
{
kasan_check_read(src, size);
return __copy_to_user_nocheck(dst, src, size);
}
extern long __copy_user_nocache(void *dst, const void __user *src,
unsigned size, int zerorest);
static inline int
__copy_from_user_nocache(void *dst, const void __user *src, unsigned size)
{
might_fault();
kasan_check_write(dst, size);
return __copy_user_nocache(dst, src, size, 1);
}
static inline int
__copy_from_user_inatomic_nocache(void *dst, const void __user *src,
unsigned size)
{
kasan_check_write(dst, size);
return __copy_user_nocache(dst, src, size, 0);
}
unsigned long
copy_user_handle_tail(char *to, char *from, unsigned len);
#endif /* _ASM_X86_UACCESS_64_H */
| williamfdevine/PrettyLinux | arch/x86/include/asm/uaccess_64.h | C | gpl-3.0 | 7,549 |
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 |
# roadie
[](https://www.gnu.org/copyleft/gpl.html)
[](https://travis-ci.org/jkawamoto/roadie)
[](https://app.wercker.com/project/byKey/6c499024136e7067b86bef4bd07d7f62)
[](https://goreportcard.com/report/github.com/jkawamoto/roadie)
[](https://github.com/jkawamoto/roadie/releases/tag/v0.4.0)
[](http://qiita.com/jkawamoto/items/751558536a597a33ae2a)
[](https://jkawamoto.github.io/roadie/)
A easy way to run your programs on [Google Cloud Platform](https://cloud.google.com/) and [Microsoft Azure](https://azure.microsoft.com/).
See [documents](https://jkawamoto.github.io/roadie/) for more information.
## Description
Roadie helps you to upload your source codes to the cloud, create and delete
instances, and manage outputs.
For example,
```sh
$ roadie run --local . --name analyze-wowah script.yml
```
uploads your source codes in current directory, and run them in such a manner
that `script.yml` specifies. The `script.yml` is a simple YAML file like
```yaml
apt:
- unrar
data:
- http://mmnet.iis.sinica.edu.tw/dl/wowah/wowah.rar
run:
- unrar x -r wowah.rar
- analyze WoWAH
```
The above `script.yml` asks roadie to install apt package `unrar` and
download a data file from such URL as the preparation. Then, it directs
to run those two commands: unrar the downloaded file, analyze the obtained
data files.
Roadie uploads results of such commands to a cloud storage after they finish.
You can access those results by
```sh
$ roadie result get analyze-wowah "*" -o ./res
```
Then, Roadie downloads all result files into `./res` directory.
## Installation
Compiled binary files for some platforms are uploaded in
[release page](https://github.com/jkawamoto/roadie/releases).
If you're a [Homebrew](http://brew.sh/) or [Linuxbrew](http://linuxbrew.sh/)
user, you can install Roadie by the following commands:
```sh
$ brew tap jkawamoto/roadie
$ brew install roadie
```
## Initialization
After installing Roadie, the following initialization is required in order to
authorize Roadie to access cloud services.
```sh
$ roadie init
```
## License
This software except files in `docker` folder is released under The GNU General Public License Version 3, see [COPYING](COPYING) for more detail.
| jkawamoto/roadie | README.md | Markdown | gpl-3.0 | 2,743 |
/*
**
** This file is part of BananaCam.
**
** BananaCam 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.
**
** BananaCam 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 BananaCam. If not, see <http://www.gnu.org/licenses/>.
**
*/
#include "camera_control.h"
void error_func (GPContext *context, const char *format, va_list args, void *data) {
context = context;
data = data;
fprintf(stderr, "*** Contexterror ***\n");
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
}
void message_func (GPContext *context, const char *format, va_list args, void *data) {
context = context;
data = data;
vprintf(format, args);
printf("\n");
}
void signal_handler(int sig)
{
printf("Signal ==> %i\n", sig);
}
void signal_inib()
{
struct sigaction act;
int i;
act.sa_handler = signal_handler;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
i = 1;
while (i < 32)
{
if (i != 11)
sigaction(i, &act, NULL);
i++;
}
}
int init(t_cam *c)
{
c->liveview = 0;
c->liveview_fps = 30;
c->liveview_fps_time = 1000000 / 30;
pthread_mutex_init(&c->liveview_mutex, NULL);
pthread_cond_init(&c->liveview_condvar, NULL);
c->folder_path = strdup("/tmp/");
c->camera_value_list = NULL;
gp_context_set_error_func(c->context, (GPContextErrorFunc)error_func, NULL);
gp_context_set_message_func(c->context, (GPContextMessageFunc)message_func, NULL);
gp_camera_new(&c->camera);
c->context = gp_context_new();
printf("Camera Init\n");
c->ret = gp_camera_init(c->camera, c->context);
if (c->ret != GP_OK) {
printf("gp_camera_init: %d\n", c->ret);
return (GP_ERROR);
}
/* get_initial_camera_values(t_cam *c); */
return (GP_OK);
}
void generic_exec(t_cam *c, char *command, char **param)
{
char *msg = NULL;
if (command && strncmp(command, "get_", 4) == 0)
{
command = &command[4];
get_config(command, c);
return;
}
if (param)
{
if (param[0])
set_config(command, param[0], c);
}
else
{
asprintf(&msg, "bad parameters for %s", command);
creat_and_send_message(BAD_PARAMETERS, NULL, NULL, msg, c);
}
}
int exec_command(t_cam *c, char *command, char **param)
{
t_func *tmp = NULL;
int flag = 0;
if (strcmp(command, "liveview") != 0 && c->liveview == 1)
{
printf("enter inside here\n");
c->liveview = 0;
flag = 1;
sleep(1);
}
tmp = c->first_func_ptr;
while (tmp != NULL)
{
if (strcmp(command, tmp->name) == 0)
{
tmp->func_ptr(c, param);
break;
}
tmp = tmp->next;
}
if (tmp == NULL)
generic_exec(c, command, param);
if (flag == 1)
liveview(c, NULL);
return (0);
}
void add_func_ptr_list(t_cam *c, char *name, int (*func_ptr)(t_cam *c, char **param))
{
t_func *tmp;
if (c->first_func_ptr == NULL)
{
c->first_func_ptr = malloc(sizeof(*c->first_func_ptr));
tmp = c->first_func_ptr;
tmp->next = NULL;
tmp->func_ptr = func_ptr;
tmp->name = strdup(name);
c->first_func_ptr = tmp;
}
else
{
tmp = c->first_func_ptr;
while (tmp->next != NULL)
tmp = tmp->next;
tmp->next = malloc(sizeof(*tmp->next));
tmp = tmp->next;
tmp->next = NULL;
tmp->func_ptr = func_ptr;
tmp->name = strdup(name);
}
}
int main(int ac, char **av)
{
t_cam *c;
ac = ac;
av = av;
#ifdef __APPLE__
//pthread_t thread;
printf("Killing PTPCamera process\n");
system("killall PTPCamera");
//pthread_create(&thread, NULL, initUSBDetect, (void *)c);
#endif
signal_inib();
c = malloc(sizeof(*c));
c->first_func_ptr = NULL;
init(c);
get_all_widget_and_choices(c);
add_func_ptr_list(c, "capture", trigger_capture);
add_func_ptr_list(c, "liveview", liveview);
add_func_ptr_list(c, "auto_focus", auto_focus);
add_func_ptr_list(c, "liveviewfps", liveviewfps);
add_func_ptr_list(c, "get_liveviewfps", get_liveviewfps);
add_func_ptr_list(c, "defaultpath", set_default_folder_path);
add_func_ptr_list(c, "get_defaultpath", get_default_folder_path);
pthread_create(&c->liveview_thread, NULL, liveview_launcher, (void*)c);
init_comm(c, UNIX_SOCKET_PATH);
gp_camera_exit(c->camera, c->context);
return (0);
}
| OliverNicolini/BananaCam | src/main.c | C | gpl-3.0 | 4,707 |
<!--
~ Copyright (C) 2010 Brockmann Consult GmbH ([email protected])
~
~ 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/
-->
<html>
<head>
<title>Sentinel-2 Toolbox Help - Export Color Legend</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../style.css">
</head>
<body>
<table class="header">
<tr class="header">
<td class="header">
Export Color Legend</td>
<td class="header" align="right"><a href="../general/BeamOverview.html"><img src="../images/snap_header.jpg" border="0" ></a></td>
</tr>
</table>
<h4>Exporting a Color Legend Image</h4>
<p>
For non-RGB images it is possible to export the current colour palette setting as a colour legend image.
This function is available from the context menu over non-RGB images.
The menu item <i>Export Color Legend</i> brings up a file chooser dialog allowing you to select
the file name for the exported legend image. The legend appearance can be modified by opening the
<i>Properties...</i> button in the file chooser:
</p>
<p align="center"> <img src="images/ColorLegendProperties.png" width="370" height="313">
</p>
<p>Note that the tranparency mode is only enabled for the image types TIFF and PNG. A preview dialog
for the legend image can be opened by clicking the <i>Preview...</i> button. Within the dialog
it is also possible to copy the colour legend image the the system clipboard by using the context menu
over the image area:
</p>
<p align="center"> <img src="images/ColorLegendPreview.png" width="492" height="194">
</p>
<hr>
</body>
</html> | corinavaduva/s2tbx-s2tbx-1.0.2 | s2tbx-help/src/main/resources/doc/help/visat/ExportColorLegend.html | HTML | gpl-3.0 | 2,276 |
/*
* This file is part of the demos-linux package.
* Copyright (C) 2011-2022 Mark Veltzer <[email protected]>
*
* 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 |
<!DOCTYPE html>
<html xml:lang="en-GB" lang="en-GB" xmlns="http://www.w3.org/1999/xhtml">
<head lang="en-GB">
<title>Ross Gammon’s Family Tree - Surname - BESSEY</title>
<meta charset="UTF-8" />
<meta name ="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1" />
<meta name ="apple-mobile-web-app-capable" content="yes" />
<meta name="generator" content="Gramps 4.2.8 http://gramps-project.org/" />
<meta name="author" content="" />
<link href="../../../images/favicon2.ico" rel="shortcut icon" type="image/x-icon" />
<link href="../../../css/narrative-screen.css" media="screen" rel="stylesheet" type="text/css" />
<link href="../../../css/narrative-print.css" media="print" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<h1 id="SiteTitle">Ross Gammon’s Family Tree</h1>
</div>
<div class="wrapper" id="nav" role="navigation">
<div class="container">
<ul class="menu" id="dropmenu">
<li><a href="../../../individuals.html" title="Individuals">Individuals</a></li>
<li class = "CurrentSection"><a href="../../../index.html" title="Surnames">Surnames</a></li>
<li><a href="../../../families.html" title="Families">Families</a></li>
<li><a href="../../../events.html" title="Events">Events</a></li>
<li><a href="../../../places.html" title="Places">Places</a></li>
<li><a href="../../../sources.html" title="Sources">Sources</a></li>
<li><a href="../../../repositories.html" title="Repositories">Repositories</a></li>
<li><a href="../../../media.html" title="Media">Media</a></li>
<li><a href="../../../thumbnails.html" title="Thumbnails">Thumbnails</a></li>
</ul>
</div>
</div>
<div class="content" id="SurnameDetail">
<h3>BESSEY</h3>
<p id="description">
This page contains an index of all the individuals in the database with the surname of BESSEY. Selecting the person’s name will take you to that person’s individual page.
</p>
<table class="infolist primobjlist surname">
<thead>
<tr>
<th class="ColumnName">Given Name</th>
<th class="ColumnDate">Birth</th>
<th class="ColumnDate">Death</th>
<th class="ColumnPartner">Partner</th>
<th class="ColumnParents">Parents</th>
</tr>
</thead>
<tbody>
<tr>
<td class="ColumnName">
<a href="../../../ppl/f/0/d15f5fd139f63d85a3442c71a0f.html">June T.<span class="grampsid"> [I1845]</span></a>
</td>
<td class="ColumnBirth"> </td>
<td class="ColumnDeath"> </td>
<td class="ColumnPartner">
</td>
<td class="ColumnParents"> </td>
</tr>
</tbody>
</table>
</div>
<div class="fullclear"></div>
<div id="footer">
<p id="createdate">
Generated by <a href="http://gramps-project.org/">Gramps</a> 4.2.8<br />Last change was the 2015-08-05 19:54:07<br />Created for <a href="../../../ppl/9/e/d15f5fb48902c4fc1b421d249e9.html">GAMMON, Francis</a>
</p>
<p id="copyright">
</p>
</div>
</body>
</html>
| RossGammon/the-gammons.net | RossFamilyTree/srn/f/3/4c30ee81481125db4c8e657faad3d53f.html | HTML | gpl-3.0 | 3,011 |
///////////////////////////////////////////////////////////////////////////////
//
//
//
//
///////////////////////////////////////////////////////////////////////////////
// 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 |
Bitrix 16.5 Business Demo = ea7587a817bea036305172b8333d43ef
| gohdan/DFC | known_files/hashes/bitrix/modules/main/lang/ru/admin/short_uri_edit.php | PHP | gpl-3.0 | 61 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_131) on Sat Oct 28 21:24:43 CEST 2017 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class fr.cryptohash.CubeHashCore (burstcoin 1.3.6cg API)</title>
<meta name="date" content="2017-10-28">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class fr.cryptohash.CubeHashCore (burstcoin 1.3.6cg API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../fr/cryptohash/CubeHashCore.html" title="class in fr.cryptohash">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?fr/cryptohash/class-use/CubeHashCore.html" target="_top">Frames</a></li>
<li><a href="CubeHashCore.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class fr.cryptohash.CubeHashCore" class="title">Uses of Class<br>fr.cryptohash.CubeHashCore</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../fr/cryptohash/CubeHashCore.html" title="class in fr.cryptohash">CubeHashCore</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#fr.cryptohash">fr.cryptohash</a></td>
<td class="colLast">
<div class="block">The <code>fr.cryptohash</code> package contains implementations of
various cryptographic hash functions.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="fr.cryptohash">
<!-- -->
</a>
<h3>Uses of <a href="../../../fr/cryptohash/CubeHashCore.html" title="class in fr.cryptohash">CubeHashCore</a> in <a href="../../../fr/cryptohash/package-summary.html">fr.cryptohash</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation">
<caption><span>Subclasses of <a href="../../../fr/cryptohash/CubeHashCore.html" title="class in fr.cryptohash">CubeHashCore</a> in <a href="../../../fr/cryptohash/package-summary.html">fr.cryptohash</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../fr/cryptohash/CubeHash224.html" title="class in fr.cryptohash">CubeHash224</a></span></code>
<div class="block">This class implements the CubeHash-224 digest algorithm under the
<a href="../../../fr/cryptohash/Digest.html" title="interface in fr.cryptohash"><code>Digest</code></a> API.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../fr/cryptohash/CubeHash256.html" title="class in fr.cryptohash">CubeHash256</a></span></code>
<div class="block">This class implements the CubeHash-256 digest algorithm under the
<a href="../../../fr/cryptohash/Digest.html" title="interface in fr.cryptohash"><code>Digest</code></a> API.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../fr/cryptohash/CubeHash384.html" title="class in fr.cryptohash">CubeHash384</a></span></code>
<div class="block">This class implements the CubeHash-384 digest algorithm under the
<a href="../../../fr/cryptohash/Digest.html" title="interface in fr.cryptohash"><code>Digest</code></a> API.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../fr/cryptohash/CubeHash512.html" title="class in fr.cryptohash">CubeHash512</a></span></code>
<div class="block">This class implements the CubeHash-512 digest algorithm under the
<a href="../../../fr/cryptohash/Digest.html" title="interface in fr.cryptohash"><code>Digest</code></a> API.</div>
</td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../fr/cryptohash/package-summary.html">fr.cryptohash</a> with parameters of type <a href="../../../fr/cryptohash/CubeHashCore.html" title="class in fr.cryptohash">CubeHashCore</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="../../../fr/cryptohash/Digest.html" title="interface in fr.cryptohash">Digest</a></code></td>
<td class="colLast"><span class="typeNameLabel">CubeHashCore.</span><code><span class="memberNameLink"><a href="../../../fr/cryptohash/CubeHashCore.html#copyState-fr.cryptohash.CubeHashCore-">copyState</a></span>(<a href="../../../fr/cryptohash/CubeHashCore.html" title="class in fr.cryptohash">CubeHashCore</a> dst)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../fr/cryptohash/CubeHashCore.html" title="class in fr.cryptohash">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?fr/cryptohash/class-use/CubeHashCore.html" target="_top">Frames</a></li>
<li><a href="CubeHashCore.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2017. All rights reserved.</small></p>
</body>
</html>
| dawallet/burstwindowswallet | burstcoin-1.3.6/html/ui/doc/fr/cryptohash/class-use/CubeHashCore.html | HTML | gpl-3.0 | 8,691 |
from math import ceil
import numpy as np
from ipywidgets import widgets
from tqdm.notebook import tqdm
from matplotlib import pyplot as plt
import lib.iq_mixer_calibration
from drivers import IQAWG
from lib.data_management import load_IQMX_calibration_database, \
save_IQMX_calibration
from lib.iq_mixer_calibration import IQCalibrator
class IQVectorGenerator:
def __init__(self, name, lo, iq_awg: IQAWG, sa, calibration_db_name="IQVG",
default_calibration_power=-30, marker_period_divisor=None,
slave_iqvgs=None, calibration_step=10e6):
"""
Parameters
----------
lo
iq_awg
sa
calibration_db_name
default_calibration_power
marker_period_divisor: int, ns
by default, the marker period should be divisible by the if_period
however, in some cases other divisor may be required, i.e. when
m3202 is used with PXICLK10 trigger sync mode this divisor
should be set to 100
"""
self._name = name
self._lo = lo
self._iqawg = iq_awg
self._sa = sa
self._cal_db_name = calibration_db_name
self._default_calibration_power = default_calibration_power
self._calibration_widget = widgets.HTML()
self._recalibrate_mixer = False
self._frequency = 5e9
self.set_if_frequency(100e6)
if marker_period_divisor is not None:
self._marker_period_divisor = marker_period_divisor
else:
self._marker_period_divisor = self._if_period
# for marker period synchronization when iqvgs are on the same AWG
self._slave_iqvgs = slave_iqvgs if slave_iqvgs is not None else []
self._power = default_calibration_power
self._dac_overridden = False
self._current_cal = None
self._requested_cal: lib.iq_mixer_calibration.IQCalibrationData = None
self._cal_db = None
self._marker_period = None
self._requested_marker_period = None
self.set_marker_period(1000)
self._calibration_initial_guess = {"dc_offsets": np.random.uniform(.03, 0.1, size=2),
"if_amplitudes": (.1, .1),
"if_phase": -np.pi * 0.54}
self._calibration_step = calibration_step
self._calibration_test_data = []
self._load_cal_db()
def get_calibration_widget(self):
return self._calibration_widget
def set_parameters(self, parameters_dict):
if "power" in parameters_dict:
self.set_power(parameters_dict["power"])
if "freq" in parameters_dict:
self.set_frequency(parameters_dict["freq"])
if "dac_overridden" in parameters_dict:
self._dac_overridden = parameters_dict["dac_overridden"]
else:
self._dac_overridden = False
def get_iqawg(self):
self._iqawg.set_parameters(
{'calibration': self._current_cal}) # ensure
return self._iqawg
def set_if_frequency(self, if_frequency):
self._if_frequency = if_frequency
self._if_period = 1 / if_frequency * 1e9 # ns
def get_if_frequency(self):
return self._if_frequency
def set_output_state(self, state):
self._lo.set_output_state(state)
def set_frequency(self, freq):
self._frequency = freq
self._lo.set_frequency(self._frequency + self._if_frequency)
self._requested_cal = self.get_calibration(self._frequency,
self._power)
self._output_SSB()
def set_power(self, power):
if power > self._default_calibration_power + 10:
raise ValueError("Power can be % dBm max, requested %d dBm" % (
self._default_calibration_power + 10, power))
self._power = power
self._requested_cal = self.get_calibration(self._frequency,
self._power)
self._lo.set_power(self._requested_cal.get_lo_power())
self._output_SSB()
def get_power(self):
return self._power
def set_marker_period(self, marker_period):
'''
For some applications there is need to control the length of the interval between triggers
output by the AWG of the IQVectorGenerator.
Parameters
----------
marker_period: ns, float
real trigger period will be recalculated to be not shorter than <marker_period> ns,
but still divisible by the IF period
'''
self._requested_marker_period = marker_period
correct_marker_period = ceil(
marker_period / self._marker_period_divisor) * \
self._marker_period_divisor
if correct_marker_period != self._marker_period:
self._marker_period = correct_marker_period
if self._requested_cal is not None:
self._current_cal = None
self._output_SSB()
for slave_iqvg in self._slave_iqvgs:
slave_iqvg.set_marker_period(self._marker_period)
def _output_SSB(self):
if self._requested_cal != self._current_cal:
# print(f"IQVG {self._name}: outputting pulse sequence to update calibration for frequency: {self._frequency/1e9:.4f} GHz"
# f", power: {self._power} dBm.")
self._iqawg.set_parameters({"calibration": self._requested_cal})
pb = self._iqawg.get_pulse_builder()
if_freq = self._requested_cal.get_radiation_parameters()[
"if_frequency"]
resolution = self._requested_cal.get_radiation_parameters()[
"waveform_resolution"]
if_period = 1 / if_freq * 1e9
if (if_period * 1e9) % resolution != 0:
print(
f"IQVectorGenerator {self._name} warning: IF period is not divisible by "
"calibration waveform resolution. Phase coherence will be bad.")
seq = pb.add_sine_pulse(self._marker_period).build()
self._iqawg.output_pulse_sequence(seq)
self._current_cal = self._requested_cal
# time.sleep(1)
def _load_cal_db(self):
self._cal_db = load_IQMX_calibration_database(self._cal_db_name, 0)
def _around_frequency(self, frequency):
# return ceil(frequency/self._calibration_step)*self._calibration_step
return round(frequency / self._calibration_step) * self._calibration_step
def get_calibration(self, frequency, power):
frequency = self._around_frequency(frequency)
# frequency = round(frequency/self._calibration_step)*self._calibration_step
if self._cal_db is None:
self._load_cal_db()
cal = \
self._cal_db.get(frozenset(dict(lo_power=14,
ssb_power=self._default_calibration_power,
lo_frequency=self._if_frequency + frequency,
if_frequency=self._if_frequency,
waveform_resolution=1,
sideband_to_maintain='left').items()))
if (cal is None) or self._recalibrate_mixer:
calibrator = IQCalibrator(self._iqawg, self._sa, self._lo,
self._cal_db_name, 0,
sidebands_to_suppress=6,
output_widget=self._calibration_widget)
ig = self._calibration_initial_guess
cal = calibrator.calibrate(
lo_frequency=frequency + self._if_frequency,
if_frequency=self._if_frequency,
lo_power=14,
ssb_power=self._default_calibration_power,
waveform_resolution=1,
iterations=3,
minimize_iterlimit=100,
sa_res_bandwidth=300,
initial_guess=ig)
save_IQMX_calibration(cal)
self._load_cal_db() # make sure to include new calibration into cache
cal._ssb_power = power
cal._if_amplitudes = cal._if_amplitudes / np.sqrt(
10 ** ((self._default_calibration_power - power) / 10))
# self._calibration_initial_guess["if_amplitudes"] = cal._if_amplitudes
self._calibration_initial_guess["if_phase"] = cal._if_phase
return cal
else:
cal = cal.copy()
cal._if_amplitudes = cal._if_amplitudes / np.sqrt(
10 ** ((self._default_calibration_power - power) / 10))
return cal
def calibrate_mixer(self, fstart, fstop, recalibrate=False):
"""
Performs calibration of the mixer in a frequency range
Parameters
----------
fstart: float
start of the frequency range
fstop : float
stop of the frequency range
recalibrate : bool
Whether or not to calibrate from scratch and override previous
calibration in this interval.
"""
fstart = self._around_frequency(fstart)
fstop = self._around_frequency(fstop)
self._recalibrate_mixer = recalibrate
pb = tqdm(np.arange(fstart, fstop + self._calibration_step, self._calibration_step),
smoothing=0)
for frequency in pb:
pb.set_description("%.3f GHz" % (frequency / 1e9))
for counter in range(3):
try:
self.set_frequency(frequency)
break
except ValueError:
print("Poor calibration at %.3f GHz, retry count "
"%d" % (frequency / 1e9, counter))
self._calibration_initial_guess["dc_offest"] = \
np.random.uniform(.03, 0.1, size=2)
self._recalibrate_mixer = False
def test_calibration(self, fstart, fstop, step=1e6,
sidebands_to_plot=[-1, 0, 1],
remeasure=False):
"""
Tests the saved calibrations by monitoring all the sidebands throughout
the specified frequency range
Parameters
----------
fstart: float, Hz
start of the frequency range
fstop: float, Hz
stop of the frequency range
step: float, Hz
step of the scan
remeasure : bool
remeasure or just replot the data from the previous run
"""
sideband_shifts = np.linspace(-3, 3, 7) * self._if_frequency
freqs = np.arange(fstart, fstop + step, step)
if remeasure or len(self._calibration_test_data) == 0:
self._calibration_test_data = []
for frequency in tqdm(freqs, smoothing=0):
self.set_frequency(frequency)
sa_freqs = sideband_shifts + self._frequency
self._sa.setup_list_sweep(list(sa_freqs), [1000] * 3)
self._sa.prepare_for_stb()
self._sa.sweep_single()
self._sa.wait_for_stb()
self._calibration_test_data.append(self._sa.get_tracedata())
self._calibration_test_data = np.array(
self._calibration_test_data).T
sidebands_to_plot_idcs = np.array(sidebands_to_plot, dtype=int) + 3
sideband_shifts = sideband_shifts[sidebands_to_plot_idcs]
data = self._calibration_test_data[sidebands_to_plot_idcs]
for row, sideband_shift in zip(data, sideband_shifts):
plt.plot(freqs, row, label=f"{(sideband_shift / 1e6):.2f} MHz")
plt.legend()
self._sa.setup_swept_sa(-self._if_frequency + self._frequency,
10 * self._if_frequency,
nop=1001, rbw=1e4)
self._sa.set_continuous()
| vdrhtc/Measurement-automation | drivers/IQVectorGenerator.py | Python | gpl-3.0 | 12,060 |
/*
Copyright 2012-2016 Michael Pozhidaev <[email protected]>
This file is part of LUWRAIN.
LUWRAIN 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.
LUWRAIN 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.
*/
package org.luwrain.core;
import java.util.*;
class ShortcutManager
{
class Entry
{
String name = "";
Shortcut shortcut;
Entry(String name, Shortcut shortcut)
{
NullCheck.notNull(name, "name");
NullCheck.notNull(shortcut, "shortcut");
if (name.trim().isEmpty())
throw new IllegalArgumentException("name may not be empty");
this.name = name;
this.shortcut = shortcut;
}
}
private final TreeMap<String, Entry> shortcuts = new TreeMap<String, Entry>();
boolean add(Shortcut shortcut)
{
NullCheck.notNull(shortcut, "shortcut");
final String name = shortcut.getName();
if (name == null || name.trim().isEmpty())
return false;
if (shortcuts.containsKey(name))
return false;
shortcuts.put(name, new Entry(name, shortcut));
return true;
}
Application[] prepareApp(String name, String[] args)
{
NullCheck.notNull(name, "name");
NullCheck.notNullItems(args, "args");
if (name.trim().isEmpty())
throw new IllegalArgumentException("name may not be empty");
if (!shortcuts.containsKey(name))
return null;
return shortcuts.get(name).shortcut.prepareApp(args);
}
String[] getShortcutNames()
{
final Vector<String> res = new Vector<String>();
for(Map.Entry<String, Entry> e: shortcuts.entrySet())
res.add(e.getKey());
String[] str = res.toArray(new String[res.size()]);
Arrays.sort(str);
return str;
}
void addBasicShortcuts()
{
add(new Shortcut(){
@Override public String getName()
{
return "registry";
}
@Override public Application[] prepareApp(String[] args)
{
Application[] res = new Application[1];
res[0] = new org.luwrain.app.registry.RegistryApp();
return res;
}
});
}
void addOsShortcuts(Luwrain luwrain, Registry registry)
{
NullCheck.notNull(luwrain, "luwrain");
NullCheck.notNull(registry, "registry");
registry.addDirectory(Settings.OS_SHORTCUTS_PATH);
for(String s: registry.getDirectories(Settings.OS_SHORTCUTS_PATH))
{
if (s.trim().isEmpty())
continue;
final OsCommands.OsShortcut shortcut = new OsCommands.OsShortcut(luwrain);
if (shortcut.init(Settings.createOsShortcut(registry, Registry.join(Settings.OS_SHORTCUTS_PATH, s))))
add(shortcut);
}
}
}
| rPman/luwrain | src/main/java/org/luwrain/core/ShortcutManager.java | Java | gpl-3.0 | 2,884 |
---
ID: 2
post_title: Sample Page
author: moises
post_date: 2016-12-14 02:19:15
post_excerpt: ""
layout: page
permalink: http://pepmeup.ie/sample-page/
published: true
---
This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:
<blockquote>Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin' caught in the rain.)</blockquote>
...or something like this:
<blockquote>The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.</blockquote>
As a new WordPress user, you should go to <a href="http:/wordpress/wp-admin/">your dashboard</a> to delete this page and create new pages for your content. Have fun! | moisesbfs/pepmeup | _pages/sample-page.md | Markdown | gpl-3.0 | 1,124 |
Namespace Interpreter.Parser.Tokens
''' <summary>
''' 该表达式之中的操作符
''' </summary>
Public Class [Operator] : Inherits Token
Public Enum Operators As Integer
NULL = -1
''' <summary>
''' <- Assign value to variable;
''' </summary>
ValueAssign
''' <summary>
''' -> Extension method calling;
''' </summary>
ExtCall
''' <summary>
''' <= Collection and hash table operations;
''' </summary>
CollectionOprOrDelegate
''' <summary>
''' = Self type cast;
''' </summary>
SelfCast
''' <summary>
''' << Hybrids scripting;
''' </summary>
HybridsScript
''' <summary>
''' >> Setup variable of hybrids scripting;
''' </summary>
HybirdsScriptPush
''' <summary>
''' => 函数指针
''' </summary>
HashOprOrDelegate
''' <summary>
''' <
''' </summary>
DynamicsCast
''' <summary>
''' >
''' </summary>
IODevice
End Enum
Public ReadOnly Property Type As [Operator].Operators
Public Overrides ReadOnly Property TokenType As TokenTypes
Get
Return TokenTypes.Operator
End Get
End Property
''' <summary>
'''
''' </summary>
''' <param name="opr">
''' [<- Assign value to variable;]
'''
'''
''' [-> Extension method calling;]
'''
'''
''' [<= Collection and hash table operations;]
'''
'''
''' [= Self type cast;]
'''
'''
''' [<< Hybrids scripting;]
'''
'''
''' [>> Setup variable of hybrids scripting;]
'''
''' </param>
Sub New(opr As String)
Call MyBase.New(0, opr)
Type = GetOperator(opr)
End Sub
Public Shared Function GetOperator(opr As String) As Operators
Select Case Trim(opr)
Case "<-", "=" : Return Operators.ValueAssign
Case "->" : Return Operators.ExtCall
Case "<=" : Return Operators.CollectionOprOrDelegate
' Case "=" : Return Operators.ValueAssign
Case "<<" : Return Operators.HybridsScript
Case ">>" : Return Operators.HybirdsScriptPush
Case "=>" : Return Operators.HashOprOrDelegate
Case "<" : Return Operators.DynamicsCast
Case ">" : Return Operators.IODevice
Case Else
Return Operators.NULL
' Throw New NotImplementedException($"The operator {NameOf(opr)}:={opr} is currently not support yet!")
End Select
End Function
Public Overrides Function ToString() As String
Return $"( {_TokenValue } ) {Type.GetType.FullName}.{Type.ToString}"
End Function
End Class
End Namespace | amethyst-asuka/GCModeller | src/Shoal/Shoal.v2/Shoal.v2/Interpreter/Parser/Tokenliser/Tokens/Operator.vb | Visual Basic | gpl-3.0 | 3,260 |
#include "tool_move.hpp"
#include "document/idocument_board.hpp"
#include "board/board.hpp"
#include "document/idocument_package.hpp"
#include "pool/package.hpp"
#include "document/idocument_padstack.hpp"
#include "pool/padstack.hpp"
#include "document/idocument_schematic.hpp"
#include "schematic/schematic.hpp"
#include "document/idocument_symbol.hpp"
#include "pool/symbol.hpp"
#include "imp/imp_interface.hpp"
#include "util/accumulator.hpp"
#include "util/util.hpp"
#include <iostream>
#include "core/tool_id.hpp"
namespace horizon {
ToolMove::ToolMove(IDocument *c, ToolID tid) : ToolBase(c, tid), ToolHelperMove(c, tid), ToolHelperMerge(c, tid)
{
}
void ToolMove::expand_selection()
{
std::set<SelectableRef> pkgs_fixed;
std::set<SelectableRef> new_sel;
for (const auto &it : selection) {
switch (it.type) {
case ObjectType::LINE: {
Line *line = doc.r->get_line(it.uuid);
new_sel.emplace(line->from.uuid, ObjectType::JUNCTION);
new_sel.emplace(line->to.uuid, ObjectType::JUNCTION);
} break;
case ObjectType::POLYGON_EDGE: {
Polygon *poly = doc.r->get_polygon(it.uuid);
auto vs = poly->get_vertices_for_edge(it.vertex);
new_sel.emplace(poly->uuid, ObjectType::POLYGON_VERTEX, vs.first);
new_sel.emplace(poly->uuid, ObjectType::POLYGON_VERTEX, vs.second);
} break;
case ObjectType::NET_LABEL: {
auto &la = doc.c->get_sheet()->net_labels.at(it.uuid);
new_sel.emplace(la.junction->uuid, ObjectType::JUNCTION);
} break;
case ObjectType::BUS_LABEL: {
auto &la = doc.c->get_sheet()->bus_labels.at(it.uuid);
new_sel.emplace(la.junction->uuid, ObjectType::JUNCTION);
} break;
case ObjectType::POWER_SYMBOL: {
auto &ps = doc.c->get_sheet()->power_symbols.at(it.uuid);
new_sel.emplace(ps.junction->uuid, ObjectType::JUNCTION);
} break;
case ObjectType::BUS_RIPPER: {
auto &rip = doc.c->get_sheet()->bus_rippers.at(it.uuid);
new_sel.emplace(rip.junction->uuid, ObjectType::JUNCTION);
} break;
case ObjectType::LINE_NET: {
auto line = &doc.c->get_sheet()->net_lines.at(it.uuid);
for (auto &it_ft : {line->from, line->to}) {
if (it_ft.is_junc()) {
new_sel.emplace(it_ft.junc.uuid, ObjectType::JUNCTION);
}
}
} break;
case ObjectType::TRACK: {
auto track = &doc.b->get_board()->tracks.at(it.uuid);
for (auto &it_ft : {track->from, track->to}) {
if (it_ft.is_junc()) {
new_sel.emplace(it_ft.junc.uuid, ObjectType::JUNCTION);
}
}
} break;
case ObjectType::VIA: {
auto via = &doc.b->get_board()->vias.at(it.uuid);
new_sel.emplace(via->junction->uuid, ObjectType::JUNCTION);
} break;
case ObjectType::POLYGON: {
auto poly = doc.r->get_polygon(it.uuid);
int i = 0;
for (const auto &itv : poly->vertices) {
(void)sizeof itv;
new_sel.emplace(poly->uuid, ObjectType::POLYGON_VERTEX, i);
i++;
}
} break;
case ObjectType::ARC: {
Arc *arc = doc.r->get_arc(it.uuid);
new_sel.emplace(arc->from.uuid, ObjectType::JUNCTION);
new_sel.emplace(arc->to.uuid, ObjectType::JUNCTION);
new_sel.emplace(arc->center.uuid, ObjectType::JUNCTION);
} break;
case ObjectType::SCHEMATIC_SYMBOL: {
auto sym = doc.c->get_schematic_symbol(it.uuid);
for (const auto &itt : sym->texts) {
new_sel.emplace(itt->uuid, ObjectType::TEXT);
}
} break;
case ObjectType::BOARD_PACKAGE: {
BoardPackage *pkg = &doc.b->get_board()->packages.at(it.uuid);
if (pkg->fixed) {
pkgs_fixed.insert(it);
}
else {
for (const auto &itt : pkg->texts) {
new_sel.emplace(itt->uuid, ObjectType::TEXT);
}
}
} break;
default:;
}
}
selection.insert(new_sel.begin(), new_sel.end());
if (pkgs_fixed.size() && imp)
imp->tool_bar_flash("can't move fixed package");
for (auto it = selection.begin(); it != selection.end();) {
if (pkgs_fixed.count(*it))
it = selection.erase(it);
else
++it;
}
}
Coordi ToolMove::get_selection_center()
{
Accumulator<Coordi> accu;
std::set<SelectableRef> items_ignore;
for (const auto &it : selection) {
if (it.type == ObjectType::BOARD_PACKAGE) {
const auto &pkg = doc.b->get_board()->packages.at(it.uuid);
for (auto &it_txt : pkg.texts) {
items_ignore.emplace(it_txt->uuid, ObjectType::TEXT);
}
}
else if (it.type == ObjectType::SCHEMATIC_SYMBOL) {
const auto &sym = doc.c->get_sheet()->symbols.at(it.uuid);
for (auto &it_txt : sym.texts) {
items_ignore.emplace(it_txt->uuid, ObjectType::TEXT);
}
}
}
for (const auto &it : selection) {
if (items_ignore.count(it))
continue;
switch (it.type) {
case ObjectType::JUNCTION:
accu.accumulate(doc.r->get_junction(it.uuid)->position);
break;
case ObjectType::HOLE:
accu.accumulate(doc.r->get_hole(it.uuid)->placement.shift);
break;
case ObjectType::BOARD_HOLE:
accu.accumulate(doc.b->get_board()->holes.at(it.uuid).placement.shift);
break;
case ObjectType::SYMBOL_PIN:
accu.accumulate(doc.y->get_symbol_pin(it.uuid).position);
break;
case ObjectType::SCHEMATIC_SYMBOL:
accu.accumulate(doc.c->get_schematic_symbol(it.uuid)->placement.shift);
break;
case ObjectType::BOARD_PACKAGE:
accu.accumulate(doc.b->get_board()->packages.at(it.uuid).placement.shift);
break;
case ObjectType::PAD:
accu.accumulate(doc.k->get_package().pads.at(it.uuid).placement.shift);
break;
case ObjectType::TEXT:
accu.accumulate(doc.r->get_text(it.uuid)->placement.shift);
break;
case ObjectType::POLYGON_VERTEX:
accu.accumulate(doc.r->get_polygon(it.uuid)->vertices.at(it.vertex).position);
break;
case ObjectType::DIMENSION:
if (it.vertex < 2) {
auto dim = doc.r->get_dimension(it.uuid);
accu.accumulate(it.vertex == 0 ? dim->p0 : dim->p1);
}
break;
case ObjectType::POLYGON_ARC_CENTER:
accu.accumulate(doc.r->get_polygon(it.uuid)->vertices.at(it.vertex).arc_center);
break;
case ObjectType::SHAPE:
accu.accumulate(doc.a->get_padstack().shapes.at(it.uuid).placement.shift);
break;
case ObjectType::BOARD_PANEL:
accu.accumulate(doc.b->get_board()->board_panels.at(it.uuid).placement.shift);
break;
case ObjectType::PICTURE:
accu.accumulate(doc.r->get_picture(it.uuid)->placement.shift);
break;
case ObjectType::BOARD_DECAL:
accu.accumulate(doc.b->get_board()->decals.at(it.uuid).placement.shift);
break;
default:;
}
}
if (doc.c || doc.y)
return (accu.get() / 1.25_mm) * 1.25_mm;
else
return accu.get();
}
ToolResponse ToolMove::begin(const ToolArgs &args)
{
std::cout << "tool move\n";
move_init(args.coords);
Coordi selection_center;
if (tool_id == ToolID::ROTATE_CURSOR || tool_id == ToolID::MIRROR_CURSOR)
selection_center = args.coords;
else
selection_center = get_selection_center();
collect_nets();
if (tool_id == ToolID::ROTATE || tool_id == ToolID::MIRROR_X || tool_id == ToolID::MIRROR_Y
|| tool_id == ToolID::ROTATE_CURSOR || tool_id == ToolID::MIRROR_CURSOR) {
move_mirror_or_rotate(selection_center, tool_id == ToolID::ROTATE || tool_id == ToolID::ROTATE_CURSOR);
if (tool_id == ToolID::MIRROR_Y) {
move_mirror_or_rotate(selection_center, true);
move_mirror_or_rotate(selection_center, true);
}
finish();
return ToolResponse::commit();
}
if (tool_id == ToolID::MOVE_EXACTLY) {
if (auto r = imp->dialogs.ask_datum_coord("Move exactly")) {
move_do(*r);
finish();
return ToolResponse::commit();
}
else {
return ToolResponse::end();
}
}
imp->tool_bar_set_actions({
{InToolActionID::LMB},
{InToolActionID::RMB},
{InToolActionID::ROTATE, InToolActionID::MIRROR, "rotate/mirror"},
{InToolActionID::ROTATE_CURSOR, InToolActionID::MIRROR_CURSOR, "rotate/mirror around cursor"},
{InToolActionID::RESTRICT},
});
update_tip();
for (const auto &it : selection) {
if (it.type == ObjectType::POLYGON_VERTEX || it.type == ObjectType::POLYGON_EDGE) {
auto poly = doc.r->get_polygon(it.uuid);
if (auto plane = dynamic_cast<Plane *>(poly->usage.ptr)) {
planes.insert(plane);
}
}
}
for (auto plane : planes) {
plane->fragments.clear();
plane->revision++;
}
InToolActionID action = InToolActionID::NONE;
switch (tool_id) {
case ToolID::MOVE_KEY_FINE_UP:
action = InToolActionID::MOVE_UP_FINE;
break;
case ToolID::MOVE_KEY_UP:
action = InToolActionID::MOVE_UP;
break;
case ToolID::MOVE_KEY_FINE_DOWN:
action = InToolActionID::MOVE_DOWN_FINE;
break;
case ToolID::MOVE_KEY_DOWN:
action = InToolActionID::MOVE_DOWN;
break;
case ToolID::MOVE_KEY_FINE_LEFT:
action = InToolActionID::MOVE_LEFT_FINE;
break;
case ToolID::MOVE_KEY_LEFT:
action = InToolActionID::MOVE_LEFT;
break;
case ToolID::MOVE_KEY_FINE_RIGHT:
action = InToolActionID::MOVE_RIGHT_FINE;
break;
case ToolID::MOVE_KEY_RIGHT:
action = InToolActionID::MOVE_RIGHT;
break;
default:;
}
if (action != InToolActionID::NONE) {
is_key = true;
ToolArgs args2;
args2.type = ToolEventType::ACTION;
args2.action = action;
update(args2);
}
if (tool_id == ToolID::MOVE_KEY)
is_key = true;
imp->tool_bar_set_tool_name("Move");
return ToolResponse();
}
void ToolMove::collect_nets()
{
for (const auto &it : selection) {
switch (it.type) {
case ObjectType::BOARD_PACKAGE: {
BoardPackage *pkg = &doc.b->get_board()->packages.at(it.uuid);
for (const auto &itt : pkg->package.pads) {
if (itt.second.net)
nets.insert(itt.second.net->uuid);
}
} break;
case ObjectType::JUNCTION: {
auto ju = doc.r->get_junction(it.uuid);
if (ju->net)
nets.insert(ju->net->uuid);
} break;
default:;
}
}
}
bool ToolMove::can_begin()
{
expand_selection();
return selection.size() > 0;
}
void ToolMove::update_tip()
{
auto delta = get_delta();
std::string s = coord_to_string(delta + key_delta, true) + " ";
if (!is_key) {
s += restrict_mode_to_string();
}
imp->tool_bar_set_tip(s);
}
void ToolMove::do_move(const Coordi &d)
{
move_do_cursor(d);
if (doc.b && update_airwires && nets.size()) {
doc.b->get_board()->update_airwires(true, nets);
}
update_tip();
}
void ToolMove::finish()
{
for (const auto &it : selection) {
if (it.type == ObjectType::SCHEMATIC_SYMBOL) {
auto sym = doc.c->get_schematic_symbol(it.uuid);
doc.c->get_schematic()->autoconnect_symbol(doc.c->get_sheet(), sym);
if (sym->component->connections.size() == 0) {
doc.c->get_schematic()->place_bipole_on_line(doc.c->get_sheet(), sym);
}
}
}
if (doc.c) {
merge_selected_junctions();
}
if (doc.b) {
auto brd = doc.b->get_board();
brd->expand_flags = static_cast<Board::ExpandFlags>(Board::EXPAND_AIRWIRES);
brd->airwires_expand = nets;
for (auto plane : planes) {
brd->update_plane(plane);
}
}
}
ToolResponse ToolMove::update(const ToolArgs &args)
{
if (args.type == ToolEventType::MOVE) {
if (!is_key)
do_move(args.coords);
return ToolResponse();
}
else if (args.type == ToolEventType::ACTION) {
if (any_of(args.action, {InToolActionID::LMB, InToolActionID::COMMIT})
|| (is_transient && args.action == InToolActionID::LMB_RELEASE)) {
finish();
return ToolResponse::commit();
}
else if (any_of(args.action, {InToolActionID::RMB, InToolActionID::CANCEL})) {
return ToolResponse::revert();
}
else if (args.action == InToolActionID::RESTRICT) {
cycle_restrict_mode();
do_move(args.coords);
}
else if (any_of(args.action, {InToolActionID::ROTATE, InToolActionID::MIRROR})) {
bool rotate = args.action == InToolActionID::ROTATE;
const auto selection_center = get_selection_center();
move_mirror_or_rotate(selection_center, rotate);
}
else if (any_of(args.action, {InToolActionID::ROTATE_CURSOR, InToolActionID::MIRROR_CURSOR})) {
bool rotate = args.action == InToolActionID::ROTATE_CURSOR;
move_mirror_or_rotate(args.coords, rotate);
}
else {
const auto [dir, fine] = dir_from_action(args.action);
if (dir.x || dir.y) {
auto sp = imp->get_grid_spacing();
if (fine)
sp = sp / 10;
key_delta += dir * sp;
move_do(dir * sp);
update_tip();
}
}
}
return ToolResponse();
}
} // namespace horizon
| carrotIndustries/horizon | src/core/tools/tool_move.cpp | C++ | gpl-3.0 | 14,465 |
#include <cstdlib> // srand()
#include <ctime> // time()
#include "StateManager.hpp"
#include "SDL.hpp"
#include "Log.hpp"
#include "Config.hpp"
#include "GameStateMainMenu.hpp"
#include "GameStateGame.hpp"
#include "GameStateGameOver.hpp"
#include "Window.hpp"
#include "Graphics.hpp"
StateManager::StateManager(int width, int height)
{
SDL::init(30);
Window::init(width, height, "Prototype", "yes");
Graphics::init(Window::screen);
Config::load("config.ini");
if (Config::debugMode)
Log::debugMode(true);
// Here we start the game!
this->currentState = new GameStateMainMenu();
this->currentState->load();
this->sharedInfo = 0;
srand(time(NULL));
}
StateManager::~StateManager()
{
SDL::exit();
if (this->currentState)
{
this->currentState->unload();
delete this->currentState;
}
}
void StateManager::run()
{
bool letsQuit = false;
while (!letsQuit)
{
// The delta time from the last frame
uint32_t delta = SDL::getDelta();
// Normally i'd refresh input right here, but
// each state must do it individually
int whatToDoNow = this->currentState->update(delta);
switch (whatToDoNow)
{
case GameState::CONTINUE:
break;
case GameState::QUIT:
letsQuit = true;
break;
case GameState::GAME_START:
this->sharedInfo = this->currentState->unload();
delete (this->currentState);
this->currentState = new GameStateGame();
this->currentState->load(this->sharedInfo);
break;
case GameState::GAME_OVER:
this->sharedInfo = this->currentState->unload();
delete (this->currentState);
this->currentState = new GameStateGameOver();
this->currentState->load(this->sharedInfo);
break;
default:
break;
}
Window::clear();
this->currentState->render();
Window::refresh();
// Let's wait a bit if the framerate is too low.
SDL::framerateWait();
}
}
| alexdantas/idj | src/StateManager.cpp | C++ | gpl-3.0 | 2,154 |
/*
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free
Software Foundation, Inc.
This file is part of GNU Inetutils.
GNU Inetutils 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.
GNU Inetutils 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/'. */
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <config.h>
#if defined AUTHENTICATION || defined ENCRYPTION
# include <unistd.h>
# include <sys/types.h>
# include <arpa/telnet.h>
# include <libtelnet/encrypt.h>
# include <libtelnet/misc.h>
# include "general.h"
# include "ring.h"
# include "externs.h"
# include "defines.h"
# include "types.h"
int
net_write (unsigned char *str, int len)
{
if (NETROOM () > len)
{
ring_supply_data (&netoring, str, len);
if (str[0] == IAC && str[1] == SE)
printsub ('>', &str[2], len - 2);
return (len);
}
return (0);
}
void
net_encrypt ()
{
# ifdef ENCRYPTION
if (encrypt_output)
ring_encrypt (&netoring, encrypt_output);
else
ring_clearto (&netoring);
# endif /* ENCRYPTION */
}
int
telnet_spin ()
{
return (-1);
}
char *
telnet_getenv (char *val)
{
return ((char *) env_getvalue (val));
}
char *
telnet_gets (char *prompt, char *result, int length, int echo)
{
# if !HAVE_DECL_GETPASS
extern char *getpass ();
# endif
extern int globalmode;
int om = globalmode;
char *res;
TerminalNewMode (-1);
if (echo)
{
printf ("%s", prompt);
res = fgets (result, length, stdin);
}
else
{
res = getpass (prompt);
if (res)
{
strncpy (result, res, length);
memset (res, 0, strlen (res));
res = result;
}
}
TerminalNewMode (om);
return (res);
}
#endif /* defined(AUTHENTICATION) || defined(ENCRYPTION) */
| infoburp/inetutils | telnet/authenc.c | C | gpl-3.0 | 3,857 |
ace.require("ace/ext/language_tools");
var editor = ace.edit("editor");
editor.setOptions({
enableBasicAutocompletion: true
});
editor.setTheme("ace/theme/eclipse");
editor.getSession().setMode("ace/mode/java");
document.getElementById('editor').style.fontSize = '18px';
editor.setAutoScrollEditorIntoView(true);
var codeTemplates = {};
var viewConfig = {
showOutput: false,
showInput: false
};
var prevLang;
function showOutput(output) {
var stdout = '';
var stderr = '';
if (output.status === 0) {
stdout = output.output;
} else if (output.status === 1) {
stderr = '<p class="error">Compiler error !</p>';
stderr += output.error;
} else if (output.status === 2) {
stderr = '<p class="error">Runtime error !</p>';
stderr += output.error;
} else if (output.status === 3) {
stderr = '<p class="error">Timeout !</p>';
stderr += output.error;
}
var out = '';
if (stderr) {
out += '<b>Stderror</b>\n' + stderr;
}
if (stdout) {
out += stdout;
}
if (!viewConfig.showOutput) {
$('#btn-show-output').click();
}
$('#output-p').html(out);
// $('#output-data').show();
// if (!$('#bottom-pane').hasClass('opened')) {
// $('#bottom-pane').addClass('opened');
// }
windowResized();
}
function loadLangs() {
$('#btn-run').prop('disabled', true);
$.ajax({
type: "GET",
url: '/apis/langs'
}).done(function (data) {
showLangs(data);
$('#btn-run').prop('disabled', false);
}).fail(function (data) {
alert("error");
$('#btn-run').prop('disabled', false);
});
}
function showLangs(langs) {
for (var i = 0; i < langs.supportedLangs.length; i++) {
var supportedLang = langs.supportedLangs[i];
$('#lang').append($('<option>', {
value: supportedLang.id,
text: supportedLang.name
}));
codeTemplates[supportedLang.id] = supportedLang.template;
}
$('#lang').val(langs.supportedLangs[0].id);
onLangChanged();
}
$(document).ready(function () {
$('#btn-output').click(function () {
$('#output-data').toggle();
$('#bottom-pane').toggleClass('opened');
windowResized();
});
$('#btn-run').click(function () {
onRunning();
var codeRunRequest = {
lang: $('#lang').find(":selected").val(),
code: editor.getValue(),
input: $('#text-input').val()
};
runCode(codeRunRequest);
// $.ajax({
// type: "POST",
// url: '/apis/run',
// data: JSON.stringify(codeRunRequest),
// contentType: 'application/json'
// }).done(function (data) {
// showOutput(data);
// $('#btn-run').prop('disabled', false);
// }).fail(function (data) {
// alert("error");
// $('#btn-run').prop('disabled', false);
// });
});
$('#btn-hide-output').click(function () {
$('#btn-hide-output').hide();
$('#btn-show-output').show();
viewConfig.showOutput = false;
windowResized();
});
$('#btn-show-output').click(function () {
$('#btn-hide-output').show();
$('#btn-show-output').hide();
viewConfig.showOutput = true;
windowResized();
});
$('#btn-hide-input').click(function () {
$('#btn-hide-input').hide();
$('#btn-show-input').show();
viewConfig.showInput = false;
windowResized();
});
$('#btn-show-input').click(function () {
$('#btn-hide-input').show();
$('#btn-show-input').hide();
viewConfig.showInput = true;
windowResized();
});
loadLangs();
$(window).resize(function () {
windowResized();
});
windowResized();
});
$('#lang').change(function () {
onLangChanged();
});
function onLangChanged() {
var lang = $('#lang').find(":selected").val();
if (prevLang) {
codeTemplates[prevLang] = editor.getValue();
}
editor.setValue(codeTemplates[lang], -1);
prevLang = lang;
if (lang === 'java7') {
editor.getSession().setMode("ace/mode/java");
} else if (lang === 'python3') {
editor.getSession().setMode("ace/mode/python");
} else if (lang === 'c' || lang === 'c++') {
editor.getSession().setMode("ace/mode/c_cpp");
} else if (lang === 'c#') {
editor.getSession().setMode("ace/mode/csharp");
}
}
function windowResized() {
var aceWrapper = $('#ace_wrapper');
var aceEditor = $('#editor');
var outputWrapper = $('#output-wrapper');
var outputData = $('#output-data');
var inputWrapper = $('#input-wrapper');
var textInput = $('#text-input');
var rightDiff;
var inputHeight;
var outputHeight;
var textInputWidth;
var textInputHeight;
if (viewConfig.showInput || viewConfig.showOutput) {
rightDiff = outputWrapper.width() + 4;
} else {
rightDiff = 0;
}
var aceHeight = window.innerHeight - aceWrapper.position().top;// - bottomPane.height();
var aceWidth = window.innerWidth - rightDiff;
if (viewConfig.showOutput) {
outputWrapper.show();
outputHeight = aceHeight;
} else {
outputWrapper.hide();
outputHeight = 0;
}
if (viewConfig.showInput) {
inputWrapper.show();
inputHeight = 225;
if (viewConfig.showOutput) {
outputHeight -= inputHeight;
} else {
inputHeight = aceHeight;
}
textInputHeight = inputHeight - 62;
textInputWidth = rightDiff - 23;
} else {
inputWrapper.hide();
inputHeight = 0;
}
// var bottomPane = $('#bottom-pane');
// var outputWrapperHeight = aceHeight - inputWrapper.height() - 2;
var outputTextHeight = outputHeight - 52;
aceWrapper.css('height', aceHeight + 'px');
aceWrapper.css('width', aceWidth + 'px');
aceEditor.css('height', aceHeight + 'px');
aceEditor.css('width', aceWidth + 'px');
editor.resize();
if (viewConfig.showOutput) {
outputWrapper.css('height', outputHeight + 'px');
outputData.css('max-height', outputTextHeight + 'px');
}
if (viewConfig.showInput) {
inputWrapper.css('height', inputHeight + 'px');
textInput.css('width', textInputWidth + 'px');
textInput.css('height', textInputHeight + 'px');
// outputData.css('max-height', outputTextHeight + 'px');
}
}
var stompClient;
function connect() {
var socket = new SockJS('/coderun');
stompClient = Stomp.over(socket);
stompClient.connect({}, function (frame) {
// window.alert("connected !");
stompClient.subscribe('/user/queue/reply', function (reply) {
showOutput(JSON.parse(reply.body));
onFinished();
});
});
}
function runCode(codeRunRequest) {
stompClient.send('/iapis/run', {}, JSON.stringify(codeRunRequest));
}
function onRunning() {
$('#btn-run').prop('disabled', true);
$('#icon-running').show();
$('#icon-run').hide();
}
function onFinished() {
$('#btn-run').prop('disabled', false);
$('#icon-running').hide();
$('#icon-run').show();
}
connect(); | AbdallaMahmoud/codeyard | src/main/resources/webapp/js/main.js | JavaScript | gpl-3.0 | 7,360 |
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd ">
<head>
<title>Admin</title>
<link rel="stylesheet" type="text/css" href="../../base/default.css"/>
</head>
<body>
<div id="wrapper">
<div id="header" wicket:id="header">
<div id="logo">
<h1><a href="#">Marbles </a></h1>
<p> by <a href="http://my-volk.de/">Thomas Volk</a></p>
</div>
</div>
<!-- end #header -->
<div id="menu" wicket:id="menu">
<ul>
<li wicket:id="items"><a>Home</a></li>
<li wicket:id="items"><a>Test</a></li>
</ul>
</div>
<!-- end #menu -->
<div id="page">
<div id="page-bgtop">
<div id="page-bgbtm">
<div id="content">
<wicket:extend>
<div class="pageContent">
<h2>
<wicket:message key="title"/>
</h2>
<div class="messages" wicket:id="messages"></div>
<form wicket:id="updateUserForm">
<div>
<div><label for="name">
<wicket:message key="name"/>
</label></div>
<span wicket:id="name" id="name"/>
</div>
<div>
<div><label for="email">
<wicket:message key="email"/>
</label></div>
<span wicket:id="email" id="email"/>
</div>
<div wicket:id="passwordPanel"></div>
<div class="buttons">
<input type="submit" wicket:id="save"/>
</div>
</form>
</div>
</wicket:extend>
<div style="clear: both;"> </div>
</div>
<!-- end #content -->
<div id="sidebar" wicket:id="sidebar"></div>
<!-- end #sidebar -->
<div style="clear: both;"> </div>
</div>
</div>
</div>
<!-- end #page -->
</div>
<div id="footer" wicket:id="footer">
<p>Copyright (c) 2011 by <a href="http://my-volk.de/">Thomas Volk</a>.</p>
</div>
<!-- end #footer -->
</body>
</html> | thomasvolk/marbles | marbles-web/src/main/java/de/voolk/marbles/web/pages/admin/auth/UpdateUserPage.html | HTML | gpl-3.0 | 2,688 |
import {Component, OnInit} from '@angular/core';
import {FundDataService} from '../funddata/funddata.service';
@Component({
selector: 'app-fund-table',
templateUrl: './fund-table.component.html',
styleUrls: ['./fund-table.component.css']
})
export class FundTableComponent implements OnInit {
private colShow: string[] = ['link_linkDisplay', 'fundResult_morningstarRating', 'oneQuarterAgoChange'];
private columns: string[];
private funds: Object[];
private fundsShow: Object[];
private error: any;
constructor(private fundDataService: FundDataService) {
}
ngOnInit() {
this.fundDataService.loadFunds().subscribe((datas) => {
this.funds = datas;
this.fundsShow = datas;
this.columns = Object.keys(datas[0]);
// console.log('columns: ' + this.columns);
// console.log(JSON.stringify(datas));
}, (err) => {// error
console.log(err);
this.error = err;
}, () => {// complete
});
}
toggleColumn(col: string) {
if (this.colShow.indexOf(col) === -1) {
this.colShow.push(col);
} else {
this.colShow.splice(this.colShow.indexOf(col), 1);
}
}
}
| jensim/fundscreener | src/app/fund-table/fund-table.component.ts | TypeScript | gpl-3.0 | 1,096 |
/*
* Copyright appNativa Inc. All Rights Reserved.
*
* This file is part of the Real-time Application Rendering Engine (RARE).
*
* RARE 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.appnativa.rare.platform.swing.ui.view;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import javax.swing.Icon;
import javax.swing.JRadioButton;
import com.appnativa.rare.Platform;
import com.appnativa.rare.iConstants;
import com.appnativa.rare.iPlatformAppContext;
import com.appnativa.rare.platform.swing.ui.util.SwingGraphics;
import com.appnativa.rare.ui.ColorUtils;
import com.appnativa.rare.ui.FontUtils;
import com.appnativa.rare.ui.UIColor;
import com.appnativa.rare.ui.UIDimension;
import com.appnativa.rare.ui.iPlatformIcon;
import com.appnativa.rare.ui.painter.iPainter;
import com.appnativa.rare.ui.painter.iPainterSupport;
import com.appnativa.rare.ui.painter.iPlatformComponentPainter;
import com.appnativa.util.CharArray;
import com.appnativa.util.XMLUtils;
public class RadioButtonView extends JRadioButton implements iPainterSupport, iView {
protected static iPlatformIcon deselectedIconDisabled_;
protected static iPlatformIcon deselectedIcon_;
protected static iPlatformIcon deselectedPressedIcon_;
protected static iPlatformIcon selectedIconDisabled_;
protected static iPlatformIcon selectedIcon_;
protected static iPlatformIcon selectedPressedIcon_;
private String originalText;
private boolean wordWrap;
public RadioButtonView() {
super();
initialize();
}
public RadioButtonView(Icon icon) {
super(icon);
initialize();
}
public RadioButtonView(String text) {
super(text);
initialize();
}
public RadioButtonView(String text, Icon icon) {
super(text, icon);
initialize();
}
AffineTransform transform;
protected SwingGraphics graphics;
private iPlatformComponentPainter componentPainter;
@Override
public boolean isOpaque() {
return ((componentPainter != null) && componentPainter.isBackgroundPaintEnabled())
? false
: super.isOpaque();
}
@Override
public void setTransformEx(AffineTransform tx) {
transform = tx;
}
@Override
public Color getForeground() {
Color c=super.getForeground();
if(c instanceof UIColor && !isEnabled()) {
c=((UIColor)c).getDisabledColor();
}
return c;
}
@Override
public AffineTransform getTransformEx() {
return transform;
}
@Override
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
AffineTransform tx = g2.getTransform();
if (transform != null) {
g2.transform(transform);
}
graphics = SwingGraphics.fromGraphics(g2, this, graphics);
super.paint(g2);
if (tx != null) {
g2.setTransform(tx);
}
graphics.clear();
}
@Override
protected void paintBorder(Graphics g) {
if (componentPainter == null) {
super.paintBorder(g);
}
}
@Override
protected void paintChildren(Graphics g) {
super.paintChildren(graphics.getGraphics());
iPlatformComponentPainter cp = getComponentPainter();
if (cp != null) {
float height = getHeight();
float width = getWidth();
cp.paint(graphics, 0, 0, width, height, iPainter.HORIZONTAL, true);
}
}
@Override
protected void paintComponent(Graphics g) {
graphics = SwingGraphics.fromGraphics(g, this, graphics);
iPlatformComponentPainter cp = getComponentPainter();
if (cp != null) {
float height = getHeight();
float width = getWidth();
cp.paint(graphics, 0, 0, width, height, iPainter.HORIZONTAL, false);
}
super.paintComponent(g);
}
@Override
public void setComponentPainter(iPlatformComponentPainter cp) {
componentPainter = cp;
}
@Override
public iPlatformComponentPainter getComponentPainter() {
return componentPainter;
}
@Override
public void getMinimumSize(UIDimension size, int maxWidth) {
Dimension d = getMinimumSize();
size.width = d.width;
size.height = d.height;
}
@Override
public void setText(String text) {
if (text == null) {
text = "";
}
originalText = text;
int len = text.length();
if (wordWrap && (len > 0) &&!text.startsWith("<html>")) {
CharArray ca = new CharArray(text.length() + 20);
ca.append("<html>");
XMLUtils.escape(text.toCharArray(), 0, len, true, ca);
ca.append("</html>");
text = ca.toString();
}
super.setText(text);
}
public void setWordWrap(boolean wordWrap) {
this.wordWrap = wordWrap;
}
@Override
public String getText() {
return originalText;
}
public boolean isWordWrap() {
return wordWrap;
}
protected void initialize() {
setOpaque(false);
setFont(FontUtils.getDefaultFont());
setForeground(ColorUtils.getForeground());
if (selectedIcon_ == null) {
iPlatformAppContext app = Platform.getAppContext();
if (ColorUtils.getForeground().isDarkColor()) {
selectedIcon_ = app.getResourceAsIcon("Rare.icon.radiobutton.on.light");
deselectedIcon_ = app.getResourceAsIcon("Rare.icon.radiobutton.off.light");
selectedPressedIcon_ = app.getResourceAsIcon("Rare.icon.radiobutton.on.pressed.light");
deselectedPressedIcon_ = app.getResourceAsIcon("Rare.icon.radiobutton.off.pressed.light");
selectedIconDisabled_ = app.getResourceAsIcon("Rare.icon.radiobutton.on.disabled.light");
deselectedIconDisabled_ = app.getResourceAsIcon("Rare.icon.radiobutton.off.disabled.light");
} else {
selectedIcon_ = app.getResourceAsIcon("Rare.icon.radiobutton.on.dark");
deselectedIcon_ = app.getResourceAsIcon("Rare.icon.radiobutton.off.dark");
selectedPressedIcon_ = app.getResourceAsIcon("Rare.icon.radiobutton.on.pressed.dark");
deselectedPressedIcon_ = app.getResourceAsIcon("Rare.icon.radiobutton.off.pressed.dark");
selectedIconDisabled_ = app.getResourceAsIcon("Rare.icon.radiobutton.on.disabled.dark");
deselectedIconDisabled_ = app.getResourceAsIcon("Rare.icon.radiobutton.off.disabled.dark");
}
}
setSelectedIcon(selectedIcon_);
setDisabledIcon(deselectedIconDisabled_);
setPressedIcon(deselectedPressedIcon_);
setIcon(deselectedIcon_);
setDisabledSelectedIcon(selectedIconDisabled_);
}
@Override
public Icon getDisabledIcon() {
Icon icon = super.getDisabledIcon();
if (icon == null) {
icon = getIcon();
if (icon instanceof iPlatformIcon) {
return ((iPlatformIcon) icon).getDisabledVersion();
}
}
return icon;
}
public Icon getDisabledSelectedIcon() {
Icon icon = super.getDisabledSelectedIcon();
if (icon == null) {
icon = getSelectedIcon();
if (icon == null) {
icon = getIcon();
}
if (icon instanceof iPlatformIcon) {
return ((iPlatformIcon) icon).getDisabledVersion();
}
}
return icon;
}
private static UIDimension size = new UIDimension();
@Override
public Dimension getPreferredSize() {
if (size == null) {
size = new UIDimension();
}
Number num = (Number) getClientProperty(iConstants.RARE_WIDTH_FIXED_VALUE);
int maxWidth = 0;
if ((num != null) && (num.intValue() > 0)) {
maxWidth = num.intValue();
}
getPreferredSize(size, maxWidth);
return new Dimension(size.intWidth(), size.intHeight());
}
@Override
public void getPreferredSize(UIDimension size, int maxWidth) {
Dimension d = super.getPreferredSize();
size.width = d.width;
size.height = d.height;
if (isFontSet() && getFont().isItalic()) {
if (getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) == null) {
size.width += 4;
}
}
}
}
| appnativa/rare | source/rare/swingx/com/appnativa/rare/platform/swing/ui/view/RadioButtonView.java | Java | gpl-3.0 | 8,918 |
package de.roskenet.simplecms.repository;
import org.springframework.data.repository.PagingAndSortingRepository;
import de.roskenet.simplecms.entity.Attribute;
public interface AttributeRepository extends PagingAndSortingRepository<Attribute, Integer> {
}
| roskenet/simple-cms | src/main/java/de/roskenet/simplecms/repository/AttributeRepository.java | Java | gpl-3.0 | 260 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Sequoia: Member List</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Sequoia
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>sequoia</b></li><li class="navelem"><b>testing</b></li><li class="navelem"><a class="el" href="../../d3/dcb/classsequoia_1_1testing_1_1shell__commands__free__test.html">shell_commands_free_test</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle"><div class="title">sequoia::testing::shell_commands_free_test Member List</div></div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="../../d3/dcb/classsequoia_1_1testing_1_1shell__commands__free__test.html">sequoia::testing::shell_commands_free_test</a>, including all inherited members.</p>
<table class="directory">
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>auxiliary_materials</b>() const noexcept (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>basic_test</b>(std::string name) (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">explicit</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>basic_test</b>(const basic_test &)=delete (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>basic_test</b>(basic_test &&) noexcept=default (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>caught_exceptions_output_filename</b>() const noexcept (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>diagnostics_output_filename</b>() const noexcept (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>duration</b> typedef (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>execute</b>(std::optional< std::size_t > index) (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>mode</b> (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>name</b>() const noexcept (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>operator=</b>(const basic_test &)=delete (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>operator=</b>(basic_test &&) noexcept=default (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>predictive_materials</b>() const noexcept (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>report_line</b>(const std::filesystem::path &file, int line, std::string_view message) (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>set_filesystem_data</b>(std::filesystem::path testRepo, const std::filesystem::path &outputDir, std::string_view familyName) (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>set_materials</b>(std::filesystem::path workingMaterials, std::filesystem::path predictiveMaterials, std::filesystem::path auxiliaryMaterials) (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>set_recovery_paths</b>(recovery_paths paths) (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>source_filename</b>() const noexcept (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html#a74f379026bb979d1253c5660a70530cb">summarize</a>(duration delta) const</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>test_repository</b>() const noexcept (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>working_materials</b>() const noexcept (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>~basic_test</b>()=default (defined in <a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a>)</td><td class="entry"><a class="el" href="../../d0/d16/classsequoia_1_1testing_1_1basic__test.html">sequoia::testing::basic_test< Checker ></a></td><td class="entry"><span class="mlabel">virtual</span></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.2
</small></address>
</body>
</html>
| ojrosten/sequoia | docs/html/dd/ded/classsequoia_1_1testing_1_1shell__commands__free__test-members.html | HTML | gpl-3.0 | 13,737 |
require('dotenv').config({ silent: true });
var Express = require('express');
var path = require('path');
var fs = require('fs');
var merge = require('lodash/merge');
var proxy = require('proxy-middleware');
var ejs = require('ejs');
var config = require('./config');
var server = new Express();
server.set('port', config.PORT);
server.engine('html', require('ejs').renderFile);
server.set('view engine', 'ejs');
server.set('views', path.resolve(__dirname, '../www'));
server.locals.CONFIG = escape(JSON.stringify(config));
server.use(config.API_PROXY_PATH, proxy(config.API_ENDPOINT));
server.get('/', function (req, res) {
res.render('index.html');
});
server.use(Express.static(path.resolve(__dirname, '../www')));
server.get('/404', function (req, res) {
res.render('404.html');
});
server.listen(server.get('port'), function (err) {
if (err) {
console.log('error while starting server', err);
}
console.log('Gandalf is started to listen at localhost:' + server.get('port'));
});
| Nebo15/gandalf.web | server/index.js | JavaScript | gpl-3.0 | 1,008 |
/* This file is part of the 'orilib' software. */
/* Copyright (C) 2007-2009, 2012 Romain Quey */
/* see the COPYING file in the top-level directory.*/
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef OL_DIS_DEP_H
#define OL_DIS_DEP_H
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<float.h>
#define isNaN(x) ((x) != (x))
#include"ut.h"
#include"../ol_set.h"
#endif /* OL_DIS_DEP_H */
#ifdef __cplusplus
}
#endif
| rquey/neper | src/contrib/orilib/ol_set/ol_set_aniso.h | C | gpl-3.0 | 431 |
/**
*
* Copyright (C) 2004-2008 FhG Fokus
*
* This file is part of the FhG Fokus UPnP stack - an open source UPnP implementation
* with some additional features
*
* You can redistribute the FhG Fokus UPnP stack and/or modify it
* under the terms of the GNU General Public License Version 3 as published by
* the Free Software Foundation.
*
* For a license to use the FhG Fokus UPnP stack software under conditions
* other than those described here, or to purchase support for this
* software, please contact Fraunhofer FOKUS by e-mail at the following
* addresses:
* [email protected]
*
* The FhG Fokus UPnP stack 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/>
* or write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package de.fraunhofer.fokus.upnp.core;
import java.util.Hashtable;
import java.util.Vector;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import de.fraunhofer.fokus.upnp.util.SAXTemplateHandler;
/**
* This class is used to parse UPnPDoc messages.
*
* @author Alexander Koenig
*
*
*/
public class UPnPDocParser extends SAXTemplateHandler
{
/** Doc entries for the current service type */
private Vector currentDocEntryList = new Vector();
private boolean isAction = false;
private boolean isStateVariable = false;
private String currentServiceType = null;
private String currentArgumentName = null;
private String currentArgumentDescription = null;
private UPnPDocEntry currentDocEntry = null;
/** Hashtable containing the UPnP doc entry list for one service type */
private Hashtable docEntryFromServiceTypeTable = new Hashtable();
/*
* (non-Javadoc)
*
* @see de.fraunhofer.fokus.upnp.util.SAXTemplateHandler#processStartElement(java.lang.String,
* java.lang.String, java.lang.String, org.xml.sax.Attributes)
*/
public void processStartElement(String uri, String name, String name2, Attributes atts) throws SAXException
{
if (getTagCount() == 2)
{
for (int i = 0; i < atts.getLength(); i++)
{
if (atts.getQName(i).equalsIgnoreCase("serviceType"))
{
currentServiceType = atts.getValue(i);
currentDocEntryList = new Vector();
}
}
}
if (getTagCount() == 3 && currentServiceType != null)
{
isAction = getCurrentTag().equalsIgnoreCase("actionList");
isStateVariable = getCurrentTag().equalsIgnoreCase("serviceStateTable");
}
if (getTagCount() == 4 && currentServiceType != null)
{
currentDocEntry = new UPnPDocEntry(currentServiceType);
}
}
/*
* (non-Javadoc)
*
* @see de.fraunhofer.fokus.upnp.util.SAXTemplateHandler#processEndElement(java.lang.String,
* java.lang.String, java.lang.String)
*/
public void processEndElement(String uri, String localName, String name) throws SAXException
{
if (getTagCount() == 6 && isAction && currentDocEntry != null && currentArgumentName != null &&
currentArgumentDescription != null)
{
currentDocEntry.addArgumentDescription(currentArgumentName, currentArgumentDescription);
currentArgumentName = null;
currentArgumentDescription = null;
}
if (getTagCount() == 4)
{
if (currentDocEntry != null && currentDocEntry.getActionName() != null && isAction)
{
// TemplateService.printMessage(" Add doc entry for action " +
// currentDocEntry.getActionName());
currentDocEntryList.add(currentDocEntry);
}
if (currentDocEntry != null && currentDocEntry.getStateVariableName() != null && isStateVariable)
{
// TemplateService.printMessage(" Add doc entry for state variable " +
// currentDocEntry.getStateVariableName());
currentDocEntryList.add(currentDocEntry);
}
currentDocEntry = null;
}
if (getTagCount() == 3)
{
isAction = false;
isStateVariable = false;
}
if (getTagCount() == 2)
{
// store list with doc entries for one service type
docEntryFromServiceTypeTable.put(currentServiceType, currentDocEntryList);
currentServiceType = null;
currentDocEntryList = null;
}
}
/*
* (non-Javadoc)
*
* @see de.fraunhofer.fokus.upnp.util.SAXTemplateHandler#processContentElement(java.lang.String)
*/
public void processContentElement(String content) throws SAXException
{
if (getTagCount() == 5 && currentDocEntry != null)
{
if (getCurrentTag().equalsIgnoreCase("name") && isAction)
{
currentDocEntry.setActionName(content.trim());
}
if (getCurrentTag().equalsIgnoreCase("name") && isStateVariable)
{
currentDocEntry.setStateVariableName(content.trim());
}
if (getCurrentTag().equalsIgnoreCase("description"))
{
currentDocEntry.setDescription(content.trim());
}
}
if (getTagCount() == 7 && currentDocEntry != null)
{
if (getCurrentTag().equalsIgnoreCase("name"))
{
currentArgumentName = content.trim();
}
if (getCurrentTag().equalsIgnoreCase("description"))
{
currentArgumentDescription = content.trim();
}
}
}
/**
* Retrieves the upnpDocEntryTable.
*
* @return The upnpDocEntryTable
*/
public Hashtable getDocEntryFormServiceTypeTable()
{
return docEntryFromServiceTypeTable;
}
}
| fraunhoferfokus/fokus-upnp | upnp-core/src/main/java/de/fraunhofer/fokus/upnp/core/UPnPDocParser.java | Java | gpl-3.0 | 5,855 |
/*
* (C) 2003-2006 Gabest
* (C) 2006-2013 see Authors.txt
*
* This file is part of MPC-HC.
*
* MPC-HC 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.
*
* MPC-HC 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/>.
*
*/
#pragma once
#include <d3dx9shader.h>
class CPixelShaderCompiler
{
typedef HRESULT(WINAPI* D3DXCompileShaderPtr)(
LPCSTR pSrcData,
UINT SrcDataLen,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
LPCSTR pFunctionName,
LPCSTR pProfile,
DWORD Flags,
LPD3DXBUFFER* ppShader,
LPD3DXBUFFER* ppErrorMsgs,
LPD3DXCONSTANTTABLE* ppConstantTable);
typedef HRESULT(WINAPI* D3DXDisassembleShaderPtr)(
CONST DWORD* pShader,
bool EnableColorCode,
LPCSTR pComments,
LPD3DXBUFFER* ppDisassembly);
D3DXCompileShaderPtr m_pD3DXCompileShader;
D3DXDisassembleShaderPtr m_pD3DXDisassembleShader;
CComPtr<IDirect3DDevice9> m_pD3DDev;
public:
CPixelShaderCompiler(IDirect3DDevice9* pD3DDev, bool fStaySilent = false);
virtual ~CPixelShaderCompiler();
HRESULT CompileShader(
LPCSTR pSrcData,
LPCSTR pFunctionName,
LPCSTR pProfile,
DWORD Flags,
IDirect3DPixelShader9** ppPixelShader,
CString* disasm = nullptr,
CString* errmsg = nullptr);
};
| jeeb/mpc-hc | src/filters/renderer/VideoRenderers/PixelShaderCompiler.h | C | gpl-3.0 | 1,932 |
<!doctype html>
<html>
<title>npm-rm</title>
<meta http-equiv="content-type" value="text/html;utf-8">
<link rel="stylesheet" type="text/css" href="../../static/style.css">
<link rel="canonical" href="https://www.npmjs.org/doc/cli/npm-rm.html">
<script async=true src="../../static/toc.js"></script>
<body>
<div id="wrapper">
<h1><a href="../cli/npm-rm.html">npm-rm</a></h1> <p>Remove a package</p>
<h2 id="synopsis">SYNOPSIS</h2>
<pre><code>npm rm <name>
npm r <name>
npm uninstall <name>
npm un <name>
</code></pre><h2 id="description">DESCRIPTION</h2>
<p>This uninstalls a package, completely removing everything npm installed
on its behalf.</p>
<h2 id="see-also">SEE ALSO</h2>
<ul>
<li><a href="../cli/npm-prune.html">npm-prune(1)</a></li>
<li><a href="../cli/npm-install.html">npm-install(1)</a></li>
<li><a href="../files/npm-folders.html">npm-folders(5)</a></li>
<li><a href="../cli/npm-config.html">npm-config(1)</a></li>
<li><a href="../misc/npm-config.html">npm-config(7)</a></li>
<li><a href="../files/npmrc.html">npmrc(5)</a></li>
</ul>
</div>
<table border=0 cellspacing=0 cellpadding=0 id=npmlogo>
<tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18> </td></tr>
<tr><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)"> </td><td style="width:40px;height:10px;background:#fff" colspan=4> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4> </td><td style="width:40px;height:10px;background:#fff" colspan=4> </td><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)"> </td><td colspan=6 style="width:60px;height:10px;background:#fff"> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4> </td></tr>
<tr><td colspan=2 style="width:20px;height:30px;background:#fff" rowspan=3> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:20px;height:10px;background:#fff" rowspan=4 colspan=2> </td><td style="width:10px;height:20px;background:rgb(237,127,127)" rowspan=2> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:20px;height:10px;background:#fff" rowspan=3 colspan=2> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td></tr>
<tr><td style="width:10px;height:10px;background:#fff" rowspan=2> </td></tr>
<tr><td style="width:10px;height:10px;background:#fff"> </td></tr>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
<p id="footer">npm-rm — [email protected]</p>
| justathoughtor2/atomicApe | cygwin/bin/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/html/doc/cli/npm-rm.html | HTML | gpl-3.0 | 3,248 |
#!/bin/bash
cd output_tfi
rm "h_mz_E_D=2_chi=20.dat"
rm "h_mz_E_D=2_chi=20_pm.dat"
rm "h_mz_E_D=3_chi=30.dat"
rm "h_mz_E_D=3_chi=30_pm.dat"
for f in `ls D=2_chi=20_*_trotter2_itebd.dat`
do
h=`echo $f | cut -f 3 -d "_" | cut -f 2 -d "="`
mz=`tail -n 1 $f | cut -f 3 -d " "`
E=`tail -n 1 $f | cut -f 5 -d " "`
tau=`echo $f | cut -f 4 -d "_" | cut -f 2 -d "="`
echo $h $mz $E $tau >> "h_mz_E_D=2_chi=20.dat"
done
for f in `ls D=2_chi=20_*_trotter2_pm_itebd.dat`
do
h=`echo $f | cut -f 3 -d "_" | cut -f 2 -d "="`
mz=`tail -n 1 $f | cut -f 3 -d " "`
E=`tail -n 1 $f | cut -f 5 -d " "`
tau=`echo $f | cut -f 4 -d "_" | cut -f 2 -d "="`
echo $h $mz $E $tau >> "h_mz_E_D=2_chi=20_pm.dat"
done
for f in `ls D=3_chi=30_*_trotter2_itebd.dat`
do
h=`echo $f | cut -f 3 -d "_" | cut -f 2 -d "="`
mz=`tail -n 1 $f | cut -f 3 -d " "`
E=`tail -n 1 $f | cut -f 5 -d " "`
tau=`echo $f | cut -f 4 -d "_" | cut -f 2 -d "="`
echo $h $mz $E $tau >> "h_mz_E_D=3_chi=30.dat"
done
for f in `ls D=3_chi=30_*_trotter2_pm_itebd.dat`
do
h=`echo $f | cut -f 3 -d "_" | cut -f 2 -d "="`
mz=`tail -n 1 $f | cut -f 3 -d " "`
E=`tail -n 1 $f | cut -f 5 -d " "`
tau=`echo $f | cut -f 4 -d "_" | cut -f 2 -d "="`
echo $h $mz $E $tau >> "h_mz_E_D=3_chi=30_pm.dat"
done
cd ..
exit 0
| kingfisher1337/itebd | tfi_gs_gather.sh | Shell | gpl-3.0 | 1,332 |
--
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local _detalhes = _G._detalhes
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
local _
_detalhes.network = {}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local _UnitName = UnitName
local _GetRealmName = GetRealmName
local _select = select
local _table_wipe = table.wipe
local _math_min = math.min
local _string_gmatch = string.gmatch
local _pairs = pairs
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
DETAILS_PREFIX_NETWORK = "DTLS"
local CONST_HIGHFIVE_REQUEST = "HI"
local CONST_HIGHFIVE_DATA = "HF"
local CONST_VERSION_CHECK = "CV"
local CONST_ITEMLEVEL_DATA = "IL"
local CONST_WIPE_CALL = "WI"
local CONST_GUILD_SYNC = "GS"
local CONST_CLOUD_REQUEST = "CR"
local CONST_CLOUD_FOUND = "CF"
local CONST_CLOUD_DATARQ = "CD"
local CONST_CLOUD_DATARC = "CE"
local CONST_CLOUD_EQUALIZE = "EQ"
local CONST_CLOUD_SHAREDATA = "SD"
local CONST_PVP_ENEMY = "PP"
local CONST_ROGUE_SR = "SR" --soul rip from akaari's soul (LEGION ONLY)
DETAILS_PREFIX_COACH = "CO" --coach feature
DETAILS_PREFIX_TBC_DATA = "BC" --tbc data
_detalhes.network.ids = {
["HIGHFIVE_REQUEST"] = CONST_HIGHFIVE_REQUEST,
["HIGHFIVE_DATA"] = CONST_HIGHFIVE_DATA,
["VERSION_CHECK"] = CONST_VERSION_CHECK,
["ITEMLEVEL_DATA"] = CONST_ITEMLEVEL_DATA,
["CLOUD_REQUEST"] = CONST_CLOUD_REQUEST,
["CLOUD_FOUND"] = CONST_CLOUD_FOUND,
["CLOUD_DATARQ"] = CONST_CLOUD_DATARQ,
["CLOUD_DATARC"] = CONST_CLOUD_DATARC,
["CLOUD_EQUALIZE"] = CONST_CLOUD_EQUALIZE,
["WIPE_CALL"] = CONST_WIPE_CALL,
["GUILD_SYNC"] = CONST_GUILD_SYNC,
["PVP_ENEMY"] = CONST_PVP_ENEMY,
["MISSDATA_ROGUE_SOULRIP"] = CONST_ROGUE_SR, --soul rip from akaari's soul (LEGION ONLY)
["CLOUD_SHAREDATA"] = CONST_CLOUD_SHAREDATA,
["COACH_FEATURE"] = DETAILS_PREFIX_COACH, --ask the raid leader is the coach is enbaled
["TBC_DATA"] = DETAILS_PREFIX_TBC_DATA, --get basic information about the player
}
local plugins_registred = {}
local temp = {}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> comm functions
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> item level
function _detalhes:SendCharacterData()
--> only send if in group
if (not IsInGroup() and not IsInRaid()) then
return
end
if (DetailsFramework.IsTimewalkWoW()) then
if (DetailsFramework.IsTBCWow()) then
--detect my spec
end
return
end
--> check the player level
local playerLevel = UnitLevel ("player")
if (not playerLevel) then
return
elseif (playerLevel < 60) then
return
end
--> delay to sent information again
if (_detalhes.LastPlayerInfoSync and _detalhes.LastPlayerInfoSync+10 > GetTime()) then
--do not send info if recently sent
return
end
--> get player item level
local overall, equipped = GetAverageItemLevel()
--> get player talents
local talents = {}
for i = 1, 7 do
for o = 1, 3 do
local talentID, name, texture, selected, available = GetTalentInfo (i, o, 1)
if (selected) then
tinsert (talents, talentID)
break
end
end
end
--> get the spec ID
local spec = DetailsFramework.GetSpecialization()
local currentSpec
if (spec) then
local specID = DetailsFramework.GetSpecializationInfo (spec)
if (specID and specID ~= 0) then
currentSpec = specID
end
end
--> get the character serial number
local serial = UnitGUID ("player")
if (IsInRaid()) then
_detalhes:SendRaidData (CONST_ITEMLEVEL_DATA, serial, equipped, talents, currentSpec)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) sent ilevel data to Raid")
end
elseif (IsInGroup()) then
_detalhes:SendPartyData (CONST_ITEMLEVEL_DATA, serial, equipped, talents, currentSpec)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) sent ilevel data to Party")
end
end
_detalhes.LastPlayerInfoSync = GetTime()
end
function _detalhes.network.ItemLevel_Received (player, realm, core_version, serial, itemlevel, talents, spec)
_detalhes:IlvlFromNetwork (player, realm, core_version, serial, itemlevel, talents, spec)
end
--high five
function _detalhes.network.HighFive_Request()
return _detalhes:SendRaidData (CONST_HIGHFIVE_DATA, _detalhes.userversion)
end
function _detalhes.network.HighFive_DataReceived (player, realm, core_version, user_version)
if (_detalhes.sent_highfive and _detalhes.sent_highfive + 30 > GetTime()) then
_detalhes.users [#_detalhes.users+1] = {player, realm, (user_version or "") .. " (" .. core_version .. ")"}
end
end
function _detalhes.network.Update_VersionReceived (player, realm, core_version, build_number)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) received version alert ", build_number)
end
if (_detalhes.streamer_config.no_alerts) then
return
end
build_number = tonumber (build_number)
if (not _detalhes.build_counter or not _detalhes.lastUpdateWarning or not build_number) then
return
end
if (build_number > _detalhes.build_counter) then
if (time() > _detalhes.lastUpdateWarning + 72000) then
local lower_instance = _detalhes:GetLowerInstanceNumber()
if (lower_instance) then
lower_instance = _detalhes:GetInstance (lower_instance)
if (lower_instance) then
lower_instance:InstanceAlert ("Update Available!", {[[Interface\GossipFrame\AvailableQuestIcon]], 16, 16, false}, _detalhes.update_warning_timeout, {_detalhes.OpenUpdateWindow})
end
end
_detalhes:Msg (Loc ["STRING_VERSION_AVAILABLE"])
_detalhes.lastUpdateWarning = time()
end
end
end
function _detalhes.network.Cloud_Request (player, realm, core_version, ...)
--deprecated | need to remove
if (true) then return end
if (_detalhes.debug) then
_detalhes:Msg ("(debug)", player, _detalhes.host_of, _detalhes:CaptureIsAllEnabled(), core_version == _detalhes.realversion)
end
if (player ~= _detalhes.playername) then
if (not _detalhes.host_of and _detalhes:CaptureIsAllEnabled() and core_version == _detalhes.realversion) then
if (realm ~= _GetRealmName()) then
player = player .."-"..realm
end
_detalhes.host_of = player
if (_detalhes.debug) then
_detalhes:Msg ("(debug) sent 'okey' answer for a cloud parser request.")
end
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (_detalhes.network.ids.CLOUD_FOUND, _UnitName ("player"), _GetRealmName(), _detalhes.realversion), "WHISPER", player)
end
end
end
function _detalhes.network.Cloud_Found (player, realm, core_version, ...)
--deprecated | need to remove
if (true) then return end
if (_detalhes.host_by) then
return
end
if (realm ~= _GetRealmName()) then
player = player .."-"..realm
end
_detalhes.host_by = player
if (_detalhes.debug) then
_detalhes:Msg ("(debug) cloud found for disabled captures.")
end
_detalhes.cloud_process = _detalhes:ScheduleRepeatingTimer ("RequestCloudData", 10)
_detalhes.last_data_requested = _detalhes._tempo
end
function _detalhes.network.Cloud_DataRequest (player, realm, core_version, ...)
--deprecated | need to remove
if (true) then return end
if (not _detalhes.host_of) then
return
end
local atributo, subatributo = player, realm
local data
local atributo_name = _detalhes:GetInternalSubAttributeName (atributo, subatributo)
if (atributo == 1) then
data = _detalhes.atributo_damage:RefreshWindow ({}, _detalhes.tabela_vigente, nil, { key = atributo_name, modo = _detalhes.modos.group })
elseif (atributo == 2) then
data = _detalhes.atributo_heal:RefreshWindow ({}, _detalhes.tabela_vigente, nil, { key = atributo_name, modo = _detalhes.modos.group })
elseif (atributo == 3) then
data = _detalhes.atributo_energy:RefreshWindow ({}, _detalhes.tabela_vigente, nil, { key = atributo_name, modo = _detalhes.modos.group })
elseif (atributo == 4) then
data = _detalhes.atributo_misc:RefreshWindow ({}, _detalhes.tabela_vigente, nil, { key = atributo_name, modo = _detalhes.modos.group })
else
return
end
if (data) then
local export = temp
local container = _detalhes.tabela_vigente [atributo]._ActorTable
for i = 1, _math_min (6, #container) do
local actor = container [i]
if (actor.grupo) then
export [#export+1] = {actor.nome, actor [atributo_name]}
end
end
if (_detalhes.debug) then
_detalhes:Msg ("(debug) requesting data from the cloud.")
end
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_CLOUD_DATARC, atributo, atributo_name, export), "WHISPER", _detalhes.host_of)
_table_wipe (temp)
end
end
function _detalhes.network.Cloud_DataReceived (player, realm, core_version, ...)
--deprecated | need to remove
if (true) then return end
local atributo, atributo_name, data = player, realm, core_version
local container = _detalhes.tabela_vigente [atributo]
if (_detalhes.debug) then
_detalhes:Msg ("(debug) received data from the cloud.")
end
for i = 1, #data do
local _this = data [i]
local name = _this [1]
local actor = container:PegarCombatente (nil, name)
if (not actor) then
if (IsInRaid()) then
for i = 1, GetNumGroupMembers() do
if (name:find ("-")) then --> other realm
local nname, server = _UnitName ("raid"..i)
if (server and server ~= "") then
nname = nname.."-"..server
end
if (nname == name) then
actor = container:PegarCombatente (UnitGUID ("raid"..i), name, 0x514, true)
break
end
else
if (_UnitName ("raid"..i) == name) then
actor = container:PegarCombatente (UnitGUID ("raid"..i), name, 0x514, true)
break
end
end
end
elseif (IsInGroup()) then
for i = 1, GetNumGroupMembers()-1 do
if (name:find ("-")) then --> other realm
local nname, server = _UnitName ("party"..i)
if (server and server ~= "") then
nname = nname.."-"..server
end
if (nname == name) then
actor = container:PegarCombatente (UnitGUID ("party"..i), name, 0x514, true)
break
end
else
if (_UnitName ("party"..i) == name or _detalhes.playername == name) then
actor = container:PegarCombatente (UnitGUID ("party"..i), name, 0x514, true)
break
end
end
end
end
end
if (actor) then
actor [atributo_name] = _this [2]
container.need_refresh = true
else
if (_detalhes.debug) then
_detalhes:Msg ("(debug) actor not found on cloud data received", name, atributo_name)
end
end
end
end
function _detalhes.network.Cloud_Equalize (player, realm, core_version, data)
--deprecated | need to remove
if (true) then return end
if (not _detalhes.in_combat) then
if (core_version ~= _detalhes.realversion) then
return
end
_detalhes:MakeEqualizeOnActor (player, realm, data)
end
end
function _detalhes.network.Wipe_Call (player, realm, core_version, ...)
local chr_name = Ambiguate(player, "none")
if (UnitIsGroupLeader (chr_name)) then
if (UnitIsInMyGuild (chr_name)) then
_detalhes:CallWipe()
end
end
end
--received an entire segment data from a user that is sharing with the 'player'
function _detalhes.network.Cloud_SharedData (player, realm, core_version, data)
if (core_version ~= _detalhes.realversion) then
if (core_version > _detalhes.realversion) then
--_detalhes:Msg ("your Details! is out dated and cannot perform the action, please update it.")
end
return false
end
end
function _detalhes.network.TBCData(player, realm, coreVersion, data)
if (not IsInRaid() and not IsInGroup()) then
return
end
local LibDeflate = _G.LibStub:GetLibrary("LibDeflate")
local dataCompressed = LibDeflate:DecodeForWoWAddonChannel(data)
local dataSerialized = LibDeflate:DecompressDeflate(dataCompressed)
local dataTable = {Details:Deserialize(dataSerialized)}
tremove(dataTable, 1)
local dataTable = dataTable[1]
local playerRole = dataTable[1]
local spec = dataTable[2]
local itemLevel = dataTable[3]
local talents = dataTable[4]
local guid = dataTable[5]
--[=[
print("Details! Received TBC Comm Data:")
print("From:", player)
print("spec:", spec)
print("role:", playerRole)
print("item level:", itemLevel)
print("guid:", guid)
--]=]
_detalhes.cached_talents[guid] = talents
if (spec and spec ~= 0) then
_detalhes.cached_specs[guid] = spec
end
_detalhes.cached_roles[guid] = playerRole
_detalhes.item_level_pool[guid] = {
name = player,
ilvl = itemLevel,
time = time()
}
end
--"CIEA" Coach Is Enabled Ask (client > server)
--"CIER" Coach Is Enabled Response (server > client)
--"CCS" Coach Combat Start (client > server)
function _detalhes.network.Coach(player, realm, core_version, msgType, data)
if (not IsInRaid()) then
return
end
if (_detalhes.debug) then
print("Details Coach Received Comm", player, realm, core_version, msgType, data)
end
local sourcePlayer = Ambiguate(player, "none")
local playerName = UnitName("player")
if (playerName == sourcePlayer) then
if (_detalhes.debug) then
print("Details Coach Received Comm | RETURN | playerName == sourcePlayer", playerName , sourcePlayer)
end
return
end
if (msgType == "CIEA") then --Is Coach Enabled Ask (regular player asked to raid leader)
Details.Coach.Server.CoachIsEnabled_Answer(sourcePlayer)
elseif (msgType == "CIER") then --Coach Is Enabled Response (regular player received a raid leader response)
local isEnabled = data
Details.Coach.Client.CoachIsEnabled_Response(isEnabled, sourcePlayer)
elseif (msgType == "CCS") then --Coach Combat Start (raid assistant told the raid leader a combat started)
Details.Coach.Server.CombatStarted()
elseif (msgType == "CCE") then --Coach Combat End (raid assistant told the raid leader a combat ended)
Details.Coach.Server.CombatEnded()
elseif (msgType == "CS") then --Coach Start (raid leader notifying other members of the group)
if (_detalhes.debug) then
print("Details Coach received 'CE' a new coach is active, coach name:", sourcePlayer)
end
Details.Coach.Client.EnableCoach(sourcePlayer)
elseif (msgType == "CE") then --Coach End (raid leader notifying other members of the group)
Details.Coach.Client.CoachEnd()
elseif (msgType == "CDT") then --Coach Data (a player in the raid sent to raid leader combat data)
if (Details.Coach.Server.IsEnabled()) then
--update the current combat with new information
Details.packFunctions.DeployPackedCombatData(data)
end
elseif (msgType == "CDD") then --Coach Death (a player in the raid sent to raid leader his death log)
if (Details.Coach.Server.IsEnabled()) then
Details.Coach.Server.AddPlayerDeath(sourcePlayer, data)
end
end
end
--guild sync R = someone pressed the sync button
--guild sync L = list of fights IDs
--guild sync G = requested a list of encounters
--guild sync A = received missing encounters, add them
function _detalhes.network.GuildSync (player, realm, core_version, type, data)
local chr_name = Ambiguate(player, "none")
if (UnitName ("player") == chr_name) then
return
end
if (core_version ~= _detalhes.realversion) then
if (core_version > _detalhes.realversion) then
--_detalhes:Msg ("your Details! is out dated and cannot perform the action, please update it.")
end
return false
end
if (type == "R") then --RoS - somebody requested IDs of stored encounters
_detalhes.LastGuildSyncDataTime1 = _detalhes.LastGuildSyncDataTime1 or 0
--build our table and send to the player
if (_detalhes.LastGuildSyncDataTime1 > GetTime()) then
--return false
end
local IDs = _detalhes.storage:GetIDsToGuildSync()
if (IDs and IDs [1]) then
local from = UnitName ("player")
local realm = GetRealmName()
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_GUILD_SYNC, from, realm, _detalhes.realversion, "L", IDs), "WHISPER", chr_name)
end
_detalhes.LastGuildSyncDataTime1 = GetTime() + 60
return true
elseif (type == "L") then --RoC - the player received the IDs list and send back which IDs he doesn't have
local MissingIDs = _detalhes.storage:CheckMissingIDsToGuildSync (data)
if (MissingIDs and MissingIDs [1]) then
local from = UnitName ("player")
local realm = GetRealmName()
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_GUILD_SYNC, from, realm, _detalhes.realversion, "G", MissingIDs), "WHISPER", chr_name)
end
return true
elseif (type == "G") then --RoS - the 'server' send the encounter dps table to the player which requested
local EncounterData = _detalhes.storage:BuildEncounterDataToGuildSync (data)
if (EncounterData and EncounterData [1]) then
local task = C_Timer.NewTicker (4, function (task)
task.TickID = task.TickID + 1
local data = task.EncounterData [task.TickID]
if (not data) then
task:Cancel()
return
end
local from = UnitName ("player")
local realm = GetRealmName()
--todo: need to check if the target is still online
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_GUILD_SYNC, from, realm, _detalhes.realversion, "A", data), "WHISPER", task.Target)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) [RoS-EncounterSync] send-task sending data #" .. task.TickID .. ".")
end
end)
task.TickID = 0
task.EncounterData = EncounterData
task.Target = chr_name
end
return true
elseif (type == "A") then --RoC - the player received the dps table and should now add it to the db
_detalhes.storage:AddGuildSyncData (data, player)
return true
end
end
function _detalhes.network.HandleMissData (player, realm, core_version, data)
-- [1] - container
-- [2] - spellid
-- [3] - spell total
-- [4] - spell counter
core_version = tonumber (core_version) or 0
if (core_version ~= _detalhes.realversion) then
if (core_version > _detalhes.realversion) then
_detalhes:Msg ("your Details! is out dated and cannot communicate with other players.")
end
return
end
if (type (player) ~= "string") then
return
end
local playerName = _detalhes:GetCLName (player)
if (playerName) then
_detalhes.HandleMissData (playerName, data)
end
end
function _detalhes.network.ReceivedEnemyPlayer (player, realm, core_version, data)
-- ["PVP_ENEMY"] = CONST_PVP_ENEMY,
end
_detalhes.network.functions = {
[CONST_HIGHFIVE_REQUEST] = _detalhes.network.HighFive_Request,
[CONST_HIGHFIVE_DATA] = _detalhes.network.HighFive_DataReceived,
[CONST_VERSION_CHECK] = _detalhes.network.Update_VersionReceived,
[CONST_ITEMLEVEL_DATA] = _detalhes.network.ItemLevel_Received,
[CONST_CLOUD_REQUEST] = _detalhes.network.Cloud_Request,
[CONST_CLOUD_FOUND] = _detalhes.network.Cloud_Found,
[CONST_CLOUD_DATARQ] = _detalhes.network.Cloud_DataRequest,
[CONST_CLOUD_DATARC] = _detalhes.network.Cloud_DataReceived,
[CONST_CLOUD_EQUALIZE] = _detalhes.network.Cloud_Equalize,
[CONST_WIPE_CALL] = _detalhes.network.Wipe_Call,
[CONST_GUILD_SYNC] = _detalhes.network.GuildSync,
[CONST_ROGUE_SR] = _detalhes.network.HandleMissData, --soul rip from akaari's soul (LEGION ONLY)
[CONST_PVP_ENEMY] = _detalhes.network.ReceivedEnemyPlayer,
[DETAILS_PREFIX_COACH] = _detalhes.network.Coach, --coach feature
[DETAILS_PREFIX_TBC_DATA] = _detalhes.network.TBCData
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> register comm
function _detalhes:CommReceived (commPrefix, data, channel, source)
local prefix, player, realm, dversion, arg6, arg7, arg8, arg9 = _select (2, _detalhes:Deserialize (data))
player = source
if (_detalhes.debug) then
_detalhes:Msg ("(debug) network received:", prefix, "length:", string.len (data))
end
--event
_detalhes:SendEvent ("COMM_EVENT_RECEIVED", nil, string.len (data), prefix, player, realm, dversion, arg6, arg7, arg8, arg9)
--print ("comm received", prefix, _detalhes.network.functions [prefix])
local func = _detalhes.network.functions [prefix]
if (func) then
--todo: this call should be safe
func (player, realm, dversion, arg6, arg7, arg8, arg9)
else
func = plugins_registred [prefix]
--print ("plugin comm?", func, player, realm, dversion, arg6, arg7, arg8, arg9)
if (func) then
--todo: this call should be safe
func (player, realm, dversion, arg6, arg7, arg8, arg9)
else
if (_detalhes.debug) then
_detalhes:Msg ("comm prefix not found:", prefix)
end
end
end
end
_detalhes:RegisterComm ("DTLS", "CommReceived")
--> hook the send comm message so we can trigger events when sending data
--> this adds overhead, but easily catches all outgoing comm messages
hooksecurefunc (Details, "SendCommMessage", function (context, addonPrefix, serializedData, channel)
--unpack data
local prefix, player, realm, dversion, arg6, arg7, arg8, arg9 = _select (2, _detalhes:Deserialize (serializedData))
--send the event
_detalhes:SendEvent ("COMM_EVENT_SENT", nil, string.len (serializedData), prefix, player, realm, dversion, arg6, arg7, arg8, arg9)
end)
function _detalhes:RegisterPluginComm (prefix, func)
assert (type (prefix) == "string" and string.len (prefix) >= 2 and string.len (prefix) <= 4, "RegisterPluginComm expects a string with 2-4 characters on #1 argument.")
assert (type (func) == "function" or (type (func) == "string" and type (self [func]) == "function"), "RegisterPluginComm expects a function or function name on #2 argument.")
assert (plugins_registred [prefix] == nil, "Prefix " .. prefix .. " already in use 1.")
assert (_detalhes.network.functions [prefix] == nil, "Prefix " .. prefix .. " already in use 2.")
if (type (func) == "string") then
plugins_registred [prefix] = self [func]
else
plugins_registred [prefix] = func
end
return true
end
function _detalhes:UnregisterPluginComm (prefix)
plugins_registred [prefix] = nil
return true
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> send functions
function _detalhes:GetChannelId (channel)
for id = 1, GetNumDisplayChannels() do
local name, _, _, room_id = GetChannelDisplayInfo (id)
if (name == channel) then
return room_id
end
end
end
--[
function _detalhes.parser_functions:CHAT_MSG_CHANNEL (...)
local message, _, _, _, _, _, _, _, channelName = ...
if (channelName == "Details") then
local prefix, data = strsplit ("_", message, 2)
local func = plugins_registred [prefix]
if (func) then
func (_select (2, _detalhes:Deserialize (data)))
else
if (_detalhes.debug) then
_detalhes:Msg ("comm prefix not found:", prefix)
end
end
end
end
--]]
function _detalhes:SendPluginCommMessage(prefix, channel, ...)
if (channel == "RAID") then
if (IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and IsInInstance()) then
_detalhes:SendCommMessage (prefix, _detalhes:Serialize (self.__version, ...), "INSTANCE_CHAT")
else
_detalhes:SendCommMessage (prefix, _detalhes:Serialize (self.__version, ...), "RAID")
end
elseif (channel == "PARTY") then
if (IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and IsInInstance()) then
_detalhes:SendCommMessage(prefix, _detalhes:Serialize (self.__version, ...), "INSTANCE_CHAT")
else
_detalhes:SendCommMessage(prefix, _detalhes:Serialize (self.__version, ...), "PARTY")
end
else
_detalhes:SendCommMessage(prefix, _detalhes:Serialize (self.__version, ...), channel)
end
return true
end
--> send as
function _detalhes:SendRaidDataAs(type, player, realm, ...)
if (not realm) then
--> check if realm is already inside player name
for _name, _realm in _string_gmatch(player, "(%w+)-(%w+)") do
if (_realm) then
player = _name
realm = _realm
end
end
end
if (not realm) then
--> doesn't have realm at all, so we assume the actor is in same realm as player
realm = _GetRealmName()
end
_detalhes:SendCommMessage(DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, player, realm, _detalhes.realversion, ...), "RAID")
end
function _detalhes:SendHomeRaidData(type, ...)
if (IsInRaid(LE_PARTY_CATEGORY_HOME) and IsInInstance()) then
_detalhes:SendCommMessage(DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, _UnitName("player"), _GetRealmName(), _detalhes.realversion, ...), "RAID")
end
end
function _detalhes:SendRaidData (type, ...)
local isInInstanceGroup = IsInRaid (LE_PARTY_CATEGORY_INSTANCE)
if (isInInstanceGroup) then
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, _UnitName("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT")
if (_detalhes.debug) then
_detalhes:Msg ("(debug) sent comm to INSTANCE raid group")
end
else
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, _UnitName("player"), _GetRealmName(), _detalhes.realversion, ...), "RAID")
if (_detalhes.debug) then
_detalhes:Msg ("(debug) sent comm to LOCAL raid group")
end
end
end
function _detalhes:SendPartyData (type, ...)
local isInInstanceGroup = IsInGroup (LE_PARTY_CATEGORY_INSTANCE)
if (isInInstanceGroup) then
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "INSTANCE_CHAT")
if (_detalhes.debug) then
_detalhes:Msg ("(debug) sent comm to INSTANCE party group")
end
else
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "PARTY")
if (_detalhes.debug) then
_detalhes:Msg ("(debug) sent comm to LOCAL party group")
end
end
end
function _detalhes:SendRaidOrPartyData (type, ...)
if (IsInRaid()) then
_detalhes:SendRaidData (type, ...)
elseif (IsInGroup()) then
_detalhes:SendPartyData (type, ...)
end
end
function _detalhes:SendGuildData (type, ...)
if not IsInGuild() then return end --> fix from Tim@WoWInterface
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "GUILD")
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> cloud
function _detalhes:SendCloudRequest()
_detalhes:SendRaidData (_detalhes.network.ids.CLOUD_REQUEST)
end
function _detalhes:ScheduleSendCloudRequest()
_detalhes:ScheduleTimer ("SendCloudRequest", 1)
end
function _detalhes:RequestCloudData()
_detalhes.last_data_requested = _detalhes._tempo
if (not _detalhes.host_by) then
return
end
for index = 1, #_detalhes.tabela_instancias do
local instancia = _detalhes.tabela_instancias [index]
if (instancia.ativa) then
local atributo = instancia.atributo
if (atributo == 1 and not _detalhes:CaptureGet ("damage")) then
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
break
elseif (atributo == 2 and (not _detalhes:CaptureGet ("heal") or _detalhes:CaptureGet ("aura"))) then
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
break
elseif (atributo == 3 and not _detalhes:CaptureGet ("energy")) then
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
break
elseif (atributo == 4 and not _detalhes:CaptureGet ("miscdata")) then
_detalhes:SendCommMessage (DETAILS_PREFIX_NETWORK, _detalhes:Serialize (CONST_CLOUD_DATARQ, atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by)
break
end
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> update
function _detalhes:CheckVersion (send_to_guild)
if (IsInRaid()) then
_detalhes:SendRaidData (_detalhes.network.ids.VERSION_CHECK, _detalhes.build_counter)
elseif (IsInGroup()) then
_detalhes:SendPartyData (_detalhes.network.ids.VERSION_CHECK, _detalhes.build_counter)
end
if (send_to_guild) then
_detalhes:SendGuildData (_detalhes.network.ids.VERSION_CHECK, _detalhes.build_counter)
end
end
| qyh214/wow_addons_private_use | AddOns/Details/core/network.lua | Lua | gpl-3.0 | 30,094 |
# htspan
## Dependencies
* gcc >= 4.8
* gsl >= 2.4.1
### Included dependencies
* htslib >= 1.8
* mlat >= 0.1
## Install
```{bash}
make
```
| djhshih/hts-fetch | README.md | Markdown | gpl-3.0 | 146 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Andrew Kofink <[email protected]>
#
# 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/>.
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: subscription_manifest
version_added: 1.0.0
short_description: Manage Subscription Manifests
description:
- Upload, refresh and delete Subscription Manifests
author: "Andrew Kofink (@akofink)"
options:
manifest_path:
description:
- Path to the manifest zip file
- This parameter will be ignored if I(state=absent) or I(state=refreshed)
type: path
state:
description:
- The state of the manifest
default: present
choices:
- absent
- present
- refreshed
type: str
repository_url:
description:
- URL to retrieve content from
aliases: [ redhat_repository_url ]
type: str
extends_documentation_fragment:
- theforeman.foreman.foreman
- theforeman.foreman.foreman.organization
'''
EXAMPLES = '''
- name: "Upload the RHEL developer edition manifest"
theforeman.foreman.subscription_manifest:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
organization: "Default Organization"
state: present
manifest_path: "/tmp/manifest.zip"
'''
RETURN = ''' # '''
from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import KatelloEntityAnsibleModule
def main():
module = KatelloEntityAnsibleModule(
argument_spec=dict(
manifest_path=dict(type='path'),
state=dict(default='present', choices=['absent', 'present', 'refreshed']),
repository_url=dict(aliases=['redhat_repository_url']),
),
foreman_spec=dict(
organization=dict(type='entity', required=True, thin=False),
),
required_if=[
['state', 'present', ['manifest_path']],
],
supports_check_mode=False,
)
module.task_timeout = 5 * 60
with module.api_connection():
organization = module.lookup_entity('organization')
scope = module.scope_for('organization')
try:
existing_manifest = organization['owner_details']['upstreamConsumer']
except KeyError:
existing_manifest = None
if module.state == 'present':
if 'repository_url' in module.foreman_params:
payload = {'redhat_repository_url': module.foreman_params['repository_url']}
org_spec = dict(id=dict(), redhat_repository_url=dict())
organization = module.ensure_entity('organizations', payload, organization, state='present', foreman_spec=org_spec)
try:
with open(module.foreman_params['manifest_path'], 'rb') as manifest_file:
files = {'content': (module.foreman_params['manifest_path'], manifest_file, 'application/zip')}
params = {}
if 'repository_url' in module.foreman_params:
params['repository_url'] = module.foreman_params['repository_url']
params.update(scope)
result = module.resource_action('subscriptions', 'upload', params, files=files, record_change=False, ignore_task_errors=True)
for error in result['humanized']['errors']:
if "same as existing data" in error:
# Nothing changed, but everything ok
break
if "older than existing data" in error:
module.fail_json(msg="Manifest is older than existing data.")
else:
module.fail_json(msg="Upload of the manifest failed: %s" % error)
else:
module.set_changed()
except IOError as e:
module.fail_json(msg="Unable to read the manifest file: %s" % e)
elif module.desired_absent and existing_manifest:
module.resource_action('subscriptions', 'delete_manifest', scope)
elif module.state == 'refreshed':
if existing_manifest:
module.resource_action('subscriptions', 'refresh_manifest', scope)
else:
module.fail_json(msg="No manifest found to refresh.")
if __name__ == '__main__':
main()
| ATIX-AG/foreman-ansible-modules | plugins/modules/subscription_manifest.py | Python | gpl-3.0 | 5,027 |
#!/usr/bin/env bash
# Copyright © 2019 by The qTox Project Contributors
#
# This file is part of qTox, a Qt-based graphical interface for Tox.
# qTox is libre 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.
#
# qTox 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 qTox. If not, see <http://www.gnu.org/licenses/>
# This script's purpose is to ease compiling qTox for users.
#
# NO AUTOMATED BUILDS SHOULD DEPEND ON IT.
#
# This script is and will be a subject to breaking changes, and at no time one
# should expect it to work - it's something that you could try to use but
# don't expect that it will work for sure.
#
# If script doesn't work, you should use instructions provided in INSTALL.md
# before reporting issues like “qTox doesn't compile”.
#
# With that being said, reporting that this script doesn't work would be nice.
#
# If you are contributing code to qTox that change its dependencies / the way
# it's being build, please keep in mind that changing just bootstrap.sh
# *IS NOT* and will not be sufficient - you should update INSTALL.md first.
set -eu -o pipefail
################ parameters ################
# directory where the script is located
readonly SCRIPT_DIR=$( cd $(dirname $0); pwd -P)
# directory where dependencies will be installed
readonly INSTALL_DIR=libs
# just for convenience
readonly BASE_DIR="${SCRIPT_DIR}/${INSTALL_DIR}"
# versions of libs to checkout
readonly TOXCORE_VERSION="v0.2.10"
readonly SQLCIPHER_VERSION="v3.4.2"
# directory names of cloned repositories
readonly TOXCORE_DIR="libtoxcore-$TOXCORE_VERSION"
readonly SQLCIPHER_DIR="sqlcipher-$SQLCIPHER_VERSION"
# default values for user given parameters
INSTALL_TOX=true
INSTALL_SQLCIPHER=false
SYSTEM_WIDE=true
KEEP_BUILD_FILES=false
# if Fedora, by default install sqlcipher
if which dnf &> /dev/null
then
INSTALL_SQLCIPHER=true
fi
print_help() {
echo "Use this script to install/update libtoxcore"
echo ""
echo "usage:"
echo " ${0} PARAMETERS"
echo ""
echo "parameters:"
echo " --with-tox : install/update libtoxcore"
echo " --without-tox : do not install/update libtoxcore"
echo " --with-sqlcipher : install/update sqlcipher"
echo " --without-sqlcipher : do not install/update sqlcipher"
echo " -h|--help : displays this help"
echo " -l|--local : install packages into ${INSTALL_DIR}"
echo " -k|--keep : keep build files after installation/update"
echo ""
echo "example usages:"
echo " ${0} -- install libtoxcore"
}
############ print debug output ############
print_debug_output() {
echo "with tox : ${INSTALL_TOX}"
echo "with sqlcipher : ${INSTALL_SQLCIPHER}"
echo "install system-wide : ${SYSTEM_WIDE}"
echo "keep build files : ${KEEP_BUILD_FILES}"
}
# remove not needed dirs
remove_build_dirs() {
rm -rf "${BASE_DIR}/${TOXCORE_DIR}"
rm -rf "${BASE_DIR}/${SQLCIPHER_DIR}"
}
install_toxcore() {
if [[ $INSTALL_TOX = "true" ]]
then
git clone https://github.com/toktok/c-toxcore.git \
--branch $TOXCORE_VERSION \
--depth 1 \
"${BASE_DIR}/${TOXCORE_DIR}"
pushd ${BASE_DIR}/${TOXCORE_DIR}
# compile and install
if [[ $SYSTEM_WIDE = "false" ]]
then
cmake . -DCMAKE_INSTALL_PREFIX=${BASE_DIR}
make -j $(nproc)
make install
else
cmake .
make -j $(nproc)
sudo make install
sudo ldconfig
fi
popd
fi
}
install_sqlcipher() {
if [[ $INSTALL_SQLCIPHER = "true" ]]
then
git clone https://github.com/sqlcipher/sqlcipher.git \
"${BASE_DIR}/${SQLCIPHER_DIR}" \
--branch $SQLCIPHER_VERSION \
--depth 1
pushd "${BASE_DIR}/${SQLCIPHER_DIR}"
autoreconf -if
if [[ $SYSTEM_WIDE = "false" ]]
then
./configure --prefix="${BASE_DIR}" \
--enable-tempstore=yes \
CFLAGS="-DSQLITE_HAS_CODEC"
make -j$(nproc)
make install || \
echo "" && \
echo "Sqlcipher failed to install locally." && \
echo "" && \
echo "Try without \"-l|--local\"" && \
exit 1
else
./configure \
--enable-tempstore=yes \
CFLAGS="-DSQLITE_HAS_CODEC"
make -j$(nproc)
sudo make install
sudo ldconfig
fi
popd
fi
}
main() {
########## parse input parameters ##########
while [ $# -ge 1 ]
do
if [ ${1} = "--with-tox" ]
then
INSTALL_TOX=true
shift
elif [ ${1} = "--without-tox" ]
then
INSTALL_TOX=false
shift
elif [ ${1} = "--with-sqlcipher" ]
then
INSTALL_SQLCIPHER=true
shift
elif [ ${1} = "--without-sqlcipher" ]
then
INSTALL_SQLCIPHER=false
shift
elif [ ${1} = "-l" -o ${1} = "--local" ]
then
SYSTEM_WIDE=false
shift
elif [ ${1} = "-k" -o ${1} = "--keep" ]
then
KEEP_BUILD_FILES=true
shift
else
if [ ${1} != "-h" -a ${1} != "--help" ]
then
echo "[ERROR] Unknown parameter \"${1}\""
echo ""
print_help
exit 1
fi
print_help
exit 0
fi
done
print_debug_output
############### prepare step ###############
# create BASE_DIR directory if necessary
mkdir -p "${BASE_DIR}"
# maybe an earlier run of this script failed
# thus we should remove the cloned repositories
# if they exist, otherwise cloning them may fail
remove_build_dirs
############### install step ###############
install_toxcore
install_sqlcipher
############### cleanup step ###############
# remove cloned repositories
if [[ $KEEP_BUILD_FILES = "false" ]]
then
remove_build_dirs
fi
}
main $@
| Diadlo/qTox | bootstrap.sh | Shell | gpl-3.0 | 6,740 |
[(#REM)
Affiche la liste des auteurs d'un objet, séparés par des virgules
Modele pour la balise #LESAUTEURS, dans le cas des auteurs d'un objet
(pour un objet ayant un champ lesauteurs dans la base, la balise affiche directement la valeur du champ)
]
<BOUCLE_auteurs(AUTEURS){id_objet}{objet}{par nom}{", "}>
<span class="author"><a class="url fn spip_in" href="#URL_AUTEUR">#NOM</a></span></BOUCLE_auteurs>
| phenix-factory/p.henix.be | plugins/auto/zoundation/v1.0.49/modeles/lesauteurs.html | HTML | gpl-3.0 | 416 |
import moment from 'moment';
import PublicationsController from './controller/publications.controller.js';
import AuthorsController from './controller/authors.controller.js';
import PublishersController from './controller/publishers.controller.js';
/*
* Application routing
*/
function routing($routeProvider) {
$routeProvider
.when('/publications', {
template: require('./view/publications.html'),
controller: PublicationsController,
controllerAs: 'vm'
})
.when('/authors', {
template: require('./view/authors.html'),
controller: AuthorsController,
controllerAs: 'vm'
})
.when('/publishers', {
template: require('./view/publishers.html'),
controller: PublishersController,
controllerAs: 'vm'
})
.otherwise({ redirectTo: '/publications' });
}
routing.$inject = ['$routeProvider'];
/*
* Theming configuration for Material AngularJS
*/
function theming($mdThemingProvider) {
$mdThemingProvider
.theme('default')
.primaryPalette('indigo')
.accentPalette('red');
}
theming.$inject = ['$mdThemingProvider'];
/*
* Date localization configuration
*/
function dateLocalization($mdDateLocaleProvider) {
const dateFmt = 'YYYY-MM-DD';
$mdDateLocaleProvider.formatDate = (date) => {
return moment(date).format(dateFmt);
};
$mdDateLocaleProvider.parseDate = (str) => {
const m = moment(str, dateFmt);
return m.isValid() ? m.toDate() : new Date(NaN);
};
}
dateLocalization.$inject = ['$mdDateLocaleProvider'];
export { routing, theming, dateLocalization };
| enric-sinh/publication-library | web/src/app/app.config.js | JavaScript | gpl-3.0 | 1,574 |
#include "disablenonworkingunits.h"
#include "wololo/datPatch.h"
namespace wololo {
void disableNonWorkingUnitsPatch(genie::DatFile *aocDat, std::map<int, std::string> *langReplacement) {
/*
* Disabling units that are not supposed to show in the scenario editor
*/
for (size_t civIndex = 0; civIndex < aocDat->Civs.size(); civIndex++) {
aocDat->Civs[civIndex].Units[1119].HideInEditor = 1;
aocDat->Civs[civIndex].Units[1145].HideInEditor = 1;
aocDat->Civs[civIndex].Units[1147].HideInEditor = 1;
aocDat->Civs[civIndex].Units[1221].HideInEditor = 1;
aocDat->Civs[civIndex].Units[1401].HideInEditor = 1;
for (size_t unitIndex = 1224; unitIndex <= 1390; unitIndex++) {
aocDat->Civs[civIndex].Units[unitIndex].HideInEditor = 1;
}
}
}
DatPatch disableNonWorkingUnits = {
&disableNonWorkingUnitsPatch,
"Hide units in the scenario editor"
};
}
| Tails8521/WololoKingdoms | fixes/disablenonworkingunits.cpp | C++ | gpl-3.0 | 872 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name='viewport' content='width=device-width, initial-scale=1.0, user-scalable=yes'>
<title>Video Poker</title>
<style>
@import url('https://fonts.googleapis.com/css?family=Luckiest+Guy');
body { background-color:#0032b4; color:#fff; font-family:"Helvetica Neue",Helvetica,sans-serif; font-size:1vw; }
#main { perspective:1000px; position:absolute; top:0px; right:0px; bottom:0px; left:0px; text-align:center; }
#paytable {
display:none;
width:90%;
color:#ffffff;
border: 4px outset #0df;
margin:.5em auto 0px;
background-color:#142850;
border-collapse:collapse;
line-height:1em;
font-weight: 700; font-size:130%;text-transform: uppercase;
}
#paybet { background-color:#0af; color:#ff0;border-bottom: 2px solid #fff; }
#paytable td#paybet1, #paytable td#paybet2,#paytable td#paybet3,#paytable td#paybet4,#paytable td#paybet5 { background-color:#0af; color:#ff0; text-align:center; border-bottom: 2px solid #fff; }
table#paytable .paybet { background-color:#c00; color:#ff0; }
#paytable td { text-align:left; border-left:3px solid #0af; white-space:nowrap; padding:.125em .25em .125em .25em;}
#paytable td.right { text-align:right; }
.paybet { background-color:#ff0; }
#toolbar { display:inline-block; position:absolute; left:0px; bottom:0px; right:0px; height:15%; text-align:center; background-color:rgba(0,0,0,.5); }
button { z-index:999; margin-top:1em; font-size:200%; color:#000; background-color:#cccc00; border:.25em outset #ffff00; width:7em; height 3em; text-transform:uppercase; height:3em; font-weight:bold; position:relative; text-shadow: 2px 2px 1px rgba(255,255,255,.5);}
button.disabled { color: #cccc00; text-shadow: none; }
.right { text-align:right; }
.left { text-align:left; }
h2 { width:3.3vw; height:6.1vh; margin:0; padding:1.3vw 1.6vw 1.1vw 0.7vw; color:#fff; z-index:9999; border-radius:5vw; display:inline-block; border:0.6vw dashed #fff; font-size:3vw; top:-1vh; position:relative; letter-spacing:-4px; text-shadow:-1px -2px 0px #000; }
.status { display:inline-block; }
#bet { width:30%; color:#eee; position:absolute; left:2vw; height:8vh; font-size:3vw; top:5vh; text-align:left; }
#bet:before { content: "BET: "; }
#credit { width:30vw; color:#eef; position:absolute; right:2vw; height:8vh; font-size:3vw; top:5vh; text-align:right; }
#credit:before { content: "CREDITS: "; }
#win { width:33%; color:#eee; position:absolute; left:33%; height:9vh; top:5vh; font-size:3vw;z-index:9999; }
@keyframes bounce {
0% { transform: rotate(0deg) scale(1); }
10% { transform: rotate(-15deg) scale(1.5); }
20% { transform: rotate(15deg) scale(1); }
30% { transform: rotate(-10deg) scale(1.5); }
40% { transform: rotate(10deg) scale(1); }
50% { transform: rotate(-5deg) scale(1.5); }
60% { transform: rotate(5deg) scale(1); }
70% { transform: scale(1.5); }
80% { transform: scale(1); }
90% { transform: scale(1.5); }
100% { transform: scale(1); }
}
.handresult {
font-size:2em;
background-color:rgba(174,84,231,1);
color:#fff;
border:.25vw solid rgba(107,36,154,1);
border-bottom-left-radius:1vw;
border-bottom-right-radius:1vw;
font-weight:bold;
text-shadow:2px 2px 2px #000;
z-index:99999;
width:100%;
position:absolute;
bottom:-0.2vh;
left:0;
display:none;
overflow:hidden;
transition:all 300ms cubic-bezier(.25, .99, .71, 1.23);
height:5vh;
text-transform:uppercase;
}
#cards .handresult {
font-size:3vw;
bottom:-1.5vh;
height:7vh;
}
#won {
position: absolute;
display: inline-block;
width:50vw;
top: 22%;
left: 20%;
font-size: 1.5vw;
color: #f9e945;
text-shadow: 2px 2px 0px #000;
font-weight: bold;
background-color: rgba(0,0,0,.5);
padding: 2vh 4vw 2vh;
border-radius: 4vw;
border: 1vw solid rgb(249, 233, 69);
transform: scale(1);
z-index: 99999;
box-shadow: 0 0.5vw 0.5vw rgba(0,0,0,.4);
animation: bounce 2s 2;
display:none;
animation: win 2000ms 2;
}
#won button { border-radius:4vw; }
@keyframes win {
0% { text-shadow:0 0 0 #fff; transform:scale(1); }
10% { transform:scale(1.25); }
20% { transform:scale(1.0); }
30% { transform:scale(1.25); }
40% { transform:scale(1.0); }
50% { text-shadow:0 0 6vw #fff; }
60% { text-shadow:0 0 0vw #fff; }
70% { text-shadow:0 0 6vw #fff; }
80% { text-shadow:0 0 0vw #fff; }
90% { text-shadow:0 0 6vw #fff; transform:scale(1.25); }
100% { text-shadow:0 0 0vw #fff; transform:scale(1.0); }
}
table#paytable tr.winner { background-color:#00d8ff; color:#000;}
td.winner { background-color:#fff; transform:scale(1); text-align:center; animation: throb 2s; }
#results { margin-top:-2em; display:none;}
.status { height: 10vh; position: absolute; font-weight: bold; bottom:16vh; text-shadow: 2px 2px 1px rgba(0,0,0,.5); left: 0px; width:100%; z-index:99; }
@keyframes throb {
0% { transform: scale(2); }
20% { transform: scale(1); }
40% { transform: scale(2); }
60% { transform: scale(1); }
80% { transform: scale(2); }
100% { transform: scale(1); }
}
th { border-bottom:3px solid #0df; border-right:3px solid #0df; }
#payleft, #payright {
position:absolute;
line-height:1.4vw;
bottom:15vh;
width:16vw;
height:42vh;
}
#payleft { left:0px; }
#payright { right:0px; }
.payline {
background-color: #f00;
margin: 0.2vh .5vw;
font-size: 1.25vw;
text-transform: uppercase;
text-align: center;
text-shadow: 1.5px 1.5px 0px #000;
border-radius: 1.5vw;
border: 0.2vw outset;
font-weight: bold;
padding-bottom: 0.3vh;
}
.pay {
background-color: #000;
display: block;
width: 10vw;
margin: 0 auto 0vh;
border: 2px inset #ff0;
padding:0.4vh 2vw;
border-bottom-left-radius:1.2vw;
border-bottom-right-radius:1.2vw;
}
#gameselect {
position:absolute;
display:inline-block;
bottom:11vh;
left:18vw;
width:24vw;
height:0vh;
background:linear-gradient(to top, #f4e130 0%,#fff460 100%);
z-index:999;
font-size:2.4vw;
color:#000;
text-shadow:1px 1px 0px #fff;
box-shadow:.25vw -.25vw .25vw rgba(0,0,0,.4), -.25vw 0 .25vw rgba(0,0,0,.4);
overflow:hidden;
font-weight:500;
text-transform:uppercase;
transition:all 300ms cubic-bezier(.25, .99, .71, 1.23);
text-align:left;
}
#handselect {
position:absolute;
display:inline-block;
bottom:11vh;
left:32.3vw;
width:14vw;
height:0vh;
background:linear-gradient(to top, #f4e130 0%,#fff460 100%);
z-index:999;
text-align:center;
font-size:3vw;
color:#000;
text-shadow:1px 1px 0px #fff;
box-shadow:.25vw -.25vw .25vw rgba(0,0,0,.4), -.25vw 0 .25vw rgba(0,0,0,.4);
overflow:hidden;
font-weight:500;
text-transform:uppercase;
transition:all 300ms cubic-bezier(.25, .99, .71, 1.23);
}
div#handselect.open { height:33vh; }
div#gameselect.open { height:36vh; }
#handselect input { display:none; }
#handcount { margin:0; padding:0; }
#gameslist { margin:0; padding:0; }
#gameslist li { list-style-type:none; border-bottom:1px solid #660; cursor:pointer; padding:1vh;}
.gameslistSelected { background-color:#660; color:#fff; }
#handcount li {
list-style-type:none;
border-bottom: 1px solid #660;
cursor:pointer;
}
.handcountSelected {
background-color:#660;
color:#fff;
}
#doubleup {
position:absolute;
display:none;
top:0;
left:0;
right:0;
bottom:0;
background-color:#0032b4;
z-index:99999;
width:100%;
}
#doubleup .cardwrap .card { width:90%; height:90%; }
#doubleup .cardwrap { padding-left:2.5vw; }
#doubleheader { font-size:2vw; font-family:"Luckiest Guy", cursive; }
#doubleheader h1 { color:#c00; -webkit-text-stroke: .125vw #ff0; font-size:2em; }
#doubleheader button {font-size:1.5vw;margin-left:2vw; }
.dealercardlabel { display: inline-block; position: relative; top: -2.2vh; background-color: #0032b4; color: #ff0; font-size: 1.5em; padding: 0px 0.25vw; left: -1.6vw; font-weight: bold; text-shadow: 2px 2px 0px #000; white-space: nowrap;}
#doubledealer { display: inline-block; width: 12vw; margin-right: 4vw; border: .25vw solid #ff0; border-radius: 1vw; padding-left: 3vw; height: 38vh; }
</style>
<link rel='manifest' href='manifest.json'>
<link rel='stylesheet' type='text/css' href='poker5.css'>
<script src="pokersolver.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.9.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyDxGzBuvFA2qrOZZPBdTmIjsXAgWpcrmcs",
authDomain: "crblackjack-9e220.firebaseapp.com",
databaseURL: "https://crblackjack-9e220.firebaseio.com",
projectId: "crblackjack-9e220",
storageBucket: "crblackjack-9e220.appspot.com",
messagingSenderId: "32143422101"
};
firebase.initializeApp(config);
</script>
</head>
<body>
<div id='main'>
<table id='paytable'>
<colgroup>
<col>
<col id='bet1pay'>
<col id='bet2pay'>
<col id='bet3pay'>
<col id='bet4pay'>
<col id='bet5pay'>
</colgroup>
</table>
<div id='holds'>
<div id='card0-hold' class='hold'></div>
<div id='card1-hold' class='hold'></div>
<div id='card2-hold' class='hold'></div>
<div id='card3-hold' class='hold'></div>
<div id='card4-hold' class='hold'></div>
</div>
<div id='hands'>
</div>
<div id='payleft'></div>
<div id='cards'>
<div id='card0' class='cardwrap'><div class='card card1H'><figure class='pic'> </figure></div><div class='cardback'><figure class='pic'> </figure></div></div>
<div id='card1' class='cardwrap'><div class='card card13H'><figure class='pic'> </figure></div><div class='cardback'><figure class='pic'> </figure></div></div>
<div id='card2' class='cardwrap'><div class='card card12H'><figure class='pic'> </figure></div><div class='cardback'><figure class='pic'> </figure></div></div>
<div id='card3' class='cardwrap'><div class='card card11H'><figure class='pic'> </figure></div><div class='cardback'><figure class='pic'> </figure></div></div>
<div id='card4' class='cardwrap'><div class='card card10H'><figure class='pic'> </figure></div><div class='cardback'><figure class='pic'> </figure></div></div>
<div id='result' class='handresult'></div>
</div>
<div id='payright'></div>
<div id='status' class='status'>
<div id='bet'>0</div>
<div id='win'></div>
<div id='credit'></div>
</div>
<div id='won'></div>
<div id='gameover'>PLAY 5 CREDITS</div>
<div id='gameselect'>
<ul id='gameslist'>
<li id='game_poker'>Jacks or Better</li>
<li id='game_bonus'>Bonus Poker</li>
<li id='game_doublebonus'>Double Bonus</li>
<li id='game_dueces'>Dueces Wild</li>
<li id='game_joker'>Joker Poker</li>
</ul>
</div>
<div id='handselect'>
<ul id='handcount'>
<li id='handcount5'>5</li>
<li id='handcount10'>10</li>
<li id='handcount25'>25</li>
<li id='handcount50'>50</li>
<li id='handcount100'>100</li>
</ul>
</div>
<div id='toolbar'>
<span class='left'>
<button onclick='cdr.login()' class='leftButton' id='loginButton'>Login</button>
<button onclick='cdr.changeGames()' id='gamesButton'>Games</button>
<button onclick='cdr.changeHands()' id='handsButton'>Hands</button>
</span>
<h2 id='denom'>$1</h2>
<span class='right'>
<button onclick='cdr.betone()' id='betOne'>Bet 1</button>
<button onclick='cdr.betmax()' id='betMax'>Bet 5</button>
<button id='dealdrawButton' onclick='cdr.dealdraw()' disabled='true' class='rightButton disabled'>Deal</button>
</span>
</div>
<div id='doubleup'>
<div id='doubleheader'>
<h1>Double Up?</h1>
<p>YOU WON $<span id='doublewin'>0</span></p>
<p>DOUBLE UP TO $<span id='doubledouble'>0</span></p>
<p>
<button id='doubleButton'>Double</button>
<button id='collectButton'>Collect</button>
</p>
</div>
<div id='doublecards'>
<div id='doubledealer'><span class='dealercardlabel'>DEALERS CARD</span><br><div id='doublecard0' class='cardwrap flipped' ><div class='card card1S'><figure class='pic'> </figure></div><div class='cardback'><figure class='pic'> </figure></div></div></div>
<div id='doublecard1' class='cardwrap flipped'><br><div class='card card3H'><figure class='pic'> </figure></div><div class='cardback'><figure class='pic'> </figure></div></div>
<div id='doublecard2' class='cardwrap flipped'><br><div class='card card8D'><figure class='pic'> </figure></div><div class='cardback'><figure class='pic'> </figure></div></div>
<div id='doublecard3' class='cardwrap flipped'><br><div class='card card11C'><figure class='pic'> </figure></div><div class='cardback'><figure class='pic'> </figure></div></div>
<div id='doublecard4' class='cardwrap flipped'><br><div class='card card10H'><figure class='pic'> </figure></div><div class='cardback'><figure class='pic'> </figure></div></div>
</div>
</div>
</div>
<script>
(function() {
window.cdr = {
game: {
endpoint: "https://us-central1-crblackjack-9e220.cloudfunctions.net/",
hands: 10,
type: "poker",
wilds: "",
chipColors: ["#dd0", "#0c0", "#c00", "#c0c", "#000", "#0be", "#fa0", "#999", "#0a6", "#69a", "#333", "#000"],
creditValues: [ 1, 2, 5, 10, 25, 100, 250, 500, 1000, 2000, 5000, 10000, 50000 ],
creditValueIdx:0,
creditValue:1,
cards: [],
discards: {},
holds: {},
bet: 0,
credit: 1000,
uid:"",
stage:0
},
paytable: {
"RoyalFlush": { hand: 'Royal Flush', win: [ 250, 500, 750, 1000, 4000]},
"StraightFlush": { hand: 'Straight Flush', win: [ 50, 100, 150, 200, 250]},
"FourOfAKind": { hand: 'Four of a Kind', win: [ 25, 50, 75, 100, 125]},
"FullHouse": { hand: 'Full House', win: [ 9, 18, 27, 36, 45]},
"Flush": { hand: 'Flush', win: [ 6, 12, 18, 24, 30]},
"Straight": { hand: 'Straight', win: [ 4, 8, 12, 16, 20]},
"ThreeOfAKind": { hand: 'Three of a Kind', win: [ 3, 6, 9, 12, 15]},
"TwoPair": { hand: 'Two Pair', win: [ 2, 4, 6, 8, 10]},
"OnePair": { hand: 'Jacks or Better', win: [ 1, 2, 3, 4, 5]}
},
games: {
"poker": "Jacks or Better",
"bonus": "Bonus Poker",
"doublebonus": "Double Bonus Poker",
"dueces": "Dueces Wild",
"joker": "Joker Poker"
},
addListener: function(i) {
$$("card" + i).addEventListener("click", function(e) { cdr.toggleCard("card" + i, 0); });
},
changeGames: function() {
$$("game_"+cdr.game.type).classList.add('gameslistSelected');
$$("gameselect").classList.toggle("open");
$$("handselect").classList.remove("open");
},
changeHands: function() {
$$("handcount"+cdr.game.hands).classList.add('handcountSelected');
$$("handselect").classList.toggle("open");
$$("gameselect").classList.remove("open");
},
betone: function() {
$$("handselect").classList.remove("open");
$$("gameselect").classList.remove("open");
if (cdr.game.bet > 0) $(".paybet").classList.remove('paybet');
cdr.game.bet++;
if (cdr.game.bet > 5) {
cdr.game.bet = 0;
$$("dealdrawButton").setAttribute("disabled", true);
$$("dealdrawButton").classList.add("disabled");
}
if (cdr.game.bet > 0) {
$$("dealdrawButton").removeAttribute("disabled");
$$("dealdrawButton").classList.remove("disabled");
$$("paytable").className = "paybet" + cdr.game.bet;
if ($(".paybet")) $(".paybet").classList.remove('paybet');
$$("bet"+cdr.game.bet+"pay").classList.add('paybet');
}
$$("bet").innerHTML = cdr.game.bet + "x"+cdr.game.hands;
cdr.genPaytable();
},
betmax: function() {
$$("handselect").classList.remove("open");
$$("gameselect").classList.remove("open");
cdr.game.bet = 5;
if (cdr.game.bet > 0) {
$$("dealdrawButton").removeAttribute("disabled");
$$("dealdrawButton").classList.remove("disabled");
$$("dealdrawButton").innerHTML = "DEAL";
$$("paytable").className = "paybet" + cdr.game.bet;
if ($(".paybet")) $(".paybet").classList.remove('paybet');
$$("bet"+cdr.game.bet+"pay").classList.add('paybet');
} else {
$$("dealdrawButton").setAttribute("disabled");
$$("dealdrawButton").classList.add("disabled");
}
$$("bet").innerHTML = cdr.game.bet + "x" + cdr.game.hands + "(" + (cdr.game.bet * cdr.game.hands) + ")";
cdr.genPaytable();
cdr.deal();
},
dealdraw: function() {
$$("handselect").classList.remove("open");
$$("gameselect").classList.remove("open");
if (cdr.game.stage === 0) {
cdr.deal();
} else if (cdr.game.stage === 1) {
cdr.draw();
}
},
addListeners: function() {
$$("cards").addEventListener("mousedown", function(e) {
var tgt = e.target;
if (tgt.classList.contains('card')) {
cdr.toggleCard(tgt.parentNode.id, 0, 0);
} else if (tgt.classList.contains('cardwrap')) {
cdr.toggleCard(tgt.id, 0, 0);
}
});
$$("gameslist").addEventListener("click", function(e) {
$(".gameslistSelected").classList.remove("gameslistSelected");
var tgt = e.target;
var matches = tgt.id.match(/game_(\w+)/);
if (matches[1]) {
cdr.game.type = matches[1];
tgt.classList.add('gameslistSelected');
var url = document.location.href.replace(/#.*/, '');
document.location.href = url + "#" + cdr.game.type;
$$("gameselect").classList.remove('open');
cdr.init();
$$('win').innerHTML = tgt.innerHTML;
cdr.settings.type = matches[1];
localStorage.setItem("settings", JSON.stringify(cdr.settings));
}
});
$$("handcount").addEventListener("click", function(e) {
var tgt = e.target;
var matches = tgt.id.match(/handcount(\d+)/);
if (matches[1]) {
var newcount = parseInt(matches[1]);
cdr.switchHands(newcount);
cdr.settings.hands = newcount;
localStorage.setItem("settings", JSON.stringify(cdr.settings));
}
});
$$("denom").addEventListener("click", function(e) {
cdr.game.creditValueIdx++;
if (cdr.game.creditValueIdx > cdr.game.creditValues.length - 1) cdr.game.creditValueIdx = 0;
if (cdr.game.balance / cdr.game.creditValues[cdr.game.creditValueIdx] < 0) cdr.game.creditValueIdx = 0;
cdr.game.creditValue = cdr.game.creditValues[cdr.game.creditValueIdx];
cdr.updateChip();
cdr.updateCredits();
cdr.settings.creditValue = cdr.game.creditValue;
cdr.settings.creditValueIdx = cdr.game.creditValueIdx;
localStorage.setItem("settings", JSON.stringify(cdr.settings));
});
},
init: function() {
if (document.location.hash) {
cdr.game.type = document.location.hash.replace(/^#/, '');
if (cdr.game.type==="dueces") {
$$("main").classList.add('wilds');
cdr.game.wilds = "wilds";
} else {
cdr.game.wilds = "";
}
}
var savedJS = localStorage.getItem("settings");
if (savedJS) {
cdr.settings = JSON.parse(savedJS);
for (var i in cdr.settings) {
if (cdr.settings.hasOwnProperty(i)) {
cdr.game[i] = cdr.settings[i];
}
}
}
cdr.updateChip();
cdr.genPaytable();
cdr.makeHands();
//var cards = cdr.newDeck();
$$("main").classList.add("hands"+cdr.game.hands);
$$("gameover").style.transform = "scale(1)";
$$("gameover").innerHTML = cdr.games[cdr.game.type];
if (!cdr.game.listening) {
cdr.addListeners();
cdr.game.listening = true;
}
},
switchHands: function(handcount) {
$$("handcount"+cdr.game.hands).className = "";
$$("handcount"+handcount).className = "handcountSelected";
cdr.game.hands = handcount;
setTimeout(function() { $$("handselect").classList.remove("open"); }, 250);
setTimeout(function() {
cdr.makeHands();
$$("main").className = "hands"+cdr.game.hands + " " + cdr.game.wilds;
}, 250);
},
updateChip: function() {
$$("denom").className = "chip" + cdr.game.creditValue;
$$("denom").style.backgroundColor = cdr.game.chipColors[cdr.game.creditValueIdx];
var show = (cdr.game.creditValue>999) ? (cdr.game.creditValue / 1000) + "K" : cdr.game.creditValue;
$$("denom").innerHTML = "$" + show;
},
updateCredits: function() {
var uid = cdr.game.uid;
firebase.database().ref("bank/"+uid+"/balance").on("value", function(snapshot) {
var balance = snapshot.val();
cdr.game.balance = balance;
cdr.game.credit = Math.floor(balance / cdr.game.creditValue);
var showCredit = cdr.game.credit;
if (showCredit > 1000000000) {
showCredit = Math.floor(showCredit / 1000000) / 100 + "B";
} else if (showCredit > 1000000) {
showCredit = Math.floor(showCredit / 1000) / 100 + "M";
} else if (showCredit > 1000) {
showCredit = Math.floor(showCredit / 100) / 10 + "K";
}
$$("credit").innerHTML = showCredit;
if ((cdr.game.credit < 1) || cdr.game.active) {
cdr.disable("betOne");
cdr.disable("betMax");
} else if (cdr.game.credit < 5) {
cdr.enable("betOne");
cdr.disable("betMax");
} else {
cdr.enable("betOne");
cdr.enable("betMax");
}
});
},
disable: function(item) {
$$(item).setAttribute("disabled",true);
$$(item).classList.add('disabled');
},
enable: function(item) {
$$(item).removeAttribute("disabled");
$$(item).classList.remove('disabled');
},
toggleCard: function(card, delay) {
// setTimeout(function() { $$(card).classList.toggle('flipped'); }, delay * 100);
var current = $$(card + '-hold').style.visibility;
if (current==="hidden") {
$$(card + '-hold').style.visibility = "";
cdr.game.holds[card] = true;
for (var i=1; i < cdr.game.hands; i++) {
$("#hand"+i+card+" .card").className = $("#"+card+" .card").className;
// $$("hand"+i+card).classList.remove('flipped');
cdr.showCard("hand"+i+card, 0, 0);
}
} else {
$$(card + '-hold').style.visibility = "hidden";
for (var i=1; i < cdr.game.hands; i++) {
// $$("hand"+i+card).classList.add('flipped');
cdr.hideCard("hand"+i+card, 0, 0);
}
delete cdr.game.holds[card];
}
// if (cdr.game.discards[card]) { delete cdr.game.discards[card]; } else { cdr.game.discards[card] = true; }
},
hideCard: function(card, delay) {
setTimeout(function() { $$(card).classList.add('flipped'); setTimeout(function() { $("#"+card+" .card").style.visibility='hidden';}, 100); }, delay * 10);
},
showCard: function(card, delay, wait=500) {
setTimeout(function() { $("#"+card+" .card").style.visibility='visible'; $$(card).classList.remove('flipped'); }, (delay * 10) + wait);
},
setCard: function(i, draw, delay) {
setTimeout(function() { $("#card" + i + " .card").className = 'card card' + draw; }, (delay * 100));
},
clearHolds: function() {
for (var i=0; i<5; i++) {
$$("card"+i+"-hold").style.visibility = "hidden";
}
cdr.game.holds = [];
},
newCard: function(card, newcard, delay) {
var match = card.match(/card(\d)/);
cdr.game.cards[match[1]] = newcard;
setTimeout(function() {
$("#" + card + " .card").className = "card card" + newcard;
}, delay * 75);
},
draw: function() {
var cnt = 0;
var needcards = [];
$$("dealdrawButton").setAttribute("disabled", true);
$$("dealdrawButton").classList.add('disabled');
$$("dealdrawButton").innerHTML = "DEAL";
for (var i=0; i<5; i++) {
if (!cdr.game.holds["card"+i]) {
cdr.hideCard('card' + i, cnt);
cnt++;
cdr.game.discards["card"+i] = true;
needcards.push(i);
}
}
var scr = document.createElement('script');
scr.src = cdr.game.endpoint + "exchangeCards?game="+cdr.game.type+"&callback=cdr.newCards&hands=" + cdr.game.hands + "&uid=" + firebase.auth().currentUser.uid + "&discard=" + needcards.join(',');
document.body.appendChild(scr);
},
newCards: function(cards) {
console.log("cards: "+JSON.stringify(cards));
console.dir(cards);
cdr.game.results = cards;
cdr.game.resultCounts = {};
cdr.game.stage = 2;
var cnt = 0;
var wintot = 0;
var c = cards.hands[0];
for (var j=0; j < c.length; j++) {
if ($$("card"+j).classList.contains('flipped')) {
$("#card"+j+" .card").className = "card card" + c[j];
$("#card"+j+" .card").style.visibility = "visible";
cdr.showCard("card"+j, cnt, 0);
cnt++;
}
}
if (cards.results[0]) {
cdr.showResult(0, cards);
wintot += cards.wins[0];
if (!cdr.game.resultCounts[cards.results[0]]) cdr.game.resultCounts[cards.results[0]] = 0;
cdr.game.resultCounts[cards.results[0]]++;
cdr.genPaytable(cdr.game.resultCounts);
}
var discards = 0;
for (var i=1; i < cards.hands.length; i++) {
var c = cards.hands[i];
for (var j=0; j < c.length; j++) {
if ($$("hand"+i+"card"+j).classList.contains('flipped')) {
$("#hand"+i+"card"+j+" .card").className = "card card" + c[j];
cdr.showCard("hand"+i+"card"+j, cnt, 0);
}
}
cnt++;
if (!discards) discards = cnt;
if (cards.results[i]) {
cdr.showResult(i, cards);
wintot += cards.wins[i];
if (!cdr.game.resultCounts[cards.results[i]]) cdr.game.resultCounts[cards.results[i]] = 0;
cdr.updatePaytable(i, cards.results[i]);
}
}
if (wintot > 0) {
setTimeout(function() {
$$("won").innerHTML = "<h1>YOU'VE WON "+Math.floor(wintot / cdr.game.creditValue)+" CREDITS!</h1><h1>\"DOUBLE IT\" TO "+Math.floor(wintot / cdr.game.creditValue) * 2 +"?</h1><button onclick='cdr.doubleup()'>DOUBLE IT</button> <button onclick='$$(\"won\").style.display = \"none\"'>COLLECT</button>";
$$("won").style.display = "inline-block";
$$("win").innerHTML = "WIN: "+Math.floor(wintot / cdr.game.creditValue);
cdr.resetButtons();
cdr.game.active = false;
cdr.game.stage = 0;
/*setTimeout(function() {
$$("doublewin").innerHTML = Math.floor(wintot / cdr.game.creditValue);
$$("doubledouble").innerHTML = Math.floor(wintot / cdr.game.creditValue) * 2;
$$("doubleup").style.display = "inline-block";
}, 2000);*/
}, cnt * 25);
} else {
cdr.gameoverTimeout = setTimeout(function() { $$("gameover").innerHTML = "GAME OVER"; $$("gameover").style.transform = "scale(1)"; }, 1000);
cdr.game.active = false;
cdr.resetButtons();
cdr.game.stage = 0;
}
},
updatePaytable: function(cnt, hand) {
setTimeout(function() {
cdr.game.resultCounts[hand]++;
cdr.genPaytable(cdr.game.resultCounts);
}, cnt * 10);
},
showResult: function(i, cards) {
var el = (i > 0) ? $$("hand"+i+"result") : $$("result");
setTimeout(function() {
el.innerHTML = cards.results[i].replace(/([a-z0-9])([A-Z0-9])/g, '$1 $2').replace(/([A-Z])([A-Z])/g, '$1 $2');
el.style.display = "inline-block";
el.style.height = "";
}, 10 * i);
},
checkWin: function() {
var scr = document.createElement('script');
scr.src = cdr.game.endpoint + "checkHand?callback=cdr.gotWin&game="+cdr.game.type+"&uid=" + firebase.auth().currentUser.uid;
document.body.appendChild(scr);
},
gotWin: function(hand, won) {
if (hand && won) {
var win = cdr.paytable[hand];
if (win) {
$$("win").innerHTML = win.hand;
$$("won").style.display = "inline-block";
$$("won").innerHTML = "WON " + win.win[cdr.game.bet - 1];
cdr.clearWinners();
$$(hand).classList.add('winner');
$$(hand + (cdr.game.bet - 1)).classList.add('winner');
cdr.gameoverTimeout = setTimeout(function() { $$("gameover").innerHTML = "GAME OVER"; $$("gameover").style.transform = "scale(1)"; }, 10000);
}
} else {
$$("gameover").innerHTML = "GAME OVER";
$$("gameover").style.transform = "scale(1)";
}
cdr.resetButtons();
cdr.game.active = false;
},
resetButtons: function() {
$$("gamesButton").classList.remove('disabled');
$$("gamesButton").removeAttribute('disabled');
$$("handsButton").classList.remove('disabled');
$$("handsButton").removeAttribute('disabled');
$$("handselect").classList.remove("open");
$$("gameselect").classList.remove("open");
$$("betOne").classList.remove('disabled');
$$("betOne").removeAttribute('disabled');
$$("betMax").classList.remove('disabled');
$$("betMax").removeAttribute('disabled');
if (cdr.game.bet) {
$$("dealdrawButton").classList.remove('disabled');
$$("dealdrawButton").removeAttribute('disabled');
} else {
$$("dealdrawButton").classList.add('disabled');
$$("dealdrawButton").setAttribute('disabled');
}
$$("dealdrawButton").innerHTML = "DEAL";
},
clearWinners: function() {
var els = $$$('.winner');
for (var i=0; i<els.length; i++) {
els[i].classList.remove('winner');
}
$$("result").style.display = "none";
for (var i=1; i<5; i++) {
$$("hand"+i+"result").style.display = "none";
}
},
resetCards: function() {
for (var h=1; h < cdr.game.hands; h++) {
for (var c=0; c < 5; c++) {
$$("hand"+h+"card"+c).classList.add('flipped');
}
$$("hand"+h+"result").style.height = "0";
}
setTimeout(function() {
var els = $$$(".handresult");
for (var i in els) {
if (els.hasOwnProperty(i)) {
els[i].style.display = "none";
}
}
}, 150);
},
deal: function() {
if (cdr.game.bet == 0) {
$$("gameover").innerHTML = "ADD CREDITS TO PLAY";
return false;
}
if (cdr.gameoverTimeout) {
clearTimeout(cdr.gameoverTimeout);
cdr.gameoverTimeout = 0;
}
$$("gameover").style.transform = "scale(0)";
$$("won").style.display = "none";
cdr.game.active = true;
cdr.game.stage = 1;
cdr.clearHolds();
cdr.clearWinners();
cdr.resetCards();
$$("win").innerHTML = "";
$$("won").innerHTML = "";
$$("won").style.display = "none";
$$("gamesButton").classList.add("disabled");
$$("gamesButton").setAttribute("disabled", true);
$$("handsButton").classList.add("disabled");
$$("handsButton").setAttribute("disabled", true);
$$("dealdrawButton").innerHTML = "DRAW";
$$("betOne").classList.add("disabled");
$$("betOne").setAttribute("disabled", true);
$$("betMax").classList.add("disabled");
$$("betMax").setAttribute("disabled", true);
cdr.game.cards = [];
cdr.game.discards = [];
cdr.newDeck();
var func = document.createElement('script');
func.src = cdr.game.endpoint + "newGame?game="+cdr.game.type+"&hands="+cdr.game.hands+"&callback=cdr.gotGame&uid=" + firebase.auth().currentUser.uid + "&bet=" + cdr.game.bet * cdr.game.creditValue;
document.body.appendChild(func);
},
gotGame: function(cards) {
for (var i=0; i<5; i++) {
draw = cards[i];
cards.push(draw);
cdr.hideCard("card" + i, i);
cdr.setCard(i, draw, i);
cdr.showCard("card" + i, i + 1);
}
cdr.game.cards = cards;
cdr.game.active = true;
cdr.game.draws = 1;
},
solve: function() {
var hand = [];
for (var i=0; i<cdr.game.cards.length; i++) {
var card = cdr.game.cards[i].toLowerCase();
var match = card.match(/(\d*)([cdsh])/i);
var num = parseInt(match[1]);
var suit = match[2];
if ((num > 9) || (num==1)) {
switch (num) {
case 1:
num = "A";
break;
case 10:
num = "T";
break;
case 11:
num = "J";
break;
case 12:
num = "Q";
break;
case 13:
num = "K";
break;
}
}
hand.push(num + suit);
}
console.log("hand:");
console.dir(hand);
var result = Hand.solve(hand, "jacksbetter", true);
cdr.game.result = result.constructor.name;
console.dir(result);
return result;
},
solveHand: function(hand) {
var suits = [];
var cards = [];
var seen = {};
var suit = '';
var canFlush = 1;
var haveAce = 0;
for (var i=0; i<hand.length; i++) {
var match = hand[i].match(/^(\d+)([HDSC])/i);
if (match[1] && match[2]) {
if (suit === '') suit = match[2];
if (match[1] == 1) {
haveAce++;
}
if (suit && (suit !== match[2])) {
canFlush = 0;
}
if (!seen[match[1]]) {
seen[match[1]] = 1;
} else {
seen[match[1]]++;
}
cards.push(parseInt(match[1]));
suits.push(match[2]);
}
}
var isFlush = canFlush;
cards = cards.sort(function(a, b) { return a - b; });
var lastCard, isStraight = true;
for (var i=0; i<cards.length - 1; i++) {
if (!lastCard) {
lastCard = parseInt(cards[i]);
} else if ((lastCard + 1) !== parseInt(cards[i])) {
if (isStraight!==false && (lastCard===1) && (cards[i]===10)) {
isStraight = true;
} else {
isStraight = false;
}
}
lastCard = parseInt(cards[i]);
}
var isPair = false;
var isTwoPair = false;
var isQualifiedPair = false;
var isThreeOfAKind = false;
var isFourOfAKind = false;
for (var i in seen) {
if (seen.hasOwnProperty(i)) {
if (seen[i] > 1) {
switch (seen[i]) {
case 2:
if ((i > 10) || (i == 1)) {
isQualifiedPair = true;
}
if (isPair===true) isTwoPair = true;
isPair = true;
break;
case 3:
isThreeOfAKind = true;
break;
case 4:
isFourOfAKind = true;
break;
}
}
}
}
if (isStraight && isFlush && (cards[0] === 10)) return "RoyalFlush";
if (isStraight && isFlush) return "StraightFlush";
if (isFourOfAKind) return "FourOfAKind";
if (isThreeOfAKind && isPair) return "FullHouse";
if (isFlush) return "Flush";
if (isStraight) return "Straight";
if (isThreeOfAKind) return "ThreeOfAKind";
if (isTwoPair) return "TwoPair";
if (isQualifiedPair) return "OnePair";
return false;
},
shuffle: function(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
},
genPaytable: function(counts) {
firebase.database().ref("payouts/"+cdr.game.type).once("value", function(snap) {
var pt = snap.val();
var hands = Object.keys(pt.hands);
var newpaytable = {};
var sortable = [];
for (var i=0; i<hands.length; i++) {
var name = hands[i];
var displayName = name.replace(/([a-z0-9])([A-Z0-9])/g, "$1 $2").replace(/([A-Z0-9])([A-Z0-9])/g, "$1 $2");
sortable.push([name, pt.hands[name]]);
var pay = [];
for (var j=1; j<6; j++) {
pay.push(parseInt(pt.hands[name]) * j);
}
newpaytable[name] = { "hand": displayName, win: pay };
}
cdr.paytable = newpaytable;
sortable.sort(function(a, b) {
return b[1] - a[1];
});
cdr.paytable[sortable[0][0]].win[4] = parseInt(pt.jackpot);
console.dir(newpaytable);
console.log("New pay table: " + JSON.stringify(newpaytable));
var payleft = $('#payleft');
var payright = $('#payright');
payleft.innerHTML = "";
payright.innerHTML = "";
var keys = Object.keys(cdr.paytable);
var half = Math.floor(keys.length / 2);
var entry, mypt, win, cnt;
for (var i=0; i < half; i++) {
mypt = cdr.paytable[sortable[i][0]];
win = mypt.win[cdr.game.bet - 1] || 0;
cnt = (counts && counts[sortable[i][0]]!=undefined) ? " X " + counts[sortable[i][0]] : "";
if (counts && cnt==="") win = 0;
entry = el('div', 'payline'+i, 'payline', mypt.hand + " <div class='pay'>" + win + cnt + "</"+"div>");
payleft.appendChild(entry);
}
for (var i=half; i < sortable.length; i++) {
mypt = cdr.paytable[sortable[i][0]];
win = mypt.win[cdr.game.bet - 1] || 0;
cnt = (counts && counts[sortable[i][0]]!=undefined) ? " X " + counts[sortable[i][0]] : "";
if (counts && cnt==="") win = 0;
entry = el('div', 'payline'+i, 'payline', mypt.hand + " <div class='pay'>"+win + cnt+"<"+"/div>");
payright.appendChild(entry);
}
});
},
newDeck: function() {
cdr.deck = [];
var suits = ['S', 'C', 'D', 'H'];
for (var s=0; s<4; s++) {
for (var i=1; i<14; i++) {
cdr.deck.push(i + suits[s]);
}
}
var scnt = Math.floor(Math.random() * 10) + 4;
for (var i=0; i<scnt; i++) {
cdr.deck = cdr.shuffle(cdr.deck);
}
return cdr.deck;
},
login: function(who) {
var provider;
provider = new firebase.auth.FacebookAuthProvider();
db = firebase.database();
firebase.auth().signInWithPopup(provider).then(function(result) {
var token = result.credential.accessToken;
var user = result.user;
console.dir(user);
writeUserData(user.uid, user.displayName, user.email, user.photoURL);
db.ref("bank/" + firebase.auth().currentUser.uid).on("value", function(snapshot) {
var bank = snapshot.val();
$$("credit").innerHTML = bank.balance;
});
}).catch(function(error) {
var errorCode = error.code;
var errorMessage = error.message;
var email = error.email;
var credential = error.credential;
});
},
writeUserData: function(userId, name, email, imageUrl) {
firebase.database().ref('users/' + userId).set({
name: name,
email: email,
profile_picture : imageUrl
});
setCookie("uid", userId);
},
makeHands: function() {
var hands = $$("hands");
hands.innerHTML = "";
for (var i=1; i<cdr.game.hands; i++) {
hands.appendChild(cdr.makeHand(i));
}
},
makeHand: function(id) {
var suits = ['S', 'C', 'D', 'H'];
var hand = el('div', 'hand'+id, 'hand');
var nums = 1, snum = 0;
for (var i=0; i<5; i++) {
var cnum = i + 1;
var suit = suits[3];
var card = el('div', '', 'card card' + cnum + suit, '<figure class="pic"> </figure>');
var cardback = el('div', '', 'cardback', '<figure class="pic"> </figure>');
var cardwrap = el('div', 'hand'+id+'card'+i, 'cardwrap flipped');
cardwrap.appendChild(card);
cardwrap.appendChild(cardback);
hand.appendChild(cardwrap);
nums++;
if (nums > 13) {
nums = 1;
snum++;
if (snum > 3) {
snum = 0;
}
}
}
hand.appendChild(el('div', 'hand'+id+'result', 'handresult'));
return hand;
}
};
cdr.init();
})();
function el(tag, id, classname, content) {
var el = document.createElement(tag);
if (id) el.id = id;
if (classname) el.className = classname;
if (content) el.innerHTML = content;
return el;
}
function $(str) { return document.querySelector(str); }
function $$(str) { return document.getElementById(str); }
function $$$(str) { return document.querySelectorAll(str); }
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
console.dir(user);
// User is signed in.
var displayName = user.displayName;
var email = user.email;
var emailVerified = user.emailVerified;
var photoURL = user.photoURL;
var isAnonymous = user.isAnonymous;
var uid = user.uid;
var providerData = user.providerData;
$$("loginButton").innerHTML = "LOGOUT";
cdr.game.uid = user.uid;
cdr.updateCredits();
} else {
// User is signed out.
// ...
$$("loginButton").innerHTML = "LOGIN";
}
});
</script>
</body>
</html>
| chrisrobison/crcasino | poker5.html | HTML | gpl-3.0 | 41,692 |
import styled from "./Theme";
export const Content = styled.div`
margin: 2rem 0;
padding: 5px;
`;
| lucas-burdell/lucas-burdell.github.io | src/Content.tsx | TypeScript | gpl-3.0 | 102 |
<?php
namespace Chamilo\Core\Repository\Selector;
/**
* A category of options in a ContentObjectTypeSelector
*
* @author Hans De Bisschop <[email protected]>
*/
class TypeSelectorCategory
{
/**
*
* @var string
*/
private $type;
/**
*
* @var string
*/
private $name;
/**
*
* @var \core\repository\ContentObjectTypeSelectorOption[]
*/
private $options;
/**
*
* @param string $type
* @param string $name
* @param \core\repository\ContentObjectTypeSelectorOption[] $options
*/
public function __construct($type, $name, $options = array())
{
$this->type = $type;
$this->name = $name;
$this->options = $options;
}
/**
*
* @return string
*/
public function get_type()
{
return $this->type;
}
/**
*
* @param string $type
*/
public function set_type($type)
{
$this->type = $type;
}
/**
*
* @return string
*/
public function get_name()
{
return $this->name;
}
/**
*
* @param string $name
*/
public function set_name($name)
{
$this->name = $name;
}
/**
*
* @return \Chamilo\Core\Repository\Selector\TypeSelectorOption[]
*/
public function get_options()
{
return $this->options;
}
/**
*
* @param \core\repository\ContentObjectTypeSelectorOption[]
*/
public function set_options($options)
{
$this->options = $options;
}
/**
*
* @param \core\repository\ContentObjectTypeSelectorOption $option
*/
public function add_option($option)
{
$this->options[] = $option;
}
/**
* Sort the ContentObjectTypeSelectorOption instances by name
*/
public function sort()
{
usort(
$this->options,
function ($option_a, $option_b)
{
return strcmp($option_a->get_name(), $option_b->get_name());
});
}
/**
*
* @return int
*/
public function count()
{
return count($this->get_options());
}
/**
*
* @return int[]
*/
public function get_unique_content_object_template_ids()
{
$types = array();
foreach ($this->get_options() as $option)
{
if (! in_array($option->get_template_registration_id(), $types))
{
$types[] = $option->get_template_registration_id();
}
}
return $types;
}
} | vanpouckesven/cosnics | src/Chamilo/Core/Repository/Selector/TypeSelectorCategory.php | PHP | gpl-3.0 | 2,653 |
# coding: utf-8
# Copyright (C) 2017 Open Path View, Maison Du Libre
# 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/>.
# Contributors: Benjamin BERNARD <[email protected]>
# Email: [email protected]
# Description: Camera Set Partition, represent a partition of ImagesSets.
from typing import NamedTuple, List
from opv_import.model import ImageSet
CameraSetPartition = NamedTuple(
'CameraSetPartition',
[
('ref_set', ImageSet),
('images_sets', List[ImageSet]),
('start_indexes', List[int]),
('fetcher_next_indexes', List[int]),
('break_reason', str),
('number_of_incomplete_sets', int),
('number_of_complete_sets', int),
('max_consecutive_incomplete_sets', int)
]
)
| OpenPathView/batchPanoMaker | opv_import/model/camera_set_partition.py | Python | gpl-3.0 | 1,341 |
<?php
/**
* @version $Id: search.class.php v1.0 $
* @package PBDigg
* @copyright Copyright (C) 2007 - 2008 PBDigg.com. All Rights Reserved.
* @license PBDigg is free software and use is subject to license terms
*/
class search
{
/**
* 搜索类型
*/
var $_searchtype;
/**
* 搜索条件语句
*/
var $_searchsql = '';
/**
* 搜索基本表
*/
var $_basetable;
/**
* 返回限定
*/
var $_limit = '';
/**
* 搜索hash
*/
var $_cacheHash = '';
/**
* 记录总数
*/
var $_resultNum;
/**
* 分页参数
*/
var $_mult = '';
/**
* 搜索匹配正则
*/
var $_pattern = array('%','_','*');
var $_replace = array('\%','\_','%');
/**
* 数据库实例
*/
var $DB = null;
var $db_prefix = '';
/**
* 是否缓存搜索
*/
var $_ifcache;
/**
* 缓存周期
*/
var $_cacheTime = 600;
function search($type, $cache = false)
{
$this->__construct($type, $cache);
}
function __construct($type, $cache = false)
{
if (in_array($type, array('article', 'comment', 'attachment', 'author')))
{
global $page, $pagesize, $DB, $db_prefix;
$this->DB = $DB;
$this->db_prefix = $db_prefix;
$this->_searchtype = $type;
$this->_ifcache = $cache ? true : false;
$this->_limit = sqlLimit($page, $pagesize);
switch ($this->_searchtype)
{
case 'article':
$this->_basetable = 't';
break;
case 'comment':
$this->_basetable = 'c';
break;
case 'attachment':
$this->_basetable = 'a';
break;
case 'author':
$this->_basetable = 'm';
break;
}
}
}
function getMult()
{
return $this->_mult;
}
function getResultNum()
{
return intval($this->_resultNum);
}
function exportResults($condition)
{
global $searchhash;
if (!is_array($condition)) return;
$cached = false;
if ($this->_ifcache && isset($searchhash) && preg_match('~^[a-z0-9]{32}$~', $searchhash))
{
$cached = $this->getCache($searchhash);
}
if (!$cached)
{
foreach ($condition as $k => $v)
{
$this->$k($v);
}
$this->_cacheHash = md5(md5($this->_searchsql).$this->_searchtype);
$this->_ifcache && $cached = $this->getCache($this->_cacheHash);
}
$this->_searchsql && $this->_searchsql = ' WHERE '.substr($this->_searchsql, 4);
return $this->{$this->_searchtype}($cached);
}
function getCache($searchhash)
{
global $timestamp;
$cacheData = $this->DB->fetch_one("SELECT num, ids, exptime FROM {$this->db_prefix}scaches WHERE hash = '$searchhash' AND exptime > '$timestamp'");
if ($cacheData && $cacheData['ids'])
{
$this->_resultNum = (int)$cacheData['num'];
$newids = '';
$ids = explode(',', $cacheData['ids']);
foreach ($ids as $v)
{
$newids .= (int)$v.',';
}
$newids && $newids = substr($newids, 0, -1);
switch ($this->_searchtype)
{
case 'article':
$this->_searchsql = " AND t.tid IN ($newids)";
break;
case 'comment':
$this->_searchsql = " AND c.rid IN ($newids)";
break;
case 'attachment':
$this->_searchsql = " AND a.aid IN ($newids)";
break;
case 'author':
$this->_searchsql = " AND m.uid IN ($newids)";
break;
}
$newids != $cacheData['ids'] && $this->DB->db_exec("UPDATE {$this->db_prefix}scaches SET ids = '".addslashes($newids)."' WHERE hash = '$searchhash' AND exptime = '".$cacheData['exptime']."'");
$this->_mult = '&searchhash='.$searchhash;
return true;
}
}
function buildCache($ids)
{
global $timestamp;
$this->DB->db_exec("DELETE FROM {$this->db_prefix}scaches WHERE exptime <= '$timestamp'");
$this->DB->db_exec("INSERT INTO {$this->db_prefix}scaches (hash,keywords,num,ids,searchip,searchtime,exptime) VALUES ('".$this->_cacheHash."','','".$this->_resultNum."','$ids','','','".($timestamp + $this->_cacheTime)."')");
$this->_mult = '&searchhash='.$this->_cacheHash;
}
function article($cached)
{
$anonymity = getSingleLang('common', 'common_anonymity');
if ($this->_ifcache && !$cached)
{
$query = $this->DB->db_query("SELECT t.tid FROM {$this->db_prefix}threads t ".$this->_searchsql);
$ids = '';
$num = 0;
while ($rs = $this->DB->fetch_all($query))
{
$ids .= (int)$rs['tid'].',';
$num++;
}
if ($ids)
{
$this->_resultNum = (int)$num;
$ids = substr($ids, 0, -1);
$this->buildCache($ids);
$this->_searchsql = " WHERE t.tid IN ($ids)";
unset($ids, $num);
}
}
if (!isset($this->_resultNum))
{
$rs = $this->DB->fetch_one("SELECT COUNT(*) num FROM {$this->db_prefix}threads t ".$this->_searchsql);
$this->_resultNum = (int)$rs['num'];
}
$query = $this->DB->db_query("SELECT t.tid, t.subject, t.author, t.postdate, t.postip FROM {$this->db_prefix}threads t ".$this->_searchsql.$this->_limit);
$article = array();
while ($rs = $this->DB->fetch_all($query))
{
$rs['postdate'] = gdate($rs['postdate'], 'Y-m-d H:i');
!$rs['author'] && $rs['author'] = $anonymity;
$article[] = $rs;
}
return $article;
}
function comment($cached)
{
$anonymity = getSingleLang('common', 'common_anonymity');
if ($this->_ifcache && !$cached)
{
$query = $this->DB->db_query("SELECT c.rid FROM {$this->db_prefix}comments c ".$this->_searchsql);
$ids = '';
$num = 0;
while ($rs = $this->DB->fetch_all($query))
{
$ids .= (int)$rs['rid'].',';
$num++;
}
if ($ids)
{
$this->_resultNum = (int)$num;
$ids = substr($ids, 0, -1);
$this->buildCache($ids);
$this->_searchsql = " WHERE c.rid IN ($ids)";
unset($ids, $num);
}
}
if (!isset($this->_resultNum))
{
$rs = $this->DB->fetch_one("SELECT COUNT(*) num FROM {$this->db_prefix}comments c ".$this->_searchsql);
$this->_resultNum = (int)$rs['num'];
}
$query = $this->DB->db_query("SELECT c.rid, c.content, c.author, c.postdate, c.postip FROM {$this->db_prefix}comments c ".$this->_searchsql.$this->_limit);
$comment = array();
while ($rs = $this->DB->fetch_all($query))
{
$rs['postdate'] = gdate($rs['postdate'], 'Y-m-d H:i');
$rs['content'] = PBSubStr($rs['content'], 50);
!$rs['author'] && $rs['author'] = $anonymity;
$comment[] = $rs;
}
return $comment;
}
// function author()
// {
// $this->_sql = "SELECT * FROM {$this->db_prefix}threads t";
// }
function attachment($cached)
{
$anonymity = getSingleLang('common', 'common_anonymity');
if ($this->_ifcache && !$cached)
{
$query = $this->DB->db_query("SELECT a.aid FROM {$this->db_prefix}attachments a ".$this->_searchsql);
$ids = '';
$num = 0;
while ($rs = $this->DB->fetch_all($query))
{
$ids .= (int)$rs['aid'].',';
$num++;
}
if ($ids)
{
$this->_resultNum = (int)$num;
$ids = substr($ids, 0, -1);
$this->buildCache($ids);
$this->_searchsql = " WHERE a.aid IN ($ids)";
unset($ids, $num);
}
}
if (!isset($this->_resultNum))
{
$rs = $this->DB->fetch_one("SELECT COUNT(*) num FROM {$this->db_prefix}attachments a ".$this->_searchsql);
$this->_resultNum = (int)$rs['num'];
}
$query = $this->DB->db_query("SELECT a.aid, a.tid, a.uid, a.filename, a.filesize, a.uploaddate, a.downloads FROM {$this->db_prefix}attachments a ".$this->_searchsql.$this->_limit);
$attachment = array();
while ($rs = $this->DB->fetch_all($query))
{
$rs['uploaddate'] = gdate($rs['uploaddate'], 'Y-m-d H:i');
$rs['filename'] = htmlspecialchars($rs['filename']);
$rs['filesize'] = getRealSize($rs['filesize']);
$attachment[] = $rs;
}
return $attachment;
}
function cid($cid)
{
!is_array($cid) && $cid = explode(',', $cid);
$newcid = '';
foreach ($cid as $v)
{
$v && is_numeric($v) && $newcid .= $newcid ? ',' : '' . (int)$v;
}
if ($newcid)
{
$this->_searchsql .= " AND ".$this->_basetable.".cid IN ($newcid)";
$this->_mult .= '&cid='.$newcid;
}
}
function mid($mid)
{
global $module;
!is_array($mid) && $mid = explode(',', $mid);
$newmid = '';
if (!is_object($module))
{
require_once PBDIGG_ROOT.'include/module.class.php';
$module = new module();
}
foreach ($mid as $v)
{
$v && is_numeric($v) && in_array($mid, $module->getModuleId()) && $newmid .= $newmid ? ',' : '' . (int)$v;
}
if ($newmid)
{
$this->_searchsql .= " AND ".$this->_basetable.".module IN ($newmid)";
$this->_mult .= '&mid='.$newmid;
}
}
function uid($uid)
{
!is_array($uid) && $uid = explode(',', $uid);
$newuid = '';
foreach ($uid as $v)
{
$v && is_numeric($v) && $newuid .= $newuid ? ',' : '' . (int)$v;
}
if ($newuid)
{
$this->_searchsql .= " AND ".$this->_basetable.".uid IN ($newuid)";
$this->_mult .= '&uid='.$newuid;
}
}
function authors($author)
{
$author = strip_tags(trim($author));
$_author = explode(',', $author);
$authorCondition = '';
foreach ($_author as $value)
{
if (trim($value) && (strlen($value) <= 20))
{
$authorCondition .= " OR username LIKE '".str_replace($this->_pattern, $this->_replace, preg_replace('~\*{2,}~i', '*', $value))."'";
}
}
if ($authorCondition)
{
$query = $this->DB->db_query("SELECT uid FROM {$this->db_prefix}members WHERE ".substr($authorCondition, 3));
$uids = '';
while ($rs = $this->DB->fetch_all($query))
{
$uids .= ",".(int)$rs['uid'];
}
$this->_searchsql .= $uids ? ' AND '.$this->_basetable.'.uid IN ('.substr($uids, 1).')' : ' AND 0';
$this->_mult .= '&authors='.rawurlencode($author);
}
}
function tags($tags)
{
$tags = strip_tags(trim($tags));
$_tags = explode(',', $tags);
$tagCondition = '';
foreach ($_tags as $value)
{
if (trim($value) && (strlen($value) <= 30))
{
$tagCondition .= " OR tg.tagname LIKE '".str_replace($this->_pattern, $this->_replace, preg_replace('/\*{2,}/i', '*', $value))."'";
}
}
if ($tagCondition)
{
$query = $this->DB->db_query("SELECT tc.tid FROM {$this->db_prefix}tagcache tc INNER JOIN {$this->db_prefix}tags tg USING (tagid) WHERE ".substr($tagCondition, 3));
$tids = '';
while ($rs = $this->DB->fetch_all($query))
{
$tids .= ",".(int)$rs['tid'];
}
$this->_searchsql .= $tids ? ' AND '.$this->_basetable.'.tid IN ('.substr($tids, 1).')' : ' AND 0';
$this->_mult .= '&tags='.rawurlencode($tags);
}
}
/**
* @param string $datefield 时间字段
*/
function searchdate($params)
{
foreach ($params as $k => $v)
{
if (preg_replace('~[a-z]~i', '', $k)) return;
list ($more, $less) = $v;
if ($more && preg_match('~^\d{4}-\d{1,2}-\d{1,2}$~i', $more))
{
$this->_searchsql .= " AND {$this->_basetable}.$k >= ".pStrToTime($more.' 0:0:0');
$this->_mult .= '&'.$k.'more='.$more;
}
if ($less && preg_match('~^\d{4}-\d{1,2}-\d{1,2}$~i', $less))
{
$this->_searchsql .= " AND {$this->_basetable}.$k < ".pStrToTime($less.' 0:0:0');
$this->_mult .= '&'.$k.'less='.$less;
}
}
}
function searchscope($params)
{
foreach ($params as $k => $v)
{
if (preg_replace('~[a-z]~i', '', $k)) return;
list ($more, $less) = $v;
if (is_numeric($more) && $more != -1)
{
$more = (int)$more;
$this->_searchsql .= " AND {$this->_basetable}.$k >= $more";
$this->_mult .= '&'.$k.'more='.$more;
}
if (is_numeric($less) && $less != -1)
{
$less = (int)$less;
$this->_searchsql .= " AND {$this->_basetable}.$k < $less";
$this->_mult .= '&'.$k.'less='.$less;
}
}
}
function postip($ip)
{
if ($ip && preg_match('~^[0-9\*\.]+$~i', $ip))
{
$this->_searchsql .= " AND ".$this->_basetable.".postip ".((strpos($ip, '*') === FALSE) ? (" = '$ip'") : " LIKE '".str_replace('*', '%', preg_replace('~\*{2,}~i', '*', $ip))."'");
$this->_mult .= '&postip='.rawurlencode($ip);
}
}
function isimg($bool)
{
if ($bool)
{
$this->_searchsql .= ' AND '.$this->_basetable.'.isimg = 1';
$this->_mult .= '&isimg=1';
}
}
function linkhost($linkhost)
{
if ($linkhost && preg_match('~^[-_a-z0-9\.\~!\$&\'\(\)\*\+,;=:@\|/]+$~i', $linkhost))
{
$this->_searchsql .= " AND ".$this->_basetable.".linkhost ".(strpos($linkhost, '*') === FALSE ? " = '$linkhost'" : " LIKE '".str_replace('*', '%', preg_replace('~\*{2,}~i', '*', $linkhost))."'");
$this->_mult .= '&linkhost='.rawurlencode($linkhost);;
}
}
}
?> | mikeshou/pbdigg | include/search.class.php | PHP | gpl-3.0 | 12,688 |
using System;
namespace ForumSystem.Data.Models.BaseEntities
{
public interface IDeletableEntity
{
bool IsDeleted { get; set; }
DateTime? DeletedOn { get; set; }
}
}
| iwelina-popova/ForumSystem | Source/Data/ForumSystem.Data.Models/BaseEntities/IDeletableEntity.cs | C# | gpl-3.0 | 199 |
#ifndef HANOI_TOWER_SOLVER_H
#define HANOI_TOWER_SOLVER_H
#include <list>
#include <map>
#include "goap/iplanner.h"
#include "goap/istate.h"
#include "goap/iscopetimer.h"
#include "goap/ifunctionstatemeter.h"
#include "goap/iplanningstatecomparer.h"
#include "newptr.h"
#include "log_hook.h"
#include "goaplibrary.h"
namespace goap
{
using namespace std;
/**
* Plan Formulation
*
* A character generates a plan in real-time by supplying some goal to satisfy to a system
* called a planner. The planner searches the space of actions for a sequence that will take
* the character from his starting state to his goal state. This process is referred to as
* formulatinga plan. If the planner is successful, it returns a plan for the character to follow
* to direct his behavior. The character follows this plan to completion, invalidation, or until
* another goal becomes more relevant. If another goal activates, or the plan in-progress
* becomes invalid for any reason, the character aborts the current plan and formulates a
* new one.
*/
class hanoi_tower_solver
{
IPlanner::Ptr _planner;
IState::CPtr _initialState;
IState::CPtr _goalState;
int _n = 0;
list<IPlanningAction::CPtr> _plan;
IPlanningStateMeter::CPtr _planningStateMeter;
public:
hanoi_tower_solver() {
}
hanoi_tower_solver(const hanoi_tower_solver& other) :
_planner(other._planner),
_initialState(other._initialState),
_goalState(other._goalState),
_n(other._n),
_plan(other._plan),
_planningStateMeter(other._planningStateMeter) {
}
list<IPlanningAction::CPtr> makePlan(const IState::New& initial, const IState::New& goal, int n = 3) {
tower_plan(initial, goal, n);
return makePlan();
}
private:
void tower_plan(const IState::New& initial, const IState::New& goal, int n = 3) {
_n = n;
_initialState = NewPtr<IState>()->assign(initial);
_goalState = NewPtr<IState>()->assign(goal);
_planner = planning_actions(n);
}
IPlanner::Ptr planning_actions(int n = 3) {
list<IPlanningAction::CPtr> planningActions {
Goap::newPlanningAction("Move from A to B",
[=](IState::CPtr state) -> bool { return validate(state, "A", "B", n); },
[=](IState::Ptr state) -> void { move(state, "A", "B", n); }),
Goap::newPlanningAction("Move from A to C",
[=](IState::CPtr state) -> bool { return validate(state, "A", "C", n); },
[=](IState::Ptr state) -> void { move(state, "A", "C", n); }),
Goap::newPlanningAction("Move from B to A",
[=](IState::CPtr state) -> bool { return validate(state, "B", "A", n); },
[=](IState::Ptr state) -> void { move(state, "B", "A", n); }),
Goap::newPlanningAction("Move from B to C",
[=](IState::CPtr state) -> bool { return validate(state, "B", "C", n); },
[=](IState::Ptr state) -> void { move(state, "B", "C", n); }),
Goap::newPlanningAction("Move from C to A",
[=](IState::CPtr state) -> bool { return validate(state, "C", "A", n); },
[=](IState::Ptr state) -> void { move(state, "C", "A", n); }),
Goap::newPlanningAction("Move from C to B",
[=](IState::CPtr state) -> bool { return validate(state, "C", "B", n); },
[=](IState::Ptr state) -> void { move(state, "C", "B", n); })
};
IPlanner::Ptr planner = Goap::newPlanner(IPlanner::BreadthFirst, planningActions);
return planner;
}
list<IPlanningAction::CPtr> makePlan() {
IPlanningStateComparer::Ptr comparer = NewPtr<IPlanningStateComparer>(EXACTSTATEMETER_SINGLETON);
if (!_planningStateMeter || *_planningStateMeter->goalState() != *_goalState) {
auto functionStateMeter = Goap::newFunctionStateMeter(_goalState);
functionStateMeter->monotonic(true);
functionStateMeter->fnDistance([=](IState::CPtr state, IFunctionStateMeter::CPtr stateMeter) {
float distanceToGoal = 1;
distanceToGoal = stateMeter->exactStateMeter()->distance(state); // Distance to goal
int an = state->atRef(concatStringInt("A", _n));
if (an == _n) {
// A conditional suggestion: First remove all elements from the tower 'A'
float distance = comparer->distance(state, _initialState);
//float distance2 = numericalComparer->distance(state, _restHelper) * 0.8 + 0.2;
distance = 1.0f - distance / (2 * _n + 1.0f);
if (distanceToGoal > distance)
distanceToGoal = distance;
}
return distanceToGoal;
});
functionStateMeter->fnEnough([](IState::CPtr state, IFunctionStateMeter::CPtr stateMeter) -> bool {
return stateMeter->exactStateMeter()->enough(state);
});
_planningStateMeter = functionStateMeter;
}
auto scopeTimer = Goap::newScopeTime("makePlan: ", [](const char *szMessage, double time, const char *szUnits) {
LOG(DEBUG) << szMessage << " " << " actions, " << time << " " << szUnits;
});
list<IPlanningAction::CPtr> actionsArray;
_planner->makePlanCached(_initialState, _planningStateMeter, actionsArray);
LOG(DEBUG) << "Goal length=" << _goalState->size() << " deep, " << pow(2, _goalState->size() - 1) << " optimus, " << actionsArray.size() << " actions:\n " << actionsArray;
_plan = actionsArray;
IPlanningAction::planToOstream(cerr, actionsArray, _initialState);
return actionsArray;
}
// public function run2():void
// {
// var Plan:Vector.<IPlanningAction>;
// tower_plan( { {"A1", 1}, {"A2", 2}, {"A3", 3}, "C1":null, "C2":null, "C3":null }, { {"C1", 1}, {"C2", 2}, {"C3", 3} }, 3);
// plan = makePlan();
// tower_plan( { {"A1", 1}, {"A2", 2}, {"A3", 3}, {"A4", 4}, {"A5", 5}, {"A6", 6}, {"A7", 7}, {"A8", 8} }, { {"C1", 1}, {"C2", 2}, {"C3", 3}, {"C4", 4}, {"C5", 5}, {"C6", 6}, {"C7", 7}, {"C8", 8} }, 8);
// plan = makePlan();
// }
// A1 1 B1 | C1 |
// A2 2 B2 | C2 |
// A3 3 B3 | C3 |
// / \ / \ / \
public:
void run()
{
list<IPlanningAction::CPtr> plan;
plan = makePlan( { {"A1", 1}, {"A2", 2}, {"A3", 3} }, { {"C1", 1}, {"C2", 2}, {"C3", 3} }, 3);
plan = makePlan( { {"A1", 1}, {"A2", 2}, {"A3", 3}, {"A4", 4} }, { {"C1", 1}, {"C2", 2}, {"C3", 3}, {"C4", 4} }, 4);
plan = makePlan( { {"A1", 1}, {"A2", 2}, {"A3", 3}, {"A4", 4}, {"A5", 5} }, { {"C1", 1}, {"C2", 2}, {"C3", 3}, {"C4", 4}, {"C5", 5} }, 5);
plan = makePlan( { {"A1", 1}, {"A2", 2}, {"A3", 3}, {"A4", 4}, {"A5", 5}, {"A6", 6} }, { {"C1", 1}, {"C2", 2}, {"C3", 3}, {"C4", 4}, {"C5", 5}, {"C6", 6} }, 6);
plan = makePlan( { {"A1", 1}, {"A2", 2}, {"A3", 3}, {"A4", 4}, {"A5", 5}, {"A6", 6}, {"A7", 7} }, { {"C1", 1}, {"C2", 2}, {"C3", 3}, {"C4", 4}, {"C5", 5}, {"C6", 6}, {"C7", 7} }, 7);
plan = makePlan( { {"A1", 1}, {"A2", 2}, {"A3", 3}, {"A4", 4}, {"A5", 5}, {"A6", 6}, {"A7", 7}, {"A8", 8} }, { {"C1", 1}, {"C2", 2}, {"C3", 3}, {"C4", 4}, {"C5", 5}, {"C6", 6}, {"C7", 7}, {"C8", 8} }, 8);
plan = makePlan( { {"A3", 1}, {"A4", 2}, {"A5", 3}, {"A6", 4}, {"A7", 5}, {"B6", 6}, {"B7", 7} }, { {"C1", 1}, {"C2", 2}, {"C3", 3}, {"C4", 4}, {"C5", 5}, {"C6", 6}, {"C7", 7} }, 7);
}
list<IPlanningAction::CPtr> plan() const {
return _plan;
}
IState::CPtr initialState() const {
return _initialState;
}
//private var _stringBuffer:StringBuffer = new StringBuffer;
/**
* Test if an action is posible given a state
* Validates that the state can change in the way it is specified in the 'from' 'to' strnigs.
* @param n The max tower height.
*/
static bool validate(IState::CPtr state, const string &from, const string &to, int n = 3)
{
int i = 0;
IStateValue::CPtr val;
int onFromTop = 0;
for (i = 1; i <= n; ++i) {
val = state->at(concatStringInt(from, i));
if (val && !val->empty()) {
break;
}
}
if (!val || !val->isInt())
return false;
onFromTop = static_cast<int>(*val);
int onToTop = 0;
bool trigerTo = false;
val.reset();
for (i = 1; i <= n; ++i) {
val = state->at(concatStringInt(to, i));
if (val && !val->empty())
break;
}
if (val && val->isInt()) {
trigerTo = true;
onToTop = static_cast<int>(*val);
}
return !trigerTo || onToTop > onFromTop;
}
//private static var _strCache:Object = { };
/**
* Helper function to cache strings in the form: 'String' + 'int'
* This is a way of lowering pression from the GC.
* The integger must be a low number.
*/
static const string& concatStringInt(const string &str, int n)
{
static map<int, map<string, string>> mapStr;
auto &val = mapStr[n][str];
if (val.empty()) {
val = str + to_string(n);
}
return val;
}
// The 'executor' function
static void move(IState::Ptr state, const string &from, const string &to, int n = 3)
{
int i = 0;
IStateValue::CPtr val;
const string* a = nullptr;
for (i = 1; i <= n; ++i) {
const string& astr = concatStringInt(from, i);
val = state->at(astr);
if (val && !val->empty()) {
a = &astr;
break;
}
}
if (!a) {
throw runtime_error("Can't trig from '" + from + "' to '" + to + "'");
}
const string* b = nullptr;
bool trigerTo = false;
for (i = 1; i <= n; ++i) {
val = state->at(concatStringInt(to, i));
if (val && !val->empty()) {
if (i-- == 1) {
throw runtime_error("Can't put to '" + to + "'"); // Tower is full
} else {
b = &concatStringInt(to, i);
}
trigerTo = true;
break;
}
}
if (!trigerTo) {
b = &concatStringInt(to, n);
}
// Update the source state
state->put(*b, state->at(*a));
state->remove(*a);
}
};
}
#endif // HANOI_TOWER_SOLVER_H
| dvdjg/GoapCpp | GoapMain/Tests/GoapTest/hanoi_tower_solver.h | C | gpl-3.0 | 10,998 |
<?php
/**
* Nombre del archivo: RegionSicaController.php
* Descripción:Contiene las funciones del controlador
* Fecha de creación:18/11/2017
* Creado por: Juan Carlos Centeno Borja
*/
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\region_sica;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class RegionSicaController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function fnc_obtener_id($param){
$id_region_sica=0;
$obj_region_sica= region_sica::all();
foreach ($obj_region_sica as $paises){
if($paises->nombre_pais==$param){
$id_region_sica=$paises->id_region_sica;
}
}
return $id_region_sica;
}
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
| jcenteno1973/sicafam | app/Http/Controllers/RegionSicaController.php | PHP | gpl-3.0 | 2,136 |
/*
* Copyright (C) 2013 Huub de Beer
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
var model = function(name, config) {
"use strict";
var _model = {name: name},
_appendix = {};
// ## Data invariant and initialization
//
// This model describes a dynamic phenomenon in terms of changing
// quantities over time.
//
//
// This description starts at `T_START` milliseconds
// (ms), defaulting to 0 ms and ends at `T_END` ms. If no end is specified
// it is assumed that the phenomenon does not end or is still ongoing in
// the real world (RW). The phenomenon's change is tracked by "measuring"
// the changing quantities at consecutive moments in time. These moments
// are `T_STEP` apart, defaulting to 1 ms, and are tracked by order
// number.
var T_START = config.time.start || 0,
T_END = config.time.end || Infinity,
T_STEP = config.time.step || 1;
function set_end(seconds) {
T_END = seconds*1000;
}
_model.set_end = set_end;
// To translate from a moment's order number to its corresponding time in
// ms and vice versa, two helper functions are defined, `time_to_moment`
// and `moment_to_time`, as well as a shorthand name for these two helper
// functions, respectively, `t2m` and `m2t`.
_model.time_to_moment = function(time) {
return Math.floor(time / T_STEP);
};
var t2m = _model.time_to_moment;
_model.moment_to_time = function(moment) {
return moment * T_STEP;
};
var m2t = _model.moment_to_time;
// When I use "measured" I mean to denote that the values of the
// quantities describing the phenomenon have been captured, computed,
// downloaded, measured, or otherwise obtained. This `model` function is
// intended to be applicable for describing purely theoretical models of a
// phenomenon as well as real-time measurements of a phenomenon.
//
// "Measuring" a moment is left to the `measure_moment` function. Each
// model has to (re)implement this function to specify the relationship
// between the phenomenon's quantities of interest at each moment during
// the phenomenon.
_model.measure_moment = function(moment) {
// to be implemented in an object implementing model
};
// The model has the following data invariant:
//
// (∀m: 0 ≤ m ≤ |`moments`|: `moment_computed`(`moments`[m]))
//
// stating that the phenomenon has been described quantitatively for all
// moments. These "measurements" are stored in a list of `moments` and can
// be accessed through a moment's order number.
var moments = [];
_model.get_moment = function(moment) {
return moments[moment];
};
_model.number_of_moments = function() {
return moments.length;
};
// A moment can only be inspected if it already has been "measured".
// Following the data invariant, a moment has been measured when its order
// number is smaller or equal to the number of measured moments.
_model.moment_measured = function(moment) {
return (moment <= (moments.length - 1));
};
// Furthermore, the current moment of interest, or `now`, points to an
// already "measured" moment during the phenomenon's duration. Hence, the
// data invariant is extended as follows:
//
// `t2m`(`T_START`) ≤ `now` ≤ `t2m`(`T_END`) → `moment_computed`(`now`)
var now;
// To ensure this data invariant, `now` is set to a moment before the
// phenomenon started.
now = t2m(T_START) - 1;
// ## Inspecting and running a model
// Inspection through registerd views
var views = [];
var update_views = function() {
var update_view = function(view) {
view.update(_model.name);
};
views.forEach(update_view);
};
_model.update_views = update_views;
var update_all_views = function() {
var update_view = function(view) {
if (view.update_all) {
view.update_all();
} else {
view.update(_model.name);
}
};
views.forEach(update_view);
};
_model.update_all_views = update_all_views;
_model.register = function(view) {
var view_found = views.indexOf(view);
if (view_found === -1) {
views.push(view);
views.forEach(function(v) { if(v.update_all) v.update_all();});
}
};
_model.get_views_of_type = function(view_type) {
return views.filter(function(v) {
return v.type === view_type;
});
};
_model.unregister = function(view) {
if (arguments.length === 0) {
var unregister = function(view) {
view.unregister(_model.name);
};
views.forEach(unregister);
} else {
var view_found = views.indexOf(view);
if (view_found !== -1) {
views.slice(view_found, 1);
}
}
};
// As a model can be inspected repeatedly, as is one
// of the reasons to model a phenomenon using a computer, we introduce a
// `reset` function to resets `now` to a moment before the phenomenon
// started.
_model.reset = function() {
now = t2m(T_START) - 1;
_model.step();
update_views();
};
// Once a model has been started, the current moment will be measured as
// well as all moments before since the start. These moments can be
// inspected.
//
_model.has_started = function() {
return now >= 0;
};
// The `step` function will advance `now` to the next moment if the end of
// the phenomenon has not been reached yet. If that moment has not been
// "measured" earlier, "measure" it now.
_model.step = function(do_not_update_views) {
if (m2t(now) + T_STEP <= T_END) {
now++;
if (!_model.moment_measured(now)) {
var moment = _model.measure_moment(now);
moment._time_ = m2t(now);
moments.push(moment);
}
}
if (!do_not_update_views) {
update_views();
}
return now;
};
// If the phenomenon is a finite process or the "measuring" process cannot
// go further `T_END` will have a value that is not `Infinity`.
_model.can_finish = function() {
return Math.abs(T_END) !== Infinity;
};
// To inspect the whole phenomenon at once or inspect the last moment,
// `finish`ing the model will ensure that all moments during the
// phenomenon have been "measured".
_model.finish = function() {
var DO_NOT_UPDATE_VIEWS = true;
if (_model.can_finish()) {
while ((moments.length - 1) < t2m(T_END)) {
_model.step(DO_NOT_UPDATE_VIEWS);
}
}
now = moments.length - 1;
_model.update_views();
return now;
};
// We call the model finished if the current moment, or `now`, is the
// phenomenon's last moment.
_model.is_finished = function() {
return _model.can_finish() && m2t(now) >= T_END;
};
function reset_model() {
moments = [];
_model.action("reset").callback(_model)();
// _model.reset();
}
_model.reset_model = reset_model;
/**
* ## Actions on the model
*
*/
_model.actions = {};
_model.add_action = function( action ) {
_model.actions[action.name] = action;
_model.actions[action.name].install = function() {
return action.callback(_model);
};
};
if (config.actions) {
var add_action = function(action_name) {
_model.add_action(config.actions[action_name]);
};
Object.keys(config.actions).forEach(add_action);
}
_model.action = function( action_name ) {
if (_model.actions[action_name]) {
return _model.actions[action_name];
}
};
_model.remove_action = function( action ) {
if (_model.actions[action.name]) {
delete _model.actions[action.name];
}
};
_model.disable_action = function( action_name ) {
if (_model.actions[action_name]) {
_model.actions[action_name].enabled = false;
}
};
_model.enable_action = function( action_name ) {
if (_model.actions[action_name]) {
_model.actions[action_name].enabled = true;
}
};
_model.toggle_action = function( action_name ) {
if (_model.actions[action_name]) {
_model.actions[action_name].enabled =
!_model.action[action_name].enabled;
}
};
// ## Coordinating quantities
//
// All quantities that describe the phenomenon being modeled change in
// coordination with time's change. Add the model's time as a quantity to
// the list with quantities. To allow people to model time as part of
// their model, for example to describe the phenomenon accelerated, the
// internal time is added as quantity `_time_` and, as a result, "_time_"
// is not allowed as a quantity name.
_model.quantities = config.quantities || {};
_model.quantities._time_ = {
hidden: true,
minimum: T_START,
maximum: T_END,
value: m2t(now),
stepsize: T_STEP,
unit: "ms",
label: "internal time",
monotone: true
};
_model.get_minimum = function(quantity) {
if (arguments.length===0) {
// called without any arguments: return all minima
var minima = {},
add_minimum = function(quantity) {
minima[quantity] = parseFloat(_model.quantities[quantity].minimum);
};
Object.keys(_model.quantities).forEach(add_minimum);
return minima;
} else {
// return quantity's minimum
return parseFloat(_model.quantities[quantity].minimum);
}
};
_model.get_maximum = function(quantity) {
if (arguments.length===0) {
// called without any arguments: return all minima
var maxima = {},
add_maximum = function(quantity) {
maxima[quantity] = parseFloat(_model.quantities[quantity].maximum);
};
Object.keys(_model.quantities).forEach(add_maximum);
return maxima;
} else {
// return quantity's minimum
return parseFloat(_model.quantities[quantity].maximum);
}
};
_model.find_moment = function(quantity, value, EPSILON) {
if (moments.length === 0) {
// no moment are measured yet, so there is nothing to be found
return -1;
} else {
var val = _appendix.quantity_value(quantity);
// pre: quantity is monotone
// determine if it is increasing or decreasing
// determine type of monotone
//
// As the first moment has been measured and we do know the
// minimum of this quantity, type of monotone follows.
var start = val(0),
INCREASING = (start !== _model.get_maximum(quantity));
// Use a stupid linear search to find the moment that approaches the
// value best
var m = 0,
n = moments.length - 1,
lowerbound,
upperbound;
if (INCREASING) {
lowerbound = function(moment) {
return val(moment) < value;
};
upperbound = function(moment) {
return val(moment) > value;
};
} else {
lowerbound = function(moment) {
return val(moment) > value;
};
upperbound = function(moment) {
return val(moment) < value;
};
}
// Increasing "function", meaning
//
// (∀m: 0 ≤ m < |`moments`|: `val`(m) <= `val`(m+1))
//
// Therefore,
//
// (∃m, n: 0 ≤ m < n ≤ |`moments`|:
// `val`(m) ≤ value ≤ `val`(n) ⋀
// (∀p: m < p < n: `val`(p) = value))
//
// `find_moment` finds those moments m and n and returns the
// one closest to value or, when even close, the last moment
// decreasing is reverse.
while (lowerbound(m)) {
m++;
if (m>n) {
//
return -1;
}
}
return m;
//m--;
/*
while (upperbound(n)) {
n--;
if (n<m) {
return -1;
}
}
//n++;
return (Math.abs(val(n)-value) < Math.abs(val(m)-value))?n:m;
*/
}
};
_model.get = function(quantity) {
if (now < 0) {
return undefined;
} else {
return moments[now][quantity];
}
};
_model.set = function(quantity, value) {
var q = _model.quantities[quantity];
if (value < parseFloat(q.minimum)) {
value = parseFloat(q.minimum);
} else if (value > parseFloat(q.maximum)) {
value = parseFloat(q.maximum);
}
// q.minimum ≤ value ≤ q.maximum
// has value already been "measured"?
// As some quantities can have the same value more often, there are
// potentially many moments that fit the bill. There can be an unknown
// amount of moments that aren't measured as well.
//
// However, some quantities will be strictly increasing or decreasing
// and no value will appear twice. For example, the internal time will
// only increase. Those quantities with property `monotone`
// `true`, only one value will be searched for
var approx = _appendix.approximates(),
moment = -1;
if (q.monotone) {
moment = _model.find_moment(quantity, value);
if (moment === -1) {
// not yet "measured"
var DO_NOT_UPDATE_VIEWS = true;
_model.step(DO_NOT_UPDATE_VIEWS);
// THIS DOES WORK ONLY FOR INCREASING QUANTITIES. CHANGE THIS
// ALTER WITH FIND FUNCTION !!!!
while((moments[now][quantity] < value) && !_model.is_finished()) {
_model.step(DO_NOT_UPDATE_VIEWS);
}
} else {
now = moment;
}
update_views();
return moments[now];
}
};
_model.data = function() {
return moments.slice(0, now + 1);
};
_model.current_moment = function(moment_only) {
if (moment_only) {
return now;
} else {
return moments[now];
}
};
_model.graphs_shown = {
tailpoints: false,
line: false,
arrows: false
};
_model.show_graph = function(kind) {
var graphs = _model.get_views_of_type("graph");
function show_this_graph(g) {
switch(kind) {
case "line":
g.show_line(_model.name);
break;
case "tailpoints":
g.show_tailpoints(_model.name);
break;
case "arrows":
g.show_arrows(_model.name);
break;
}
}
graphs.forEach(show_this_graph);
_model.graphs_shown[kind] = true;
};
_model.hide_graph = function(kind) {
var graphs = _model.get_views_of_type("graph");
function hide_this_graph(g) {
switch(kind) {
case "line":
g.hide_line(_model.name);
break;
case "tailpoints":
g.hide_tailpoints(_model.name);
break;
case "arrows":
g.hide_arrows(_model.name);
break;
}
}
graphs.forEach(hide_this_graph);
_model.graphs_shown[kind] = false;
};
_model.graph_is_shown = function(kind) {
return _model.graphs_shown[kind];
};
// ## _appendix H: helper functions
_appendix.approximates = function(epsilon) {
var EPSILON = epsilon || 0.001,
fn = function(a, b) {
return Math.abs(a - b) <= EPSILON;
};
fn.EPSILON = EPSILON;
return fn;
};
_appendix.quantity_value = function(quantity) {
return function(moment) {
return moments[moment][quantity];
};
};
var step = (config.step_size || T_STEP)*5 ;
function step_size(size) {
if (arguments.length === 1) {
step = size;
}
return step;
}
_model.step_size = step_size;
function random_color() {
var hexes = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'],
colors = [],
i = 0;
while (i < 6) {
colors.push(hexes[Math.round(Math.random()*(hexes.length - 1))]);
i++;
}
return "#"+ colors.join("");
}
var color = random_color();
_model.color = function(c) {
if (arguments.length === 1) {
if (c === "random") {
color = random_color();
} else {
color = c;
}
}
return color;
};
return _model;
};
module.exports = model;
| htdebeer/PhD-DE3 | src/models/model.js | JavaScript | gpl-3.0 | 19,172 |
/////////////////////////////////////////////////////////////////////////////
// C# Version Copyright (c) 2003 CenterSpace Software, LLC //
// //
// This code is free software under the Artistic license. //
// //
// CenterSpace Software //
// 2098 NW Myrtlewood Way //
// Corvallis, Oregon, 97330 //
// USA //
// http://www.centerspace.net //
/////////////////////////////////////////////////////////////////////////////
/*
A C-program for MT19937, with initialization improved 2002/1/26.
Coded by Takuji Nishimura and Makoto Matsumoto.
Before using, initialize the state by using init_genrand(seed)
or init_by_array(init_key, key_length).
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of its contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Any feedback is very welcome.
http://www.math.keio.ac.jp/matumoto/emt.html
email: [email protected]
*/
using System;
namespace CenterSpace.Free
{
/// <summary>
/// Class MersenneTwister generates random numbers from a uniform distribution using
/// the Mersenne Twister algorithm.
/// </summary>
/// <remarks>Caution: MT is for MonteCarlo, and is NOT SECURE for CRYPTOGRAPHY
/// as it is.</remarks>
public class MersenneTwister
{
#region Constants -------------------------------------------------------
// Period parameters.
private const int N = 624;
private const int M = 397;
private const uint MATRIX_A = 0x9908b0dfU; // constant vector a
private const uint UPPER_MASK = 0x80000000U; // most significant w-r bits
private const uint LOWER_MASK = 0x7fffffffU; // least significant r bits
private const int MAX_RAND_INT = 0x7fffffff;
#endregion Constants
#region Instance Variables ----------------------------------------------
// mag01[x] = x * MATRIX_A for x=0,1
private uint[] mag01 = {0x0U, MATRIX_A};
// the array for the state vector
private uint[] mt = new uint[N];
// mti==N+1 means mt[N] is not initialized
private int mti = N+1;
#endregion Instance Variables
#region Constructors ----------------------------------------------------
/// <summary>
/// Creates a random number generator using the time of day in milliseconds as
/// the seed.
/// </summary>
public MersenneTwister()
{
init_genrand( (uint)DateTime.Now.Millisecond );
}
/// <summary>
/// Creates a random number generator initialized with the given seed.
/// </summary>
/// <param name="seed">The seed.</param>
public MersenneTwister( int seed )
{
init_genrand( (uint)seed );
}
/// <summary>
/// Creates a random number generator initialized with the given array.
/// </summary>
/// <param name="init">The array for initializing keys.</param>
public MersenneTwister( int[] init )
{
uint[] initArray = new uint[init.Length];
for ( int i = 0; i < init.Length; ++i )
initArray[i] = (uint)init[i];
init_by_array( initArray, (uint)initArray.Length );
}
#endregion Constructors
#region Properties ------------------------------------------------------
/// <summary>
/// Gets the maximum random integer value. All random integers generated
/// by instances of this class are less than or equal to this value. This
/// value is <c>0x7fffffff</c> (<c>2,147,483,647</c>).
/// </summary>
public static int MaxRandomInt
{
get
{
return 0x7fffffff;
}
}
#endregion Properties
#region Member Functions ------------------------------------------------
/// <summary>
/// Returns a random integer greater than or equal to zero and
/// less than or equal to <c>MaxRandomInt</c>.
/// </summary>
/// <returns>The next random integer.</returns>
public int Next()
{
return genrand_int31();
}
/// <summary>
/// Returns a positive random integer less than the specified maximum.
/// </summary>
/// <param name="maxValue">The maximum value. Must be greater than zero.</param>
/// <returns>A positive random integer less than or equal to <c>maxValue</c>.</returns>
public int Next( int maxValue )
{
return Next( 0, maxValue );
}
/// <summary>
/// Returns a random integer within the specified range.
/// </summary>
/// <param name="minValue">The lower bound.</param>
/// <param name="maxValue">The upper bound.</param>
/// <returns>A random integer greater than or equal to <c>minValue</c>, and less than
/// or equal to <c>maxValue</c>.</returns>
public int Next( int minValue, int maxValue )
{
if ( minValue > maxValue )
{
int tmp = maxValue;
maxValue = minValue;
minValue = tmp;
}
return (int)( Math.Floor((maxValue-minValue+1)*genrand_real1() + minValue) );
}
/// <summary>
/// Returns a random number between 0.0 and 1.0.
/// </summary>
/// <returns>A single-precision floating point number greater than or equal to 0.0,
/// and less than 1.0.</returns>
public float NextFloat()
{
return (float) genrand_real2();
}
/// <summary>
/// Returns a random number greater than or equal to zero, and either strictly
/// less than one, or less than or equal to one, depending on the value of the
/// given boolean parameter.
/// </summary>
/// <param name="includeOne">
/// If <c>true</c>, the random number returned will be
/// less than or equal to one; otherwise, the random number returned will
/// be strictly less than one.
/// </param>
/// <returns>
/// If <c>includeOne</c> is <c>true</c>, this method returns a
/// single-precision random number greater than or equal to zero, and less
/// than or equal to one. If <c>includeOne</c> is <c>false</c>, this method
/// returns a single-precision random number greater than or equal to zero and
/// strictly less than one.
/// </returns>
public float NextFloat( bool includeOne )
{
if ( includeOne )
{
return (float) genrand_real1();
}
return (float) genrand_real2();
}
/// <summary>
/// Returns a random number greater than 0.0 and less than 1.0.
/// </summary>
/// <returns>A random number greater than 0.0 and less than 1.0.</returns>
public float NextFloatPositive()
{
return (float) genrand_real3();
}
/// <summary>
/// Returns a random number between 0.0 and 1.0.
/// </summary>
/// <returns>A double-precision floating point number greater than or equal to 0.0,
/// and less than 1.0.</returns>
public double NextDouble()
{
return genrand_real2();
}
/// <summary>
/// Returns a random number greater than or equal to zero, and either strictly
/// less than one, or less than or equal to one, depending on the value of the
/// given boolean parameter.
/// </summary>
/// <param name="includeOne">
/// If <c>true</c>, the random number returned will be
/// less than or equal to one; otherwise, the random number returned will
/// be strictly less than one.
/// </param>
/// <returns>
/// If <c>includeOne</c> is <c>true</c>, this method returns a
/// single-precision random number greater than or equal to zero, and less
/// than or equal to one. If <c>includeOne</c> is <c>false</c>, this method
/// returns a single-precision random number greater than or equal to zero and
/// strictly less than one.
/// </returns>
public double NextDouble( bool includeOne )
{
if ( includeOne )
{
return genrand_real1();
}
return genrand_real2();
}
/// <summary>
/// Returns a random number greater than 0.0 and less than 1.0.
/// </summary>
/// <returns>A random number greater than 0.0 and less than 1.0.</returns>
public double NextDoublePositive()
{
return genrand_real3();
}
/// <summary>
/// Generates a random number on <c>[0,1)</c> with 53-bit resolution.
/// </summary>
/// <returns>A random number on <c>[0,1)</c> with 53-bit resolution</returns>
public double Next53BitRes()
{
return genrand_res53();
}
/// <summary>
/// Reinitializes the random number generator using the time of day in
/// milliseconds as the seed.
/// </summary>
public void Initialize()
{
init_genrand( (uint)DateTime.Now.Millisecond );
}
/// <summary>
/// Reinitializes the random number generator with the given seed.
/// </summary>
/// <param name="seed">The seed.</param>
public void Initialize( int seed )
{
init_genrand( (uint)seed );
}
/// <summary>
/// Reinitializes the random number generator with the given array.
/// </summary>
/// <param name="init">The array for initializing keys.</param>
public void Initialize( int[] init )
{
uint[] initArray = new uint[init.Length];
for ( int i = 0; i < init.Length; ++i )
initArray[i] = (uint)init[i];
init_by_array( initArray, (uint)initArray.Length );
}
#region Methods ported from C -------------------------------------------
// initializes mt[N] with a seed
private void init_genrand( uint s)
{
mt[0]= s & 0xffffffffU;
for (mti=1; mti<N; mti++)
{
mt[mti] =
(uint)(1812433253U * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
// See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier.
// In the previous versions, MSBs of the seed affect
// only MSBs of the array mt[].
// 2002/01/09 modified by Makoto Matsumoto
mt[mti] &= 0xffffffffU;
// for >32 bit machines
}
}
// initialize by an array with array-length
// init_key is the array for initializing keys
// key_length is its length
private void init_by_array(uint[] init_key, uint key_length)
{
int i, j, k;
init_genrand(19650218U);
i=1; j=0;
k = (int)(N>key_length ? N : key_length);
for (; k>0; k--)
{
mt[i] = (uint)((uint)(mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525U)) + init_key[j] + j); /* non linear */
mt[i] &= 0xffffffffU; // for WORDSIZE > 32 machines
i++; j++;
if (i>=N) { mt[0] = mt[N-1]; i=1; }
if (j>=key_length) j=0;
}
for (k=N-1; k>0; k--)
{
mt[i] = (uint)((uint)(mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941U))- i); /* non linear */
mt[i] &= 0xffffffffU; // for WORDSIZE > 32 machines
i++;
if (i>=N) { mt[0] = mt[N-1]; i=1; }
}
mt[0] = 0x80000000U; // MSB is 1; assuring non-zero initial array
}
// generates a random number on [0,0xffffffff]-interval
uint genrand_int32()
{
uint y;
if (mti >= N)
{ /* generate N words at one time */
int kk;
if (mti == N+1) /* if init_genrand() has not been called, */
init_genrand(5489U); /* a default initial seed is used */
for (kk=0;kk<N-M;kk++)
{
y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1U];
}
for (;kk<N-1;kk++)
{
y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1U];
}
y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1U];
mti = 0;
}
y = mt[mti++];
// Tempering
y ^= (y >> 11);
y ^= (y << 7) & 0x9d2c5680U;
y ^= (y << 15) & 0xefc60000U;
y ^= (y >> 18);
return y;
}
// generates a random number on [0,0x7fffffff]-interval
private int genrand_int31()
{
return (int)(genrand_int32()>>1);
}
// generates a random number on [0,1]-real-interval
double genrand_real1()
{
return genrand_int32()*(1.0/4294967295.0);
// divided by 2^32-1
}
// generates a random number on [0,1)-real-interval
double genrand_real2()
{
return genrand_int32()*(1.0/4294967296.0);
// divided by 2^32
}
// generates a random number on (0,1)-real-interval
double genrand_real3()
{
return (((double)genrand_int32()) + 0.5)*(1.0/4294967296.0);
// divided by 2^32
}
// generates a random number on [0,1) with 53-bit resolution
double genrand_res53()
{
uint a=genrand_int32()>>5, b=genrand_int32()>>6;
return(a*67108864.0+b)*(1.0/9007199254740992.0);
}
// These real versions are due to Isaku Wada, 2002/01/09 added
#endregion Methods ported from C
#endregion Member Functions
}
}
| bashrc/sentience | sentcore/MersenneTwister.cs | C# | gpl-3.0 | 15,228 |
package main
import (
"net/http"
"os"
"path"
"strings"
"github.com/zenazn/goji/web"
)
func fileServeHandler(c web.C, w http.ResponseWriter, r *http.Request) {
fileName := c.URLParams["name"]
filePath := path.Join(Config.filesDir, fileName)
if !fileExistsAndNotExpired(fileName) {
notFoundHandler(c, w, r)
return
}
if !Config.allowHotlink {
referer := r.Header.Get("Referer")
if referer != "" && !strings.HasPrefix(referer, Config.siteURL) {
w.WriteHeader(403)
return
}
}
w.Header().Set("Content-Security-Policy", Config.fileContentSecurityPolicy)
http.ServeFile(w, r, filePath)
}
func staticHandler(c web.C, w http.ResponseWriter, r *http.Request) {
path := r.URL.Path
if path[len(path)-1:] == "/" {
notFoundHandler(c, w, r)
return
} else {
if path == "/favicon.ico" {
path = "/static/images/favicon.gif"
}
filePath := strings.TrimPrefix(path, "/static/")
file, err := staticBox.Open(filePath)
if err != nil {
notFoundHandler(c, w, r)
return
}
w.Header().Set("Etag", timeStartedStr)
w.Header().Set("Cache-Control", "max-age=86400")
http.ServeContent(w, r, filePath, timeStarted, file)
return
}
}
func fileExistsAndNotExpired(filename string) bool {
filePath := path.Join(Config.filesDir, filename)
_, err := os.Stat(filePath)
if err != nil {
return false
}
if isFileExpired(filename) {
os.Remove(path.Join(Config.filesDir, filename))
os.Remove(path.Join(Config.metaDir, filename))
return false
}
return true
}
| matthazinski/linx-server | fileserve.go | GO | gpl-3.0 | 1,505 |
/******************************************************************************
*******************************************************************************
*******************************************************************************
libferris
Copyright (C) 2001 Ben Martin
libferris 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.
libferris 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 libferris. If not, see <http://www.gnu.org/licenses/>.
For more details see the COPYING file in the root directory of this
distribution.
$Id: libferrispostgresqlshared.cpp,v 1.2 2006/12/07 06:49:42 ben Exp $
*******************************************************************************
*******************************************************************************
******************************************************************************/
#include "config.h"
#include "libferrisgoogle_shared.hh"
#include <Ferris/Configuration_private.hh>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include <QBuffer>
#include <Ferris/FerrisQt_private.hh>
#include <Ferris/FerrisKDE.hh>
#include <Ferris/FerrisDOM.hh>
#include <Ferris/FerrisBoost.hh>
#include <Ferris/Iterator.hh>
#include <Ferris/FerrisKDE.hh>
#include <qjson/parser.h>
#define DEBUG LG_GOOGLE_D
namespace Ferris
{
using namespace XML;
using namespace std;
static const string DBNAME = FDB_SECURE;
string prettyprintxml( const std::string& s )
{
try
{
fh_domdoc dom = Factory::StringToDOM( s );
fh_stringstream ss = tostream( dom );
return ss.str();
}
catch( exception& e )
{
return s;
}
}
FERRISEXP_EXPORT userpass_t getGoogleUserPass(
const std::string& server )
{
string user;
string pass;
string Key = ""; // server;
{
stringstream ss;
ss << "google" << Key << "-username";
user = getConfigString( DBNAME, tostr(ss), "" );
}
{
stringstream ss;
ss << "google" << Key << "-password";
pass = getConfigString( DBNAME, tostr(ss), "" );
}
return make_pair( user, pass );
}
FERRISEXP_EXPORT void setGoogleUserPass(
const std::string& server,
const std::string& user, const std::string& pass )
{
string Key = ""; // server;
{
stringstream ss;
ss << "google" << Key << "-username";
setConfigString( DBNAME, tostr(ss), user );
}
{
stringstream ss;
ss << "google" << Key << "-password";
setConfigString( DBNAME, tostr(ss), pass );
}
}
FERRISEXP_EXPORT std::string
columnNumberToName( int col )
{
stringstream ss;
int aval = 'a';
--aval;
ss << (char)(aval + col);
string v = ss.str();
return v;
}
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/
// GoogleClientResponseWaiter::GoogleClientResponseWaiter()
// {
// m_loop = g_main_loop_new( 0, 0 );
// }
// void
// GoogleClientResponseWaiter::block()
// {
// LG_GOOGLE_D << "GoogleClientResponseWaiter::block(top)" << endl;
// g_main_loop_run( m_loop );
// LG_GOOGLE_D << "GoogleClientResponseWaiter::block(done)" << endl;
// }
// void
// GoogleClientResponseWaiter::unblock()
// {
// g_main_loop_quit( m_loop );
// }
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/
GoogleClient::GoogleClient()
:
m_qmanager( 0 )
{
}
QNetworkAccessManager*
GoogleClient::getQManager()
{
return ::Ferris::getQManager();
// return new QNetworkAccessManager(0);
// if( !m_qmanager )
// {
// m_qmanager = new QNetworkAccessManager(0);
// }
// return m_qmanager;
}
void
GoogleClient::addAuth( QNetworkRequest& r, const std::string& service )
{
if( m_authTokens[ service ].empty() )
Authenticate_ClientLogin( service );
DEBUG << "Auth token service:" << service << " token:" << m_authTokens[service] << endl;
r.setRawHeader("Authorization", m_authTokens[service].c_str() );
}
void
GoogleClient::dumpReplyToConsole(QNetworkReply* reply )
{
m_waiter.unblock( reply );
cerr << "GoogleClient::dumpReplyToConsole()" << endl;
cerr << "error:" << reply->error() << endl;
cerr << "earl:" << tostr(reply->url().toString()) << endl;
QByteArray ba = reply->readAll();
cerr << "ba.sz:" << ba.size() << endl;
cerr << "ba:" << (string)ba << endl;
cerr << "-------------" << endl;
}
void
GoogleClient::dumpReplyToConsole()
{
QNetworkReply* reply = (QNetworkReply*)sender();
m_waiter.unblock( reply );
cerr << "GoogleClient::dumpReplyToConsole()" << endl;
cerr << "error:" << reply->error() << endl;
cerr << "earl:" << tostr(reply->url().toString()) << endl;
QByteArray ba = reply->readAll();
cerr << "ba.sz:" << ba.size() << endl;
cerr << "ba:" << (string)ba << endl;
cerr << "-------------" << endl;
}
std::string responseToAuthToken( const std::string& data )
{
string ret;
stringstream ss;
ss << data;
string s;
while( getline(ss,s) )
{
// LG_GOOGLE_D << "s:" << s << endl;
if( starts_with( s, "Auth=" ))
{
ret = "GoogleLogin " + s;
ret = Util::replace_all( ret, "Auth=", "auth=" );
}
}
return ret;
}
void
GoogleClient::replyFinished(QNetworkReply* reply )
{
m_waiter.unblock( reply );
LG_GOOGLE_D << "-------------" << endl;
LG_GOOGLE_D << "GoogleClient::replyFinished(3)" << endl;
// m_authToken = responseToAuthToken( (string)reply->readAll() );
// stringstream ss;
// ss << reply->readAll().data();
// string s;
// while( getline(ss,s) )
// {
// // LG_GOOGLE_D << "s:" << s << endl;
// if( starts_with( s, "Auth=" ))
// {
// m_authToken = "GoogleLogin " + s;
// }
// }
// listSheets();
}
void
GoogleClient::handleFinished()
{
QNetworkReply* r = dynamic_cast<QNetworkReply*>(sender());
m_waiter.unblock(r);
LG_GOOGLE_D << "GoogleClient::handleFinished()" << endl;
}
void
GoogleClient::handleFinished( QNetworkReply* r )
{
m_waiter.unblock(r);
LG_GOOGLE_D << "GoogleClient::handleFinished(QNR)" << endl;
}
void
GoogleClient::localtest()
{
QNetworkAccessManager* qm = getQManager();
QNetworkRequest request;
request.setUrl(QUrl("http://alkid"));
request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
cerr << "getting reply..." << endl;
connect( qm, SIGNAL(finished(QNetworkReply*)), SLOT(dumpReplyToConsole(QNetworkReply*)));
QNetworkReply *reply = qm->get(request);
QUrl postdata("https://www.google.com/accounts/ClientLogin");
postdata.addQueryItem("accountType", "HOSTED_OR_GOOGLE");
// connect( reply, SIGNAL( finished() ), SLOT( dumpReplyToConsole() ) );
m_waiter.block(reply);
}
void
GoogleClient::Authenticate_ClientLogin( const std::string& service )
{
userpass_t up = getGoogleUserPass();
std::string username = up.first;
std::string password = up.second;
QNetworkAccessManager* qm = getQManager();
QNetworkRequest request;
QUrl postdata("https://www.google.com/accounts/ClientLogin");
postdata.addQueryItem("accountType", "HOSTED_OR_GOOGLE");
postdata.addQueryItem("Email", username.c_str() );
postdata.addQueryItem("Passwd", password.c_str() );
postdata.addQueryItem("service", service.c_str() );
postdata.addQueryItem("source", "libferris" FERRIS_VERSION);
request.setUrl(postdata);
connect( qm, SIGNAL(finished(QNetworkReply*)), SLOT(handleFinished(QNetworkReply*)));
LG_GOOGLE_D << "postdata.toEncoded():" << tostr(QString(postdata.toEncoded())) << endl;
LG_GOOGLE_D << "getting reply...2" << endl;
QByteArray empty;
QNetworkReply *reply = qm->post( request, empty );
m_waiter.block(reply);
string token = responseToAuthToken( (string)reply->readAll() );
LG_GOOGLE_D << "service:" << service << " token:" << token << endl;
m_authTokens[service] = token;
}
QNetworkReply*
GoogleClient::get( QNetworkRequest req )
{
QNetworkAccessManager* qm = getQManager();
QNetworkReply* reply = qm->get( req );
connect( reply, SIGNAL( finished() ), SLOT( handleFinished() ) );
m_waiter.block(reply);
return reply;
}
QNetworkReply*
GoogleClient::put( QNetworkRequest req, QByteArray& ba )
{
QNetworkAccessManager* qm = getQManager();
QNetworkReply* reply = qm->put( req, ba );
connect( reply, SIGNAL( finished() ), SLOT( handleFinished() ) );
m_waiter.block(reply);
return reply;
}
QNetworkReply*
GoogleClient::put( QNetworkRequest req, const std::string& data )
{
QByteArray ba( data.data(), data.size() );
return put( req, ba );
}
QNetworkReply*
GoogleClient::post( QNetworkRequest req, const std::string& data )
{
QNetworkAccessManager* qm = getQManager();
QNetworkReply* reply = qm->post( req, data.c_str() );
connect( reply, SIGNAL( finished() ), SLOT( handleFinished() ) );
m_waiter.block(reply);
return reply;
}
QNetworkRequest
GoogleClient::createRequest( QUrl& u, const std::string& service, const std::string& gversion )
{
QNetworkRequest req;
addAuth( req, service );
if( !gversion.empty() )
req.setRawHeader("GData-Version", gversion.c_str() );
req.setUrl(u);
return req;
}
std::string
GoogleClient::getYoutubeDevKey()
{
return getStrSubCtx( "~/.ferris/youtube-dev-key.txt", "" );
}
FERRISEXP_API std::list< DOMElement* >
getAllChildrenElementsWithAttribute( DOMNode* node,
const std::string& name,
const std::string& attr,
const std::string& value,
bool recurse = true );
FERRISEXP_API DOMElement*
getFirstChildElementsWithAttribute( DOMNode* node,
const std::string& name,
const std::string& attrname,
const std::string& value,
bool recurse = true );
FERRISEXP_API std::list< DOMElement* >
getAllChildrenElementsWithAttribute( DOMNode* node,
const std::string& name,
const std::string& attrname,
const std::string& value,
bool recurse )
{
typedef std::list< DOMElement* > LIST;
LIST l = getAllChildrenElements( node,
name,
recurse );
LIST ret;
for( LIST::iterator li = l.begin(); li != l.end(); ++li )
{
DOMElement* e = *li;
std::string s = getAttribute( e, attrname );
// cerr << "value:" << value << " s:" << s << endl;
if( s == value )
{
// cerr << "match!" << endl;
ret.push_back( e );
}
}
// cerr << "ret.sz:" << ret.size() << endl;
return ret;
}
FERRISEXP_API DOMElement*
getFirstChildElementsWithAttribute( DOMNode* node,
const std::string& name,
const std::string& attrname,
const std::string& value,
bool recurse )
{
DOMElement* ret = 0;
std::list< DOMElement* > l = getAllChildrenElementsWithAttribute( node, name, attrname, value, recurse );
if( !l.empty() )
ret = l.front();
return ret;
}
std::string getMatchingAttribute( DOMNode* node,
const std::string& name,
const std::string& attrname,
const std::string& value,
const std::string& desiredAttribute )
{
DOMElement* e = getFirstChildElementsWithAttribute( node, name, attrname, value );
if( e )
{
return getAttribute( e, desiredAttribute );
}
return "";
}
typedef std::list< DOMElement* > entries_t;
GoogleSpreadSheets_t
GoogleClient::listSheets()
{
LG_GOOGLE_D << "running listSheets...." << endl;
QUrl u("http://spreadsheets.google.com/feeds/spreadsheets/private/full");
QNetworkRequest request = createRequest( u );
QNetworkReply *reply = get( request );
LG_GOOGLE_D << "after running listSheets...." << endl;
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "spreadsheets error:" << reply->error() << endl;
LG_GOOGLE_D << "spreadsheets reply:" << (string)ba << endl;
fh_domdoc dom = Factory::StringToDOM( (string)ba );
entries_t entries = XML::getAllChildrenElements( dom->getDocumentElement(), "entry", false );
GoogleSpreadSheets_t ret;
for( entries_t::iterator ei = entries.begin(); ei!=entries.end(); ++ei )
{
fh_GoogleSpreadSheet t = new GoogleSpreadSheet( this, dom, *ei );
ret.push_back(t);
}
return ret;
}
fh_GoogleDocumentFolder
GoogleClient::getRootFolder()
{
DEBUG << "GoogleClient::getRootFolder...." << endl;
fh_GoogleDocumentFolder ret = new GoogleDocumentFolder( this, "" );
return ret;
}
GoogleDocuments_t
GoogleClient::listDocuments()
{
LG_GOOGLE_D << "running listDocuments...." << endl;
QUrl u("http://docs.google.com/feeds/documents/private/full");
QNetworkRequest request = createRequest( u, "writely" );
request.setRawHeader("GData-Version", " 2.0");
QNetworkReply *reply = get( request );
LG_GOOGLE_D << "after running listDocuments...." << endl;
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "docs error:" << reply->error() << endl;
LG_GOOGLE_D << "docs reply:" << (string)ba << endl;
fh_domdoc dom = Factory::StringToDOM( (string)ba );
m_documentsETag = getAttribute( dom->getDocumentElement(), "gd:etag" );
entries_t entries = XML::getAllChildrenElements( dom->getDocumentElement(), "entry", false );
if( LG_GOOGLE_D_ACTIVE )
{
fh_stringstream ss = tostream( dom );
LG_GOOGLE_D << "Documents:" << ss.str() << endl;
LG_GOOGLE_D << "m_documentsETag:" << m_documentsETag << endl;
}
GoogleDocuments_t ret;
for( entries_t::iterator ei = entries.begin(); ei!=entries.end(); ++ei )
{
fh_GoogleDocument t = new GoogleDocument( this, dom, *ei );
ret.push_back(t);
}
//
// Have to get all the folder names to get the top level ones :(
// GET /feeds/documents/private/full/-/folder?showfolders=true
//
{
request.setUrl( QUrl( "http://docs.google.com/feeds/documents/private/full/-/folder?showfolders=true" ));
QNetworkReply *reply = get( request );
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "docs folders error:" << reply->error() << endl;
LG_GOOGLE_D << "docs folders reply:" << (string)ba << endl;
fh_domdoc dom = Factory::StringToDOM( (string)ba );
entries_t entries = XML::getAllChildrenElements( dom->getDocumentElement(), "entry", false );
for( entries_t::iterator ei = entries.begin(); ei!=entries.end(); ++ei )
{
fh_GoogleDocument t = new GoogleDocument( this, dom, *ei );
ret.push_back(t);
}
}
// // GET /feeds/documents/private/full/-/folder?showfolders=true
// {
// QUrl u("http://docs.google.com/feeds/documents/private/full/-/folder?showfolders=true");
// QNetworkRequest request = createRequest( u, "writely" );
// request.setRawHeader("GData-Version", " 2.0");
// QNetworkReply *reply = get( request );
// LG_GOOGLE_D << "after running listDocuments...." << endl;
// QByteArray ba = reply->readAll();
// LG_GOOGLE_D << "docs error:" << reply->error() << endl;
// fh_domdoc dom = Factory::StringToDOM( (string)ba );
// fh_stringstream ss = tostream( dom );
// LG_GOOGLE_D << "Folders:" << ss.str() << endl;
// }
// GET http://docs.google.com/feeds/folders/private/full/folder%3Afolder_id
{
LG_GOOGLE_D << "------------------------------------------------------------------------" << endl;
// QUrl u("http://docs.google.com/feeds/folders/private/full/folder%3A1d90eb20-cad4-4bf3-b4d7-0ff8ddf3448d");
QUrl u("http://docs.google.com/feeds/folders/private/full/folder%3Abe4824a5-8b8f-4129-9b33-5c5f3c1cdb57?showfolders=true");
QNetworkRequest request = createRequest( u, "writely" );
request.setRawHeader("GData-Version", " 2.0");
QNetworkReply* reply = get( request );
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "x error:" << reply->error() << endl;
LG_GOOGLE_D << "x reply:" << (string)ba << endl;
fh_domdoc dom = Factory::StringToDOM( (string)ba );
fh_stringstream ss = tostream( dom );
LG_GOOGLE_D << "DATA:" << ss.str() << endl;
}
return ret;
}
fh_YoutubeUpload
GoogleClient::createYoutubeUpload()
{
return new YoutubeUpload( this );
}
/****************************************/
/****************************************/
/****************************************/
// This is for the root directory...
GoogleDocumentFolder::GoogleDocumentFolder( fh_GoogleClient gc, const std::string& folderID )
:
m_gc( gc ),
m_haveRead( false ),
m_folderID( folderID )
{
}
GoogleDocumentFolder::GoogleDocumentFolder( fh_GoogleClient gc, fh_domdoc dom, DOMElement* e )
:
m_gc( gc ),
m_haveRead( false )
{
m_title = getStrSubCtx( e, "title" );
m_editURL = getMatchingAttribute( e, "link",
"rel", "edit",
"href" );
m_folderID = getStrSubCtx( e, "id" );
m_folderID = m_folderID.substr( m_folderID.length() - strlen("fac1125b-6dc7-4e79-8ef2-7dc1c8b4c9b8"));
// m_folderID = Util::replace_all( m_folderID,
// "http://docs.google.com/feeds/documents/private/full/folder%3A",
// "" );
}
// <category label="spreadsheet" scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/docs/2007#spreadsheet"/>
void
GoogleDocumentFolder::addItem( fh_domdoc dom, DOMElement* e )
{
string kind = getMatchingAttribute( e, "category",
"scheme", "http://schemas.google.com/g/2005#kind",
"label" );
DEBUG << "kind:" << kind << endl;
if( kind == "folder" )
{
fh_GoogleDocumentFolder f = new GoogleDocumentFolder( m_gc, dom, e );
m_folders.push_back(f);
}
else
{
fh_GoogleDocument d = new GoogleDocument( m_gc, dom, e );
m_docs.push_back(d);
}
}
void
GoogleDocumentFolder::read( bool force )
{
DEBUG << "read() title:" << m_title << " folderID:" << m_folderID << endl;
GoogleDocumentFolders_t ret;
if( m_haveRead )
return;
m_haveRead = true;
//
// Have to get all the folder names to get the top level ones :(
// GET /feeds/documents/private/full/-/folder?showfolders=true
//
if( m_folderID.empty() )
{
QUrl u("http://docs.google.com/feeds/documents/private/full?showfolders=true");
QNetworkRequest request = m_gc->createRequest( u, "writely" );
request.setRawHeader("GData-Version", " 2.0");
QNetworkReply *reply = m_gc->get( request );
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "docs folders error:" << reply->error() << endl;
LG_GOOGLE_D << "docs folders reply:" << (string)ba << endl;
if( reply->error() == 0 )
{
fh_domdoc dom = Factory::StringToDOM( (string)ba );
entries_t entries = XML::getAllChildrenElements( dom->getDocumentElement(), "entry", false );
for( entries_t::iterator ei = entries.begin(); ei!=entries.end(); ++ei )
{
DOMElement* e = *ei;
string p = getMatchingAttribute( e, "link",
"rel", "http://schemas.google.com/docs/2007#parent",
"href" );
if( p.empty() )
{
addItem( dom, *ei );
}
}
if( LG_GOOGLE_D_ACTIVE )
{
fh_stringstream ss = tostream( dom );
LG_GOOGLE_D << "TOP FOLDER....:" << ss.str() << endl;
}
}
}
else
{
stringstream uss;
uss << "http://docs.google.com/feeds/folders/private/full/folder%3A" << m_folderID << "?showfolders=true";
QUrl u(uss.str().c_str());
QNetworkRequest request = m_gc->createRequest( u, "writely" );
request.setRawHeader("GData-Version", " 2.0");
QNetworkReply* reply = m_gc->get( request );
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "x error:" << reply->error() << endl;
LG_GOOGLE_D << "x reply:" << (string)ba << endl;
if( reply->error() == 0 )
{
fh_domdoc dom = Factory::StringToDOM( (string)ba );
fh_stringstream ss = tostream( dom );
LG_GOOGLE_D << "DATA:" << ss.str() << endl;
entries_t entries = XML::getAllChildrenElements( dom->getDocumentElement(), "entry", false );
for( entries_t::iterator ei = entries.begin(); ei!=entries.end(); ++ei )
{
addItem( dom, *ei );
}
}
}
}
GoogleDocumentFolders_t
GoogleDocumentFolder::getSubFolders()
{
read();
return m_folders;
}
GoogleDocuments_t
GoogleDocumentFolder::getDocuments()
{
read();
return m_docs;
}
std::string
GoogleDocumentFolder::getEditURL()
{
return m_editURL;
}
std::string
GoogleDocumentFolder::getTitle()
{
return m_title;
}
fh_GoogleDocument
GoogleDocumentFolder::createDocument( const std::string& data,
const std::string& slug,
const std::string& format )
{
fh_GoogleDocument ret = new GoogleDocument( m_gc, data, slug, format );
return ret;
}
/****************************************/
/****************************************/
/****************************************/
GoogleDocument::GoogleDocument( fh_GoogleClient gc, fh_domdoc dom, DOMElement* e )
:
m_gc( gc ),
m_haveRead( false )
{
m_title = getStrSubCtx( e, "title" );
m_editURL = getMatchingAttribute( e, "link",
"rel", "edit",
"href" );
m_docID = getStrSubCtx( e, "gd:resourceId" );
m_docID = Util::replace_all( m_docID, "document:", "" );
}
GoogleDocument::GoogleDocument( fh_GoogleClient gc,
const std::string& data,
const std::string& slug,
const std::string& format )
:
m_gc(gc),
m_haveRead( false )
{
QNetworkRequest request = prepareCreateOrReplace( data, slug, format, true );
QNetworkReply* reply = m_gc->post( request, data.c_str() );
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "create doc error code:" << reply->error() << endl;
LG_GOOGLE_D << "create doc reply:" << (string)ba << endl;
}
std::string
GoogleDocument::getEditURL()
{
return m_editURL;
}
std::string
GoogleDocument::getTitle()
{
return m_title;
}
fh_istream
GoogleDocument::exportToFormat( const std::string& format )
{
DEBUG << "exportToFormat() m_docID:" << m_docID << endl;
QUrl u( "http://docs.google.com/feeds/download/documents/Export" );
u.addQueryItem("docID", m_docID.c_str() );
u.addQueryItem("exportFormat", format.c_str() );
LG_GOOGLE_D << "export args:" << tostr(QString(u.toEncoded())) << endl;
QNetworkRequest request = m_gc->createRequest( u, "writely", "" );
QNetworkReply *reply = m_gc->get( request );
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "export error:" << reply->error() << endl;
LG_GOOGLE_D << "export reply:" << (string)ba << endl;
fh_stringstream ret;
ret.write( ba.data(), ba.size() );
ret->clear();
ret->seekg(0, ios::beg);
ret->seekp(0, ios::beg);
ret->clear();
return ret;
}
string filenameToContentType( const std::string& slug_const,
const std::string& format,
const std::string& data = "" )
{
string slug = tolowerstr()( slug_const );
// 299, update reply:Content-Type application/vnd.oasis.opendocument.spreadsheet is not a valid input type.
string ret = "text/plain";
if( format == "xx" || ends_with( slug, "xx" ) )
ret = "application/vnd.ms-excel";
else if( format == "xls" || ends_with( slug, "xls" ) )
ret = "application/vnd.ms-excel";
else if( format == "doc" || ends_with( slug, "doc" ) )
ret = "application/msword";
else if( format == "odt" || ends_with( slug, "odt" ) )
ret = "application/vnd.oasis.opendocument.text";
else if( format == "ods" || ends_with( slug, "ods" ) )
ret = "application/vnd.oasis.opendocument.spreadsheet";
else if( ends_with( slug, "png" ) )
ret = "image/png";
else if( ends_with( slug, "pdf" ) )
ret = "application/pdf";
else
{
string mt = regex_match_single( data, ".*mimetypeapplication/([^P]+)PK.*" );
if( !mt.empty() )
ret = "application/" + mt;
}
return ret;
}
QNetworkRequest
GoogleDocument::prepareCreateOrReplace( const std::string& data,
const std::string& slug,
const std::string& format,
bool create )
{
string ctype = filenameToContentType( slug, format, data );
stringstream uss;
if( create )
uss << "http://docs.google.com/feeds/documents/private/full";
else
{
if( contains( m_docID, "spreadshee" ))
uss << "http://docs.google.com/feeds/media/private/full/" << m_docID;
else
uss << "http://docs.google.com/feeds/media/private/full/document:" << m_docID;
}
QUrl u( uss.str().c_str() );
QNetworkRequest request = m_gc->createRequest( u, "writely", "" );
request.setHeader( QNetworkRequest::ContentTypeHeader, ctype.c_str() );
request.setHeader( QNetworkRequest::ContentLengthHeader, tostr(data.length()).c_str() );
request.setRawHeader("Content-Type", ctype.c_str() );
// request.setRawHeader("Content-Length", tostr(data.length()).c_str() );
request.setRawHeader("Slug", slug.c_str() );
if( !create )
request.setRawHeader("If-Match", "*" );
DEBUG << "import url:" << tostr(QString(u.toEncoded())) << endl;
DEBUG << "slug:" << slug << endl;
DEBUG << "ctype:" << ctype << endl;
DEBUG << "format:" << format << endl;
return request;
}
void
GoogleDocument::importFromFormat( fh_istream iss, const std::string& format )
{
DEBUG << "importFromFormat() m_title:" << m_title << endl;
string data = StreamToString(iss);
QNetworkRequest request = prepareCreateOrReplace( data, m_title, format, false );
DEBUG << "importFromFormat() Calling put..." << endl;
QNetworkReply* reply = m_gc->put( request, data );
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "update error code:" << reply->error() << endl;
LG_GOOGLE_D << "update reply:" << (string)ba << endl;
}
/****************************************/
/****************************************/
/****************************************/
GoogleSpreadSheet::GoogleSpreadSheet( fh_GoogleClient gc, fh_domdoc dom, DOMElement* e )
:
m_gc( gc ),
m_haveRead( false )
{
m_title = getStrSubCtx( e, "title" );
m_feedURL = getMatchingAttribute( e, "content",
"type", "application/atom+xml;type=feed",
"src" );
// non versioned data header
// m_feedURL = getMatchingAttribute( e, "link",
// "rel", "http://schemas.google.com/spreadsheets/2006#worksheetsfeed",
// "href" );
}
std::string
GoogleSpreadSheet::getFeedURL()
{
return m_feedURL;
}
std::string
GoogleSpreadSheet::getTitle()
{
return m_title;
}
GoogleWorkSheets_t
GoogleSpreadSheet::listSheets()
{
LG_GOOGLE_D << "running list WORK Sheets...." << endl;
if( m_haveRead )
return m_sheets;
QUrl u( getFeedURL().c_str() );
QNetworkRequest request = m_gc->createRequest( u );
QNetworkReply* reply = m_gc->get( request );
LG_GOOGLE_D << "after running list WORK Sheets...." << endl;
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "worksheets error:" << reply->error() << endl;
LG_GOOGLE_D << "worksheets reply:" << (string)ba << endl;
fh_domdoc dom = Factory::StringToDOM( (string)ba );
entries_t entries = XML::getAllChildrenElements( dom->getDocumentElement(), "entry", false );
for( entries_t::iterator ei = entries.begin(); ei!=entries.end(); ++ei )
{
fh_GoogleWorkSheet t = new GoogleWorkSheet( m_gc, dom, *ei );
m_sheets.push_back(t);
}
return m_sheets;
}
// void
// GoogleSpreadSheet::addDocsAPIAuth_reply(QNetworkReply* reply )
// {
// m_gc->m_waiter.unblock(reply);
// }
// void
// GoogleSpreadSheet::addDocsAPIAuth( QNetworkRequest& r )
// {
// if( m_docsAPIAuth.empty() )
// {
// QNetworkAccessManager* qm = m_gc->getQManager();
// QNetworkRequest request;
// userpass_t up = getGoogleUserPass();
// string username = up.first;
// string password = up.second;
// QUrl postdata("https://www.google.com/accounts/ClientLogin");
// postdata.addQueryItem("accountType", "HOSTED_OR_GOOGLE");
// postdata.addQueryItem("Email", username.c_str() );
// postdata.addQueryItem("Passwd", password.c_str() );
// postdata.addQueryItem("service", "writely");
// postdata.addQueryItem("source", "libferris" FERRIS_VERSION);
// request.setUrl(postdata);
// connect( qm, SIGNAL(finished(QNetworkReply*)), SLOT(addDocsAPIAuth_reply(QNetworkReply*)));
// LG_GOOGLE_D << "GoogleSpreadSheet::addDocsAPIAuth():" << tostr(QString(postdata.toEncoded())) << endl;
// LG_GOOGLE_D << "getting reply...2" << endl;
// QByteArray empty;
// QNetworkReply *reply = qm->post( request, empty );
// LG_GOOGLE_D << "calling block()" << endl;
// m_gc->m_waiter.block(reply);
// LG_GOOGLE_D << "after block()" << endl;
// m_docsAPIAuth = responseToAuthToken( (string)reply->readAll() );
// LG_GOOGLE_D << "m_docsAPIAuth:" << m_docsAPIAuth << endl;
// }
// r.setRawHeader("Authorization", m_docsAPIAuth.c_str() );
// }
string
GoogleSpreadSheet::getDocIDFromTitle( const std::string& title )
{
// cerr << "FIXME GoogleSpreadSheet::getDocIDFromTitle() " << endl;
// return "tz96EupEQKYKTbu3m0GpqTw";
// QUrl u( "http://docs.google.com/feeds/documents/private/full/-/spreadsheet" );
// QNetworkRequest request = m_gc->createRequest( u );
// request.setRawHeader("GData-Version", " 2.0");
QUrl u("http://docs.google.com/feeds/documents/private/full");
QNetworkRequest request;
// m_gc->addAuth( request, "wise" );
m_gc->addAuth( request, "writely" );
request.setRawHeader("GData-Version", " 2.0");
request.setUrl(u);
LG_GOOGLE_D << "about to issue google docs request..." << endl;
QNetworkReply *reply = m_gc->get( request );
LG_GOOGLE_D << "done with google docs request..." << endl;
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "getDocIDFromTitle error:" << reply->error() << endl;
LG_GOOGLE_D << "getDocIDFromTitle reply:" << (string)ba << endl;
string ret;
fh_domdoc dom = Factory::StringToDOM( (string)ba );
string etag = getAttribute( dom->getDocumentElement(), "gd:etag" );
entries_t entries = XML::getAllChildrenElements( dom->getDocumentElement(), "entry", false );
for( entries_t::iterator ei = entries.begin(); ei!=entries.end(); ++ei )
{
DOMElement* e = *ei;
string t = getStrSubCtx( e, "title" );
if( t == title )
{
ret = getStrSubCtx( e, "id" );
break;
}
}
LG_GOOGLE_D << "docid ret:" << ret << endl;
return ret;
}
fh_GoogleDocument
GoogleSpreadSheet::getDocument()
{
// getDocIDFromTitle
// ( fh_GoogleClient gc, fh_domdoc dom, DOMElement* e );
stringstream uss;
uss << "http://docs.google.com/feeds/documents/private/full?"
<< "title-exact=true&title=" << getTitle();
QUrl u( uss.str().c_str() );
DEBUG << "GoogleSpreadSheet::getDocument() earl:" << uss.str() << endl;
QNetworkRequest request = m_gc->createRequest( u, "writely" );
request.setRawHeader("GData-Version", " 2.0");
QNetworkReply *reply = m_gc->get( request );
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "docs error:" << reply->error() << endl;
LG_GOOGLE_D << "docs reply:" << (string)ba << endl;
fh_domdoc dom = Factory::StringToDOM( (string)ba );
entries_t entries = XML::getAllChildrenElements( dom->getDocumentElement(), "entry", false );
if( LG_GOOGLE_D_ACTIVE )
{
fh_stringstream ss = tostream( dom );
LG_GOOGLE_D << "Documents:" << ss.str() << endl;
}
for( entries_t::iterator ei = entries.begin(); ei!=entries.end(); ++ei )
{
fh_GoogleDocument t = new GoogleDocument( m_gc, dom, *ei );
return t;
}
return 0;
}
void
GoogleSpreadSheet::importFromFormat( fh_istream iss, const std::string& format )
{
LG_GOOGLE_D << "GoogleSpreadSheet::importFromFormat() format:" << format << endl;
string docid = getDocIDFromTitle( m_title );
LG_GOOGLE_D << "getDocIDFromTitle() title:" << m_title << " docid:" << docid << endl;
fh_GoogleDocument doc = getDocument();
doc->importFromFormat( iss, format );
}
fh_istream
GoogleSpreadSheet::exportToFormat( const std::string& format )
{
LG_GOOGLE_D << "GoogleSpreadSheet::exportToFormat() format:" << format << endl;
string docid = getDocIDFromTitle( m_title );
LG_GOOGLE_D << "getDocIDFromTitle() title:" << m_title << " docid:" << docid << endl;
QUrl u( "http://spreadsheets.google.com/feeds/download/spreadsheets/Export" );
u.addQueryItem("key", docid.c_str() );
u.addQueryItem("exportFormat", format.c_str() );
LG_GOOGLE_D << "exportToFormat, args:" << tostr(QString(u.toEncoded())) << endl;
QNetworkRequest request = m_gc->createRequest( u );
QNetworkReply *reply = m_gc->get( request );
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "exportToFormat error:" << reply->error() << endl;
if( !reply->error() )
LG_GOOGLE_D << "exportToFormat reply.len:" << ba.size() << endl;
else
LG_GOOGLE_D << "exportToFormat reply:" << (string)ba << endl;
{
QVariant qv = reply->header( QNetworkRequest::ContentTypeHeader );
DEBUG << "Got ctype:" << tostr(qv.toString()) << endl;
// application/vnd.oasis.opendocument.spreadsheet; charset=UTF-8
}
fh_stringstream ret;
ret.write( ba.data(), ba.size() );
return ret;
}
fh_GoogleWorkSheet
GoogleSpreadSheet::createWorkSheet( const std::string& name )
{
LG_GOOGLE_D << "createWorkSheet() top" << endl;
stringstream ss;
ss << "<entry xmlns=\"http://www.w3.org/2005/Atom\"" << endl
<< " xmlns:gs=\"http://schemas.google.com/spreadsheets/2006\">" << endl
<< " <title>" << name << "</title>" << endl
<< " <gs:rowCount>100</gs:rowCount>" << endl
<< " <gs:colCount>100</gs:colCount>" << endl
<< "</entry>" << endl;
QUrl u( getFeedURL().c_str() );
QNetworkRequest request = m_gc->createRequest( u );
request.setHeader( QNetworkRequest::ContentTypeHeader, "application/atom+xml" );
QNetworkReply *reply = m_gc->post( request, ss.str() );
QByteArray ba = reply->readAll();
LG_GOOGLE_D << "createWorkSheet() reply:" << (string)ba << endl;
fh_domdoc dom = Factory::StringToDOM( (string)ba );
DOMElement* e = dom->getDocumentElement();
fh_GoogleWorkSheet t = new GoogleWorkSheet( m_gc, dom, e );
m_sheets.push_back(t);
return t;
}
/****************************************/
/****************************************/
/****************************************/
GoogleWorkSheet::GoogleWorkSheet( fh_GoogleClient gc, fh_domdoc dom, DOMElement* e )
:
m_gc( gc ),
m_cellsFetched( false ),
m_delayCellSync( false )
{
m_etag = getAttribute( e, "gd:etag" );
m_title = getStrSubCtx( e, "title" );
m_cellFeedURL = getMatchingAttribute( e, "link",
"rel", "http://schemas.google.com/spreadsheets/2006#cellsfeed",
"href" );
m_editURL = getMatchingAttribute( e, "link",
"rel", "edit",
"href" );
if( LG_GOOGLE_D_ACTIVE )
{
fh_stringstream ss = tostream( *e );
LG_GOOGLE_D << "WorkSheet:" << ss.str() << endl;
}
}
std::string
GoogleWorkSheet::getCellFeedURL()
{
return m_cellFeedURL;
}
std::string
GoogleWorkSheet::getTitle()
{
return m_title;
}
void
GoogleWorkSheet::fetchCells()
{
QUrl u( getCellFeedURL().c_str() );
QNetworkRequest request = m_gc->createRequest( u );
// If-None-Match: W/"D08FQn8-eil7ImA9WxZbFEw."
if( !m_cellFeedETag.empty() )
request.setRawHeader("If-None-Match", m_cellFeedETag.c_str() );
QNetworkReply* reply = m_gc->get( request );
QByteArray ba = reply->readAll();
// cerr << "CELL DATA:" << (string)ba << endl;
fh_domdoc dom = Factory::StringToDOM( (string)ba );
m_cellFeedETag = getAttribute( dom->getDocumentElement(), "gd:etag" );
entries_t entries = XML::getAllChildrenElements( dom->getDocumentElement(), "entry", false );
int cellURLLength = getCellFeedURL().length();
int header_rownum = 1;
int max_headerrow_colnum = 0;
for( entries_t::iterator ei = entries.begin(); ei!=entries.end(); ++ei )
{
DOMElement* e = *ei;
fh_GoogleWorkSheetCell cell = new GoogleWorkSheetCell( m_gc, dom, *ei, this, cellURLLength );
LG_GOOGLE_D << "have cell at row:" << cell->row() << " col:" << cell->col() << endl;
m_cells_t::iterator ci = m_cells.find( make_pair( cell->row(), cell->col() ));
if( ci != m_cells.end() )
{
fh_GoogleWorkSheetCell cell = ci->second;
cell->update( dom, e, cellURLLength );
}
else
{
m_cells[ make_pair( cell->row(), cell->col() ) ] = cell;
}
if( cell->row() == header_rownum )
{
max_headerrow_colnum = max( max_headerrow_colnum, cell->col() );
}
}
m_colnames.clear();
LG_GOOGLE_D << "max_headerrow_colnum:" << max_headerrow_colnum << endl;
for( int col=1; col <= max_headerrow_colnum; ++col )
{
m_cells_t::iterator ci = m_cells.find( make_pair( header_rownum, col ));
if( ci != m_cells.end() )
{
string v = ci->second->value();
m_colnames[ v ] = col;
}
string v = columnNumberToName( col );
m_colnames[ v ] = col;
LG_GOOGLE_D << " setting col:" << col << " to name:" << v << endl;
}
for( int col=1; col < 26; ++col )
{
string v = columnNumberToName( col );
m_colnames[ v ] = col;
}
m_cellsFetched = true;
}
std::list< std::string >
GoogleWorkSheet::getColumnNames()
{
ensureCellsFetched();
std::list< std::string > ret;
copy( map_domain_iterator( m_colnames.begin() ),
map_domain_iterator( m_colnames.end() ),
back_inserter( ret ) );
return ret;
}
void
GoogleWorkSheet::ensureCellsFetched()
{
if( !m_cellsFetched )
fetchCells();
}
fh_GoogleWorkSheetCell
GoogleWorkSheet::getCell( int row, int col )
{
ensureCellsFetched();
m_cells_t::iterator ci = m_cells.find( make_pair( row, col ));
if( ci == m_cells.end() )
{
LG_GOOGLE_D << "Creating new cell at row:" << row << " col:" << col << endl;
fh_GoogleWorkSheetCell cell = new GoogleWorkSheetCell( m_gc, this, row, col, "" );
m_cells[ make_pair( cell->row(), cell->col() ) ] = cell;
return cell;
}
return ci->second;
}
fh_GoogleWorkSheetCell
GoogleWorkSheet::getCell( int row, const std::string& colName )
{
ensureCellsFetched();
int c = m_colnames[ colName ];
LG_GOOGLE_D << "m_colnames.sz:" << m_colnames.size() << " colName:" << colName << " has number:" << c << endl;
for( m_colnames_t::iterator ci = m_colnames.begin(); ci != m_colnames.end(); ++ci )
{
LG_GOOGLE_D << "ci.first:" << ci->first << " sec:" << ci->second << endl;
}
return getCell( row, c );
}
int
GoogleWorkSheet::getLargestRowNumber()
{
ensureCellsFetched();
int ret = 0;
for( m_cells_t::iterator ci = m_cells.begin(); ci != m_cells.end(); ++ci )
{
fh_GoogleWorkSheetCell c = ci->second;
ret = max( ret, c->row() );
}
return ret;
}
bool
GoogleWorkSheet::getDelayCellSync()
{
return m_delayCellSync;
}
void
GoogleWorkSheet::setDelayCellSync( bool v )
{
m_delayCellSync = v;
}
void
GoogleWorkSheet::sync()
{
if( !getDelayCellSync() )
return;
string baseURL = getCellFeedURL();
string fullEditURL = baseURL + "/batch";
stringstream updatess;
updatess << "<feed xmlns=\"http://www.w3.org/2005/Atom\"" << endl
<< " xmlns:batch=\"http://schemas.google.com/gdata/batch\" " << endl
<< " xmlns:gs=\"http://schemas.google.com/spreadsheets/2006\" " << endl
<< " >" << endl
<< endl
<< "<id>" << getCellFeedURL() << "</id> " << endl
<< endl;
for( m_cells_t::iterator ci = m_cells.begin(); ci != m_cells.end(); ++ci )
{
fh_GoogleWorkSheetCell c = ci->second;
// if( c->isCreated() )
// {
// c->sync();
// }
// else
{
c->writeUpdateBlock( updatess );
}
}
updatess << "</feed>" << endl;
QUrl u(fullEditURL.c_str());
QNetworkRequest request = m_gc->createRequest( u );
request.setHeader( QNetworkRequest::ContentTypeHeader, "application/atom+xml" );
if( !m_etag.empty() )
request.setRawHeader("If-Match", "*" );
QNetworkReply* reply = m_gc->post( request, updatess.str() );
cerr << "-------------" << endl;
cerr << "m_etag:" << m_etag << endl;
cerr << "m_cellFeedETag:" << m_cellFeedETag << endl;
cerr << "DST URL:" << fullEditURL << endl;
cerr << "SENT2" << endl;
cerr << updatess.str() << endl;
cerr << "error:" << reply->error() << endl;
QByteArray ba = reply->readAll();
cerr << "ba.sz:" << ba.size() << endl;
cerr << "ba:" << prettyprintxml( (string)ba ) << endl;
cerr << "-------------" << endl;
fh_domdoc dom = Factory::StringToDOM( (string)ba );
entries_t entries = XML::getAllChildrenElements( dom->getDocumentElement(), "atom:entry", false );
int cellURLLength = getCellFeedURL().length();
GoogleSpreadSheets_t ret;
for( entries_t::iterator ei = entries.begin(); ei!=entries.end(); ++ei )
{
DOMElement* e = *ei;
cerr << "have entry..." << endl;
DOMElement* x = XML::getChildElement( e, "gs:cell" );
if( x )
{
cerr << "have entry/x..." << endl;
int row = toint( getAttribute( x, "row" ) );
int col = toint( getAttribute( x, "col" ) );
cerr << "row:" << row << " col:" << col << endl;
if( fh_GoogleWorkSheetCell cell = m_cells[ make_pair( row, col ) ] )
cell->update( dom, e, cellURLLength );
}
}
//
// now, update any formula cells
// this shouldn't need to be explicit with ETags and feeds
//
fetchCells();
// for( m_cells_t::iterator ci = m_cells.begin(); ci != m_cells.end(); ++ci )
// {
// fh_GoogleWorkSheetCell c = ci->second;
// if( c->isFormula() )
// {
// }
// }
}
/****************************************/
/****************************************/
/****************************************/
GoogleWorkSheetCell::GoogleWorkSheetCell( fh_GoogleClient gc,
fh_domdoc dom,
DOMElement* e,
fh_GoogleWorkSheet ws,
int cellURLLength )
:
m_gc( gc ),
m_ws( ws ),
m_dirty( false ),
m_created( false ),
m_etag("")
{
update( dom, e, cellURLLength );
// string editURL = getMatchingAttribute( e, "link",
// "rel", "edit",
// "href" );
// DOMElement* x = XML::getChildElement( e, "gs:cell" );
// m_value = getStrSubCtx( e, "gs:cell" );
// m_row = toint( getAttribute( x, "row" ) );
// m_col = toint( getAttribute( x, "col" ) );
// m_cellURL = editURL.substr( cellURLLength );
{
fh_stringstream ss = tostream( *e );
LG_GOOGLE_D << "CELL:" << ss.str() << endl;
}
}
void
GoogleWorkSheetCell::update( fh_domdoc dom, DOMElement* e, int cellURLLength )
{
string editURL = getMatchingAttribute( e, "link",
"rel", "edit",
"href" );
if( editURL.empty() )
editURL = getMatchingAttribute( e, "atom:link",
"rel", "edit",
"href" );
m_etag = getAttribute( e, "gd:etag" );
DOMElement* x = XML::getChildElement( e, "gs:cell" );
m_value = getStrSubCtx( e, "gs:cell" );
m_row = toint( getAttribute( x, "row" ) );
m_col = toint( getAttribute( x, "col" ) );
m_cellURL = editURL.substr( cellURLLength );
m_isFormula = starts_with( getAttribute( x, "inputValue" ), "=" );
LG_GOOGLE_D << "editURL:" << editURL << endl;
LG_GOOGLE_D << "etag:" << m_etag << endl;
LG_GOOGLE_D << "m_value:" << m_value << endl;
LG_GOOGLE_D << "m_isFormula:" << m_isFormula << endl;
}
GoogleWorkSheetCell::GoogleWorkSheetCell( fh_GoogleClient gc, fh_GoogleWorkSheet ws,
int r, int c, const std::string& v )
:
m_gc( gc ),
m_ws( ws ),
m_created( true ),
m_etag("")
{
m_row = r;
m_col = c;
m_value = v;
{
stringstream ss;
ss << "/R" << r << "C" << c;
m_cellURL = ss.str();
}
}
bool
GoogleWorkSheetCell::isCreated()
{
return m_created;
}
bool
GoogleWorkSheetCell::isFormula()
{
return m_isFormula;
}
int
GoogleWorkSheetCell::row()
{
return m_row;
}
int
GoogleWorkSheetCell::col()
{
return m_col;
}
std::string
GoogleWorkSheetCell::value()
{
LG_GOOGLE_D << "reading cell at row:" << m_row << " col:" << m_col << " result:" << m_value << endl;
return m_value;
}
void
GoogleWorkSheetCell::writeUpdateBlock( stringstream& ss )
{
if( !m_dirty )
return;
string fullEditURL = editURL();
if( m_created )
fullEditURL += "/latest";
cerr << "m_etag:" << m_etag << endl;
ss << "" << endl
<< "<entry "
// << " xmlns:gd=\"http://schemas.google.com/g/2005\" "
// << " gd:etag=\"" << Util::replace_all( m_etag, "\"", """ ) << "\" "
<< " >" << endl
<< " <batch:id>A" << toVoid(this) << "</batch:id> " << endl
<< " <batch:operation type=\"update\"/> " << endl
<< " <id>" << fullEditURL << "</id> " << endl
<< " <link rel=\"edit\" type=\"application/atom+xml\" " << endl
<< " href=\"" << fullEditURL << "\"/>" << endl
<< " <gs:cell row=\"" << row() << "\" col=\"" << col() << "\" inputValue=\"" << m_value << "\"/>" << endl
<< "</entry> " << endl
<< endl;
}
void
GoogleWorkSheetCell::sync()
{
string fullEditURL = editURL();
if( m_created )
fullEditURL += "/latest";
cerr << "SENDING VALUE:" << m_value << endl;
stringstream updatess;
updatess << "" << endl
<< "<entry xmlns=\"http://www.w3.org/2005/Atom\"" << endl
<< " xmlns:gs=\"http://schemas.google.com/spreadsheets/2006\">" << endl
<< " <id>" << "http://spreadsheets.google.com/feeds/cells/key/worksheetId/private/full/cellId" << "</id>" << endl
<< " <link rel=\"edit\" type=\"application/atom+xml\"" << endl
<< " href=\"" << fullEditURL << "\"/>" << endl
<< " <gs:cell row=\"" << row() << "\" col=\"" << col() << "\" inputValue=\"" << m_value << "\" />" << endl
<< "</entry>" << endl
<<"" << endl;
QUrl u(fullEditURL.c_str());
QNetworkRequest request = m_gc->createRequest( u );
request.setHeader( QNetworkRequest::ContentTypeHeader, "application/atom+xml" );
QNetworkReply* reply = m_gc->put( request, updatess.str() );
cerr << "-------------" << endl;
cerr << "SENT to:" << fullEditURL << endl;
cerr << updatess.str() << endl;
cerr << "error:" << reply->error() << endl;
QByteArray ba = reply->readAll();
cerr << "ba.sz:" << ba.size() << endl;
cerr << "ba:" << prettyprintxml( (string)ba ) << endl;
cerr << "-------------" << endl;
fh_domdoc dom = Factory::StringToDOM( (string)ba );
DOMElement* e = dom->getDocumentElement();
string editURL = getMatchingAttribute( e, "link",
"rel", "edit",
"href" );
cerr << "have updated editURL:" << editURL << endl;
int cellURLLength = m_ws->getCellFeedURL().length();
m_value = getStrSubCtx( e, "gs:cell" );
m_cellURL = editURL.substr( cellURLLength );
}
void
GoogleWorkSheetCell::value( const std::string& s )
{
if( m_ws->getDelayCellSync() )
{
m_dirty = true;
m_value = s;
return;
}
m_value = s;
sync();
}
std::string
GoogleWorkSheetCell::editURL()
{
return m_ws->getCellFeedURL() + m_cellURL;
}
/****************************************/
/****************************************/
/****************************************/
YoutubeUpload::YoutubeUpload( fh_GoogleClient gc )
:
m_gc( gc )
{
}
YoutubeUpload::~YoutubeUpload()
{
// cerr << "~YoutubeUpload()" << endl;
// BackTrace();
}
void
YoutubeUpload::streamingUploadComplete()
{
cerr << "YoutubeUpload::streamingUploadComplete() m_streamToQIO:" << GetImpl(m_streamToQIO)
<< " blocking for reply" << endl;
DEBUG << "YoutubeUpload::streamingUploadComplete() blocking for reply" << endl;
QNetworkReply* reply = m_reply;
cerr << "YoutubeUpload::streamingUploadComplete() m_streamToQIO:" << GetImpl(m_streamToQIO) << " wc1" << endl;
m_streamToQIO->writingComplete();
cerr << "YoutubeUpload::streamingUploadComplete() m_streamToQIO:" << GetImpl(m_streamToQIO) << " wc2" << endl;
DEBUG << "YoutubeUpload::streamingUploadComplete() reading data..." << endl;
QByteArray ba = m_streamToQIO->readResponse();
// QByteArray ba = reply->readAll();
cerr << "YoutubeUpload::streamingUploadComplete() m_streamToQIO:" << GetImpl(m_streamToQIO)
<< " reply:" << reply->error() << endl;
DEBUG << "streamingUploadComplete() reply.err:" << reply->error() << endl;
DEBUG << "streamingUploadComplete() got reply:" << tostr(ba) << endl;
fh_domdoc dom = Factory::StringToDOM( tostr(ba) );
DOMElement* e = dom->getDocumentElement();
m_url = getMatchingAttribute( e, "link",
"rel", "self",
"href" );
m_id = XML::getChildText( firstChild( e, "yt:videoid" ));
// <?xml version="1.0" encoding="UTF-8"?>
// <entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:media="http://search.yahoo.com/mrss/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:yt="http://gdata.youtube.com/schemas/2007" gd:etag="W/"C0YMQXoycCp7ImA9WxNTFEU."">
// <id>tag:youtube.com,2008:video:jKY6tYD5s0U</id>
// <published>2009-08-16T20:53:00.498-07:00</published>
// <updated>2009-08-16T20:53:00.498-07:00</updated>
// <app:edited>2009-08-16T20:53:00.498-07:00</app:edited>
// <app:control>
// <app:draft>yes</app:draft>
// <yt:state name="processing"/>
// </app:control>
// <category scheme="http://schemas.google.com/g/2005#kind" term="http://gdata.youtube.com/schemas/2007#video"/>
// <category scheme="http://gdata.youtube.com/schemas/2007/categories.cat" term="People" label="People & Blogs"/>
// <category scheme="http://gdata.youtube.com/schemas/2007/keywords.cat" term="nothing"/>
// <title>nothing</title>
// <link rel="alternate" type="text/html" href="http://www.youtube.com/watch?v=jKY6tYD5s0U"/>
// <link rel="http://gdata.youtube.com/schemas/2007#video.responses" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/jKY6tYD5s0U/responses"/>
// <link rel="http://gdata.youtube.com/schemas/2007#video.ratings" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/jKY6tYD5s0U/ratings"/>
// <link rel="http://gdata.youtube.com/schemas/2007#video.complaints" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/jKY6tYD5s0U/complaints"/>
// <link rel="http://gdata.youtube.com/schemas/2007#video.related" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/jKY6tYD5s0U/related"/>
// <link rel="http://gdata.youtube.com/schemas/2007#video.captionTracks" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/videos/jKY6tYD5s0U/captions" yt:hasEntries="false"/>
// <link rel="http://gdata.youtube.com/schemas/2007#insight.views" type="text/html" href="http://insight.youtube.com/video-analytics/csvreports?query=jKY6tYD5s0U&type=v&starttime=1249862400000&endtime=1250467200000&region=world&token=yyT3Wb4oxV4D5VKuz1sLnroReKR8MTI1MDQ4Mjk4MA%3D%3D&hl=en_US"/>
// <link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/users/monkeyiqtesting/uploads/jKY6tYD5s0U"/>
// <link rel="edit" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/users/monkeyiqtesting/uploads/jKY6tYD5s0U"/>
// <author>
// <name>monkeyiqtesting</name>
// <uri>http://gdata.youtube.com/feeds/api/users/monkeyiqtesting</uri>
// </author>
// <gd:comments>
// <gd:feedLink href="http://gdata.youtube.com/feeds/api/videos/jKY6tYD5s0U/comments" countHint="0"/>
// </gd:comments>
// <media:group>
// <media:category label="People & Blogs" scheme="http://gdata.youtube.com/schemas/2007/categories.cat">People</media:category>
// <media:content url="http://www.youtube.com/v/jKY6tYD5s0U&f=user_uploads&d=DeKCSMvhFol1x0mvu9wlZWD9LlbsOl3qUImVMV6ramM&app=youtube_gdata" type="application/x-shockwave-flash" medium="video" isDefault="true" expression="full" yt:format="5"/>
// <media:credit role="uploader" scheme="urn:youtube">monkeyiqtesting</media:credit>
// <media:description type="plain">nothing</media:description>
// <media:keywords>nothing</media:keywords>
// <media:player url="http://www.youtube.com/watch?v=jKY6tYD5s0U"/>
// <media:title type="plain">nothing</media:title>
// <yt:uploaded>2009-08-16T20:53:00.498-07:00</yt:uploaded>
// <yt:videoid>jKY6tYD5s0U</yt:videoid>
// </media:group>
// </entry>
}
fh_iostream
YoutubeUpload::createStreamingUpload( const std::string& ContentType )
{
m_url = "";
m_id = "";
// NO X-GData-Client: <client_id>
// OK X-GData-Key: key=<developer_key>
// OK Slug: <video_filename>
// OK Authorization: AuthSub token="<authentication_token>"
// OK GData-Version: 2
// OK Content-Length: <content_length>
string devkey = (string)"key=" + m_gc->getYoutubeDevKey();
QUrl u( "http://uploads.gdata.youtube.com/feeds/api/users/default/uploads");
// u.addQueryItem("Slug", m_uploadFilename.c_str());
// u.addQueryItem("X-GData-Key", devkey.c_str());
QNetworkRequest req = m_gc->createRequest( u, "youtube", "2" );
req.setRawHeader("Slug", m_uploadFilename.c_str());
req.setRawHeader("X-GData-Key", devkey.c_str());
DEBUG << "X-GData-Key START|" << devkey << "|END" << endl;
req.setHeader(QNetworkRequest::ContentLengthHeader, tostr(m_uploadSize).c_str() );
m_streamToQIO = Factory::createStreamToQIODevice();
{
string desc = m_desc;
string title = m_title;
string keywords = m_keywords;
if( keywords.empty() )
keywords = "none";
stringstream ss;
ss << "Content-Type: application/atom+xml; charset=UTF-8\n";
ss << "\n";
ss << "<?xml version=\"1.0\"?>";
ss << "<entry xmlns=\"http://www.w3.org/2005/Atom\"\n";
ss << " xmlns:media=\"http://search.yahoo.com/mrss/\"\n";
ss << " xmlns:yt=\"http://gdata.youtube.com/schemas/2007\">\n";
ss << " <media:group>\n";
// if( m_uploadDefaultsToPrivate )
// ss << " <yt:private/>\n";
ss << " <media:title type=\"plain\">" << title << "</media:title>\n";
ss << " <media:description type=\"plain\">\n";
ss << " " << desc << "\n";
ss << " </media:description>\n";
ss << " <media:category\n";
ss << " scheme=\"http://gdata.youtube.com/schemas/2007/categories.cat\">People\n";
ss << " </media:category>\n";
ss << " <media:keywords>" << keywords << "</media:keywords>\n";
ss << " </media:group>\n";
ss << "</entry>\n";
string API_XML_request;
API_XML_request = ss.str();
m_streamToQIO->addExtraDataChunk( API_XML_request );
}
stringstream blobss;
blobss << "Content-Type: " << ContentType << "\n"
<< "Content-Transfer-Encoding: binary;";
m_streamToQIO->setContentType( "multipart/related" );
QNetworkReply* reply = m_streamToQIO->post( ::Ferris::getQNonCachingManager(),
req, blobss.str() );
m_reply = reply;
fh_iostream ret = m_streamToQIO->getStream();
return ret;
}
/****************************************/
/****************************************/
/****************************************/
namespace Factory
{
fh_GoogleClient createGoogleClient()
{
Main::processAllPendingEvents();
KDE::ensureKDEApplication();
return new GoogleClient();
}
};
/******************************************************/
/******************************************************/
/******************************************************/
GDriveFile::GDriveFile( fh_GDriveClient gd, QVariantMap dm )
: m_gd( gd )
, m_id(tostr(dm["id"]))
, m_etag(tostr(dm["etag"]))
, m_rdn(tostr(dm["originalFilename"]))
, m_mime(tostr(dm["mimeType"]))
, m_title(tostr(dm["title"]))
, m_desc(tostr(dm["description"]))
, m_earl(tostr(dm["downloadUrl"]))
, m_earlview(tostr(dm["webViewLink"]))
, m_ext(tostr(dm["fileExtension"]))
, m_md5(tostr(dm["md5checksum"]))
, m_sz(toint(tostr(dm["fileSize"])))
{
m_ctime = parseTime(tostr(dm["createdDate"]));
m_mtime = parseTime(tostr(dm["modifiedDate"]));
m_mmtime = parseTime(tostr(dm["modifiedByMeDate"]));
}
time_t
GDriveFile::parseTime( const std::string& v_const )
{
string v = v_const;
try
{
// 2013-07-26T03:51:28.238Z
v = replaceg( v, "\\.[0-9]*Z", "Z" );
return Time::toTime(Time::ParseTimeString( v ));
}
catch( ... )
{
return 0;
}
}
QNetworkRequest
GDriveFile::createRequest( const std::string& earl )
{
QNetworkRequest req( QUrl(earl.c_str()) );
req.setRawHeader("Authorization", string(string("Bearer ") + m_gd->m_accessToken).c_str() );
return req;
}
fh_istream
GDriveFile::getIStream()
{
m_gd->ensureAccessTokenFresh();
QNetworkAccessManager* qm = getQManager();
QNetworkRequest req = createRequest(m_earl);
DEBUG << "getIStream()...url:" << tostr(QString(req.url().toEncoded())) << endl;
QNetworkReply *reply = qm->get( req );
fh_istream ret = Factory::createIStreamFromQIODevice( reply );
return ret;
}
void
GDriveFile::OnStreamClosed( fh_istream& ss, std::streamsize tellp, ferris_ios::openmode m )
{
DEBUG << "GDriveFile::OnStreamClosed(top)" << endl;
m_streamToQIO->writingComplete();
QByteArray ba = m_streamToQIO->readResponse();
DEBUG << "RESULT:" << tostr(ba) << endl;
}
fh_iostream
GDriveFile::getIOStream()
{
DEBUG << "GDriveFile::getIOStream(top)" << endl;
// PUT https://www.googleapis.com/upload/drive/v2/files/fileId
stringstream earlss;
earlss << "https://www.googleapis.com/upload/drive/v2/files/" << m_id << "?"
<< "uploadType=media&"
<< "fileId=" << m_id;
QNetworkRequest req = createRequest(tostr(earlss));
req.setRawHeader( "Accept", "*/*" );
req.setRawHeader( "Connection", "" );
req.setRawHeader( "Accept-Encoding", "" );
req.setRawHeader( "Accept-Language", "" );
req.setRawHeader( "User-Agent", "" );
DEBUG << "PUT()ing main request..." << endl;
m_streamToQIO = Factory::createStreamToQIODevice();
QNetworkReply* reply = m_streamToQIO->put( ::Ferris::getQNonCachingManager(), req );
m_streamToQIO_reply = reply;
DEBUG << "preparing iostream for user..." << endl;
fh_iostream ret = m_streamToQIO->getStream();
ferris_ios::openmode m = 0;
ret->getCloseSig().connect( sigc::bind( sigc::mem_fun(*this, &_Self::OnStreamClosed ), m ));
DEBUG << "GDriveFile::getIOStream(end)" << endl;
return ret;
}
bool
GDriveFile::isDir() const
{
return m_mime == "application/vnd.google-apps.folder";
}
string
GDriveFile::DRIVE_BASE()
{
return "https://www.googleapis.com/drive/v2/";
}
QNetworkRequest
GDriveFile::addAuth( QNetworkRequest req )
{
return m_gd->addAuth( req );
}
QNetworkReply*
GDriveFile::wait(QNetworkReply* reply )
{
return getDrive()->wait( reply );
}
void
GDriveFile::updateMetadata( const std::string& key, const std::string& value )
{
stringmap_t update;
update[ key ] = value;
updateMetadata( update );
}
fh_GDriveFile
GDriveFile::createFile( const std::string& title )
{
QNetworkRequest req = createRequest(DRIVE_BASE() + "files");
req.setRawHeader("Content-Type", "application/json" );
stringmap_t update;
update["fileId"] = "";
update["title"] = title;
update["description"] = "new";
update["data"] = "";
update["mimeType"] = KDE::guessMimeType( title );
string body = stringmapToJSON( update );
DEBUG << "createFile() url:" << tostr( req.url().toEncoded() ) << endl;
DEBUG << "createFile() body:" << body << endl;
QNetworkReply* reply = getDrive()->callPost( req, stringmap_t(), body );
wait( reply );
QByteArray ba = reply->readAll();
DEBUG << "REST error code:" << reply->error() << endl;
DEBUG << "HTTP response :" << httpResponse(reply) << endl;
QVariantMap dm = JSONToQVMap( tostr(ba) );
fh_GDriveFile f = new GDriveFile( getDrive(), dm );
return f;
}
void
GDriveFile::updateMetadata( stringmap_t& update )
{
getDrive()->ensureAccessTokenFresh();
// PATCH https://www.googleapis.com/drive/v2/files/fileId
QUrl u( string(DRIVE_BASE() + "files/" + m_id).c_str() );
QNetworkRequest req;
req.setUrl( u );
DEBUG << "u1.str::" << tostr(req.url().toString()) << endl;
req.setRawHeader("Content-Type", "application/json" );
req = addAuth( req );
DEBUG << "u2.str::" << tostr(req.url().toString()) << endl;
std::string json = stringmapToJSON( update );
DEBUG << " json:" << json << endl;
QBuffer* buf = new QBuffer(new QByteArray(json.c_str()));
QNetworkReply* reply = getQManager()->sendCustomRequest( req, "PATCH", buf );
wait( reply );
QByteArray ba = reply->readAll();
DEBUG << "REST error code:" << reply->error() << endl;
DEBUG << "HTTP response :" << httpResponse(reply) << endl;
DEBUG << "result:" << tostr(ba) << endl;
stringmap_t sm = JSONToStringMap( tostr(ba) );
fh_stringstream ess;
for( stringmap_t::iterator iter = update.begin(); iter != update.end(); ++iter )
{
DEBUG << "iter->first:" << iter->first << endl;
DEBUG << "iter->second:" << iter->second << endl;
DEBUG << " got:" << sm[iter->first] << endl;
if( sm[iter->first] != iter->second )
{
ess << "attribute " << iter->first << " not correct." << endl;
ess << "expected:" << iter->second << endl;
ess << " got:" << sm[iter->first] << endl;
}
}
string e = tostr(ess);
DEBUG << "e:" << e << endl;
if( !e.empty() )
{
Throw_WebAPIException( e, 0 );
}
}
GDrivePermissions_t
GDriveFile::readPermissions()
{
GDrivePermissions_t ret;
QNetworkRequest req = createRequest(DRIVE_BASE() + "files/" + m_id + "/permissions");
req.setRawHeader("Content-Type", "application/json" );
stringmap_t args;
args["fileId"] = m_id;
QNetworkReply* reply = getDrive()->callMeth( req, args );
QByteArray ba = reply->readAll();
DEBUG << "readPermissions() REST error code:" << reply->error() << endl;
DEBUG << "readPermissions() HTTP response :" << httpResponse(reply) << endl;
DEBUG << "readPermissions() RESULT:" << tostr(ba) << endl;
QVariantMap qm = JSONToQVMap( tostr(ba) );
QVariantList l = qm["items"].toList();
foreach (QVariant ding, l)
{
QVariantMap dm = ding.toMap();
int perm = GDrivePermission::NONE;
if( dm["role"] == "reader" )
perm = GDrivePermission::READ;
if( dm["role"] == "writer" || dm["role"] == "owner" )
perm = GDrivePermission::WRITE;
fh_GDrivePermission p = new GDrivePermission( perm, tostr(dm["name"]));
ret.push_back(p);
}
return ret;
}
void
GDriveFile::sharesAdd( std::string email )
{
stringlist_t emails;
emails.push_back( email );
return sharesAdd( emails );
}
void
GDriveFile::sharesAdd( stringlist_t& emails )
{
// POST https://www.googleapis.com/drive/v2/files/fileId/permissions
for( stringlist_t::iterator si = emails.begin(); si != emails.end(); ++si )
{
string email = *si;
QNetworkRequest req = createRequest(DRIVE_BASE() + "files/" + m_id + "/permissions");
req.setRawHeader("Content-Type", "application/json" );
stringmap_t args;
args["fileId"] = m_id;
args["emailMessage"] = "Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.";
stringstream bodyss;
bodyss << "{" << endl
<< " \"kind\": \"drive#permission\", " << endl
<< " \"value\": \"" << email << "\" , " << endl
<< " \"role\": \"writer\"," << endl
<< " \"type\": \"user\"" << endl
<< " } " << endl;
DEBUG << "body:" << tostr(bodyss) << endl;
QNetworkReply* reply = getDrive()->callPost( req, args, tostr(bodyss) );
QByteArray ba = reply->readAll();
DEBUG << "sharesAdd() REST error code:" << reply->error() << endl;
DEBUG << "sharesAdd() HTTP response :" << httpResponse(reply) << endl;
DEBUG << "sharesAdd() RESULT:" << tostr(ba) << endl;
stringmap_t sm = JSONToStringMap( tostr(ba) );
if( !sm["etag"].empty() && !sm["id"].empty() )
continue;
// Failed
stringstream ess;
ess << "Failed to create permission for user:" << email << endl
<< " reply:" << tostr(ba) << endl;
Throw_WebAPIException( tostr(ess), 0 );
}
}
/********************/
GDriveClient::GDriveClient()
: m_clientID( "881964254376.apps.googleusercontent.com" )
, m_secret( "UH9zxZ8k_Fj3actLPRVPVG8Q" )
{
readAuthTokens();
}
void
GDriveClient::readAuthTokens()
{
m_accessToken = getConfigString( FDB_SECURE, "gdrive-access-token", "" );
m_refreshToken = getConfigString( FDB_SECURE, "gdrive-refresh-token", "" );
m_accessToken_expiretime = toType<time_t>(
getConfigString( FDB_SECURE,
"gdrive-access-token-expires-timet", "0"));
}
std::string
GDriveClient::AUTH_BASE()
{
return "https://accounts.google.com/o/oauth2/";
}
fh_GDriveClient
GDriveClient::getGDriveClient()
{
Main::processAllPendingEvents();
KDE::ensureKDEApplication();
static fh_GDriveClient ret = new GDriveClient();
return ret;
}
bool
GDriveClient::haveAPIKey() const
{
return !m_clientID.empty() && !m_secret.empty();
}
bool
GDriveClient::isAuthenticated() const
{
return !m_accessToken.empty() && !m_refreshToken.empty();
}
void
GDriveClient::handleFinished()
{
QNetworkReply* r = dynamic_cast<QNetworkReply*>(sender());
m_waiter.unblock(r);
DEBUG << "handleFinished() r:" << r << endl;
}
QNetworkReply*
GDriveClient::wait(QNetworkReply* reply )
{
connect( reply, SIGNAL( finished() ), SLOT( handleFinished() ) );
m_waiter.block(reply);
return reply;
}
QNetworkReply*
GDriveClient::post( QNetworkRequest req )
{
QUrl u = req.url();
DEBUG << "u.str::" << tostr(u.toString()) << endl;
string body = tostr(u.encodedQuery());
DEBUG << "body:" << body << endl;
u.setEncodedQuery(QByteArray());
// u.setUrl( "http://localhost/testing" );
req.setHeader( QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded" );
req.setHeader(QNetworkRequest::ContentLengthHeader, tostr(body.size()).c_str() );
QNetworkReply* reply = getQManager()->post( req, body.c_str() );
connect( reply, SIGNAL( finished() ), SLOT( handleFinished() ) );
m_waiter.block(reply);
DEBUG << "REST error code:" << reply->error() << endl;
return reply;
}
std::string
GDriveClient::requestToken( stringmap_t args )
{
QUrl u( string(AUTH_BASE() + "auth").c_str() );
u.addQueryItem("response_type", "code" );
u.addQueryItem("client_id", m_clientID.c_str() );
u.addQueryItem("redirect_uri", "urn:ietf:wg:oauth:2.0:oob" );
u.addQueryItem("scope", "https://www.googleapis.com/auth/drive.file "
"https://www.googleapis.com/auth/drive "
"https://www.googleapis.com/auth/drive.scripts "
"https://www.googleapis.com/auth/drive.appdata " );
u.addQueryItem("state", "anyone... anyone?" );
std::string authURL = tostr( u.toEncoded() );
return authURL;
}
void
GDriveClient::accessToken( const std::string& code, stringmap_t args )
{
QUrl u( string(AUTH_BASE() + "token").c_str() );
QNetworkRequest req;
req.setUrl( u );
args["code"] = code;
args["client_id"] = m_clientID;
args["client_secret"] = m_secret;
args["redirect_uri"] = "urn:ietf:wg:oauth:2.0:oob";
args["grant_type"] = "authorization_code";
DEBUG << "u1.str::" << tostr(req.url().toString()) << endl;
req = setArgs( req, args );
DEBUG << "u2.str::" << tostr(req.url().toString()) << endl;
QNetworkReply* reply = post( req );
QByteArray ba = reply->readAll();
cerr << "result:" << tostr(ba) << endl;
stringmap_t sm = JSONToStringMap( tostr(ba) );
time_t expiretime = Time::getTime() + toint(sm["expires_in"]);
setConfigString( FDB_SECURE, "gdrive-access-token", sm["access_token"] );
setConfigString( FDB_SECURE, "gdrive-refresh-token", sm["refresh_token"] );
setConfigString( FDB_SECURE, "gdrive-access-token-expires-timet", tostr(expiretime) );
readAuthTokens();
}
void
GDriveClient::ensureAccessTokenFresh( int force )
{
if( !isAuthenticated() )
return;
if( !force )
{
if( Time::getTime() + 30 < m_accessToken_expiretime )
return;
}
DEBUG << "ensureAccessTokenFresh() really doing it!" << endl;
QUrl u( string(AUTH_BASE() + "token").c_str() );
QNetworkRequest req;
req.setUrl( u );
stringmap_t args;
args["refresh_token"] = m_refreshToken;
args["client_id"] = m_clientID;
args["client_secret"] = m_secret;
args["grant_type"] = "refresh_token";
req = setArgs( req, args );
QNetworkReply* reply = post( req );
cerr << "ensureAccessTokenFresh() have reply..." << endl;
QByteArray ba = reply->readAll();
cerr << "ensureAccessTokenFresh(b) m_accessToken:" << m_accessToken << endl;
cerr << "ensureAccessTokenFresh() result:" << tostr(ba) << endl;
stringmap_t sm = JSONToStringMap( tostr(ba) );
time_t expiretime = Time::getTime() + toint(sm["expires_in"]);
setConfigString( FDB_SECURE, "gdrive-access-token", sm["access_token"] );
setConfigString( FDB_SECURE, "gdrive-access-token-expires-timet", tostr(expiretime) );
readAuthTokens();
cerr << "ensureAccessTokenFresh(e) m_accessToken:" << m_accessToken << endl;
}
QNetworkRequest
GDriveClient::addAuth( QNetworkRequest req )
{
req.setRawHeader("Authorization", string(string("Bearer ") + m_accessToken).c_str() );
return req;
}
QNetworkReply*
GDriveClient::callMeth( QNetworkRequest req, stringmap_t args )
{
ensureAccessTokenFresh();
req = setArgs( req, args );
req = addAuth( req );
QUrl u = req.url();
DEBUG << "callMeth U:" << tostr(QString(u.toEncoded())) << endl;
// u.setUrl( "http://localhost/testing" );
// req.setUrl(u);
QNetworkReply* reply = getQManager()->get( req );
connect( reply, SIGNAL( finished() ), SLOT( handleFinished() ) );
m_waiter.block(reply);
DEBUG << "REST error code:" << reply->error() << endl;
return reply;
}
QNetworkReply*
GDriveClient::callPost( QNetworkRequest req, stringmap_t args, const std::string& body )
{
ensureAccessTokenFresh();
req = setArgs( req, args );
req = addAuth( req );
QUrl u = req.url();
DEBUG << "callPost U:" << tostr(QString(u.toEncoded())) << endl;
DEBUG << " body:" << body << endl;
QBuffer* buf = new QBuffer(new QByteArray(body.c_str()));
QNetworkReply* reply = getQManager()->post( req, buf );
connect( reply, SIGNAL( finished() ), SLOT( handleFinished() ) );
m_waiter.block(reply);
DEBUG << "REST error code:" << reply->error() << endl;
return reply;
}
string
GDriveClient::DRIVE_BASE()
{
return "https://www.googleapis.com/drive/v2/";
}
QNetworkRequest
GDriveClient::createRequest( const std::string& earlTail )
{
QUrl u( string(DRIVE_BASE() + earlTail).c_str() );
QNetworkRequest req;
req.setUrl( u );
return req;
}
files_t
GDriveClient::filesList( const std::string& q_const, const std::string& pageToken )
{
string q = q_const;
if( q.empty() )
{
q = "hidden = false and trashed = false";
}
files_t ret;
// QNetworkRequest req = createRequest("files/root/children");
QNetworkRequest req = createRequest("files");
stringmap_t args;
args["maxResults"] = tostr(1000);
if( !pageToken.empty() )
args["pageToken"] = pageToken;
if( !q.empty() )
args["q"] = q;
QNetworkReply* reply = callMeth( req, args );
QByteArray ba = reply->readAll();
DEBUG << "filesList() result:" << tostr(ba) << endl;
stringmap_t sm = JSONToStringMap( tostr(ba) );
DEBUG << "etag:" << sm["etag"] << endl;
QVariantMap qm = JSONToQVMap( tostr(ba) );
QVariantList l = qm["items"].toList();
foreach (QVariant ding, l)
{
QVariantMap dm = ding.toMap();
string rdn = tostr(dm["originalFilename"]);
long sz = toint(tostr(dm["fileSize"]));
QVariantMap labels = dm["labels"].toMap();
if( labels["hidden"].toInt() || labels["trashed"].toInt() )
continue;
bool skipThisOne = false;
QVariantList parents = dm["parents"].toList();
foreach (QVariant pv, parents)
{
QVariantMap pm = pv.toMap();
if( !pm["isRoot"].toInt() )
{
skipThisOne = 1;
break;
}
}
if( dm["userPermission"].toMap()["role"] != "owner" )
skipThisOne = true;
if( skipThisOne )
continue;
DEBUG << "sz:" << sz << " fn:" << rdn << endl;
fh_GDriveFile f = new GDriveFile( this, dm );
ret.push_back(f);
}
return ret;
}
/****************************************/
/****************************************/
/****************************************/
};
| monkeyiq/ferris | plugins/context/libferrisgoogle_shared.cpp | C++ | gpl-3.0 | 87,216 |
//
// This file is part of Return To The Roots.
//
// Return To The Roots 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.
//
// Return To The Roots 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 Return To The Roots. If not, see <http://www.gnu.org/licenses/>.
#include "rttrDefines.h" // IWYU pragma: keep
#include "LanGameInfo.h"
#include "s25util/Serializer.h"
bool LanGameInfo::Serialize(Serializer& serializer)
{
if(name.size() > 64)
name.resize(64);
if(map.size() > 64)
map.resize(64);
if(version.size() > 16)
version.resize(16);
serializer.PushString(name);
serializer.PushBool(hasPwd);
serializer.PushString(map);
serializer.PushUnsignedChar(curNumPlayers);
serializer.PushUnsignedChar(maxNumPlayers);
serializer.PushUnsignedShort(port);
serializer.PushBool(isIPv6);
serializer.PushString(version);
serializer.PushString(revision);
return true;
}
bool LanGameInfo::Deserialize(Serializer& serializer)
{
name = serializer.PopString();
hasPwd = serializer.PopBool();
map = serializer.PopString();
curNumPlayers = serializer.PopUnsignedChar();
maxNumPlayers = serializer.PopUnsignedChar();
port = serializer.PopUnsignedShort();
isIPv6 = serializer.PopBool();
version = serializer.PopString();
revision = serializer.PopString();
return true;
}
| stefson/s25client | libs/s25main/gameTypes/LanGameInfo.cpp | C++ | gpl-3.0 | 1,822 |
<?php
/*
publicacion_miniatura.php
Una publicacion en miniatura
*/
/*
Created on : 23/04/2015, 14:40:40
Author : Juan Manuel Scarciofolo
License : GPLv3
*/
?>
<div class="publicacion_miniatura">
<h2><?php print $producto->getDescripcion(); ?></h2>
<p>
<?php
$img = $producto->getImagenes();
for ($index = 0; $index < 3; $index++) {
if (!empty($img[$index]['imagen'])) {
break;
}
}
print getImagen($img[$index]['imagen'], 'img_preview img_preview_left');
print extractoTexto($producto->getResumen());
?>
</p>
</div> | scarfive/mercadosocialmdq | publicacion_miniatura.php | PHP | gpl-3.0 | 727 |
require 'package'
class Aspell_fr < Package
description 'French Aspell Dictionary'
homepage 'https://ftpmirror.gnu.org/aspell/dict/0index.html'
version '0.50-3'
source_url 'https://ftpmirror.gnu.org/aspell/dict/fr/aspell-fr-0.50-3.tar.bz2'
source_sha256 'f9421047519d2af9a7a466e4336f6e6ea55206b356cd33c8bd18cb626bf2ce91'
binary_url ({
aarch64: 'https://dl.bintray.com/chromebrew/chromebrew/aspell_fr-0.50-3-chromeos-armv7l.tar.xz',
armv7l: 'https://dl.bintray.com/chromebrew/chromebrew/aspell_fr-0.50-3-chromeos-armv7l.tar.xz',
i686: 'https://dl.bintray.com/chromebrew/chromebrew/aspell_fr-0.50-3-chromeos-i686.tar.xz',
x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/aspell_fr-0.50-3-chromeos-x86_64.tar.xz',
})
binary_sha256 ({
aarch64: 'c109f726e0a3a7e708a6c8fb4cb1cd7f84d0486fa352c141ce5f70817651efc7',
armv7l: 'c109f726e0a3a7e708a6c8fb4cb1cd7f84d0486fa352c141ce5f70817651efc7',
i686: '3a466ebca6ea8267b2ba5e5bcda9b1e15869f11d144b2c282dc5ff40a37d7364',
x86_64: '8ffcc409bf5c6e4a142b68d027498942788535f8025927de23efa477e1a7d2c1',
})
depends_on 'aspell'
def self.build
system './configure'
system 'make'
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
| chromebrew/chromebrew-test | packages/aspell_fr.rb | Ruby | gpl-3.0 | 1,281 |
require_relative '../core_ext/array'
require_relative '../core_ext/hash'
require_relative 'host'
require_relative 'command'
require_relative 'command_map'
require_relative 'configuration'
require_relative 'coordinator'
require_relative 'logger'
require_relative 'log_message'
require_relative 'formatters/abstract'
require_relative 'formatters/black_hole'
require_relative 'formatters/pretty'
require_relative 'formatters/dot'
require_relative 'runners/abstract'
require_relative 'runners/sequential'
require_relative 'runners/parallel'
require_relative 'runners/group'
require_relative 'runners/null'
require_relative 'backends/abstract'
require_relative 'backends/printer'
require_relative 'backends/netssh'
require_relative 'backends/local'
require_relative 'backends/skipper'
| mattbrictson/sshkit | lib/sshkit/all.rb | Ruby | gpl-3.0 | 786 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
add word counts to Cornetto lexical units database file
The word count file should have three columns, delimited by white space,
containing (1) the count, (2) the lemma, (3) the main POS tag.
The tagset is assumed to be the Spoken Dutch Corpus tagset,
and the character encoding must be ISO-8859-1.
The counts appear as the value of the feature "count" on <form> elements.
The updated lexical units xml database is written to standard output.
Since we have only the lemma and the POS, and no word sense, the frequency
information is added to each matching lexical unit regardless of its sense
(i.e. the value of the "c_seq_nr" attribute).
"""
# TODO:
# - deal with multiword counts
__author__ = 'Erwin Marsi <[email protected]>'
__version__ = '0.6'
from sys import stderr, stdout
from xml.etree.cElementTree import iterparse, SubElement, tostring, ElementTree
from cornetto.argparse import ArgumentParser, RawDescriptionHelpFormatter
def read_counts(file):
if not hasattr(file, "read"):
file = open(file)
counts = {}
totals = dict(noun=0, verb=0, adj=0, other=0)
for l in file:
try:
count, form, tag = l.strip().split()
except ValueError:
stderr.write("Warning; ill-formed line: %s\n" % repr(l))
continue
# translate CGN tagset to word category
if tag in ("N", "VNW", "TW", "SPEC"):
cat = "noun"
elif tag in ("WW"):
cat = "verb"
elif tag in ("ADJ", "BW"):
cat = "adj"
else:
# LET LID TSW VG VZ
cat = "other"
# Cornetto word forms are stored in unicode
form = form.decode("iso-8859-1")
count = int(count)
if form not in counts:
counts[form] = dict(noun=0, verb=0, adj=0, other=0)
counts[form][cat] += count
totals[cat] += count
return counts, totals
def add_count_attrib(counts, totals, cdb_lu_file):
parser = iterparse(cdb_lu_file)
for event, elem in parser:
if elem.tag == "form":
# following the ElementTree conventions,
# word form will be ascii or unicode
form = elem.get("form-spelling")
# lower case because Cornette is not consistent
cat = elem.get("form-cat").lower()
# fix category flaws in current release of Cornetto
if cat == "adjective":
cat = "adj"
elif cat == "adverb":
cat = "other"
try:
count = counts[form][cat]
except KeyError:
# form not found
count = 0
elem.set("count", str(count))
# Finally, add totals, per category and overall, to the doc root
# Note that all words _not_ in Cornetto are not included in these totals
totals["all"] = sum(totals.values())
for cat, count in totals.items():
parser.root.set("count-total-%s" % cat, str(count))
return ElementTree(parser.root)
parser = ArgumentParser(description=__doc__,
version="%(prog)s version " + __version__,
formatter_class=RawDescriptionHelpFormatter)
parser.add_argument("cdb_lu", type=file,
help="xml file containing the lexical units")
parser.add_argument("word_counts", type=file,
help="tabular file containing the word counts")
args = parser.parse_args()
counts, totals = read_counts(args.word_counts)
etree = add_count_attrib(counts, totals, args.cdb_lu)
etree.write(stdout, encoding="utf-8")
#def add_statistics_elem(counts, cdb_lu_file):
#"""
#adds a separate <statistics> element,
#which accomodates for other counts for other sources
#"""
#parser = iterparse(cdb_lu_file)
#for event, elem in parser:
#if elem.tag == "cdb_lu":
#try:
#count = counts[form][cat]
#except KeyError:
#count = 0
#freq_el = SubElement(elem, "statistics")
#SubElement(freq_el, "count", scr="uvt").text = str(count)
#elif elem.tag == "form":
## following the ElementTree conventions,
## word form will be ascii or unicode
#form = elem.get("form-spelling")
#cat = elem.get("form-cat")
#return ElementTree(parser.root)
| emsrc/pycornetto | bin/cornetto-add-counts.py | Python | gpl-3.0 | 4,585 |
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.stt.data.jpa.service;
import com.stt.data.jpa.domain.City;
import com.stt.data.jpa.domain.Hotel;
import com.stt.data.jpa.domain.HotelSummary;
import com.stt.data.jpa.domain.RatingCount;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import java.util.List;
interface HotelRepository extends Repository<Hotel, Long> {
Hotel findByCityAndName(City city, String name);
@Query("select h.city as city, h.name as name, avg(r.rating) as averageRating "
+ "from Hotel h left outer join h.reviews r where h.city = ?1 group by h")
Page<HotelSummary> findByCity(City city, Pageable pageable);
@Query("select r.rating as rating, count(r) as count "
+ "from Review r where r.hotel = ?1 group by r.rating order by r.rating DESC")
List<RatingCount> findRatingCounts(Hotel hotel);
}
| shitongtong/libraryManage | spring-boot-demo/data-jpa/src/main/java/com/stt/data/jpa/service/HotelRepository.java | Java | gpl-3.0 | 1,574 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>png++: index_pixel.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">png++ <span id="projectnumber">0.2.1</span></div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<div class="title">index_pixel.hpp</div> </div>
</div>
<div class="contents">
<a href="index__pixel_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2007,2008 Alex Shulgin</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * This file is part of png++ the C++ wrapper for libpng. PNG++ is free</span>
<a name="l00005"></a>00005 <span class="comment"> * software; the exact copying conditions are as follows:</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00008"></a>00008 <span class="comment"> * modification, are permitted provided that the following conditions are met:</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * 1. Redistributions of source code must retain the above copyright notice,</span>
<a name="l00011"></a>00011 <span class="comment"> * this list of conditions and the following disclaimer.</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00014"></a>00014 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span>
<a name="l00015"></a>00015 <span class="comment"> * documentation and/or other materials provided with the distribution.</span>
<a name="l00016"></a>00016 <span class="comment"> *</span>
<a name="l00017"></a>00017 <span class="comment"> * 3. The name of the author may not be used to endorse or promote products</span>
<a name="l00018"></a>00018 <span class="comment"> * derived from this software without specific prior written permission.</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR</span>
<a name="l00021"></a>00021 <span class="comment"> * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</span>
<a name="l00022"></a>00022 <span class="comment"> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN</span>
<a name="l00023"></a>00023 <span class="comment"> * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
<a name="l00024"></a>00024 <span class="comment"> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED</span>
<a name="l00025"></a>00025 <span class="comment"> * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR</span>
<a name="l00026"></a>00026 <span class="comment"> * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF</span>
<a name="l00027"></a>00027 <span class="comment"> * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING</span>
<a name="l00028"></a>00028 <span class="comment"> * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span>
<a name="l00029"></a>00029 <span class="comment"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00030"></a>00030 <span class="comment"> */</span>
<a name="l00031"></a>00031 <span class="preprocessor">#ifndef PNGPP_INDEX_PIXEL_HPP_INCLUDED</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define PNGPP_INDEX_PIXEL_HPP_INCLUDED</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="preprocessor">#include "<a class="code" href="types_8hpp.html">types.hpp</a>"</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include "<a class="code" href="packed__pixel_8hpp.html">packed_pixel.hpp</a>"</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include "<a class="code" href="pixel__traits_8hpp.html">pixel_traits.hpp</a>"</span>
<a name="l00037"></a>00037
<a name="l00038"></a>00038 <span class="keyword">namespace </span>png
<a name="l00039"></a>00039 {
<a name="l00040"></a>00040
<a name="l00044"></a><a class="code" href="classpng_1_1index__pixel.html">00044</a> <span class="keyword">class </span><a class="code" href="classpng_1_1index__pixel.html" title="The 8-bit Indexed (colormap) pixel type.">index_pixel</a>
<a name="l00045"></a>00045 {
<a name="l00046"></a>00046 <span class="keyword">public</span>:
<a name="l00047"></a><a class="code" href="classpng_1_1index__pixel.html#a16519149701f54c24cc9e09ac033d1b6">00047</a> <a class="code" href="classpng_1_1index__pixel.html#a16519149701f54c24cc9e09ac033d1b6">index_pixel</a>(<a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a> index = 0)
<a name="l00048"></a>00048 : m_index(index)
<a name="l00049"></a>00049 {
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051
<a name="l00052"></a><a class="code" href="classpng_1_1index__pixel.html#acbd240869e0002e145ed1dc1ad11ab52">00052</a> <a class="code" href="classpng_1_1index__pixel.html#acbd240869e0002e145ed1dc1ad11ab52">operator byte</a>()<span class="keyword"> const</span>
<a name="l00053"></a>00053 <span class="keyword"> </span>{
<a name="l00054"></a>00054 <span class="keywordflow">return</span> m_index;
<a name="l00055"></a>00055 }
<a name="l00056"></a>00056
<a name="l00057"></a>00057 <span class="keyword">private</span>:
<a name="l00058"></a>00058 <a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a> m_index;
<a name="l00059"></a>00059 };
<a name="l00060"></a>00060
<a name="l00065"></a>00065 <span class="keyword">template</span>< <span class="keywordtype">size_t</span> bits >
<a name="l00066"></a><a class="code" href="classpng_1_1packed__index__pixel.html">00066</a> <span class="keyword">class </span><a class="code" href="classpng_1_1packed__index__pixel.html" title="The packed indexed pixel class template. The available specializations are for 1-, 2- and 4-bit pixels.">packed_index_pixel</a>
<a name="l00067"></a>00067 : <span class="keyword">public</span> <a class="code" href="classpng_1_1packed__pixel.html" title="The packed pixel class template.">packed_pixel</a>< bits >
<a name="l00068"></a>00068 {
<a name="l00069"></a>00069 <span class="keyword">public</span>:
<a name="l00070"></a><a class="code" href="classpng_1_1packed__index__pixel.html#af2998b19cb86caaf0c02c0718638cfa9">00070</a> <a class="code" href="classpng_1_1packed__index__pixel.html#af2998b19cb86caaf0c02c0718638cfa9">packed_index_pixel</a>(<a class="code" href="namespacepng.html#ac0e0e2e09bdd9a287618bfdc5f31ca52">byte</a> value = 0)
<a name="l00071"></a>00071 : <a class="code" href="classpng_1_1packed__pixel.html" title="The packed pixel class template.">packed_pixel</a>< bits >(value)
<a name="l00072"></a>00072 {
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074 };
<a name="l00075"></a>00075
<a name="l00079"></a><a class="code" href="namespacepng.html#ad9bcd36130a08ef57f572cd8f5589ba5">00079</a> <span class="keyword">typedef</span> <a class="code" href="classpng_1_1packed__index__pixel.html" title="The packed indexed pixel class template. The available specializations are for 1-, 2- and 4-bit pixels.">packed_index_pixel< 1 ></a> <a class="code" href="namespacepng.html#ad9bcd36130a08ef57f572cd8f5589ba5" title="The 1-bit Indexed pixel type.">index_pixel_1</a>;
<a name="l00080"></a>00080
<a name="l00084"></a><a class="code" href="namespacepng.html#ab8275ae7a6deacae66e45e38a6493b7f">00084</a> <span class="keyword">typedef</span> <a class="code" href="classpng_1_1packed__index__pixel.html" title="The packed indexed pixel class template. The available specializations are for 1-, 2- and 4-bit pixels.">packed_index_pixel< 2 ></a> <a class="code" href="namespacepng.html#ab8275ae7a6deacae66e45e38a6493b7f" title="The 1-bit Indexed pixel type.">index_pixel_2</a>;
<a name="l00085"></a>00085
<a name="l00089"></a><a class="code" href="namespacepng.html#a303ec6fdaacd846547a7992d3bd84c29">00089</a> <span class="keyword">typedef</span> <a class="code" href="classpng_1_1packed__index__pixel.html" title="The packed indexed pixel class template. The available specializations are for 1-, 2- and 4-bit pixels.">packed_index_pixel< 4 ></a> <a class="code" href="namespacepng.html#a303ec6fdaacd846547a7992d3bd84c29" title="The 1-bit Indexed pixel type.">index_pixel_4</a>;
<a name="l00090"></a>00090
<a name="l00094"></a>00094 <span class="keyword">template</span><>
<a name="l00095"></a><a class="code" href="structpng_1_1pixel__traits_3_01index__pixel_01_4.html">00095</a> <span class="keyword">struct </span>pixel_traits< <a class="code" href="classpng_1_1index__pixel.html" title="The 8-bit Indexed (colormap) pixel type.">index_pixel</a> >
<a name="l00096"></a>00096 : <a class="code" href="structpng_1_1basic__pixel__traits.html" title="Basic pixel traits class template.">basic_pixel_traits</a>< index_pixel, byte, color_type_palette >
<a name="l00097"></a>00097 {
<a name="l00098"></a>00098 };
<a name="l00099"></a>00099
<a name="l00103"></a>00103 <span class="keyword">template</span>< <span class="keywordtype">size_t</span> bits >
<a name="l00104"></a><a class="code" href="structpng_1_1pixel__traits_3_01packed__index__pixel_3_01bits_01_4_01_4.html">00104</a> <span class="keyword">struct </span>pixel_traits< <a class="code" href="classpng_1_1packed__index__pixel.html" title="The packed indexed pixel class template. The available specializations are for 1-, 2- and 4-bit pixels.">packed_index_pixel</a>< bits > >
<a name="l00105"></a>00105 : <a class="code" href="structpng_1_1basic__pixel__traits.html" title="Basic pixel traits class template.">basic_pixel_traits</a>< packed_index_pixel< bits >, byte,
<a name="l00106"></a>00106 color_type_palette, <span class="comment">/* channels = */</span> 1, bits >
<a name="l00107"></a>00107 {
<a name="l00108"></a>00108 };
<a name="l00109"></a>00109
<a name="l00110"></a>00110 } <span class="comment">// namespace png</span>
<a name="l00111"></a>00111
<a name="l00112"></a>00112 <span class="preprocessor">#endif // PNGPP_INDEX_PIXEL_HPP_INCLUDED</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Thu Apr 21 2011 22:55:12 for png++ by 
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>
| Nvveen/First-Sight | lib/png++/doc/html/index__pixel_8hpp_source.html | HTML | gpl-3.0 | 12,270 |
---------------------------------------------
-- Pleiades Ray
--
-- Description: Fires a magical ray at nearby targets. Additional effects: Paralysis + Blind + Poison + Plague + Bind + Silence + Slow
-- Type: Magical
-- Utsusemi/Blink absorb: Wipes shadows
-- Range: Unknown
-- Notes: Only used by Gurfurlur the Menacing with health below 20%.
---------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
return 0;
end;
function onMobWeaponSkill(target, mob, skill)
local duration = 120;
MobStatusEffectMove(mob, target, EFFECT_PARALYSIS, 40, 3, duration);
MobStatusEffectMove(mob, target, EFFECT_AMNESIA, 40, 3, duration);
MobStatusEffectMove(mob, target, EFFECT_ADDLE, 10, 3, duration);
MobStatusEffectMove(mob, target, EFFECT_PLAGUE, 5, 3, duration);
MobStatusEffectMove(mob, target, EFFECT_CURSE_I, 1, 3, duration);
MobStatusEffectMove(mob, target, EFFECT_SILENCE, 1, 3, duration);
MobStatusEffectMove(mob, target, EFFECT_SLOW, 128, 3, duration);
local dmgmod = 1.2;
local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*7,ELE_FIRE,dmgmod,TP_NO_EFFECT);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_MAGICAL,MOBPARAM_FIRE,MOBPARAM_WIPE_SHADOWS);
target:delHP(dmg);
return dmg;
end;
| bnetcc/darkstar | scripts/globals/mobskills/eternal_misery_custom.lua | Lua | gpl-3.0 | 1,431 |
# Copyright © 2016 Lars Peter Søndergaard <[email protected]>
# Copyright © 2016 FichteFoll <[email protected]>
#
# This file is part of Shanghai, an asynchronous multi-server IRC bot.
#
# Shanghai 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.
#
# Shanghai 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 Shanghai. If not, see <http://www.gnu.org/licenses/>.
import asyncio
from unittest import mock
import pytest
from shanghai import event
from shanghai.logging import Logger, get_logger, LogLevels
# use this when debug log output is desired
debug_logger = get_logger('logging', 'debug')
debug_logger.setLevel(LogLevels.DDEBUG)
@pytest.fixture
def loop():
return asyncio.get_event_loop()
@pytest.fixture
def evt():
return event.build_event("event")
# base class to subclass for an actual plugin
class BasePlugin:
pass
@pytest.fixture
def sample_plugin():
class TestPlugin(BasePlugin):
@event.event
def on_test(self):
pass
return TestPlugin
class TestPriority:
def test_type(self):
assert isinstance(event.Priority.DEFAULT, int)
def test_order(self):
assert (event.Priority.PRE_CORE
> event.Priority.CORE
> event.Priority.POST_CORE
> event.Priority.PRE_DEFAULT
> event.Priority.DEFAULT
> event.Priority.POST_DEFAULT)
def test_lookup(self):
assert event.Priority.lookup(event.Priority.CORE) is event.Priority.CORE
assert event.Priority.lookup(event.Priority.CORE.value) is event.Priority.CORE
assert event.Priority.lookup(-12312412) == -12312412
class TestEvent:
def test_build_event(self):
evt = event.build_event("evt_name", arg1="val1", arg2=None)
assert evt.name == "evt_name"
assert evt.args == {'arg1': "val1", 'arg2': None}
class TestPrioritizedSetList:
def test_bool(self):
prio_set_list = event._PrioritizedSetList()
assert bool(prio_set_list) is False
prio_set_list.add(0, None)
assert bool(prio_set_list) is True
def test_add(self):
prio_set_list = event._PrioritizedSetList()
objs = [(i,) for i in range(5)]
prio_set_list.add(0, objs[0])
assert prio_set_list.list == [(0, {objs[0]})]
prio_set_list.add(0, objs[1])
assert prio_set_list.list == [(0, {objs[0], objs[1]})]
prio_set_list.add(10, objs[2])
assert prio_set_list.list == [(10, {objs[2]}),
(0, {objs[0], objs[1]})]
prio_set_list.add(-10, objs[3])
assert prio_set_list.list == [( 10, {objs[2]}), # noqa: E201
( 0, {objs[0], objs[1]}), # noqa: E201
(-10, {objs[3]})]
prio_set_list.add(-1, objs[4])
assert prio_set_list.list == [( 10, {objs[2]}), # noqa: E201
( 0, {objs[0], objs[1]}), # noqa: E201
( -1, {objs[4]}), # noqa: E201
(-10, {objs[3]})]
def test_add_already_added(self):
prio_set_list = event._PrioritizedSetList()
obj = object()
prio_set_list.add(0, obj)
with pytest.raises(ValueError) as excinfo:
prio_set_list.add(0, obj)
excinfo.match(r"has already been added")
with pytest.raises(ValueError) as excinfo:
prio_set_list.add(1, obj)
excinfo.match(r"has already been added")
def test_contains(self):
prio_set_list = event._PrioritizedSetList()
obj = object()
prio_set_list.add(0, obj)
assert obj in prio_set_list
def test_iter(self):
prio_set_list = event._PrioritizedSetList()
objs = [(i,) for i in range(5)]
for i, obj in enumerate(objs):
prio_set_list.add(-i, obj)
for i, set_ in enumerate(prio_set_list):
assert set_ == (-i, {objs[i]})
def test_remove(self):
prio_set_list = event._PrioritizedSetList()
obj = (1,)
prio_set_list.add(1, obj)
assert prio_set_list
prio_set_list.remove(obj)
assert not prio_set_list
with pytest.raises(ValueError) as excinfo:
prio_set_list.remove(obj)
excinfo.match(r"can not be found")
# Skipping HandlerInfo tests
# since that is only to be used with the `event` decorator anyway.
class TestEventDecorator:
def test_no_param_usage(self):
@event.event
def func_name(self):
pass
@event.event
def on_test(self):
pass
assert hasattr(on_test, '_h_info')
h_info = on_test._h_info
assert h_info.event_name == "test"
assert func_name._h_info.event_name == "func_name"
assert h_info.handler is on_test
assert h_info.priority is event.Priority.DEFAULT
assert h_info.should_enable
assert not h_info.is_async
def test_param_usage(self):
@event.event('evt_test', priority=-12, enable=False)
def on_test(self):
pass
assert hasattr(on_test, '_h_info')
h_info = on_test._h_info
assert h_info.event_name == 'evt_test'
assert h_info.handler is on_test
assert h_info.priority == -12
assert not h_info.should_enable
assert not h_info.is_async
def test_async_handler(self):
@event.event(enable=False)
async def on_async_test(self):
pass
assert hasattr(on_async_test, '_h_info')
h_info = on_async_test._h_info
assert h_info.event_name == 'async_test'
assert h_info.handler is on_async_test
assert h_info.priority is event.Priority.DEFAULT
assert not h_info.should_enable
assert h_info.is_async
def test_prefix(self):
import functools
other_event_deco = functools.partial(event.event, _prefix="__test_")
@other_event_deco
def on_test(self):
pass
assert hasattr(on_test, '_h_info')
h_info = on_test._h_info
assert h_info.event_name == '__test_test'
def test_core_event_deco(self):
@event.core_event
def on_test(self):
pass
assert hasattr(on_test, '_h_info')
h_info = on_test._h_info
assert h_info.priority is event.Priority.CORE
def test_non_callable(self):
with pytest.raises(TypeError) as excinfo:
event.event(123)
excinfo.match(r"Expected string, callable or None as first argument")
with pytest.raises(TypeError) as excinfo:
event.event("name")([])
excinfo.match(r"Callable must be a function \(`def`\)"
r" or coroutine function \(`async def`\)")
class TestHandlerInstance:
def test_from_handler(self):
@event.event
def handler():
pass
h_inst = event.HandlerInstance.from_handler(handler)
assert h_inst.info is handler._h_info
assert h_inst.enabled
assert h_inst.handler is handler._h_info.handler
def test_from_not_handler(self):
def func():
pass
with pytest.raises(ValueError) as excinfo:
event.HandlerInstance.from_handler(func)
excinfo.match(r"Event handler must be decorated with `@event`")
def test_hash(self):
@event.event
def handler():
pass
h_inst = event.HandlerInstance.from_handler(handler)
h_inst2 = event.HandlerInstance.from_handler(handler)
assert h_inst is not h_inst2
assert hash(h_inst) == hash(h_inst2)
assert h_inst != h_inst2
class TestResultSet:
def test_extend(self, evt, loop):
async def corofunc():
pass
coro = corofunc()
coro2 = corofunc()
# silence "coroutine never awaited" warnings
loop.run_until_complete(coro)
loop.run_until_complete(coro2)
rval = event.ReturnValue(append_events=[evt])
rval2 = event.ReturnValue(eat=True, schedule={coro})
rval3 = event.ReturnValue(append_events=[evt], insert_events=[evt],
schedule={coro, coro2})
rset = event.ResultSet()
rset2 = event.ResultSet()
rset.extend(rval)
assert not rset.eat
assert rset.append_events == [evt]
rset.extend(rval2)
assert rset.eat
assert rset.schedule == {coro}
rset2.extend(rval3)
rset.extend(rset2)
rset.extend(None)
assert rset.eat
assert rset.append_events == [evt, evt]
assert rset.insert_events == [evt]
assert rset.schedule == {coro, coro2}
def test_iadd(self, evt):
rval = event.ReturnValue(append_events=[evt])
rval2 = event.ReturnValue(eat=True, append_events=[evt])
rset = event.ResultSet()
rset += rval
rset += rval2
rset += None
assert rset.eat
assert rset.append_events == [evt, evt]
def test_type(self):
rset = event.ResultSet()
with pytest.raises(NotImplementedError):
rset.extend([])
with pytest.raises(NotImplementedError):
rset.extend(False)
class TestEventDispatcher:
@pytest.fixture
def dispatcher(self):
return event.EventDispatcher()
def test_register(self, dispatcher):
name = "some_name"
@event.event(name)
async def corofunc(*args):
return True
h_inst = event.HandlerInstance.from_handler(corofunc)
dispatcher.register(h_inst)
assert h_inst in dispatcher.event_map["some_name"]
def test_register_plugin(self, dispatcher):
name = "some_name"
class AClass:
@event.event(name)
def handler(self):
pass
@event.event(name)
async def hander(self):
pass
obj = AClass()
h_insts = dispatcher.register_plugin(obj)
assert len(dispatcher.event_map) == 1
assert len(h_insts) == 2
for h_inst in h_insts:
assert h_inst in dispatcher.event_map[name]
def test_dispatch(self, dispatcher, loop):
name = "some_name"
args = dict(zip(map(str, range(10)), range(10, 20)))
called = 0
@event.event(name)
async def corofunc(**local_args):
nonlocal called
assert local_args == args
called += 1
h_inst = event.HandlerInstance.from_handler(corofunc)
dispatcher.register(h_inst)
evt = event.Event(name, args)
evt2 = evt._replace(name=evt.name + "_")
loop.run_until_complete(dispatcher.dispatch(evt))
loop.run_until_complete(dispatcher.dispatch(evt2))
assert called == 1
def test_dispatch_priority(self, dispatcher, loop, evt):
called = list()
@event.event(evt.name, priority=0)
async def corofunc():
called.append(corofunc)
@event.event(evt.name, priority=1)
def corofunc2():
called.append(corofunc2)
h_inst = event.HandlerInstance.from_handler(corofunc)
h_inst2 = event.HandlerInstance.from_handler(corofunc2)
dispatcher.register(h_inst)
dispatcher.register(h_inst2)
loop.run_until_complete(dispatcher.dispatch(evt))
assert called == [corofunc2, corofunc]
def test_dispatch_disabled(self, dispatcher, loop, evt):
called = 0
@event.event(evt.name, enable=False)
async def corofunc():
nonlocal called
called += 1
h_inst = event.HandlerInstance.from_handler(corofunc)
dispatcher.register(h_inst)
loop.run_until_complete(dispatcher.dispatch(evt))
assert called == 0
# TODO test disabled
def test_dispatch_exception(self, loop, evt):
logger = mock.Mock(Logger)
dispatcher = event.EventDispatcher(logger=logger)
called = 0
@event.event(evt.name)
async def corofunc():
nonlocal called
called += 1
raise ValueError("yeah async")
@event.event(evt.name)
def handler():
nonlocal called
called += 1
raise ValueError("yeah sync")
dispatcher.register(event.HandlerInstance.from_handler(corofunc))
dispatcher.register(event.HandlerInstance.from_handler(handler))
assert not logger.exception.called
loop.run_until_complete(dispatcher.dispatch(evt))
assert called == 2
assert logger.exception.call_count == 2
def test_dispatch_unknown_return(self, loop, evt):
logger = mock.Mock(Logger)
dispatcher = event.EventDispatcher(logger=logger)
called = False
@event.event(evt.name)
async def corofunc():
nonlocal called
called = True
return "some arbitrary value"
dispatcher.register(event.HandlerInstance.from_handler(corofunc))
assert not logger.warning.called
loop.run_until_complete(dispatcher.dispatch(evt))
assert called
assert logger.warning.call_count == 1
def test_dispatch_eat(self, loop, evt):
dispatcher = event.EventDispatcher()
called = [False] * 3
@event.event(evt.name, priority=1)
def corofunc():
called[0] = True
@event.event(evt.name, priority=0)
async def corofunc2():
called[1] = True
return event.ReturnValue(eat=True)
@event.event(evt.name, priority=-1)
async def corofunc3():
called[2] = True
dispatcher.register(event.HandlerInstance.from_handler(corofunc))
dispatcher.register(event.HandlerInstance.from_handler(corofunc2))
dispatcher.register(event.HandlerInstance.from_handler(corofunc3))
result = loop.run_until_complete(dispatcher.dispatch(evt))
assert result.eat
assert called == [True, True, False]
def test_dispatch_nested_insert(self, loop, evt):
dispatcher = event.EventDispatcher()
called = [0] * 3
evt1 = evt
evt2 = evt._replace(name=evt.name + "_")
evt3 = evt._replace(name=evt.name + "__")
@event.event(evt.name)
def corofunc1():
called[0] += 1
return event.ReturnValue(insert_events=[evt2], append_events=[evt])
@event.event(evt2.name)
def corofunc2():
called[1] += 1
return event.ReturnValue(insert_events=[evt3], append_events=[evt2])
@event.event(evt3.name)
def corofunc3():
called[2] += 1
async def corofunc():
pass
return event.ReturnValue(append_events=[evt3], schedule={corofunc()})
dispatcher.register(event.HandlerInstance.from_handler(corofunc1))
dispatcher.register(event.HandlerInstance.from_handler(corofunc2))
dispatcher.register(event.HandlerInstance.from_handler(corofunc3))
result = loop.run_until_complete(dispatcher.dispatch(evt))
assert called == [1, 1, 1]
assert result.append_events == [evt1, evt2, evt3]
assert len(result.schedule) == 1
# prevent warnings again
loop.run_until_complete(next(iter(result.schedule)))
# TODO other ReturnValue tests
| chireiden/shanghai | tests/test_event.py | Python | gpl-3.0 | 15,979 |
/************************************************************************
* Copyright (C) 2019 Spatial Information Systems Research 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 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 <Action/ActionToggleCameraActorInteraction.h>
#include <FaceModelViewer.h>
#include <FaceModel.h>
using FaceTools::Action::ActionToggleCameraActorInteraction;
using FaceTools::Interactor::ActorMoveNotifier;
using FaceTools::Action::FaceAction;
using FaceTools::Action::Event;
using FaceTools::FaceModelViewer;
using FaceTools::ModelViewer;
using FaceTools::FM;
using FaceTools::FVS;
using FaceTools::Vis::FV;
using MS = FaceTools::Action::ModelSelector;
ActionToggleCameraActorInteraction::ActionToggleCameraActorInteraction( const QString& dn, const QIcon& ico, const QKeySequence& ks)
: FaceAction( dn, ico, ks), _dblClickDrag(false)
{
const Interactor::SelectNotifier *sn = MS::selector();
connect( sn, &Interactor::SelectNotifier::onDoubleClickedSelected, this, &ActionToggleCameraActorInteraction::_doDoubleClicked);
connect( sn, &Interactor::SelectNotifier::onLeftButtonUp, this, &ActionToggleCameraActorInteraction::_doLeftButtonUp);
_moveNotifier = std::shared_ptr<ActorMoveNotifier>( new ActorMoveNotifier);
connect( &*_moveNotifier, &ActorMoveNotifier::onActorStart, this, &ActionToggleCameraActorInteraction::_doOnActorStart);
connect( &*_moveNotifier, &ActorMoveNotifier::onActorStop, this, &ActionToggleCameraActorInteraction::_doOnActorStop);
setCheckable( true, false);
} // end ctor
QString ActionToggleCameraActorInteraction::toolTip() const
{
return "When on, click and drag the selected model to change its position or orientation.";
} // end toolTip
QString ActionToggleCameraActorInteraction::whatsThis() const
{
QStringList htext;
htext << "With this option toggled off, mouse clicking and dragging causes the camera to move around.";
htext << "When this option is toggled on, clicking and dragging on a model will reposition or reorient it in space.";
htext << "Click and drag with the left mouse button to rotate the model in place.";
htext << "Click and drag with the right mouse button (or hold down the SHIFT key while left clicking and dragging)";
htext << "to shift the model laterally. Click and drag with the middle mouse button (or hold down the CTRL key while";
htext << "left or right clicking and dragging) to move the model towards or away from you.";
htext << "Note that clicking and dragging off the model's surface will still move the camera around, but that this also";
htext << "toggles this option off (any camera action from the menu/toolbar will also toggle this option off).";
return tr( htext.join(" ").toStdString().c_str());
} // end whatsThis
bool ActionToggleCameraActorInteraction::checkState( Event)
{
return MS::interactionMode() == IMode::ACTOR_INTERACTION;
} // end checkState
bool ActionToggleCameraActorInteraction::checkEnable( Event)
{
const FM* fm = MS::selectedModel();
return fm || isChecked();
} // end checkEnabled
void ActionToggleCameraActorInteraction::doAction( Event)
{
if ( isChecked())
{
MS::showStatus( "Model interaction ACTIVE");
MS::setInteractionMode( IMode::ACTOR_INTERACTION, true);
} // end if
else
{
MS::showStatus( "Camera interaction ACTIVE", 5000);
MS::setInteractionMode( IMode::CAMERA_INTERACTION);
} // end else
} // end doAction
void ActionToggleCameraActorInteraction::_doOnActorStart()
{
storeUndo( this, Event::AFFINE_CHANGE);
} // end _doOnActorStart
void ActionToggleCameraActorInteraction::_doOnActorStop()
{
emit onEvent( Event::AFFINE_CHANGE);
} // end _doOnActorStop
// Called only when user double clicks on an already selected model.
void ActionToggleCameraActorInteraction::_doDoubleClicked()
{
_dblClickDrag = true;
setChecked( true);
execute( Event::USER);
} // end _doDoubleClicked
void ActionToggleCameraActorInteraction::_doLeftButtonUp()
{
if ( _dblClickDrag)
{
_dblClickDrag = false;
setChecked( false);
execute( Event::USER);
} // end if
} // end _doLeftButtonUp
| richeytastic/FaceTools | src/Action/ActionToggleCameraActorInteraction.cpp | C++ | gpl-3.0 | 4,893 |
<!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" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Geotagger Map</title>
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<!-- Make the document body take up the full screen -->
<style type="text/css">
html, body {width: 100%; height: 100%}
body {margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0px}
</style>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>
<!-- Include GeoTaggerMap (GTM) scripting interface functions -->
<script src="gtminterface.js" type="text/javascript"></script>
<!-- Include Bing map (BMap) scripting interface functions -->
<script src="bmapinterface.js" type="text/javascript"></script>
<!-- Include offline map scripting interface functions -->
<script src="nomapinterface.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function onLoad()
{
if (BMapInterface.IsAvailable())
{
// Initialize Google Maps implementation of callback interface
BMapInterface.Initialize("map");
// Initialize generic callback interface
GTMInterface.Initialize(BMapInterface);
}
else
{
NoMapInterface.Initialize(document.getElementById("map"));
GTMInterface.Initialize(NoMapInterface);
}
}
//]]>
</script>
</head>
<body onload="onLoad()">
<div id="map" style="width: 100%; height: 100%;">Loading...</div>
</body>
</html>
| kokuda/geotagger | Geotagger/html/bing.html | HTML | gpl-3.0 | 1,739 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.