repo_id
stringlengths
4
98
size
int64
611
5.02M
file_path
stringlengths
1
276
content
stringlengths
611
5.02M
shard_id
int64
0
109
quality_score
float32
0.5
1
quality_prediction
int8
1
1
quality_confidence
float32
0.5
1
topic_primary
stringclasses
1 value
topic_group
stringclasses
1 value
topic_score
float32
0.05
1
topic_all
stringclasses
96 values
quality2_score
float32
0.5
1
quality2_prediction
int8
1
1
quality2_confidence
float32
0.5
1
googlevr/blocks
4,227
Assets/Scripts/model/util/CollisionSystem.cs
// Copyright 2020 The Blocks 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. using UnityEngine; using System.Collections.Generic; using System; using com.google.apps.peltzer.client.model.core; namespace com.google.apps.peltzer.client.model.util { /// <summary> /// Spatial index for objects based on their Bounds. /// </summary> public interface CollisionSystem<T> { /// <summary> /// Add an item to the CollisionSystem. /// </summary> /// <param name="item">The item to add</param> /// <param name="bounds">The item's initial bounds.</param> /// <exception cref="System.Exception"> /// Thrown when bounds is not contained by the CollisionSystem's bounds.</exception> void Add(T item, Bounds bounds); /// <summary> /// Update the bounds of an item. The item must already exist /// in the index. /// </summary> /// <param name="item">The item to update.</param> /// <param name="bounds">The item's updated bounds.</param> /// <exception cref="System.Exception"> /// Thrown when the item isn't in the tree.</exception> void UpdateItemBounds(T item, Bounds bounds); /// <summary> /// Remove an item from the index. /// </summary> /// <param name="item">Item to remove.</param> /// <exception cref="System.Exception"> /// Thrown when the item isn't in the tree.</exception> void Remove(T item); /// <summary> /// Find items contained entirely within the given bounds. /// This method will create a set when the number of items /// is greater than zero. /// </summary> /// <param name="bounds">Containing bounds.</param> /// <param name="items">Set of items found. Null when this /// method returns false.</param> /// <param name="limit">Maximum number of items to find.</param> /// <returns>true if any items are found.</returns> bool ContainedBy(Bounds bounds, out HashSet<T> items, int limit = SpatialIndex.MAX_INTERSECT_RESULTS); /// <summary> /// Find items that intersect the given bounds. /// This method will create a Set when the number of items /// is greater than zero. /// </summary> /// <param name="bounds">Intersecting bounds.</param> /// <param name="items">Set of items found. Null when this /// method returns false.</param> /// <param name="limit">Maximum number of items to find.</param> /// <returns>true if any items are found.</returns> bool IntersectedBy(Bounds bounds, out HashSet<T> items, int limit = SpatialIndex.MAX_INTERSECT_RESULTS); /// <summary> /// Find items that intersect the given bounds. /// This method will create a Set when the number of items /// is greater than zero. /// </summary> /// <param name="bounds">Intersecting bounds.</param> /// <param name="items">Set of items found. Null when this /// method returns false.</param> /// <param name="limit">Maximum number of items to find.</param> /// <returns>true if any items are found.</returns> bool IntersectedByPreallocated(Bounds bounds, ref HashSet<T> items, int limit = SpatialIndex.MAX_INTERSECT_RESULTS); /// <summary> /// True if the given item is in the tree. /// </summary> bool HasItem(T item); // Return the bounds specified when the item was inserted or updated. Bounds BoundsForItem(T item); } }
1
0.898136
1
0.898136
game-dev
MEDIA
0.231787
game-dev
0.794992
1
0.794992
Choonster-Minecraft-Mods/TestMod3
3,917
src/main/java/choonster/testmod3/util/RegistryUtil.java
package choonster.testmod3.util; import choonster.testmod3.TestMod3; import com.google.common.base.Preconditions; import net.minecraft.core.Registry; import net.minecraft.core.component.DataComponentType; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.material.Fluid; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.IForgeRegistry; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.stream.StreamSupport; /** * Utility methods for Forge registries. * * @author Choonster */ public class RegistryUtil { /** * Get all of this mod's registry entries from the provided registry. * * @param registry The registry * @param <T> The registry type * @return A Stream containing the registry entries */ public static <T> Stream<T> getModRegistryEntriesStream(final IForgeRegistry<T> registry) { return stream(registry) .filter(entry -> Optional.ofNullable(registry.getKey(entry)) .filter(key -> key.getNamespace().equals(TestMod3.MODID)) .isPresent() ); } /** * Get all of this mod's registry entries from the provided registry. * * @param registry The registry * @param <T> The registry type * @return A Set containing the registry entries */ public static <T> Set<T> getModRegistryEntries(final IForgeRegistry<T> registry) { return getModRegistryEntriesStream(registry).collect(Collectors.toSet()); } /** * Gets a {@link Stream} of the registry's entries. * * @param registry The registry * @param <T> The registry type * @return A Stream of the registry's entries */ public static <T> Stream<T> stream(final IForgeRegistry<T> registry) { return StreamSupport.stream(registry.spliterator(), false); } /** * Gets the key of the registry entry, throwing an exception if it's not set. * * @param entry The registry entry * @return The key * @throws NullPointerException If the key is null */ public static <T> ResourceLocation getKey(final IForgeRegistry<T> registry, final T entry) { return Preconditions.checkNotNull(registry.getKey(entry), "%s has no registry key", entry); } /** * Gets the key of the registry entry, throwing an exception if it's not set. * * @param entry The registry entry * @return The key * @throws NullPointerException If the key is null */ public static <T> ResourceLocation getKey(final Registry<T> registry, final T entry) { return Preconditions.checkNotNull(registry.getKey(entry), "%s has no registry key", entry); } /** * @see #getKey(IForgeRegistry, Object) */ public static ResourceLocation getKey(final Block block) { return getKey(ForgeRegistries.BLOCKS, block); } /** * @see #getKey(IForgeRegistry, Object) */ public static ResourceLocation getKey(final Item item) { return getKey(ForgeRegistries.ITEMS, item); } /** * @see #getKey(IForgeRegistry, Object) */ public static ResourceLocation getKey(final EntityType<?> entityType) { return getKey(ForgeRegistries.ENTITY_TYPES, entityType); } /** * @see #getKey(IForgeRegistry, Object) */ public static ResourceLocation getKey(final Fluid fluid) { return getKey(ForgeRegistries.FLUIDS, fluid); } /** * @see #getKey(IForgeRegistry, Object) */ public static ResourceLocation getKey(final Potion potion) { return getKey(ForgeRegistries.POTIONS, potion); } /** * @see #getKey(Registry, Object) */ public static ResourceLocation getKey(final DataComponentType<?> componentType) { return getKey(BuiltInRegistries.DATA_COMPONENT_TYPE, componentType); } }
1
0.803257
1
0.803257
game-dev
MEDIA
0.877632
game-dev
0.831259
1
0.831259
Choonster-Minecraft-Mods/TestMod3
2,414
src/main/java/choonster/testmod3/client/hiddenblock/HiddenBlockManager.java
package choonster.testmod3.client.hiddenblock; import choonster.testmod3.TestMod3; import choonster.testmod3.init.ModDataComponents; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.listener.SubscribeEvent; import net.minecraftforge.fml.common.Mod; /** * Manages the hidden block state for the client. * <p> * Based on EnderIO's {@code crazypants.enderio.paint.YetaUtil} class. * * @author Choonster */ @Mod.EventBusSubscriber(value = Dist.CLIENT, modid = TestMod3.MODID) public class HiddenBlockManager { private static volatile boolean lastCheckResult = false; private static boolean toggled = false; /** * Should either of the player's held items reveal hidden blocks? * * @param player The player * @return Should hidden blocks be revealed? */ private static boolean shouldHeldItemRevealHiddenBlocks(final Player player) { for (final var hand : InteractionHand.values()) { final var revealHiddenBlocks = player.getItemInHand(hand).has(ModDataComponents.REVEAL_HIDDEN_BLOCKS.get()); if (revealHiddenBlocks) { return true; } } return false; } @SubscribeEvent public static void clientTick(final TickEvent.ClientTickEvent.Post ignoredEvent) { final var player = Minecraft.getInstance().player; if (player == null) { return; } final var checkResult = shouldHeldItemRevealHiddenBlocks(player); toggled = lastCheckResult != checkResult; lastCheckResult = checkResult; } /** * Should the client player's held item reveal hidden blocks? * <p> * This method should only be called on the physical client. * * @return Should the client player's held item reveal hidden blocks? */ public static boolean shouldHeldItemRevealHiddenBlocksClient() { return lastCheckResult; } /** * Update the chunk containing the {@link BlockPos} if the hidden state has changed. * * @param world The world * @param pos The position of the hidden block to update */ public static void refresh(final Level world, final BlockPos pos) { if (toggled) { final var state = world.getBlockState(pos); world.sendBlockUpdated(pos, state, state, 3); } } }
1
0.937371
1
0.937371
game-dev
MEDIA
0.969216
game-dev
0.90868
1
0.90868
JetBrains/mapper
2,765
util/json/src/main/java/jetbrains/jetpad/json/JsonArray.java
/* * Copyright 2012-2017 JetBrains s.r.o * * 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 jetbrains.jetpad.json; import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; public class JsonArray extends JsonValue implements Iterable<JsonValue> { private List<JsonValue> myValues; public JsonArray() { } @Override public Iterator<JsonValue> iterator() { if (myValues == null) { return Collections.emptyIterator(); } return myValues.iterator(); } public int size() { if (myValues == null) { return 0; } return myValues.size(); } public void add(int pos, @Nonnull JsonValue value) { if (myValues == null) { myValues = new ArrayList<>(1); } myValues.add(pos, value); } public void remove(int pos) { myValues.remove(pos); } public void add(JsonValue value) { add(size(), value); } public JsonValue get(int index) { return myValues.get(index); } public void add(@Nonnull String s) { add(new JsonString(s)); } public void add(double d) { add(new JsonNumber(d)); } public void add(boolean b) { add(new JsonBoolean(b)); } public JsonObject getObject(int index) { return (JsonObject) get(index); } public JsonArray getArray(int index) { return (JsonArray) get(index); } public String getString(int index) { return ((JsonString) get(index)).getStringValue(); } public double getDouble(int index) { return ((JsonNumber) get(index)).getDoubleValue(); } public boolean getBoolean(int index) { return ((JsonBoolean) get(index)).getBooleanValue(); } public int getInt(int index) { return (int) getDouble(index); } public long getLong(int index) { return (long) getDouble(index); } @Override protected void toString(IndentBuilder builder) { builder.append("["); builder.indent(); builder.newLine(); int size = size(); for (int i = 0; i < size; i++) { get(i).toString(builder); if (i != size - 1) { builder.append(","); builder.newLine(); } } builder.unindent(); builder.newLine(); builder.append("]"); } }
1
0.55675
1
0.55675
game-dev
MEDIA
0.318272
game-dev
0.535892
1
0.535892
scratchfoundation/scratchjr
16,578
src/painteditor/Ghost.js
import Snap from 'snapsvg'; import ScratchJr from '../editor/ScratchJr'; import SVGTools from './SVGTools'; import Paint from './Paint'; import PaintAction from './PaintAction'; import Layer from './Layer'; import Vector from '../geom/Vector'; import Transform from './Transform'; import SVG2Canvas from '../utils/SVG2Canvas'; import {gn, setCanvasSize, newDiv} from '../utils/lib'; let maskCanvas = document.createElement('canvas'); let maskData = {}; let linemask = 16; let maskColor = 16; export default class Ghost { static get maskCanvas () { return maskCanvas; } static get maskData () { return maskData; } static set maskData (newMaskData) { maskData = newMaskData; } static get linemask () { return linemask; } static highlight (group) { Ghost.clearLayer(); var g = SVGTools.createGroup(gn('draglayer'), 'ghostgroup'); g.setAttribute('class', 'active3d'); for (var i = 0; i < group.length; i++) { Ghost.hightlightElem(g, group[i], 0.5, '5,5', 'black', 3); } } static hightlightElem (p, elem, opacity, space, c, sw) { if (elem.tagName == 'g') { for (var i = 0; i < elem.childElementCount; i++) { Ghost.hightlightElem(p, elem.childNodes[i], opacity, space, c, sw); } } else { if (Ghost.hasGhost(elem)) { Ghost.getKid(p, elem, opacity, space, c, sw); } } } static hasGhost (elem) { // too slow if there are too many--> doing this to minimize overlapping ghosts if (!elem.id) { return true; } if (elem.id.indexOf('Border') < 0) { return true; } var mfill = elem.id.split('Border')[0]; if (mfill == '') { return true; } return (!gn(mfill)); } static clearLayer () { var p = gn('draglayer'); if (!p) { return; } while (p.childElementCount > 0) { p.removeChild(p.childNodes[0]); } } /////////////////////////////////// // Ghost Management /////////////////////////////////// static findTarget (evt) { Ghost.clearLayer(); if (evt == null) { return null; } var pt = PaintAction.getScreenPt(evt); if (Ghost.outsideArea(Vector.floor(Vector.scale(pt, Paint.currentZoom)), maskCanvas)) { return null; } else { return Ghost.allTools(pt); } } static findWho (evt) { // just gets the object clicked Ghost.clearLayer(); if (evt == null) { return null; } var pt = PaintAction.getScreenPt(evt); var color = Ghost.getPtColor(pt); var id = maskData[color]; var mt = (id && gn(id)) ? gn(id) : null; return (mt && mt.getAttribute('fixed') != 'yes') ? mt : Ghost.getHitObject(pt); } static allTools (pt) { var color = Ghost.getPtColor(pt); var id = maskData[color]; if (id) { return Ghost.hitSomething(pt, id, color); } else { return Ghost.notHitted(pt); } } static hitSomething (pt, id) { var mt = gn(id); var dogohst = true; if (mt && mt.getAttribute('relatedto')) { mt = gn(mt.getAttribute('relatedto')); } switch (Paint.mode) { case 'select': case 'rotate': case 'stamper': case 'scissors': case 'path': if (mt.getAttribute('fixed') == 'yes') { mt = Ghost.getHitObject(pt, Paint.mode == 'path'); } dogohst = mt ? (mt.getAttribute('fixed') != 'yes') : false; break; case 'paintbucket': case 'camera': mt = Ghost.getHitObject(pt, Paint.mode == 'path'); break; } if (mt && dogohst) { return Ghost.setGhostTo(mt); } return null; } static svgHit (pt) { var rpos = Paint.root.createSVGRect(); rpos.x = pt.x; rpos.y = pt.y; rpos.width = 1; rpos.height = 1; var matches = Paint.root.getIntersectionList(rpos, null); if (matches !== null) { return matches; } else { // getIntersectionList() isn't implemented below API Level 19 // and will return null. Call the helper method to manually detect // the intersection lists. return Ghost.svgHitHelper(gn('layer1'), pt); } } /** * Iterates all the path elements of the root and checks if 'pt' * is inside the path. * This method uses the SnapSVG library (Apache 2 license) to perform the hit test. */ static svgHitHelper (root, pt) { var matches = []; if (!root) { return matches; } var paths = root.getElementsByTagName('path'); for (var i = 0; i < paths.length; ++i) { var pathData = paths[i].getAttribute('d'); if (pathData && Snap.path.isPointInside(pathData, pt.x, pt.y)) { matches.push(paths[i]); } } return matches; } static setGhostTo (mt) { var g = SVGTools.createGroup(gn('draglayer'), 'ghostlayer'); Ghost.setDashBorder(g, mt, 0.7, '5,5', 'black', 3); return mt; } static notHitted (pt) { var mt; switch (Paint.mode) { case 'select': case 'rotate': case 'stamper': case 'scissors': mt = Ghost.getActualHit(Ghost.getHitObject(pt, Paint.mode != 'path'), pt); if (mt && mt.id) { if (mt.getAttribute('relatedto')) { mt = gn(mt.getAttribute('relatedto')); } var isStencil = ( (mt.id.indexOf('staticbkg') > -1) || (mt.getAttribute('stencil') == 'yes') || (mt.getAttribute('fixed') == 'yes') ); if (isStencil) { mt = undefined; } } break; case 'camera': case 'paintbucket': var targ = Ghost.getHitObject(pt, false); var target = Ghost.getActualHit(targ, pt); if (target && target.nodeName != 'g') { mt = target; } break; } if (mt) { return Ghost.setGhostTo(mt); } return null; } static getActualHit (mt, pt) { if (!mt) { return null; } pt = Vector.floor(Vector.scale(pt, Paint.currentZoom)); var list = Layer.findUnderMe(mt); for (var i = 0; i < list.length; i++) { var obj = list[i]; if (!Ghost.contains(mt, obj)) { continue; } if (!Ghost.hittedSingleObject(obj, pt)) { continue; } mt = obj; } return mt; } static contains (e1, e2) { var box1 = SVGTools.getBox(e1); var box2 = SVGTools.getBox(e2); var boxi = box1.intersection(box2); if (boxi.isEmpty()) { return false; } return boxi.isEqual(box2); } static hittedSingleObject (obj, pt) { var ctx = ScratchJr.workingCanvas.getContext('2d'); ctx.clearRect(0, 0, ScratchJr.workingCanvas.width, ScratchJr.workingCanvas.height); ctx.save(); Layer.drawInContext(obj, ctx, Paint.currentZoom); ctx.restore(); var pixel = ctx.getImageData(pt.x, pt.y, 1, 1).data; return pixel[3] != 0; } static getPtColor (pt) { pt = Vector.floor(Vector.scale(pt, Paint.currentZoom)); if (Ghost.outsideArea(pt, maskCanvas)) { return 0; } var ctx = maskCanvas.getContext('2d'); var pixel = ctx.getImageData(pt.x, pt.y, 1, 1).data; var r = pixel[0]; var g = pixel[1]; var b = pixel[2]; return Ghost.getHex([r, g, b]); } static outsideArea (node, canvas) { if ((node.x < 0) || (node.x > (canvas.width - 1))) { return true; } if ((node.y < 0) || (node.y > (canvas.height - 1))) { return true; } return false; } static setDashBorder (p, elem, opacity, space, c, sw) { if (elem.tagName == 'g') { for (var i = 0; i < elem.childElementCount; i++) { Ghost.setDashBorder(p, elem.childNodes[i], opacity, space, c, sw); } } else { Ghost.getKid(p, elem, opacity, space, c, sw); } } static getKid (p, elem, opacity, space, c, sw) { if (!sw) { sw = elem.getAttribute('stroke-width'); } var attr = SVGTools.attributeTable[elem.tagName]; if (!attr) { attr = []; } var drawattr = SVGTools.attributePenTable[elem.tagName]; if (!drawattr) { drawattr = []; } // black outline var shape = document.createElementNS(Paint.xmlns, elem.tagName); p.appendChild(shape); attr = attr.concat(drawattr); for (var i = 0; i < attr.length; i++) { if (elem.getAttribute(attr[i]) == null) { continue; } shape.setAttribute(attr[i], elem.getAttribute(attr[i])); } shape.setAttribute('fill', 'none'); shape.setAttribute('stroke', c); shape.setAttribute('stroke-width', sw / Paint.currentZoom); shape.setAttribute('class', 'active3d'); var ang = Transform.getRotationAngle(elem); if (ang != 0) { Transform.applyRotation(shape, ang); } if (opacity) { shape.setAttribute('opacity', opacity); } // white dashed var dash = document.createElementNS(Paint.xmlns, elem.tagName); p.appendChild(dash); attr = attr.concat(drawattr); for (var j = 0; j < attr.length; j++) { if (elem.getAttribute(attr[j]) == null) { continue; } dash.setAttribute(attr[j], elem.getAttribute(attr[j])); } dash.setAttribute('fill', 'none'); dash.setAttribute('stroke', 'white'); dash.setAttribute('stroke-width', 3 / Paint.currentZoom); dash.setAttribute('stroke-dasharray', space); dash.setAttribute('class', 'active3d'); if (opacity) { dash.setAttribute('opacity', opacity); } if (ang != 0) { Transform.applyRotation(dash, ang); } return dash; } ////////////////////////////////////////////////// // Offscreen for cursor ////////////////////////////////////////////////// static drawOffscreen () { setCanvasSize( maskCanvas, Math.round(Number(Paint.root.getAttribute('width')) * Paint.currentZoom), Math.round(Number(Paint.root.getAttribute('height')) * Paint.currentZoom) ); var ctx = maskCanvas.getContext('2d'); ctx.clearRect(0, 0, maskCanvas.width, maskCanvas.height); var p = gn('layer1'); if (!p) { return; } maskData = {}; maskColor = 16; Ghost.drawElements(p, ctx); } static drawElements (p, ctx) { for (var i = 0; i < p.childElementCount; i++) { var elem = p.childNodes[i]; if (elem.id == 'pathdots') { continue; } if (elem.tagName == 'image') { continue; } if (elem.tagName == 'clipPath') { continue; } if (elem.nodeName == 'g') { Ghost.drawElements(elem, ctx); } else { Ghost.drawElement(elem, ctx); } } } static drawElement (elem, ctx) { var c = Ghost.getRGB(maskColor); var bc = Ghost.getRGB(maskColor + 8); maskColor += 16; ctx.save(); var nostroke = (!elem.getAttribute('stroke')) || (elem.getAttribute('stroke') == 'none'); var n = Number(elem.getAttribute('stroke-width')); ctx.lineWidth = nostroke ? 0 : n; ctx.fillStyle = (elem.getAttribute('fill') == 'none') ? 'rgba(0,0,0,0)' : 'rgba(' + c[0] + ',' + c[1] + ',' + c[2] + ',255)'; ctx.strokeStyle = !elem.getAttribute('stroke') ? 'rgba(0,0,0,0)' : 'rgba(' + bc[0] + ',' + bc[1] + ',' + bc[2] + ',255)'; if (!SVG2Canvas.isCloseDPath(elem)) { ctx.strokeStyle = 'rgba(' + c[0] + ',' + c[1] + ',' + c[2] + ',255)'; } if (elem.id.indexOf('pathborder_image') > -1) { ctx.fillStyle = 'rgba(' + c[0] + ',' + c[1] + ',' + c[2] + ',255)'; } if (!elem.getAttribute('fill') && !elem.getAttribute('stroke')) { ctx.fillStyle = 'rgba(' + bc[0] + ',' + bc[1] + ',' + bc[2] + ',255)'; } maskData[Ghost.getHex(c)] = elem.id; maskData[Ghost.getHex(bc)] = elem.id; var rot = Transform.extract(elem, 4); if (rot.angle != 0) { Layer.rotateFromCenter(ctx, elem, rot.angle); } ctx.scale(Paint.currentZoom, Paint.currentZoom); SVG2Canvas.processXMLnode(elem, ctx, true); ctx.restore(); if (SVG2Canvas.isCloseDPath(elem)) { return; } ctx.save(); ctx.scale(Paint.currentZoom, Paint.currentZoom); ctx.lineWidth = (linemask) < n ? n : linemask; ctx.fillStyle = 'rgba(' + c[0] + ',' + c[1] + ',' + c[2] + ',255)'; ctx.strokeStyle = 'rgba(' + bc[0] + ',' + bc[1] + ',' + bc[2] + ',255)'; rot = Transform.extract(elem, 4); if (rot.angle != 0) { Layer.rotateFromCenter(ctx, elem, rot.angle); } SVG2Canvas.renderPathTips(elem, ctx); ctx.restore(); } static getRGB (color) { return [Number((color >> 16) & 255), Number((color >> 8) & 255), Number(color & 255)]; } static getHex (rgb) { var r = rgb[0].toString(16); if (r.length < 2) { r = '0' + r; } var g = rgb[1].toString(16); if (g.length < 2) { g = '0' + g; } var b = rgb[2].toString(16); if (b.length < 2) { b = '0' + b; } return r + g + b; } static getHitObject (pt, isTip, exclude) { var list = Ghost.svgHit(pt); pt = Vector.floor(Vector.scale(pt, Paint.currentZoom)); if (!Paint.root) { return false; } setCanvasSize(ScratchJr.workingCanvas, Math.round(Paint.root.getAttribute('width') * Paint.currentZoom), Math.round(Paint.root.getAttribute('height') * Paint.currentZoom) ); var ctx = ScratchJr.workingCanvas.getContext('2d'); if (Ghost.outsideArea(pt, ScratchJr.workingCanvas)) { return null; } ctx.clearRect(0, 0, ScratchJr.workingCanvas.width, ScratchJr.workingCanvas.height); return Ghost.findHit(list, pt, ScratchJr.workingCanvas.getContext('2d'), isTip, exclude); } static findHit (list, pt, ctx, isTip, exclude) { for (var i = list.length - 1; i >= 0; i--) { var elem = list[i]; if (exclude && (elem == exclude)) { continue; } var lw = elem.getAttribute('stroke-width') ? elem.getAttribute('stroke-width') : 0; ctx.save(); Layer.drawInContext(elem, ctx, Paint.currentZoom, lw, isTip); ctx.restore(); var pixel = ctx.getImageData(pt.x, pt.y, 1, 1).data; if (pixel[3] != 0) { return elem; } } return null; } //////////////////// // Debugging hit masks //////////////////////// static showmask () { var mask = newDiv(Paint.frame, 0, 0, maskCanvas.width, maskCanvas.height, { position: 'absolute', zIndex: ScratchJr.layerTop + 20 }); mask.setAttribute('id', 'ghostmask'); mask.appendChild(maskCanvas); } static off () { gn('ghostmask').style.visibility = 'hidden'; } static on () { gn('ghostmask').style.visibility = 'visible'; } }
1
0.71408
1
0.71408
game-dev
MEDIA
0.623873
game-dev,graphics-rendering
0.974254
1
0.974254
kbengine/kbengine
22,442
kbe/src/lib/pyscript/vector4.cpp
// Copyright 2008-2018 Yolo Technologies, Inc. All Rights Reserved. https://www.comblockengine.com #include "vector2.h" #include "vector3.h" #include "vector4.h" #include "pyscript/py_gc.h" namespace KBEngine{ namespace script{ const int ScriptVector4::VECTOR_SIZE = sizeof(Vector4) / sizeof(float); PySequenceMethods ScriptVector4::seqMethods = { ScriptVector4::seq_length, /* sq_length */ 0, /* sq_concat */ 0, /* sq_repeat */ ScriptVector4::seq_item, /* sq_item */ 0,//ScriptVector4::seq_slice, /* sq_slice */ ScriptVector4::seq_ass_item, /* sq_ass_item */ 0, /* sq_ass_slice */ 0, /* sq_contains */ 0, /* sq_inplace_concat */ 0, /* sq_inplace_repeat */ }; PyNumberMethods ScriptVector4::numberMethods = { ScriptVector4::py_add, //binaryfunc nb_add; ScriptVector4::py_subtract, //binaryfunc nb_subtract; ScriptVector4::py_multiply, //binaryfunc nb_multiply; //ScriptVector4::py_divide, //binaryfunc nb_divide; 0, //binaryfunc nb_remainder; 0, //binaryfunc nb_divmod; 0, //ternaryfunc nb_power; ScriptVector4::py_negative, //unaryfunc nb_negative; ScriptVector4::py_positive, //unaryfunc nb_positive; 0, //unaryfunc nb_absolute; ScriptVector4::py_nonzero, //inquiry nb_nonzero nb_nonzeroΪnb_bool,__nonzero__()Ϊ__bool__(); 0, //unaryfunc nb_invert; 0, //binaryfunc nb_lshift; 0, //binaryfunc nb_rshift; 0, //binaryfunc nb_and; 0, //binaryfunc nb_xor; 0, //binaryfunc nb_or; //0, //coercion nb_coerce; 0, //unaryfunc nb_int; 0, // void *nb_reserved; //0, //unaryfunc nb_long; 0, //unaryfunc nb_float; //0, //unaryfunc nb_oct; //0, //unaryfunc nb_hex; ScriptVector4::py_inplace_add, //binaryfunc nb_inplace_add; ScriptVector4::py_inplace_subtract, //binaryfunc nb_inplace_subtract; ScriptVector4::py_inplace_multiply, //binaryfunc nb_inplace_multiply; //ScriptVector4::py_inplace_divide, //binaryfunc nb_inplace_divide; 0, //binaryfunc nb_inplace_remainder; 0, //ternaryfunc nb_inplace_power; 0, //binaryfunc nb_inplace_lshift; 0, //binaryfunc nb_inplace_rshift; 0, //binaryfunc nb_inplace_and; 0, //binaryfunc nb_inplace_xor; 0, //binaryfunc nb_inplace_or; // Added in release 2.2 0, //binaryfunc nb_floor_divide; 0, //binaryfunc nb_true_divide; 0, //binaryfunc nb_inplace_floor_divide; 0, //binaryfunc nb_inplace_true_divide; }; /* static int tp_compare(PyObject* v, PyObject* w) { if (ScriptVector4::check(v) && ScriptVector4::check(w)){ const Vector4& a = ((ScriptVector4 *)v)->getVector(); const Vector4& b = ((ScriptVector4 *)w)->getVector(); return (a < b) ? -1 : (b < a) ? 1 : 0; } return 0; } */ SCRIPT_METHOD_DECLARE_BEGIN(ScriptVector4) SCRIPT_METHOD_DECLARE("distTo", pyDistTo, METH_VARARGS, 0) SCRIPT_METHOD_DECLARE("distSqrTo", pyDistSqrTo, METH_VARARGS, 0) SCRIPT_METHOD_DECLARE("scale", pyScale, METH_VARARGS, 0) SCRIPT_METHOD_DECLARE("dot", pyDot, METH_VARARGS, 0) SCRIPT_METHOD_DECLARE("normalise", pyNormalise, METH_VARARGS, 0) SCRIPT_METHOD_DECLARE("tuple", pyTuple, METH_VARARGS, 0) SCRIPT_METHOD_DECLARE("list", pyList, METH_VARARGS, 0) SCRIPT_METHOD_DECLARE("set", pySet, METH_VARARGS, 0) SCRIPT_DIRECT_METHOD_DECLARE("__reduce_ex__", __reduce_ex__, METH_VARARGS, 0) SCRIPT_METHOD_DECLARE_END() SCRIPT_MEMBER_DECLARE_BEGIN(ScriptVector4) SCRIPT_MEMBER_DECLARE_END() SCRIPT_GETSET_DECLARE_BEGIN(ScriptVector4) SCRIPT_GETSET_DECLARE("x", pyGetX, pySetX, 0, 0) SCRIPT_GETSET_DECLARE("y", pyGetY, pySetY, 0, 0) SCRIPT_GETSET_DECLARE("z", pyGetZ, pySetZ, 0, 0) SCRIPT_GETSET_DECLARE("w", pyGetW, pySetW, 0, 0) SCRIPT_GET_DECLARE("length", pyGetVectorLength, 0, 0) SCRIPT_GET_DECLARE("lengthSquared", pyGetVectorLengthSquared, 0, 0) SCRIPT_GETSET_DECLARE_END() SCRIPT_INIT(ScriptVector4, 0, &ScriptVector4::seqMethods, 0, 0, 0) //------------------------------------------------------------------------------------- ScriptVector4::ScriptVector4(Vector4* v): ScriptObject(getScriptType(), false), val_(v), isCopy_(true) { script::PyGC::incTracing("Vector4"); } //------------------------------------------------------------------------------------- ScriptVector4::ScriptVector4(Vector4 v): ScriptObject(getScriptType(), false), isCopy_(false) { val_ = new Vector4(v); script::PyGC::incTracing("Vector4"); } //------------------------------------------------------------------------------------- ScriptVector4::ScriptVector4(float x, float y, float z, float w): ScriptObject(getScriptType(), false), isCopy_(false) { val_ = new Vector4(x, y, z, w); script::PyGC::incTracing("Vector4"); } //------------------------------------------------------------------------------------- ScriptVector4::~ScriptVector4() { if(!isCopy_) delete val_; script::PyGC::decTracing("Vector4"); } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::tp_new(PyTypeObject* type, PyObject* args, PyObject* kwds) { ScriptVector4* v = new ScriptVector4(0,0,0,0); if(PyTuple_Size(args) > 0) { PyObject* pyResult = v->__py_pySet((PyObject*)v, args); if(pyResult) Py_DECREF(pyResult); else return NULL; } return v; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::tp_repr() { char str[128]; Vector4 v = this->getVector(); strcpy(str, "Vector4("); for(int i=0; i < VECTOR_SIZE; ++i) { if (i > 0) strcat(str, ", "); kbe_snprintf(str + strlen(str), 128, "%f", v[i]); } strcat(str, ")"); return PyUnicode_FromString(str); } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::tp_str() { return tp_repr(); } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::pyGetVectorLength() { return PyFloat_FromDouble(KBEVec4Length(&getVector())); } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::pyGetVectorLengthSquared() { return PyFloat_FromDouble(KBEVec4LengthSq(&getVector())); } //------------------------------------------------------------------------------------- Py_ssize_t ScriptVector4::seq_length(PyObject* self) { ScriptVector4* seq = static_cast<ScriptVector4*>(self); return seq->length(); } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::seq_item(PyObject* self, Py_ssize_t index) { if (index < 0 || VECTOR_SIZE <= index) { PyErr_SetString(PyExc_IndexError, "Vector4 index out of range"); //PyErr_PrintEx(0); return NULL; } ScriptVector4* sv = static_cast<ScriptVector4*>(self); return PyFloat_FromDouble(sv->getVector()[static_cast<int>(index)]); } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::seq_slice(PyObject* self, Py_ssize_t startIndex, Py_ssize_t endIndex) { if(startIndex < 0) startIndex = 0; if(endIndex > VECTOR_SIZE) endIndex = VECTOR_SIZE; if(endIndex < startIndex) endIndex = startIndex; ScriptVector4* sv = static_cast<ScriptVector4*>(self); Vector4& my_v = sv->getVector(); PyObject* pyResult = NULL; int length = (int)(endIndex - startIndex); if (length == VECTOR_SIZE) { pyResult = sv; Py_INCREF(pyResult); } else switch(length) { case 0: pyResult = PyTuple_New(0); break; case 1: pyResult = PyTuple_New(1); PyTuple_SET_ITEM(pyResult, 0, PyFloat_FromDouble(sv->getVector()[static_cast<int>(startIndex)])); break; case 2: { Vector2 v; for (int i = (int)startIndex; i < (int)endIndex; ++i){ v[i - static_cast<int>(startIndex)] = my_v[i]; } pyResult = new ScriptVector2(v); break; } case 3: { Vector3 v; for (int i = (int)startIndex; i < (int)endIndex; ++i){ v[i - static_cast<int>(startIndex)] = my_v[i]; } pyResult = new ScriptVector3(v); break; } default: PyErr_Format(PyExc_IndexError, "Bad slice indexes [%d, %d] for Vector%d", startIndex, endIndex, VECTOR_SIZE); PyErr_PrintEx(0); break; } return pyResult; } //------------------------------------------------------------------------------------- int ScriptVector4::seq_ass_item(PyObject* self, Py_ssize_t index, PyObject* value) { ScriptVector4* sv = static_cast<ScriptVector4*>(self); if (index < 0 || VECTOR_SIZE <= index) { PyErr_SetString(PyExc_IndexError, "Vector assignment index out of range"); PyErr_PrintEx(0); return -1; } Vector4& v = sv->getVector(); v[static_cast<int>(index)] = float(PyFloat_AsDouble(value)); return 0; } //------------------------------------------------------------------------------------- int ScriptVector4::pySetX(PyObject *value) { getVector().x = float(PyFloat_AsDouble(value)); return 0; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::pyGetX() { return PyFloat_FromDouble(getVector().x); } //------------------------------------------------------------------------------------- int ScriptVector4::pySetY(PyObject *value) { getVector().y = float(PyFloat_AsDouble(value)); return 0; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::pyGetY() { return PyFloat_FromDouble(getVector().y); } //------------------------------------------------------------------------------------- int ScriptVector4::pySetZ(PyObject *value) { getVector().z = float(PyFloat_AsDouble(value)); return 0; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::pyGetZ() { return PyFloat_FromDouble(getVector().z); } //------------------------------------------------------------------------------------- int ScriptVector4::pySetW(PyObject *value) { getVector().w = float(PyFloat_AsDouble(value)); return 0; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::pyGetW() { return PyFloat_FromDouble(getVector().w); } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::__reduce_ex__(PyObject* self, PyObject* protocol) { ScriptVector4* sv = static_cast<ScriptVector4*>(self); Vector4& v = sv->getVector(); PyObject* args = PyTuple_New(2); PyObject* unpickleMethod = script::Pickler::getUnpickleFunc("Vector4"); PyTuple_SET_ITEM(args, 0, unpickleMethod); PyObject* args1 = PyTuple_New(VECTOR_SIZE); PyTuple_SET_ITEM(args1, 0, PyFloat_FromDouble(v.x)); PyTuple_SET_ITEM(args1, 1, PyFloat_FromDouble(v.y)); PyTuple_SET_ITEM(args1, 1, PyFloat_FromDouble(v.z)); PyTuple_SET_ITEM(args1, 1, PyFloat_FromDouble(v.w)); PyTuple_SET_ITEM(args, 1, args1); if(unpickleMethod == NULL){ Py_DECREF(args); return NULL; } return args; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::__unpickle__(PyObject* self, PyObject* args) { float x, y, z, w; Py_ssize_t size = PyTuple_Size(args); if(size != VECTOR_SIZE) { ERROR_MSG("ScriptVector4::__unpickle__: args error! size != 4"); S_Return; } if(!PyArg_ParseTuple(args, "ffff", &x, &y, &z, &w)) { ERROR_MSG("ScriptVector4::__unpickle__: args error!"); S_Return; } return new ScriptVector4(x, y, z, w); } //------------------------------------------------------------------------------------- void ScriptVector4::onInstallScript(PyObject* mod) { static PyMethodDef __unpickle__Method = {"Vector4", (PyCFunction)&ScriptVector4::__unpickle__, METH_VARARGS, 0}; PyObject* pyFunc = PyCFunction_New(&__unpickle__Method, NULL); script::Pickler::registerUnpickleFunc(pyFunc, "Vector4"); Py_DECREF(pyFunc); ScriptVector4::_scriptType.tp_as_number = &ScriptVector4::numberMethods; //ScriptVector4::_scriptType.tp_compare = tp_compare; ScriptVector4::_scriptType.tp_name = "Vector4"; } //------------------------------------------------------------------------------------- bool ScriptVector4::check(PyObject* value, bool isPrintErr) { if(value == NULL || PySequence_Check(value) <= 0) { if(isPrintErr) { PyErr_Format(PyExc_TypeError, "ScriptVector4::check(): args is must a sequence."); PyErr_PrintEx(0); } return false; } Py_ssize_t size = PySequence_Size(value); if(size != VECTOR_SIZE) { if(isPrintErr) { PyErr_Format(PyExc_TypeError, "ScriptVector4::check(): len(args) != %d. can't set.", VECTOR_SIZE); PyErr_PrintEx(0); } return false; } return true; } //------------------------------------------------------------------------------------- bool ScriptVector4::convertPyObjectToVector4(Vector4& v, PyObject* obj) { if(!check(obj)) return false; PyObject* pyItem = PySequence_GetItem(obj, 0); v.x = float(PyFloat_AsDouble(pyItem)); Py_DECREF(pyItem); pyItem = PySequence_GetItem(obj, 1); v.y = float(PyFloat_AsDouble(pyItem)); Py_DECREF(pyItem); pyItem = PySequence_GetItem(obj, 2); v.z = float(PyFloat_AsDouble(pyItem)); Py_DECREF(pyItem); pyItem = PySequence_GetItem(obj, 3); v.w = float(PyFloat_AsDouble(pyItem)); Py_DECREF(pyItem); return true; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::py_add(PyObject *a, PyObject *b) { if(!check(a) || !check(b)) { PyErr_Clear(); Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } Vector4 av; Vector4 bv; convertPyObjectToVector4(av, a); convertPyObjectToVector4(bv, b); return new ScriptVector4(av + bv); } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::py_subtract(PyObject *a, PyObject *b) { if(!check(a) || !check(b)) { PyErr_Clear(); Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } Vector4 av; Vector4 bv; convertPyObjectToVector4(av, a); convertPyObjectToVector4(bv, b); return new ScriptVector4(av - bv); } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::py_multiply(PyObject *a, PyObject *b) { float f; if(check(a)) { ScriptVector4* sv = static_cast<ScriptVector4*>(a); f = float(PyFloat_AsDouble(b)); return new ScriptVector4(sv->getVector() * f); } else if(check(b)) { ScriptVector4* sv = static_cast<ScriptVector4*>(b); f = float(PyFloat_AsDouble(a)); return new ScriptVector4(sv->getVector() * f); } PyErr_Clear(); Py_INCREF( Py_NotImplemented ); return Py_NotImplemented; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::py_divide(PyObject *a, PyObject *b) { if(!check(a)) { PyErr_Clear(); Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } Vector4 av; convertPyObjectToVector4(av, a); float f = float(PyFloat_AsDouble(b)); return new ScriptVector4(av / f); } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::py_negative(PyObject *self) { //ScriptVector4* sv = static_cast<ScriptVector4*>(self); S_Return; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::py_positive(PyObject *self) { ScriptVector4* sv = static_cast<ScriptVector4*>(self); return new ScriptVector4(sv->getVector() * -1.f); } //------------------------------------------------------------------------------------- int ScriptVector4::py_nonzero(PyObject *self) { ScriptVector4* sv = static_cast<ScriptVector4*>(self); // Vector4 v = sv->getVector(); float val = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w; return val > 0.f; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::py_inplace_add(PyObject *self, PyObject *b) { if(!check(b)) { PyErr_Clear(); Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } Vector4 bv; convertPyObjectToVector4(bv, b); ScriptVector4* sv = static_cast<ScriptVector4*>(self); Vector4& v = sv->getVector(); v += bv; Py_INCREF(sv); return sv; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::py_inplace_subtract(PyObject *self, PyObject *b) { if(!check(b)) { PyErr_Clear(); Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } Vector4 bv; convertPyObjectToVector4(bv, b); ScriptVector4* sv = static_cast<ScriptVector4*>(self); Vector4& v = sv->getVector(); v -= bv; Py_INCREF(sv); return sv; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::py_inplace_multiply(PyObject *self, PyObject *b) { float value = float(PyFloat_AsDouble(b)); ScriptVector4* sv = static_cast<ScriptVector4*>(self); sv->setVector(sv->getVector() * value); Py_INCREF(sv); return sv; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::py_inplace_divide(PyObject *self, PyObject *b) { ScriptVector4* sv = static_cast<ScriptVector4*>(self); Vector4& v = sv->getVector(); float f = float(PyFloat_AsDouble(b)); v /= f; Py_INCREF(sv); return sv; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::__py_pyDistTo(PyObject* self, PyObject* args) { if (PyTuple_Size(args) != 1) { PyErr_SetString(PyExc_TypeError, "args > 1 error!\n"); PyErr_PrintEx(0); S_Return; } PyObject* pyVal = PyTuple_GET_ITEM(args, 0); if(!check(pyVal)) { S_Return; } ScriptVector4* sv = static_cast<ScriptVector4*>(self); Vector4& v = sv->getVector(); Vector4 v1; convertPyObjectToVector4(v1, pyVal); Vector4 rv = (v - v1); return PyFloat_FromDouble(KBEVec4Length(&rv)); //㳤Ȳ } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::__py_pyDistSqrTo(PyObject* self, PyObject* args) { if (PyTuple_Size(args) != 1) { PyErr_SetString(PyExc_TypeError, "args > 1 error!\n"); PyErr_PrintEx(0); S_Return; } PyObject* pyVal = PyTuple_GET_ITEM(args, 0); if(!check(pyVal)) { S_Return; } ScriptVector4* sv = static_cast<ScriptVector4*>(self); Vector4& v = sv->getVector(); Vector4 v1; convertPyObjectToVector4(v1, pyVal); Vector4 rv = (v - v1); return PyFloat_FromDouble(KBEVec4LengthSq(&rv)); //˲ } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::__py_pyScale(PyObject* self, PyObject* args) { if(PyTuple_Size(args) == 1) { ScriptVector4* sv = static_cast<ScriptVector4*>(self); Vector4& v = sv->getVector(); PyObject* pItem = PyTuple_GetItem(args, 0); return new ScriptVector4(v * float(PyFloat_AsDouble(pItem))); } PyErr_SetString(PyExc_TypeError, "Vector.scale expects a float argument"); PyErr_PrintEx(0); return NULL; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::__py_pyDot(PyObject* self, PyObject* args) { ScriptVector4* v = new ScriptVector4(0,0,0,0); PyObject* pyResult = v->__py_pySet((PyObject*)v, args); if(pyResult) Py_DECREF(pyResult); ScriptVector4* sv = static_cast<ScriptVector4*>(self); float result = KBEVec4Dot(const_cast<Vector4*>(&sv->getVector()), const_cast<Vector4*>(&v->getVector())); Py_DECREF(v); return PyFloat_FromDouble(result); } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::__py_pyNormalise(PyObject* self, PyObject* args) { if (PyTuple_Size(args) != 0) { PyErr_SetString(PyExc_TypeError, "Vector.normalise takes no arguments(nor does it brook any dissent :)"); PyErr_PrintEx(0); return NULL; } ScriptVector4* sv = static_cast<ScriptVector4*>(self); Vector4& v = sv->getVector(); KBEVec4Normalize(&v, &v); S_Return; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::__py_pyTuple(PyObject* self, PyObject* args) { if (PyTuple_Size(args) != 0) { PyErr_SetString(PyExc_TypeError, "Vector.tuple takes no arguments"); PyErr_PrintEx(0); return NULL; } PyObject* pyTup = PyTuple_New(VECTOR_SIZE); ScriptVector4* sv = static_cast<ScriptVector4*>(self); Vector4& v = sv->getVector(); for(int i = 0; i < VECTOR_SIZE; ++i) PyTuple_SetItem(pyTup, i, PyFloat_FromDouble(v[i])); return pyTup; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::__py_pyList(PyObject* self, PyObject* args) { if (PyTuple_Size(args) != 0) { PyErr_SetString(PyExc_TypeError, "Vector.tuple takes no arguments"); PyErr_PrintEx(0); return NULL; } PyObject* pyList = PyList_New(VECTOR_SIZE); ScriptVector4* sv = static_cast<ScriptVector4*>(self); Vector4& v = sv->getVector(); for (int i=0; i < VECTOR_SIZE; ++i) PyList_SetItem(pyList, i, PyFloat_FromDouble(v[i])); return pyList; } //------------------------------------------------------------------------------------- PyObject* ScriptVector4::__py_pySet(PyObject* self, PyObject* args) { ScriptVector4* sv = static_cast<ScriptVector4*>(self); bool good = false; Vector4 v; // ֻ1Ԫ int tupleSize = (int)PyTuple_Size(args); if(tupleSize == 1) { PyObject* pyItem = PyTuple_GetItem(args, 0); if(ScriptVector4::check(pyItem, false)) { convertPyObjectToVector4(v, pyItem); good = true; } else { float f = float(PyFloat_AsDouble(pyItem)); for (int i=0; i < VECTOR_SIZE; ++i) { v[i] = f; } good = true; } } else if(tupleSize >= VECTOR_SIZE) { convertPyObjectToVector4(v, args); good = true; } if(!good) { PyErr_Format(PyExc_TypeError, "Vector.set must be set to a tuple of %d floats, or one float", VECTOR_SIZE); PyErr_PrintEx(0); return NULL; } sv->setVector(v); S_Return; } //------------------------------------------------------------------------------------- } }
1
0.680508
1
0.680508
game-dev
MEDIA
0.320847
game-dev
0.724507
1
0.724507
arvindrajayadav/Good-Robot
14,477
fxmachine.cpp
/*----------------------------------------------------------------------------- Machine.cpp Good Robot (c) 2015 Pyrodactyl This manages the complex vending machine objects that can be spread around the gameworld. This is actually inherited from an fx object, just like bullets and pickups, but this one is a bit too large and complex to end up shoved in the kid's table in fx.cpp. -----------------------------------------------------------------------------*/ #include "master.h" #include "audio.h" #include "camera.h" #include "collision.h" #include "drop.h" #include "entity.h" #include "fx.h" #include "loaders.h" #include "fxmachine.h" #include "menu.h" #include "particle.h" #include "player.h" #include "random.h" #include "render.h" #include "world.h" #include "zone.h" #define SPAWN_RATE 200 #define LONG_COOLDOWN 4000 using namespace pyrodactyl; /*----------------------------------------------------------------------------- MachineInfo class holds the properties of machine types. -----------------------------------------------------------------------------*/ string MachineInfo::StringFromXML(rapidxml::xml_node<char> *node, string field) { string result; LoadStr(result, field, node); return result; } vector<float> MachineInfo::BlinkFromString(string s) { vector<float> b; for (unsigned i = 0; i < s.length(); i++) { b.push_back((float)stoi(s.substr(i, 1), nullptr, 16) / 15.0f); } return b; } MachineUse MachineInfo::UseFromString(string input) { input = StringToLower(input); if (input.compare("insurance") == 0) return MACHINE_USE_INSURANCE; if (input.compare("shop") == 0) return MACHINE_USE_GUNS; if (input.compare("factory") == 0) return MACHINE_USE_FACTORY; if (input.compare("upgrade") == 0) return MACHINE_USE_UPGRADE; if (input.compare ("hats") == 0) return MACHINE_USE_HATS; if (input.compare ("spawn") == 0) return MACHINE_USE_SPAWN; return MACHINE_USE_NONE; } MachineMount MachineInfo::MountFromString(string input) { input = StringToLower(input); if (input.compare("ceiling") == 0) return MACHINE_MOUNT_CEILING; if (input.compare("left") == 0) return MACHINE_MOUNT_LEFT; if (input.compare("right") == 0) return MACHINE_MOUNT_RIGHT; return MACHINE_MOUNT_FLOOR; } void MachineInfo::Load(class rapidxml::xml_node<char>* node) { float group_rotate; _name = node->name(); _message = StringFromXML(node, "Message"); _drop = StringFromXML(node, "Drop"); _use = UseFromString(StringFromXML(node, "Use")); _mount = MountFromString(StringFromXML(node, "Mount")); group_rotate = StringToFloat(StringFromXML(node, "Angle")); _hitpoints = EnvGetHitpointsFromID(StringFromXML(node, "Hitpoints")); //Negative hitpoints means a machine is immune to damage. _invulnerable = (_hitpoints <= 0); //Hitpoints of zero means a machine can't be hit with bullets. _shootable = (_hitpoints != 0); _offset = StringToVector2(StringFromXML(node, "Offset")); _offset = _offset.Rotated(group_rotate); _activate_radius = StringToFloat(StringFromXML(node, "ActivateRadius")); _can_activate = false; if (!LoadNum(_max_active_robots, "MaxActiveRobots", node)) _max_active_robots = 6; _parts.clear(); _bbox.Clear(); for (int part_count = 0;; part_count++) { rapidxml::xml_node<char> *part_node; MachinePart mp; part_node = node->first_node(StringSprintf("Part%d", part_count).c_str()); if (!NodeValid(part_node)) break; mp.origin.x = StringToFloat(StringFromXML(part_node, "X")); mp.origin.y = StringToFloat(StringFromXML(part_node, "Y")); mp.origin = mp.origin.Rotated(group_rotate); mp.origin += _offset; mp.position = mp.origin; mp.depth = StringToFloat(StringFromXML(part_node, "Depth")); mp.color = GLrgbaFromHex(StringFromXML(part_node, "Color")); mp.size = StringToFloat(StringFromXML(part_node, "Size")); mp.sprite = SpriteEntryLookup(StringFromXML(part_node, "Sprite")); mp.start_angle = StringToFloat(StringFromXML(part_node, "Angle")) + group_rotate; mp.spin = StringToFloat(StringFromXML(part_node, "Spin")); mp.blink = BlinkFromString(StringFromXML(part_node, "Blink")); mp.indestructible = (bool)(StringToInt (StringFromXML (part_node, "Indestructible")) != 0); mp.glow = (bool)(StringToInt (StringFromXML (part_node, "Glow")) != 0); mp.destroyed = false; //Move also needs to rotate depending on the rotate value mp.move = StringToVector2(StringFromXML(part_node, "Move")); mp.move = mp.move.Rotated(group_rotate); int time = StringToInt(StringFromXML(part_node, "MoveTime")); mp.move_linear = time > 0; mp.move_time = max(abs(time), 1);//Must be at least 1, or else divide by zero. mp.is_moving = mp.move != GLvector2(); mp.looping_movement = StringToInt(StringFromXML(part_node, "MoveLoop")) != 0; _parts.push_back(mp); if (!mp.glow) { _bbox.ContainPoint(mp.position - (mp.size / 2.0f)); _bbox.ContainPoint(mp.position + (mp.size / 2.0f)); } } if (_use == MACHINE_USE_GUNS || _use == MACHINE_USE_UPGRADE || _use == MACHINE_USE_HATS) _can_activate = true; //Now shave off the portion of the bbox that will be embedded into the level geometry. if (_mount == MACHINE_MOUNT_FLOOR) _bbox.pmax.y = 0.0f; if (_mount == MACHINE_MOUNT_LEFT) _bbox.pmin.x = 0.0f; _cell_size.x = max((int)ceil(_bbox.Size().x), 1); _cell_size.y = max((int)ceil(_bbox.Size().y), 1); } /*----------------------------------------------------------------------------- This sort is used to put machine parts in order so they can be rendered back-to-front. -----------------------------------------------------------------------------*/ static int compare_parts(const void* part1, const void* part2) { const MachinePart* p1 = (MachinePart*)part1; const MachinePart* p2 = (MachinePart*)part2; if (p1->depth < p2->depth) return -1; else if (p1->depth > p2->depth) return 1; return 1; } /*----------------------------------------------------------------------------- fxMachine holds the instance of a single machine within the game. It's in charge of animating, rendering, and activating it. -----------------------------------------------------------------------------*/ void fxMachine::Init(GLvector2 position, GLcoord2 page, const MachineInfo* info) { _origin = position; _info = info; _page = page; _active = true; _tick_offset = RandomVal(); _bbox.Clear(); _bbox.ContainPoint(_origin); _factory_next = 0; _on = true; _spawner = position; _hitpoints = _info->_hitpoints; _destroyed = false; _humming = false; _dropoff = _bbox.Center (); //See if we're on the left or right half of this page. (Room.) //We want to spawn stuff TOWARDS the center. float page_x = fmod (position.x, (float)PAGE_SIZE); float offset = _bbox.Size ().x + 1.0f; if (page_x > PAGE_HALF) _dropoff.x -= offset; else _dropoff.x += offset; if (_info->Use () == MACHINE_USE_FACTORY) WorldZone ()->PageGet (_page)->FactoryAdded (); for (unsigned i = 0; i < _info->_parts.size(); i++) { MachinePart p; p = _info->_parts[i]; p.depth += DEPTH_MACHINES; p.sprite_color = p.color; p.angle = p.start_angle; p.destroyed = false; if (!p.glow) { _bbox.ContainPoint(_origin + p.origin + (p.size / 2)); _bbox.ContainPoint(_origin + p.origin - (p.size / 2)); } _parts.push_back(p); } //If this thing has an activation radius, make sure the bbox is large enough to contain it. if (info->_activate_radius > 0.0f) { _bbox.ContainPoint(_origin + GLvector2(info->_activate_radius, info->_activate_radius)); _bbox.ContainPoint(_origin - GLvector2(info->_activate_radius, info->_activate_radius)); } //Don't know why anyone would make a machine with no parts, but let's avoid crashing anyway. if (!_parts.empty()) { //Things should pop out of the center of the first sprite. _spawner = _parts[0].position; qsort(&_parts[0], _parts.size(), sizeof(MachinePart), compare_parts); } } void fxMachine::Destroy () { if (_destroyed) return; _destroyed = true; if (_info->Use () == MACHINE_USE_FACTORY) WorldZone ()->PageGet (_page)->FactoryDestroyed (); //Make an explosion to cover up the vanising device. for (unsigned i = 0; i < _info->_parts.size (); i++) { MachinePart* p; p = &_parts[i]; if (!p->indestructible) p->destroyed = true; if (!p->glow && !p->indestructible) { fxExplosion* e = new fxExplosion; e->Init (OWNER_NONE, _origin + p->position, 1, p->size / 1.4f); EntityFxAdd (e); ParticleDebris (_origin + p->position, p->size / 4.0f, 3, 1.0f + RandomFloat () * 7.0f); } } //Drop stuff. if (!_info->_drop.empty ()) DropLoot (_info->_drop, _origin); } void fxMachine::Update() { MachinePart* p; unsigned blink_tick; unsigned now; now = GameTick(); if (_destroyed) return; if (!_info->_invulnerable && _hitpoints <= 0) { Destroy (); return; } if (_info->_use == MACHINE_USE_SPAWN) { if (Player()->Warranty() && !_on) TurnOn(); if (!Player()->Warranty() && _on && !PlayerIgnore()) TurnOff(); } if (_on) { blink_tick = GameTick() / 20 + _tick_offset; for (unsigned i = 0; i < _info->_parts.size(); i++) { p = &_parts[i]; if (!p->blink.empty()) { int index = (blink_tick) % p->blink.size(); p->sprite_color = p->color * p->blink[index]; } if (p->is_moving) { float delta = (float)(now % p->move_time) / (float)p->move_time; //Scale delta so it runs from 0 to 1 and back to 0 again. if (p->looping_movement) { delta *= 2.0f; if (delta > 1.0f) delta = 2.0f - delta; } //Use delta to move this object. if (!p->move_linear) delta = syMathScalarCurve(delta); p->position = p->origin + p->move * delta; } p->angle += p->spin; } } if (_info->_can_activate) { bool close = false; float distance = GLvector2 (_origin - PlayerOrigin ()).Length (); if (distance < _info->_activate_radius) close = true; if (close) { float volume = 1.0f - (distance / _info->_activate_radius); PlayerOfferAccess (0.0f, _info->_message.c_str ()); WorldVendingNear (); _humming = true; if (PlayerAccessActivated () && !MenuIsOpen ()) { WorldItemDropoffSet (_dropoff); PlayerOriginSet (_dropoff); if (_info->_use == MACHINE_USE_GUNS) MenuOpen (MENU_STORE); if (_info->_use == MACHINE_USE_UPGRADE) MenuOpen (MENU_UPGRADE); if (_info->_use == MACHINE_USE_HATS) MenuOpen (MENU_HAT); } } else if (_humming) { //If we're humming but player is no longer close. _humming = false; AudioLoop (LOOP_ACCESS, 1.0f, 0.0f); } } if (_info->_use == MACHINE_USE_FACTORY) FactoryUpdate(); } void fxMachine::TurnOff() { _on = false; } void fxMachine::TurnOn() { _on = true; } void fxMachine::FactoryUpdate() { //Limit the rate at which we spawn robots. if (GameTick() < _factory_next) return; _factory_next = GameTick() + SPAWN_RATE; int robot_id; Robot b; GLvector2 launch_vector; bool player_can_see_us; GLvector2 to_player; //Take our origin, nudge it slightly towards the player, and see if that point //ends up on-screen. If so, they can see us well enough. to_player = GLvector2(PlayerPosition() - _origin).Normalized() * 0.5f; player_can_see_us = RenderPointVisible(_origin - to_player); //Make sure the spawner is on-screen, so we're not spewing out robots in parts of the level //where they don't matter. if (!player_can_see_us) return; //If there are no robots left (or never were any to begin with) //then shut down this machine. if (WorldZone()->RobotSpawnCount(_page) == 0) { if (_on) TurnOff(); ParticleSmoke (_origin + _spawner, 0.85f, 2); _factory_next += 100; return; } //If the population is too high, put this spawner on a long cooldown //before we try again. if (EntityRobotsActive() > _info->_max_active_robots) { _factory_next += LONG_COOLDOWN; return; } //Don't make robots unless there's a clear line of sight to the player, //to avoid spawning robots or behind walls. if (!CollisionLos(_origin + _parts[0].position, PlayerPosition(), 0.5f)) return; robot_id = WorldZone()->RobotSpawnId(_page); //If RobotSpawnId returns ROBOT_INVALID, then the current location is //out of robots. if (robot_id == ROBOT_INVALID) { if (_on) TurnOff(); ParticleSmoke(_origin + _spawner, 0.85f, 2); _factory_next += 100; return; } //Spawn a robot launch_vector = GLvectorFromAngle(_parts[0].angle + 180.0f); b.Init(_bbox.Center(), robot_id); b.Launch(launch_vector); EntityRobotAdd(b); //Make some particle effects to cover the spawn. ParticleBloom (_bbox.Center (), GLrgba (1, 1, 1), 1.0f, 500); AudioPlay ("skate", _bbox.Center ()); } void fxMachine::Render() { MachinePart* p; if (_on) { for (unsigned i = 0; i < _info->_parts.size(); i++) { p = &_parts[i]; if (p->destroyed) continue; RenderQuad (_origin + p->position, p->sprite, p->sprite_color, p->size, p->angle, p->depth, p->glow); } } else { for (unsigned i = 0; i < _info->_parts.size(); i++) { p = &_parts[i]; if (p->glow || p->destroyed) continue; RenderQuad(_origin + p->position, p->sprite, GLrgba(), p->size, p->angle, p->depth, p->glow); } } if (EnvValueb(ENV_BBOX)) { if (_destroyed) glColor3f(1, 0, 0); else glColor3f (0, 1, 0); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_TEXTURE_2D); _bbox.Render(); glEnable(GL_TEXTURE_2D); } } void fxMachine::RenderOccluded() { MachinePart* p; for (unsigned i = 0; i < _info->_parts.size(); i++) { p = &_parts[i]; if (p->glow || p->destroyed) continue; RenderQuad(_origin + p->position, p->sprite, GLrgba(), p->size, p->angle, p->depth, p->glow); } } bool fxMachine::Collide(GLvector2 bullet_pos) { if (!_info->_shootable) return false; if (_destroyed) return false; //If a factory runs out of robots, you can't shoot it. if (_info->_use == MACHINE_USE_FACTORY && !_on) return false; if (!_bbox.Contains(bullet_pos)) return false; MachinePart* p; SpriteUnit s; for (unsigned i = 0; i < _info->_parts.size(); i++) { p = &_parts[i]; //Bullets can't hit glowing parts, which are usually light auras and other non-tangible stuff. if (p->glow) continue; s.Init(p->sprite, p->size, GLrgba()); s.Move(_origin + p->position, p->angle); if (s.Collide(bullet_pos)) return true; } return false; } void fxMachine::Hit(GLvector2 x, int damage) { if (_info->_invulnerable) return; _hitpoints -= damage; }
1
0.955177
1
0.955177
game-dev
MEDIA
0.83342
game-dev
0.912871
1
0.912871
bcdev/beam
5,768
beam-avhrr-reader/src/main/java/org/esa/beam/dataio/avhrr/noaa/pod/PodGeoCoding.java
/* * Copyright (C) 2015 Brockmann Consult GmbH (info@brockmann-consult.de) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 3 of the License, or (at your option) * any later version. * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, see http://www.gnu.org/licenses/ */ package org.esa.beam.dataio.avhrr.noaa.pod; import org.esa.beam.framework.dataio.ProductSubsetDef; import org.esa.beam.framework.datamodel.GeoApproximation; import org.esa.beam.framework.datamodel.GeoPos; import org.esa.beam.framework.datamodel.PixelPos; import org.esa.beam.framework.datamodel.PixelPosEstimator; import org.esa.beam.framework.datamodel.Product; import org.esa.beam.framework.datamodel.Scene; import org.esa.beam.framework.datamodel.TiePointGeoCoding; import org.esa.beam.framework.datamodel.TiePointGrid; import javax.media.jai.PlanarImage; import java.awt.Rectangle; /** * This geo-coding improves the inverse approximations used in the {@code TiePointGeoCoding} in order * to facilitate accurate re-projections and graticule drawing. * <p/> * Limitation: this geo-coding is not transferred when making subsets and is not saved when a product * is written to disk. * * @author Ralf Quast */ final class PodGeoCoding extends TiePointGeoCoding { private transient PixelPosEstimator pixelPosEstimator; private transient PodPixelFinder pixelFinder; private transient GeoApproximation[] approximations; private transient PlanarImage latImage; PodGeoCoding(TiePointGrid latGrid, TiePointGrid lonGrid) { this(latGrid, lonGrid, createApproximations(lonGrid.getGeophysicalImage(), latGrid.getGeophysicalImage())); } private PodGeoCoding(TiePointGrid latGrid, TiePointGrid lonGrid, GeoApproximation[] approximations) { super(latGrid, lonGrid); this.approximations = approximations; final PlanarImage lonImage = lonGrid.getGeophysicalImage(); latImage = latGrid.getGeophysicalImage(); final Rectangle bounds = new Rectangle(0, 0, lonGrid.getSceneRasterWidth(), lonGrid.getSceneRasterHeight()); pixelPosEstimator = new PixelPosEstimator(approximations, bounds); pixelFinder = new PodPixelFinder(lonImage, latImage, null, 0.025); // slightly more than 2 km, half a border pixel } @Override public boolean canGetPixelPos() { return pixelPosEstimator.canGetPixelPos(); } @Override public PixelPos getPixelPos(GeoPos geoPos, PixelPos pixelPos) { if (pixelPosEstimator.canGetPixelPos()) { if (pixelPos == null) { pixelPos = new PixelPos(); } pixelPosEstimator.getPixelPos(geoPos, pixelPos); if (pixelPos.isValid()) { pixelFinder.findPixelPos(geoPos, pixelPos); } if (pixelPos.isValid()) { // do not fill gap, check that LAT displacement is less than 0.05, about 4 km int x = (int) Math.floor(pixelPos.x); int y = (int) Math.floor(pixelPos.y); try { double lat = latImage.getData(new Rectangle(x, y, 1, 1)).getSampleDouble(x, y, 0); if (Math.abs(lat - geoPos.getLat()) > 0.05) { pixelPos.setInvalid(); } } catch (IllegalArgumentException iae) { //pixelPosEstimator.getPixelPos(geoPos, pixelPos); pixelPos.setInvalid(); } } // if (pixelPos.isValid()) { // pixelFinder.findPixelPos(geoPos, pixelPos); // } } else { super.getPixelPos(geoPos, pixelPos); } return pixelPos; } private static GeoApproximation[] createApproximations(PlanarImage lonImage, PlanarImage latImage) { return GeoApproximation.createApproximations(lonImage, latImage, null, 0.5); } @Override public boolean transferGeoCoding(Scene srcScene, Scene destScene, ProductSubsetDef subsetDef) { final String latGridName = getLatGrid().getName(); final String lonGridName = getLonGrid().getName(); final Product destProduct = destScene.getProduct(); TiePointGrid latGrid = destProduct.getTiePointGrid(latGridName); if (latGrid == null) { latGrid = TiePointGrid.createSubset(getLatGrid(), subsetDef); destProduct.addTiePointGrid(latGrid); } TiePointGrid lonGrid = destProduct.getTiePointGrid(lonGridName); if (lonGrid == null) { lonGrid = TiePointGrid.createSubset(getLonGrid(), subsetDef); destProduct.addTiePointGrid(lonGrid); } if (latGrid != null && lonGrid != null) { if (subsetDef == null || subsetDef.getRegion() == null) { // re-use approximations destScene.setGeoCoding(new PodGeoCoding(latGrid, lonGrid, approximations)); } else { destScene.setGeoCoding(new PodGeoCoding(latGrid, lonGrid)); } return true; } else { return false; } } @Override public void dispose() { super.dispose(); pixelFinder = null; pixelPosEstimator = null; approximations = null; latImage = null; } }
1
0.846193
1
0.846193
game-dev
MEDIA
0.311894
game-dev
0.858578
1
0.858578
modernuo/ModernUO
1,167
Projects/UOContent/Items/Addons/JackOLantern.cs
using ModernUO.Serialization; namespace Server.Items { [SerializationGenerator(0)] public partial class JackOLantern : BaseAddon { [Constructible] public JackOLantern() : this(Utility.Random(2) < 1) { } [Constructible] public JackOLantern(bool south) { AddComponent(new AddonComponent(5703), 0, 0, +0); const int hue = 1161; if (!south) { AddComponent(GetComponent(3178, 0), 0, 0, -1); AddComponent(GetComponent(3883, hue), 0, 0, +1); AddComponent(GetComponent(3862, hue), 0, 0, +0); } else { AddComponent(GetComponent(3179, 0), 0, 0, +0); AddComponent(GetComponent(3885, hue), 0, 0, -1); AddComponent(GetComponent(3871, hue), 0, 0, +0); } } public override bool ShareHue => false; private static AddonComponent GetComponent(int itemID, int hue) => new(itemID) { Hue = hue, Name = "jack-o-lantern" }; } }
1
0.864894
1
0.864894
game-dev
MEDIA
0.945894
game-dev
0.936311
1
0.936311
Dimbreath/AzurLaneData
1,454
ko-KR/view/minigame/gameview/lanternfestivalview.lua
slot0 = class("LanternFestivalView", import("..BaseMiniGameView")) function slot0.getUIName(slot0) return "LanternFestivalUI" end function slot0.didEnter(slot0) slot0.controller = LanternRiddlesController.New() slot0.controller.view:SetUI(slot0._tf) slot0.controller:SetCallBack(function () uv0:emit(uv1.ON_BACK) end, function () uv0:emit(uv1.ON_HOME) end, function () if uv0:GetMGHubData().count > 0 then uv0:SendSuccess(0) end end, function () uv0:StoreDataToServer(uv0.controller:GetSaveData()) end) slot0.controller:SetUp(slot0:PackData()) end function slot0.PackData(slot0) slot1 = 15 slot4, slot5 = nil if slot0:GetMGData():GetRuntimeData("elements") and #slot3 > 0 then slot4 = _.slice(slot3, 1, slot1) slot5 = _.slice(slot3, slot1 + 1, slot0:GetMGHubData().usedtime) else for slot9 = 1, slot1 do table.insert({}, 0) end slot5 = {} end return { finishCount = slot2.usedtime, unlockCount = slot2.count, nextTimes = slot4, finishList = slot5 } end function slot0.OnGetAwardDone(slot0, slot1) if slot1.cmd == MiniGameOPCommand.CMD_COMPLETE then slot2 = slot0:GetMGHubData() if slot2.ultimate == 0 and slot2:getConfig("reward_need") <= slot2.usedtime then pg.m02:sendNotification(GAME.SEND_MINI_GAME_OP, { hubid = slot2.id, cmd = MiniGameOPCommand.CMD_ULTIMATE, args1 = {} }) end end end function slot0.willExit(slot0) slot0.controller:Dispose() end return slot0
1
0.549308
1
0.549308
game-dev
MEDIA
0.811427
game-dev
0.917931
1
0.917931
David-JonesDVN/Touhou-Relauncher
14,027
Touhou Launcher/thcrap.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using System.Net; using Newtonsoft.Json; namespace Touhou_Launcher { public partial class thcrap : Form { internal class repoData { public string contact = ""; public string id = ""; public List<string> neighbors = new List<string>(); public Dictionary<string, string> patches = new Dictionary<string, string>(); public List<string> servers = new List<string>(); public string title = ""; } internal class patchData { public List<string> dependencies = new List<string>(); public string id = ""; public List<string> servers = new List<string>(); public string title = ""; public Dictionary<string, bool> fonts = new Dictionary<string, bool>(); } internal class profileData { public bool console = false; public bool dat_dump = false; public List<Dictionary<string, string>> patches = new List<Dictionary<string, string>>(); } ConfigForm cfgForm; string gamejs; Dictionary<string, repoData> repos = new Dictionary<string, repoData>(); List<string> checkedRepos = new List<string>(); List<string> patchStates = new List<string>(); Dictionary<string, string> games = new Dictionary<string, string>(); Queue<string> repoQueue = new Queue<string>(); private void InitializeLanguage() { this.Text = MainForm.rm.GetString("thcrapTitle") + MainForm.rm.GetString(MainForm.nameToID.FirstOrDefault(t => t.Value == cfgForm.game).Key); foreach (ListView list in MainForm.GetAll(this, typeof(ListView))) { foreach (ColumnHeader column in list.Columns) { column.Text = MainForm.rm.GetString(column.Name); } } gameGroup.Text = MainForm.rm.GetString("gameGroup"); patchGroup.Text = MainForm.rm.GetString("patchGroup"); gameID.Text = MainForm.rm.GetString("gameIDColumn") + ":"; gamePath.Text = MainForm.rm.GetString("pathColumn") + ":"; browsePath.Text = MainForm.rm.GetString("browse"); addGame.Text = MainForm.rm.GetString("customAdd"); removeGame.Text = MainForm.rm.GetString("customRemove"); } private void RefreshProfiles() { gameList.Items.Clear(); foreach (KeyValuePair<string, string> game in games) { ListViewItem gameID = gameList.Items.Add(game.Key); gameID.SubItems.Add(game.Value); } } public thcrap(ConfigForm cfg) { cfgForm = cfg; gamejs = MainForm.curCfg.crapDir + "\\config\\launcher" + MainForm.idToNumber[cfg.game] + ".js"; InitializeComponent(); InitializeLanguage(); } private void thcrap_Load(object sender, EventArgs e) { repoList.Items.Add(MainForm.rm.GetString("selectedPatches")); if (File.Exists(gamejs)) { profileData profile = JsonConvert.DeserializeObject<profileData>(File.ReadAllText(gamejs)); foreach (Dictionary<string, string> patch in profile.patches) { if (!patchStates.Contains(patch["archive"])) patchStates.Add(patch["archive"].Substring(6)); } } foreach (FileInfo localRepo in new DirectoryInfo(MainForm.curCfg.crapDir).CreateSubdirectory("repos").GetFiles("repo.js", SearchOption.AllDirectories)) { addRepo(File.ReadAllText(localRepo.FullName), true); } searchRepo(MainForm.curCfg.StartingRepo); if (File.Exists(MainForm.curCfg.crapDir + "\\config\\games.js")) games = JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(MainForm.curCfg.crapDir + "\\config\\games.js")); for (int i = 0; i < 3; i += 2) { if (MainForm.curCfg.gameCFG[cfgForm.game].GameDir[i] != "" && !games.ContainsValue(MainForm.curCfg.gameCFG[cfgForm.game].GameDir[i].Replace("\\", "/"))) { string augment = i == 2 ? "_custom" : ""; games.Add("th" + (MainForm.idToNumber[cfgForm.game]).ToString("00") + augment, MainForm.curCfg.gameCFG[cfgForm.game].GameDir[i].Replace("\\", "/")); } } RefreshProfiles(); } private async void searchRepo(string address) { WebClient wc = new WebClient(); wc.Encoding = Encoding.UTF8; while (true) { if (!checkedRepos.Contains(address)) { try { addRepo(await wc.DownloadStringTaskAsync(address + "/repo.js")); checkedRepos.Add(address); } catch (Exception ex) { /* Code for exploring the thcrap mirror manually. using (var reader = new StreamReader(WebRequest.Create(address).GetResponse().GetResponseStream())) { string result = reader.ReadToEnd(); System.Text.RegularExpressions.MatchCollection matches = new System.Text.RegularExpressions.Regex("<a href=\".*\">(?<name>.*)</a>").Matches(result); //Alt Regex: <a\s+(?:[^>]*?\s+)?href=(["'])(.*?)\1 foreach (System.Text.RegularExpressions.Match match in matches) { if (!match.Success) { continue; } if (match.Groups["name"].Value.EndsWith("/")) searchRepo(address + match.Groups["name"].Value, true); } } */ } } if (repoQueue.Count > 0) { address = repoQueue.Dequeue(); } else break; } } private void addRepo(string repojs, bool offline = false) { try { repoData data = JsonConvert.DeserializeObject<repoData>(repojs); FileInfo jsPath = new FileInfo(MainForm.curCfg.crapDir + "\\repos\\" + data.id + "\\repo.js"); jsPath.Directory.Create(); File.WriteAllText(jsPath.FullName, repojs); if (!repoList.Items.ContainsKey(data.id) || (bool)repoList.Items[data.id].Tag == true) { foreach (string neighbor in data.neighbors) { repoQueue.Enqueue(neighbor); } repos[data.id] = data; if (!repoList.Items.ContainsKey(data.id)) { ListViewItem title = repoList.Items.Add(data.title); title.Name = data.id; title.Tag = offline; title.SubItems.Add(data.id); } else { ListViewItem title = repoList.Items[data.id]; title.Tag = offline; } repoList_SelectedIndexChanged(repoList.Items[data.id], new EventArgs()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } private void onPatchGet(object sender, DownloadStringCompletedEventArgs e) { if (e.Error == null) { patchData patch = JsonConvert.DeserializeObject<patchData>(e.Result); FileInfo jsPath = new FileInfo(MainForm.curCfg.crapDir + "\\repos\\" + (string)e.UserState + "\\" + patch.id + "\\patch.js"); jsPath.Directory.Create(); File.WriteAllText(jsPath.FullName, e.Result); foreach (string dependency in patch.dependencies) { string[] dependencySet = dependency.Split('/'); string repository = ""; if (dependencySet.Length == 1) { foreach (KeyValuePair<string, repoData> repo in repos) { if (repo.Value.patches.ContainsKey(dependencySet[0])) { repository = repo.Key; } } } else repository = dependencySet[0]; addPatch(repository, dependencySet[dependencySet.Length - 1], patchStates.IndexOf((string)e.UserState + "/" + patch.id + "/")); } } } private void addPatch(string repo, string patch, int dependent = -1) { if (!patchStates.Contains(repo + "/" + patch + "/")) { patchStates.Insert(dependent == -1 ? patchStates.Count : dependent, repo + "/" + patch + "/"); repoList_SelectedIndexChanged(repoList.Items[repo], new EventArgs()); } WebClient wc = new WebClient(); wc.Encoding = Encoding.UTF8; wc.DownloadStringCompleted += onPatchGet; wc.DownloadStringAsync(new Uri(repos[repo].servers[0] + "/" + patch + "/patch.js"), repo); } private void thcrap_Closing(object sender, FormClosingEventArgs e) { profileData profile = new profileData(); foreach (string patch in patchStates) { profile.patches.Add(new Dictionary<string, string> { {"archive", "repos/" + patch} }); } File.WriteAllText(gamejs, JsonConvert.SerializeObject(profile, Formatting.Indented)); Dictionary<string, string> games = new Dictionary<string, string>(); foreach (ListViewItem game in gameList.Items) { games[game.Text] = game.SubItems[1].Text; } File.WriteAllText(MainForm.curCfg.crapDir + "\\config\\games.js", JsonConvert.SerializeObject(games, Formatting.Indented)); cfgForm.Refreshcrap(); } private void repoList_SelectedIndexChanged(object sender, EventArgs e) { if (sender == repoList || repoList.SelectedItems.Contains((ListViewItem)sender) || repoList.SelectedIndices.Contains(0)) { patchList.Items.Clear(); if (repoList.SelectedItems.Count > 0) { patchList.ItemChecked -= patchList_ItemChecked; if (repoList.SelectedIndices[0] == 0) { foreach (string patch in patchStates) { string[] patchSet = patch.Split('/'); ListViewItem title = patchList.Items.Add(patch); title.SubItems.Add(repos[patchSet[0]].patches[patchSet[1]]); title.Checked = true; } } else { foreach (KeyValuePair<string, string> patch in repos[repoList.SelectedItems[0].SubItems[1].Text].patches) { ListViewItem title = patchList.Items.Add(patch.Key); title.SubItems.Add(patch.Value); title.Checked = patchStates.Contains(repoList.SelectedItems[0].SubItems[1].Text + "/" + patch.Key + "/"); } } patchList.ItemChecked += patchList_ItemChecked; } } } private void patchList_ItemChecked(object sender, ItemCheckedEventArgs e) { string id = repoList.SelectedIndices[0] == 0 ? e.Item.Text : repoList.SelectedItems[0].SubItems[1].Text + "/" + e.Item.Text + "/"; if (e.Item.Checked) { addPatch(repoList.SelectedItems[0].SubItems[1].Text, e.Item.Text); } else { patchStates.Remove(id); if (repoList.SelectedIndices[0] == 0) e.Item.Remove(); } } private void browsePath_Click(object sender, EventArgs e) { foreach (string file in MainForm.FileBrowser(MainForm.rm.GetString("gameSelectTitle"), MainForm.rm.GetString("executableFilter") + " (*.exe, *.bat, *.lnk)|*.exe;*.bat;*.lnk|" + MainForm.rm.GetString("allFilter") + " (*.*)|*.*")) path.Text = file; } private void addGame_Click(object sender, EventArgs e) { if (File.Exists(path.Text)) { games[id.Text] = path.Text.Replace("\\", "/"); RefreshProfiles(); } } private void removeGame_Click(object sender, EventArgs e) { games.Remove(id.Text); RefreshProfiles(); } private void gameList_SelectedIndexChanged(object sender, EventArgs e) { if (gameList.SelectedItems.Count > 0) { id.Text = gameList.SelectedItems[0].Text; path.Text = gameList.SelectedItems[0].SubItems[1].Text.Replace("/", "\\"); } } } }
1
0.873765
1
0.873765
game-dev
MEDIA
0.523869
game-dev
0.935777
1
0.935777
wmixvideo/nfe
2,153
src/main/java/com/fincatto/documentofiscal/cte300/classes/os/CTeOSInfoInformacoesRelativasImpostosTributosFederais.java
package com.fincatto.documentofiscal.cte300.classes.os; import com.fincatto.documentofiscal.DFBase; import com.fincatto.documentofiscal.cte.CTeConfig; import com.fincatto.documentofiscal.validadores.DFBigDecimalValidador; import org.simpleframework.xml.Element; import org.simpleframework.xml.Namespace; import org.simpleframework.xml.Root; import java.math.BigDecimal; @Root(name = "infTribFed") @Namespace(reference = CTeConfig.NAMESPACE) public class CTeOSInfoInformacoesRelativasImpostosTributosFederais extends DFBase { private static final long serialVersionUID = -5969100532189710320L; @Element(name = "vPIS", required = false) private String valorPIS; @Element(name = "vCOFINS", required = false) private String valorCOFINS; @Element(name = "vIR", required = false) private String valorIR; @Element(name = "vINSS", required = false) private String valorINSS; @Element(name = "vCSLL", required = false) private String valorCSLL; public String getValorPIS() { return valorPIS; } public void setValorPIS(final BigDecimal valorPIS) { this.valorPIS = DFBigDecimalValidador.tamanho15Com2CasasDecimais(valorPIS, "Valor PIS"); } public String getValorCOFINS() { return valorCOFINS; } public void setValorCOFINS(final BigDecimal valorCOFINS) { this.valorCOFINS = DFBigDecimalValidador.tamanho15Com2CasasDecimais(valorCOFINS, "Valor COFINS"); } public String getValorIR() { return valorIR; } public void setValorIR(final BigDecimal valorIR) { this.valorIR = DFBigDecimalValidador.tamanho15Com2CasasDecimais(valorIR, "Valor IR"); } public String getValorINSS() { return valorINSS; } public void setValorINSS(final BigDecimal valorINSS) { this.valorINSS = DFBigDecimalValidador.tamanho15Com2CasasDecimais(valorINSS, "Valor INSS"); } public String getValorCSLL() { return valorCSLL; } public void setValorCSLL(final BigDecimal valorCSLL) { this.valorCSLL = DFBigDecimalValidador.tamanho15Com2CasasDecimais(valorCSLL, "Valor CSLL"); } }
1
0.678088
1
0.678088
game-dev
MEDIA
0.390021
game-dev
0.583873
1
0.583873
Squalr/Squally
2,931
Source/Engine/Events/ObjectEvents.cpp
#include "ObjectEvents.h" #include "cocos/base/CCDirector.h" #include "cocos/base/CCEventDispatcher.h" #include "cocos/base/CCValue.h" #include "Engine/Maps/GameObject.h" using namespace cocos2d; const std::string ObjectEvents::EventQueryObject = "EVENT_QUERY_OBJECT"; const std::string ObjectEvents::EventQueryObjectByTagPrefix = "EVENT_QUERY_OBJECT_BY_TAG_"; const std::string ObjectEvents::EventBroadCastMapObjectStatePrefix = "EVENT_BROADCAST_MAP_OBJECT_STATE_"; const std::string ObjectEvents::EventBindObjectToUI = "EVENT_BIND_OBJECT_TO_UI"; const std::string ObjectEvents::EventReparentBindPrefix = "EVENT_REPARENT_BIND_"; const std::string ObjectEvents::EventUnbindObjectPrefix = "EVENT_UNBIND_OBJECT_"; const std::string ObjectEvents::EventElevateObject = "EVENT_ELEVATE_OBJECT"; const std::string ObjectEvents::EventObjectDespawningPrefix = "EVENT_OBJECT_DESPAWNING_"; const std::string ObjectEvents::EventSpawnObject = "EVENT_SPAWN_OBJECT"; const std::string ObjectEvents::EventSpawnObjectDelegator = "EVENT_SPAWN_OBJECT_DELEGATOR"; const std::string ObjectEvents::EventWriteStatePrefix = "EVENT_WRITE_OBJECT_STATE_"; unsigned long long ObjectEvents::WatchId = 0; void ObjectEvents::TriggerBroadCastMapObjectState(std::string eventName, ValueMap args) { if (!eventName.empty()) { Director::getInstance()->getEventDispatcher()->dispatchEvent( ObjectEvents::EventBroadCastMapObjectStatePrefix + eventName, &args ); } } void ObjectEvents::TriggerObjectSpawn(RequestObjectSpawnArgs args) { Director::getInstance()->getEventDispatcher()->dispatchEvent( ObjectEvents::EventSpawnObject, &args ); if (args.handled && args.onSpawnSuccess != nullptr) { args.onSpawnSuccess(); } else if (args.onSpawnFailed != nullptr) { args.onSpawnFailed(); } } void ObjectEvents::TriggerBindObjectToUI(RelocateObjectArgs args) { Director::getInstance()->getEventDispatcher()->dispatchEvent( ObjectEvents::EventBindObjectToUI, &args ); }; void ObjectEvents::TriggerElevateObject(RelocateObjectArgs args) { Director::getInstance()->getEventDispatcher()->dispatchEvent( ObjectEvents::EventElevateObject, &args ); } void ObjectEvents::TriggerReparentBind(ReparentBindArgs args) { Director::getInstance()->getEventDispatcher()->dispatchEvent( ObjectEvents::EventReparentBindPrefix + std::to_string((unsigned long long)(args.relocatedObject)), &args ); } void ObjectEvents::TriggerObjectSpawnDelegator(RequestObjectSpawnDelegatorArgs args) { Director::getInstance()->getEventDispatcher()->dispatchEvent( ObjectEvents::EventSpawnObjectDelegator, &args ); } void ObjectEvents::TriggerWriteObjectState(StateWriteArgs args) { const std::string eventKey = args.key + "_" + std::to_string((unsigned long long)(args.owner)); Director::getInstance()->getEventDispatcher()->dispatchEvent( ObjectEvents::EventWriteStatePrefix + eventKey, &args ); }
1
0.70921
1
0.70921
game-dev
MEDIA
0.593414
game-dev
0.74806
1
0.74806
sheenli/U3dFrameworkTolua
2,388
Lua/ToLua/System/Injection/LuaInjectionStation.lua
--[[ --- File:LuaInjectionStation.lua --- Created by Jonson --- DateTime: 2018/1/2 10:24 ]]-- local pcall = pcall local pairs = pairs local error = error local rawset = rawset local rawget = rawget local string = string local tolua_tag = tolua_tag local getmetatable = getmetatable local CSLuaInjectStation local bridgeInfo = require "System.Injection.InjectionBridgeInfo" local function Check(csModule) local existmt = getmetatable(csModule) if rawget(existmt, tolua_tag) ~= 1 then error("Can't Inject") end return existmt end local function CacheCSLuaInjectStation() if CSLuaInjectStation == nil then CSLuaInjectStation = LuaInterface.LuaInjectionStation end end local function UpdateFunctionReference(metatable, injectInfo) local oldIndexMetamethod = metatable.__index local newMethodGroup = {} for funcName, infoPipeline in pairs(injectInfo) do local injectFunction, injectFlag = infoPipeline() if injectFlag == LuaInterface.InjectType.Replace or injectFlag == LuaInterface.InjectType.ReplaceWithPostInvokeBase or injectFlag == LuaInterface.InjectType.ReplaceWithPreInvokeBase then rawset(newMethodGroup, funcName, injectFunction) end end metatable.__index = function(t, k) --Ignore Overload Function local injectFunc = rawget(newMethodGroup, k) if injectFunc ~= nil then return injectFunc end local status, result = pcall(oldIndexMetamethod, t, k) if status then return result else error(result) return nil end end end function InjectByModule(csModule, injectInfo) local mt = Check(csModule) local moduleName = mt[".name"] InjectByName(moduleName, injectInfo) UpdateFunctionReference(mt, injectInfo) end --Won't Update Function Reference In Lua Env function InjectByName(moduleName, injectInfo) CacheCSLuaInjectStation() local moduleBridgeInfo = rawget(bridgeInfo, moduleName) if moduleBridgeInfo == nil then error(string.format("Module %s Can't Inject", moduleName)) end for funcName, infoPipeline in pairs(injectInfo) do local injectFunction, injectFlag = infoPipeline() local injectIndex = rawget(moduleBridgeInfo, funcName) if injectIndex == nil then error(string.format("Function %s Doesn't Exist In Module %s", funcName, moduleName)) end CSLuaInjectStation.CacheInjectFunction(injectIndex, injectFlag:ToInt(), injectFunction) end end require "System.Injection.LuaInjectionBus"
1
0.624529
1
0.624529
game-dev
MEDIA
0.884426
game-dev
0.753326
1
0.753326
TheAssemblyArmada/Vanilla-Conquer
57,929
redalert/bullet.cpp
// // Copyright 2020 Electronic Arts Inc. // // TiberianDawn.DLL and RedAlert.dll and corresponding source code 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. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed // in the hope that it will be useful, but with permitted additional restrictions // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT // distributed with this program. You should have received a copy of the // GNU General Public License along with permitted additional restrictions // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection /* $Header: /CounterStrike/BULLET.CPP 1 3/03/97 10:24a Joe_bostic $ */ /*********************************************************************************************** *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *** *********************************************************************************************** * * * Project Name : Command & Conquer * * * * File Name : BULLET.CPP * * * * Programmer : Joe L. Bostic * * * * Start Date : April 23, 1994 * * * * Last Update : October 10, 1996 [JLB] * * * *---------------------------------------------------------------------------------------------* * Functions: * * BulletClass::AI -- Logic processing for bullet. * * BulletClass::BulletClass -- Bullet constructor. * * BulletClass::Bullet_Explodes -- Performs bullet explosion logic. * * BulletClass::Detach -- Removes specified target from this bullet's targeting system. * * BulletClass::Draw_It -- Displays the bullet at location specified. * * BulletClass::In_Which_Layer -- Fetches the layer that the bullet resides in. * * BulletClass::Init -- Clears the bullets array for scenario preparation. * * BulletClass::Is_Forced_To_Explode -- Checks if bullet should explode NOW. * * BulletClass::Mark -- Performs related map refreshing under bullet. * * BulletClass::Occupy_List -- Determines the bullet occupation list. * * BulletClass::Shape_Number -- Fetches the shape number for the bullet object. * * BulletClass::Sort_Y -- Sort coordinate for bullet rendering. * * BulletClass::Target_Coord -- Fetches coordinate to use when firing on this object. * * BulletClass::Unlimbo -- Transitions a bullet object into the game render/logic system. * * BulletClass::delete -- Bullet memory delete. * * BulletClass::new -- Allocates memory for bullet object. * * BulletClass::~BulletClass -- Destructor for bullet objects. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "function.h" /*********************************************************************************************** * BulletClass::BulletClass -- Bullet constructor. * * * * This is the constructor for the bullet class. It handles all * * initialization of the bullet and starting it in motion toward its * * target. * * * * INPUT: id -- The type of bullet this is (could be missile). * * * * OUTPUT: none * * * * WARNINGS: none * * * * HISTORY: * * 05/02/1994 JLB : Created. * * 06/20/1994 JLB : Firer is a base class pointer. * * 12/10/1994 JLB : Auto calculate range optional. * * 12/12/1994 JLB : Handles small arms as an instantaneous effect. * * 12/23/1994 JLB : Fixed scatter algorithm for non-homing projectiles. * * 12/31/1994 JLB : Removed range parameter (not needed). * *=============================================================================================*/ BulletClass::BulletClass(BulletType id, TARGET target, TechnoClass* payback, int strength, WarheadType warhead, int speed) : ObjectClass(RTTI_BULLET, Bullets.ID(this)) , Class(BulletTypes.Ptr((int)id)) , Payback(payback) , PrimaryFacing(DIR_N) , IsInaccurate(false) , IsToAnimate(false) , IsLocked(true) , TarCom(target) , MaxSpeed(speed) , Warhead(warhead) { Strength = strength; Height = FLIGHT_LEVEL; } /*********************************************************************************************** * BulletClass::~BulletClass -- Destructor for bullet objects. * * * * The bullet destructor must detect if a dog has been attached to this bullet. If so, * * then the attached dog must be unlimboed back onto the map. This operation is necessary * * because, unlike other objects, the dog flies with the bullet it fires. * * * * INPUT: none * * * * OUTPUT: none * * * * WARNINGS: none * * * * HISTORY: * * 07/06/1996 JLB : Created. * *=============================================================================================*/ BulletClass::~BulletClass(void) { if (GameActive) { /* ** SPECIAL CASE: ** The dog is attached to the dog bullet in a limbo state. When the bullet is ** destroyed, the dog must come back out of limbo at the closest location possible to ** the bullet. */ if (Payback != NULL && Payback->What_Am_I() == RTTI_INFANTRY && ((InfantryClass*)Payback)->Class->IsDog) { InfantryClass* dog = (InfantryClass*)Payback; if (dog) { bool unlimbo = false; DirType dogface = dog->PrimaryFacing; COORDINATE newcoord = Coord; /* ** Ensure that the coordinate, that the dog is to appear at, is legal. If not, ** then find a nearby legal location. */ if (Can_Enter_Cell(newcoord) != MOVE_OK) { newcoord = Map.Nearby_Location(Coord_Cell(newcoord), dog->Class->Speed); } /* ** Try to put the dog down where the target impacted. If we can't ** put it in that cell, then scan through the adjacent cells, ** starting with our current heading, until we find a place where ** we can put him down. If all 8 adjacent cell checks fail, then ** just delete the dog. */ for (int i = -1; i < 8; i++) { if (i != -1) { newcoord = Adjacent_Cell(Coord, FacingType(i)); } ScenarioInit++; if (dog->Unlimbo(newcoord, dog->PrimaryFacing)) { dog->Mark(MARK_DOWN); dog->Do_Action(DO_DOG_MAUL, true); if (dog->WasSelected) { dog->Select(); } ScenarioInit--; unlimbo = true; break; } ScenarioInit--; } Payback = 0; if (!unlimbo) { delete dog; } } } BulletClass::Limbo(); } Class = 0; Payback = 0; } /*********************************************************************************************** * BulletClass::new -- Allocates memory for bullet object. * * * * This function will "allocate" a block of memory for a bullet object. * * This memory block is merely lifted from a fixed pool of blocks. * * * * INPUT: size -- The size of the memory block needed. * * * * OUTPUT: Returns with a pointer to an available bullet object block. * * * * WARNINGS: none * * * * HISTORY: * * 05/02/1994 JLB : Created. * *=============================================================================================*/ void* BulletClass::operator new(size_t) noexcept { void* ptr = Bullets.Allocate(); if (ptr) { ((BulletClass*)ptr)->Set_Active(); } return (ptr); } /*********************************************************************************************** * BulletClass::delete -- Bullet memory delete. * * * * Since bullets memory is merely "allocated" out of a pool, it never * * actually gets deleted. * * * * INPUT: ptr -- Generic pointer to bullet object. * * * * OUTPUT: none * * * * WARNINGS: none * * * * HISTORY: * * 05/02/1994 JLB : Created. * *=============================================================================================*/ void BulletClass::operator delete(void* ptr) { if (ptr) { ((BulletClass*)ptr)->IsActive = false; } Bullets.Free((BulletClass*)ptr); } /*********************************************************************************************** * BulletClass::Occupy_List -- Determines the bullet occupation list. * * * * This function will determine the cell occupation list and return a pointer to it. Most * * bullets are small and the list is usually short, but on occasion, it can be a list that * * rivals the size of regular vehicles. * * * * INPUT: none * * * * OUTPUT: Returns with a pointer to the cell offset list that covers all the cells a bullet * * is over. * * * * WARNINGS: none * * * * HISTORY: * * 06/20/1994 JLB : Created. * * 01/05/1995 JLB : Handles projectiles with altitude. * *=============================================================================================*/ short const* BulletClass::Occupy_List(bool) const { assert(Bullets.ID(this) == ID); assert(IsActive); /* ** Super-gigundo units use the >= 64 coord spillage list logic. */ if (Class->IsGigundo) { static short _list[] = {-1, 0, 1, MAP_CELL_W * 1 - 1, MAP_CELL_W * 1, MAP_CELL_W * 1 + 1, -MAP_CELL_W * 1 - 1, -MAP_CELL_W * 1, -MAP_CELL_W * 1 + 1, MAP_CELL_W * 2 - 1, MAP_CELL_W * 2, MAP_CELL_W * 2 + 1, -MAP_CELL_W * 2 - 1, -MAP_CELL_W * 2, -MAP_CELL_W * 2 + 1, -MAP_CELL_W * 3 - 1, -MAP_CELL_W * 3, -MAP_CELL_W * 3 + 1, REFRESH_EOL}; return (_list); // return(Coord_Spillage_List(Coord, 64)); } /* ** Flying units need a special adjustment to the spillage list to take into account ** that the bullet imagery and the shadow are widely separated. */ if (Height > 0) { static short _list[25]; const short* ptr = Coord_Spillage_List(Coord, 5); int index = 0; CELL cell1 = Coord_Cell(Coord); while (ptr[index] != REFRESH_EOL) { _list[index] = ptr[index]; index++; } COORDINATE coord = Coord_Move(Coord, DIR_N, Height); CELL cell2 = Coord_Cell(coord); ptr = Coord_Spillage_List(coord, 5); while (*ptr != REFRESH_EOL) { _list[index++] = *ptr + (cell2 - cell1); ptr++; } _list[index] = REFRESH_EOL; return (_list); } return (Coord_Spillage_List(Coord, 10)); } /*********************************************************************************************** * BulletClass::Mark -- Performs related map refreshing under bullet. * * * * This routine marks the objects under the bullet so that they will * * be redrawn. This is necessary as the bullet moves -- objects under * * its path need to be restored. * * * * INPUT: none * * * * OUTPUT: none * * * * WARNINGS: none * * * * HISTORY: * * 05/02/1994 JLB : Created. * *=============================================================================================*/ bool BulletClass::Mark(MarkType mark) { assert(Bullets.ID(this) == ID); assert(IsActive); if (ObjectClass::Mark(mark)) { if (!Class->IsInvisible) { Map.Refresh_Cells(Coord_Cell(Coord), Occupy_List()); } return (true); } return (false); } /*********************************************************************************************** * BulletClass::AI -- Logic processing for bullet. * * * * This routine will perform all logic (flight) logic on the bullet. * * Primarily this is motion, fuse tracking, and detonation logic. Call * * this routine no more than once per bullet per game tick. * * * * INPUT: none * * * * OUTPUT: none * * * * WARNINGS: none * * * * HISTORY: * * 05/02/1994 JLB : Created. * *=============================================================================================*/ void BulletClass::AI(void) { assert(Bullets.ID(this) == ID); assert(IsActive); COORDINATE coord; ObjectClass::AI(); if (!IsActive) return; /* ** Ballistic objects are handled here. */ bool forced = false; // Forced explosion. if ((Class->IsArcing || Class->IsDropping) && !IsFalling) { forced = true; } /* ** Homing projectiles constantly change facing to face toward the target but ** they only do so every other game frame (improves game speed and makes ** missiles not so deadly). */ if ((Frame & 0x01) && Class->ROT != 0 && Target_Legal(TarCom)) { PrimaryFacing.Set_Desired(Direction256(Coord, ::As_Coord(TarCom))); } /* ** Move the projectile forward according to its speed ** and direction. */ coord = Coord; if (Class->IsFlameEquipped) { if (IsToAnimate) { if (stricmp(Class->GraphicName, "FB1") == 0) { new AnimClass(ANIM_FBALL_FADE, coord, 1); } else { new AnimClass(ANIM_SMOKE_PUFF, coord, 1); } } IsToAnimate = !IsToAnimate; } /* ** Handle any body rotation at this time. This process must ** occur every game fame in order to achieve smooth rotation. */ if (PrimaryFacing.Is_Rotating()) { PrimaryFacing.Rotation_Adjust(Class->ROT); } switch (Physics(coord, PrimaryFacing)) { /* ** When a projectile reaches the edge of the world, it ** vanishes from existence -- presumed to explode off ** map. */ case IMPACT_EDGE: Mark(); if (Payback != NULL && Class->Type == BULLET_GPS_SATELLITE) { bool reveal = false; if (Session.Type != GAME_GLYPHX_MULTIPLAYER) { if (Payback->House == PlayerPtr) { reveal = true; } } else { if (Payback->House->IsHuman) { reveal = true; } } if (reveal) { if (!Map.Is_Radar_Active()) { Map.Radar_Activate(1); } for (CELL cell = 0; cell < MAP_CELL_TOTAL; cell++) { Map.Map_Cell(cell, Payback->House); } Map.RadarClass::Flag_To_Redraw(true); } Payback->House->IsGPSActive = true; Payback->House->IsVisionary = true; } #ifdef OBSOLETE /* ** Hack: If it's the artificial nukes, don't let the bullets come down (as ** they're the only ones that blow up). We know it's artificial if you're ** at tech level 10 or below, because you can't build the nuclear silo until ** tech level 15 or so. */ if (Payback != NULL && Class->Type == BULLET_NUKE_UP && Payback->House->Control.TechLevel <= 10) { BulletClass* bullet = new BulletClass( BULLET_NUKE_DOWN, ::As_Target(Payback->House->NukeDest), Payback, 200, WARHEAD_NUKE, MPH_VERY_FAST); if (bullet) { int celly = Cell_Y(Payback->House->NukeDest); celly -= 15; if (celly < 1) celly = 1; COORDINATE start = Cell_Coord(XY_Cell(Cell_X(Payback->House->NukeDest), celly)); if (!bullet->Unlimbo(start, DIR_S)) { delete bullet; } } } #endif delete this; break; default: case IMPACT_NONE: /* ** The projectile has moved. Check its fuse. If detonation ** is signaled, then do so. Otherwise, just move. */ case IMPACT_NORMAL: Mark(); // if(Class->Type == BULLET_NUKE_DOWN) { // Render(true); // } if (Class->Type == BULLET_NUKE_UP) { if (Payback != NULL) { if (Distance(Payback->As_Target()) > 0x0C00) { delete this; return; } } } Coord = coord; /* ** See if the bullet should be forced to explode now in spite of what ** the fuse would otherwise indicate. Maybe the bullet hit a wall? */ if (!forced) { forced = Is_Forced_To_Explode(Coord); } /* ** If the bullet is not to explode, then perform normal flight ** maintenance (usually nothing). Otherwise, explode and then ** delete the bullet. */ if (!forced && (Class->IsDropping || !Fuse_Checkup(Coord))) { /* ** Certain projectiles lose strength when they travel. */ if (Class->IsDegenerate && Strength > 5) { Strength--; } } else { Bullet_Explodes(forced); delete this; } break; } } /*********************************************************************************************** * BulletClass::Shape_Number -- Fetches the shape number for the bullet object. * * * * Use this routine to fetch a shape number to use for this bullet object. * * * * INPUT: none * * * * OUTPUT: Returns with the shape number to use when drawing this bullet. * * * * WARNINGS: none * * * * HISTORY: * * 08/06/1996 JLB : Created. * *=============================================================================================*/ int BulletClass::Shape_Number(void) const { int shapenum = 0; if (!Class->IsFaceless) { shapenum = UnitClass::BodyShape[Dir_To_32(PrimaryFacing)]; } /* ** For tumbling projectiles, fetch offset stage. */ if (Class->Tumble > 0) { shapenum += Frame % Class->Tumble; } return (shapenum); } /*********************************************************************************************** * BulletClass::Draw_It -- Displays the bullet at location specified. * * * * This routine displays the bullet visual at the location specified. * * * * INPUT: x,y -- The center coordinate to render the bullet at. * * * * window -- The window to clip to. * * * * OUTPUT: none * * * * WARNINGS: none * * * * HISTORY: * * 06/20/1994 JLB : Created. * * 06/27/1994 JLB : Takes a window clipping parameter. * * 01/08/1995 JLB : Handles translucent colors if necessary. * *=============================================================================================*/ void BulletClass::Draw_It(int x, int y, WindowNumberType window) const { assert(Bullets.ID(this) == ID); assert(IsActive); /* ** Certain projectiles aren't visible. This includes small bullets (which are actually ** invisible) and flame thrower flames (which are rendered as an animation instead of a projectile). */ if (Class->IsInvisible) return; /* ** If there is no shape loaded for this object, then ** it obviously can't be rendered -- just bail. */ void const* shapeptr = Get_Image_Data(); if (shapeptr == NULL) return; /* ** Get the basic shape number for this projectile. */ int shapenum = Shape_Number(); /* ** For flying projectiles, draw the shadow and adjust the actual projectile body ** render position. */ if (Height > 0 && Class->IsShadow) { if (Class->IsParachuted) { // Add 'this' parameter to call new shape draw intercept. ST - 5/22/2019 CC_Draw_Shape(this, AnimTypeClass::As_Reference(ANIM_PARA_BOMB).Get_Image_Data(), 1, x + Lepton_To_Pixel(Height / 2), y + 10, window, SHAPE_PREDATOR | SHAPE_CENTER | SHAPE_WIN_REL | SHAPE_FADING, NULL, DisplayClass::UnitShadow); } else { // Add 'this' parameter to call new shape draw intercept. ST - 5/22/2019 CC_Draw_Shape(this, shapeptr, shapenum, x, y, window, SHAPE_PREDATOR | SHAPE_CENTER | SHAPE_WIN_REL | SHAPE_FADING, NULL, DisplayClass::UnitShadow); } y -= Lepton_To_Pixel(Height); } /* ** Draw the main body of the projectile. */ ShapeFlags_Type flags = SHAPE_NORMAL; if (Class->IsTranslucent) { flags = SHAPE_GHOST; } if (Class->IsSubSurface) { // Add 'this' parameter to call new shape draw intercept. ST - 5/22/2019 CC_Draw_Shape(this, shapeptr, shapenum, x, y, window, flags | SHAPE_PREDATOR | SHAPE_CENTER | SHAPE_WIN_REL | SHAPE_FADING, NULL, DisplayClass::FadingShade); } else { // Add 'this' parameter to call new shape draw intercept. ST - 5/22/2019 CC_Draw_Shape(this, shapeptr, shapenum, x, y, window, flags | SHAPE_CENTER | SHAPE_WIN_REL, NULL, DisplayClass::UnitShadow); } } /*********************************************************************************************** * BulletClass::Init -- Clears the bullets array for scenario preparation. * * * * This routine will zero out the bullet tracking list and object array in preparation for * * the start of a new scenario. All bullets cease to exists after this function is * * called. * * * * INPUT: none * * * * OUTPUT: none * * * * WARNINGS: none * * * * HISTORY: * * 08/15/1994 JLB : Created. * *=============================================================================================*/ void BulletClass::Init(void) { Bullets.Free_All(); } /*********************************************************************************************** * BulletClass::Detach -- Removes specified target from this bullet's targeting system. * * * * When an object is removed from the game system, it must be removed all targeting and * * tracking systems as well. This routine is used to remove the specified object from the * * bullet. If the object isn't part of this bullet's tracking system, then no action is * * performed. * * * * INPUT: target -- The target to remove from this tracking system. * * * * all -- Is the target going away for good as opposed to just cloaking/hiding? * * * * OUTPUT: none * * * * WARNINGS: none * * * * HISTORY: * * 09/24/1994 JLB : Created. * *=============================================================================================*/ void BulletClass::Detach(TARGET target, bool all) { assert(Bullets.ID(this) == ID); assert(IsActive); ObjectClass* obj = As_Object(target); if (Payback != NULL && obj == Payback) { /* ** If we're being called as a result of the dog that fired us being put ** in limbo, then don't detach. If for any other reason, detach. */ if (Payback->What_Am_I() != RTTI_INFANTRY || !((InfantryClass*)Payback)->Class->IsDog) { Payback = 0; } } if (all && target == TarCom) { TarCom = TARGET_NONE; } } /*********************************************************************************************** * BulletClass::Unlimbo -- Transitions a bullet object into the game render/logic system. * * * * This routine is used to take a bullet object that is in limbo and transition it to the * * game system. A bullet object so transitioned, will be drawn and logic processing * * performed. In effect, it comes into existence. * * * * INPUT: coord -- The location where the bullet object is to appear. * * * * dir -- The initial facing for the bullet object. * * * * OUTPUT: bool; Was the unlimbo successful? * * * * WARNINGS: none * * * * HISTORY: * * 01/10/1995 JLB : Created. * *=============================================================================================*/ bool BulletClass::Unlimbo(COORDINATE coord, DirType dir) { assert(Bullets.ID(this) == ID); assert(IsActive); /* ** Try to unlimbo the bullet as far as the base class is concerned. Use the already ** set direction and strength if the "punt" values were passed in. This allows a bullet ** to be setup prior to being launched. */ if (!Class->IsHigh) { Height = 0; } if (ObjectClass::Unlimbo(coord)) { Map.Remove(this, In_Which_Layer()); COORDINATE tcoord = As_Coord(TarCom); /* ** Homing projectiles (missiles) do NOT override facing. They just fire in the ** direction specified and let the chips fall where they may. */ if (Class->ROT == 0 && !Class->IsDropping) { dir = Direction(tcoord); } /* ** Possibly adjust the target if this projectile is inaccurate. This occurs whenever ** certain weapons are trained upon targets they were never designed to attack. Example: when ** turrets or anti-tank missiles are fired at infantry. Indirect ** fire is inherently inaccurate. */ if (IsInaccurate || Class->IsInaccurate || ((Is_Target_Cell(TarCom) || Is_Target_Infantry(TarCom)) && (Warhead == WARHEAD_AP || Class->IsFueled))) { /* ** Inaccuracy for low velocity or homing projectiles manifests itself as a standard ** Circular Error of Probability (CEP) algorithm. High speed projectiles usually ** just overshoot the target by extending the straight line flight. */ if (/*Class->ROT != 0 ||*/ Class->IsArcing) { int scatterdist = (::Distance(coord, tcoord) / 16) - 0x0040; scatterdist = min(scatterdist, Rule.HomingScatter); scatterdist = max(scatterdist, 0); dir = (DirType)((dir + (Random_Pick(0, 10) - 5)) & 0x00FF); tcoord = Coord_Scatter(tcoord, Random_Pick(0, scatterdist)); } else { int scatterdist = (::Distance(coord, tcoord) / 16) - 0x0040; scatterdist = min(scatterdist, Rule.BallisticScatter); scatterdist = max(scatterdist, 0); tcoord = Coord_Move(tcoord, dir, Random_Pick(0, scatterdist)); } } /* ** For very fast and invisible projectiles, just make the projectile exist at the target ** location and dispense with the actual flight. */ if (MaxSpeed == MPH_LIGHT_SPEED && Class->IsInvisible) { Coord = tcoord; } /* ** Set the range equal to either the class defined range or the calculated ** number of game frames it would take for the projectile to reach the target. */ int range = 0xFF; if (!Class->IsDropping) { range = (::Distance(tcoord, Coord) / MaxSpeed) + 4; } /* ** Projectile speed is usually the default value for that projectile, but ** certain projectiles alter speed according to the distance to the ** target. */ int speed = MaxSpeed; if (speed == MPH_LIGHT_SPEED) speed = MPH_IMMOBILE; if (Class->IsArcing) { speed = MaxSpeed + (Distance(tcoord) / 32); /* ** Set minimum speed (i.e., distance) for arcing projectiles. */ speed = max(speed, 25); } if (!Class->IsDropping) { Fly_Speed(255, (MPHType)speed); } /* ** Arm the fuse. */ Arm_Fuse(Coord, tcoord, range, ((As_Aircraft(TarCom) != 0) ? 0 : Class->Arming)); /* ** Projectiles that make a ballistic flight to impact point must determine a ** vertical component for the projectile launch. This is crudely simulated ** by biasing ground speed according to target distance and then giving ** enough vertical velocity to keep the projectile airborne for the ** desired amount of time. The mathematically correct solution would be to ** calculate launch angle (given fixed projectile velocity) and then derive ** the vertical and horizontal components. That solution would require a ** square root and an arcsine lookup table. OUCH! */ Riser = 0; if (Class->IsArcing) { IsFalling = true; Height = 1; Riser = ((Distance(tcoord) / 2) / (speed + 1)) * Rule.Gravity; Riser = max(Riser, 10); } if (Class->IsDropping) { IsFalling = true; Height = FLIGHT_LEVEL; // Height = Pixel_To_Lepton(24); Riser = 0; if (Class->IsParachuted) { AnimClass* anim = new AnimClass(ANIM_PARA_BOMB, Target_Coord()); // AnimClass * anim = new AnimClass(ANIM_PARACHUTE, Target_Coord()); if (anim) { anim->Attach_To(this); } } } Map.Submit(this, In_Which_Layer()); PrimaryFacing = dir; return (true); } return (false); } /*********************************************************************************************** * BulletClass::Target_Coord -- Fetches coordinate to use when firing on this object. * * * * * * INPUT: none * * * * OUTPUT: Returns with the coordinate that should be used when firing at the object. * * * * WARNINGS: none * * * * HISTORY: * * 09/21/1995 JLB : Created. * *=============================================================================================*/ COORDINATE BulletClass::Target_Coord(void) const { assert(Bullets.ID(this) == ID); assert(IsActive); return (Coord_Add(XY_Coord(0, -Height), Coord)); } /*********************************************************************************************** * BulletClass::Sort_Y -- Sort coordinate for bullet rendering. * * * * This will return the coordinate to use when sorting this bullet in the display list. * * Typically, this only occurs for bullets in the ground layer. Since bullets are to be * * seen a bit more than the normal sorting order would otherwise imply, bias the sort * * value such that bullets will tend to be drawn on top of the objects. * * * * INPUT: none * * * * OUTPUT: Returns with the coordinate to use when sorting this bullet in the display list. * * * * WARNINGS: none * * * * HISTORY: * * 10/02/1996 JLB : Created. * *=============================================================================================*/ COORDINATE BulletClass::Sort_Y(void) const { assert(this != 0); assert(IsActive); return (Coord_Move(Coord, DIR_S, CELL_LEPTON_H / 2)); } /*********************************************************************************************** * BulletClass::In_Which_Layer -- Fetches the layer that the bullet resides in. * * * * This examines the bullet to determine what rendering layer it should be in. The * * normal logic applies unless this is a torpedo. A torpedo is always in the surface * * layer. * * * * INPUT: none * * * * OUTPUT: Returns with the render layer that this bullet should reside in. * * * * WARNINGS: none * * * * HISTORY: * * 10/10/1996 JLB : Created. * *=============================================================================================*/ LayerType BulletClass::In_Which_Layer(void) const { if (Class->IsSubSurface) { return (LAYER_SURFACE); } return (ObjectClass::In_Which_Layer()); } /*********************************************************************************************** * BulletClass::Is_Forced_To_Explode -- Checks if bullet should explode NOW. * * * * This routine will examine the bullet and where it is travelling in order to determine * * if it should prematurely explode. Typical of this would be when a bullet hits a wall * * or a torpedo hits a ship -- regardless of where the projectile was originally aimed. * * * * INPUT: coord -- The new coordinate to place the bullet at presuming it is forced to * * explode and a modification of the bullet's coordinate is needed. * * Otherwise, the coordinate is not modified. * * * * OUTPUT: bool; Should the bullet explode now? * * * * WARNINGS: none * * * * HISTORY: * * 10/10/1996 JLB : Created. * *=============================================================================================*/ bool BulletClass::Is_Forced_To_Explode(COORDINATE& coord) const { coord = Coord; CellClass const* cellptr = &Map[coord]; /* ** Check for impact on a wall or other high obstacle. */ if (!Class->IsHigh && cellptr->Overlay != OVERLAY_NONE && OverlayTypeClass::As_Reference(cellptr->Overlay).IsHigh) { coord = Cell_Coord(Coord_Cell(coord)); return (true); } /* ** Check to make sure that underwater projectiles (torpedoes) will not ** travel in anything but water. */ if (Class->IsSubSurface) { int d = ::Distance(Coord_Fraction(coord), XY_Coord(CELL_LEPTON_W / 2, CELL_LEPTON_W / 2)); if (cellptr->Land_Type() != LAND_WATER || (d < CELL_LEPTON_W / 3 && cellptr->Cell_Techno() != NULL && cellptr->Cell_Techno() != Payback)) { /* ** Force explosion to be at center of techno object if one is present. */ if (cellptr->Cell_Techno() != NULL) { coord = cellptr->Cell_Techno()->Target_Coord(); } /* ** However, if the torpedo was blocked by a bridge, then force the ** torpedo to explode on top of that bridge cell. */ if (cellptr->Is_Bridge_Here()) { coord = Coord_Snap(coord); } return (true); } } /* ** Bullets are generally more effective when they are fired at aircraft. */ if (Class->IsAntiAircraft && As_Aircraft(TarCom) && Distance(TarCom) < 0x0080) { return (true); } /* ** No reason for forced explosion was detected, so return 'false' to ** indicate that no forced explosion is required. */ return (false); } /*********************************************************************************************** * BulletClass::Bullet_Explodes -- Performs bullet explosion logic. * * * * This handles the exploding bullet action. It will generate the animation and the * * damage as necessary. * * * * INPUT: none * * * * OUTPUT: none * * * * WARNINGS: The bullet should be deleted after this routine is called. * * * * HISTORY: * * 10/10/1996 JLB : Created. * *=============================================================================================*/ void BulletClass::Bullet_Explodes(bool forced) { /* ** When the target is reached, explode and do the damage ** required of it. For homing objects, don't force the explosion to ** match the target position. Non-homing projectiles adjust position so ** that they hit the target. This compensates for the error in line of ** flight logic. */ if ((Payback != NULL && Payback->What_Am_I() == RTTI_INFANTRY && ((InfantryClass*)Payback)->Class->IsDog) || (!forced && !Class->IsArcing && Class->ROT == 0 && Fuse_Target())) { Coord = Fuse_Target(); } /* ** Non-aircraft targets apply damage to the ground. */ if (!Is_Target_Aircraft(TarCom) || As_Aircraft(TarCom)->In_Which_Layer() == LAYER_GROUND) { Explosion_Damage(Coord, Strength, Payback, Warhead); if (!IsActive) return; } else { /* ** Special damage apply for SAM missiles. This is the only way that missile ** damage affects the aircraft target. */ if (Distance(TarCom) < 0x0080) { AircraftClass* object = As_Aircraft(TarCom); int str = Strength; if (object) object->Take_Damage(str, 0, Warhead, Payback); } } /* ** For projectiles that are invisible while travelling toward the target, ** allow scatter effect for the impact animation. */ if (Class->IsInvisible) { Coord = Coord_Scatter(Coord, 0x0020); } /* ** Fetch the land type that the explosion will be upon. Special case for ** flying aircraft targets, their land type will be LAND_NONE. */ CellClass const* cellptr = &Map[Coord]; LandType land = cellptr->Land_Type(); if (Is_Target_Aircraft(TarCom) && As_Aircraft(TarCom)->In_Which_Layer() == LAYER_TOP) { land = LAND_NONE; } AnimType anim = Combat_Anim(Strength, Warhead, land); /* ** If it's a water explosion that's going to play, don't play it ** if its cell is the same as the center cell of the target ship. */ if (anim >= ANIM_WATER_EXP1 && anim <= ANIM_WATER_EXP3 && Is_Target_Vessel(TarCom)) { if (Coord_Cell(Coord) == Coord_Cell(As_Vessel(TarCom)->Center_Coord())) { anim = (AnimType)(ANIM_VEH_HIT1 + (anim - ANIM_WATER_EXP1)); } } if (anim != ANIM_NONE) { AnimClass* aptr = new AnimClass(anim, Coord); if (aptr) { aptr->Sort_Above(TarCom); } /* ** Special case trap: if they're making the nuclear explosion, ** and no anim is available, force the nuclear damage anyway ** because nuke damage is done in the middle of the animation ** and if there's no animation, there won't be any damage. */ if (!aptr && anim == ANIM_ATOM_BLAST) { GlyphX_Debug_Print("FAILED to create ANIM_ATOM_BLAST"); HousesType house = HOUSE_NONE; if (Payback) { house = Payback->House->Class->House; } AnimClass::Do_Atom_Damage(house, Coord_Cell(Coord)); } // MBL 05.20.2020 // Fix for Nuke or Atom Bomb killing structures and units during animation sequence and not getting kills // tracked Per https://jaas.ea.com/browse/TDRA-6610 // else if (aptr && anim == ANIM_ATOM_BLAST && aptr->OwnerHouse == HOUSE_NONE) { if (Payback && Payback->House && Payback->House->Class) { aptr->Set_Owner(Payback->House->Class->House); } } } // if (Payback && Payback->House == PlayerPtr && stricmp(Class->Name(), "GPSSATELLITE") == 0) { if (Payback && Class->Type == BULLET_GPS_SATELLITE) { bool reveal = false; if (Session.Type != GAME_GLYPHX_MULTIPLAYER) { if (Payback->House == PlayerPtr) { reveal = true; } } else { if (Payback->House->IsHuman) { reveal = true; } } if (reveal) { if (!Map.Is_Radar_Active()) { Map.Radar_Activate(1); } for (CELL cell = 0; cell < MAP_CELL_TOTAL; cell++) { Map.Map_Cell(cell, Payback->House); } Map.RadarClass::Flag_To_Redraw(true); } // Sound_Effect(VOC_SATTACT2); Payback->House->IsGPSActive = true; Payback->House->IsVisionary = true; } }
1
0.947764
1
0.947764
game-dev
MEDIA
0.777536
game-dev
0.900039
1
0.900039
grayj/Jedi-Academy
11,941
code/game/AI_SaberDroid.cpp
// leave this line at the top of all AI_xxxx.cpp files for PCH reasons... #include "g_headers.h" // leave this line at the top of all AI_xxxx.cpp files for PCH reasons... #include "g_headers.h" #include "b_local.h" #include "g_nav.h" #include "anims.h" #include "g_navigator.h" #include "wp_saber.h" //extern void G_AddVoiceEvent( gentity_t *self, int event, int speakDebounceTime ); extern void WP_DeactivateSaber( gentity_t *self, qboolean clearLength = qfalse ); extern int PM_AnimLength( int index, animNumber_t anim ); qboolean NPC_CheckPlayerTeamStealth( void ); static qboolean enemyLOS; static qboolean enemyCS; static qboolean faceEnemy; static qboolean move; static qboolean shoot; static float enemyDist; /* void NPC_SaberDroid_PlayConfusionSound( gentity_t *self ) {//FIXME: make this a custom sound in sound set if ( self->health > 0 ) { G_AddVoiceEvent( self, Q_irand(EV_CONFUSE1, EV_CONFUSE3), 2000 ); } //reset him to be totally unaware again TIMER_Set( self, "enemyLastVisible", 0 ); TIMER_Set( self, "flee", 0 ); self->NPC->squadState = SQUAD_IDLE; self->NPC->tempBehavior = BS_DEFAULT; //self->NPC->behaviorState = BS_PATROL; G_ClearEnemy( self );//FIXME: or just self->enemy = NULL;? self->NPC->investigateCount = 0; } */ /* ------------------------- ST_Move ------------------------- */ static qboolean SaberDroid_Move( void ) { NPCInfo->combatMove = qtrue;//always move straight toward our goal UpdateGoal(); if ( !NPCInfo->goalEntity ) { NPCInfo->goalEntity = NPC->enemy; } NPCInfo->goalRadius = 30.0f; qboolean moved = NPC_MoveToGoal( qtrue ); // navInfo_t info; //Get the move info // NAV_GetLastMove( info ); //FIXME: if we bump into another one of our guys and can't get around him, just stop! //If we hit our target, then stop and fire! // if ( info.flags & NIF_COLLISION ) // { // if ( info.blocker == NPC->enemy ) // { // SaberDroid_HoldPosition(); // } // } //If our move failed, then reset /* if ( moved == qfalse ) {//couldn't get to enemy //just hang here SaberDroid_HoldPosition(); } */ return moved; } /* ------------------------- NPC_BSSaberDroid_Patrol ------------------------- */ void NPC_BSSaberDroid_Patrol( void ) {//FIXME: pick up on bodies of dead buddies? if ( NPCInfo->confusionTime < level.time ) { //Look for any enemies if ( NPCInfo->scriptFlags&SCF_LOOK_FOR_ENEMIES ) { if ( NPC_CheckPlayerTeamStealth() ) { //NPCInfo->behaviorState = BS_HUNT_AND_KILL;//should be automatic now //NPC_AngerSound(); NPC_UpdateAngles( qtrue, qtrue ); return; } } if ( !(NPCInfo->scriptFlags&SCF_IGNORE_ALERTS) ) { //Is there danger nearby int alertEvent = NPC_CheckAlertEvents( qtrue, qtrue, -1, qfalse, AEL_SUSPICIOUS ); //There is an event to look at if ( alertEvent >= 0 )//&& level.alertEvents[alertEvent].ID != NPCInfo->lastAlertID ) { //NPCInfo->lastAlertID = level.alertEvents[alertEvent].ID; if ( level.alertEvents[alertEvent].level >= AEL_DISCOVERED ) { if ( level.alertEvents[alertEvent].owner && level.alertEvents[alertEvent].owner->client && level.alertEvents[alertEvent].owner->health >= 0 && level.alertEvents[alertEvent].owner->client->playerTeam == NPC->client->enemyTeam ) {//an enemy G_SetEnemy( NPC, level.alertEvents[alertEvent].owner ); //NPCInfo->enemyLastSeenTime = level.time; TIMER_Set( NPC, "attackDelay", Q_irand( 500, 2500 ) ); } } else {//FIXME: get more suspicious over time? //Save the position for movement (if necessary) VectorCopy( level.alertEvents[alertEvent].position, NPCInfo->investigateGoal ); NPCInfo->investigateDebounceTime = level.time + Q_irand( 500, 1000 ); if ( level.alertEvents[alertEvent].level == AEL_SUSPICIOUS ) {//suspicious looks longer NPCInfo->investigateDebounceTime += Q_irand( 500, 2500 ); } } } if ( NPCInfo->investigateDebounceTime > level.time ) {//FIXME: walk over to it, maybe? Not if not chase enemies //NOTE: stops walking or doing anything else below vec3_t dir, angles; float o_yaw, o_pitch; VectorSubtract( NPCInfo->investigateGoal, NPC->client->renderInfo.eyePoint, dir ); vectoangles( dir, angles ); o_yaw = NPCInfo->desiredYaw; o_pitch = NPCInfo->desiredPitch; NPCInfo->desiredYaw = angles[YAW]; NPCInfo->desiredPitch = angles[PITCH]; NPC_UpdateAngles( qtrue, qtrue ); NPCInfo->desiredYaw = o_yaw; NPCInfo->desiredPitch = o_pitch; return; } } } //If we have somewhere to go, then do that if ( UpdateGoal() ) { ucmd.buttons |= BUTTON_WALKING; NPC_MoveToGoal( qtrue ); } else if ( !NPC->client->ps.weaponTime && TIMER_Done( NPC, "attackDelay" ) && TIMER_Done( NPC, "inactiveDelay" ) ) { if ( NPC->client->ps.SaberActive() ) { WP_DeactivateSaber( NPC, qfalse ); NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_TURNOFF, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); } } NPC_UpdateAngles( qtrue, qtrue ); } int SaberDroid_PowerLevelForSaberAnim( gentity_t *self ) { switch ( self->client->ps.legsAnim ) { case BOTH_A2_TR_BL: if ( self->client->ps.torsoAnimTimer <= 200 ) {//end of anim return FORCE_LEVEL_0; } else if ( PM_AnimLength( self->client->clientInfo.animFileIndex, (animNumber_t)self->client->ps.legsAnim ) - self->client->ps.torsoAnimTimer < 200 ) {//beginning of anim return FORCE_LEVEL_0; } return FORCE_LEVEL_2; break; case BOTH_A1_BL_TR: if ( self->client->ps.torsoAnimTimer <= 300 ) {//end of anim return FORCE_LEVEL_0; } else if ( PM_AnimLength( self->client->clientInfo.animFileIndex, (animNumber_t)self->client->ps.legsAnim ) - self->client->ps.torsoAnimTimer < 200 ) {//beginning of anim return FORCE_LEVEL_0; } return FORCE_LEVEL_1; break; case BOTH_A1__L__R: if ( self->client->ps.torsoAnimTimer <= 250 ) {//end of anim return FORCE_LEVEL_0; } else if ( PM_AnimLength( self->client->clientInfo.animFileIndex, (animNumber_t)self->client->ps.legsAnim ) - self->client->ps.torsoAnimTimer < 150 ) {//beginning of anim return FORCE_LEVEL_0; } return FORCE_LEVEL_1; break; case BOTH_A3__L__R: if ( self->client->ps.torsoAnimTimer <= 200 ) {//end of anim return FORCE_LEVEL_0; } else if ( PM_AnimLength( self->client->clientInfo.animFileIndex, (animNumber_t)self->client->ps.legsAnim ) - self->client->ps.torsoAnimTimer < 300 ) {//beginning of anim return FORCE_LEVEL_0; } return FORCE_LEVEL_3; break; } return FORCE_LEVEL_0; } /* ------------------------- NPC_BSSaberDroid_Attack ------------------------- */ void NPC_SaberDroid_PickAttack( void ) { int attackAnim = Q_irand( 0, 3 ); switch ( attackAnim ) { case 0: default: attackAnim = BOTH_A2_TR_BL; NPC->client->ps.saberMove = LS_A_TR2BL; NPC->client->ps.saberAnimLevel = SS_MEDIUM; break; case 1: attackAnim = BOTH_A1_BL_TR; NPC->client->ps.saberMove = LS_A_BL2TR; NPC->client->ps.saberAnimLevel = SS_FAST; break; case 2: attackAnim = BOTH_A1__L__R; NPC->client->ps.saberMove = LS_A_L2R; NPC->client->ps.saberAnimLevel = SS_FAST; break; case 3: attackAnim = BOTH_A3__L__R; NPC->client->ps.saberMove = LS_A_L2R; NPC->client->ps.saberAnimLevel = SS_STRONG; break; } NPC->client->ps.saberBlocking = saberMoveData[NPC->client->ps.saberMove].blocking; if ( saberMoveData[NPC->client->ps.saberMove].trailLength > 0 ) { NPC->client->ps.SaberActivateTrail( saberMoveData[NPC->client->ps.saberMove].trailLength ); // saber trail lasts for 75ms...feel free to change this if you want it longer or shorter } else { NPC->client->ps.SaberDeactivateTrail( 0 ); } NPC_SetAnim( NPC, SETANIM_BOTH, attackAnim, SETANIM_FLAG_HOLD|SETANIM_FLAG_OVERRIDE ); NPC->client->ps.torsoAnim = NPC->client->ps.legsAnim;//need to do this because we have no anim split but saber code checks torsoAnim NPC->client->ps.weaponTime = NPC->client->ps.torsoAnimTimer = NPC->client->ps.legsAnimTimer; NPC->client->ps.weaponstate = WEAPON_FIRING; } void NPC_BSSaberDroid_Attack( void ) { //Don't do anything if we're hurt if ( NPC->painDebounceTime > level.time ) { NPC_UpdateAngles( qtrue, qtrue ); return; } //NPC_CheckEnemy( qtrue, qfalse ); //If we don't have an enemy, just idle if ( NPC_CheckEnemyExt() == qfalse )//!NPC->enemy )// { NPC->enemy = NULL; NPC_BSSaberDroid_Patrol();//FIXME: or patrol? return; } if ( !NPC->enemy ) {//WTF? somehow we lost our enemy? NPC_BSSaberDroid_Patrol();//FIXME: or patrol? return; } enemyLOS = enemyCS = qfalse; move = qtrue; faceEnemy = qfalse; shoot = qfalse; enemyDist = DistanceSquared( NPC->enemy->currentOrigin, NPC->currentOrigin ); //can we see our target? if ( NPC_ClearLOS( NPC->enemy ) ) { NPCInfo->enemyLastSeenTime = level.time; enemyLOS = qtrue; if ( enemyDist <= 4096 && InFOV( NPC->enemy->currentOrigin, NPC->currentOrigin, NPC->client->ps.viewangles, 90, 45 ) )//within 64 & infront { VectorCopy( NPC->enemy->currentOrigin, NPCInfo->enemyLastSeenLocation ); enemyCS = qtrue; } } /* else if ( gi.inPVS( NPC->enemy->currentOrigin, NPC->currentOrigin ) ) { NPCInfo->enemyLastSeenTime = level.time; faceEnemy = qtrue; } */ if ( enemyLOS ) {//FIXME: no need to face enemy if we're moving to some other goal and he's too far away to shoot? faceEnemy = qtrue; } if ( !TIMER_Done( NPC, "taunting" ) ) { move = qfalse; } else if ( enemyCS ) { shoot = qtrue; if ( enemyDist < (NPC->maxs[0]+NPC->enemy->maxs[0]+32)*(NPC->maxs[0]+NPC->enemy->maxs[0]+32) ) {//close enough move = qfalse; } }//this should make him chase enemy when out of range...? if ( NPC->client->ps.legsAnimTimer && NPC->client->ps.legsAnim != BOTH_A3__L__R )//this one is a running attack {//in the middle of a held, stationary anim, can't move move = qfalse; } if ( move ) {//move toward goal move = SaberDroid_Move(); if ( move ) {//if we had to chase him, be sure to attack as soon as possible TIMER_Set( NPC, "attackDelay", NPC->client->ps.weaponTime ); } } if ( !faceEnemy ) {//we want to face in the dir we're running if ( move ) {//don't run away and shoot NPCInfo->desiredYaw = NPCInfo->lastPathAngles[YAW]; NPCInfo->desiredPitch = 0; shoot = qfalse; } NPC_UpdateAngles( qtrue, qtrue ); } else// if ( faceEnemy ) {//face the enemy NPC_FaceEnemy(); } if ( NPCInfo->scriptFlags&SCF_DONT_FIRE ) { shoot = qfalse; } //FIXME: need predicted blocking? //FIXME: don't shoot right away! if ( shoot ) {//try to shoot if it's time if ( TIMER_Done( NPC, "attackDelay" ) ) { if( !(NPCInfo->scriptFlags & SCF_FIRE_WEAPON) ) // we've already fired, no need to do it again here { NPC_SaberDroid_PickAttack(); if ( NPCInfo->rank > RANK_CREWMAN ) { TIMER_Set( NPC, "attackDelay", NPC->client->ps.weaponTime+Q_irand(0, 1000) ); } else { TIMER_Set( NPC, "attackDelay", NPC->client->ps.weaponTime+Q_irand( 0, 1000 )+(Q_irand( 0, (3-g_spskill->integer)*2 )*500) ); } } } } } void NPC_BSSD_Default( void ) { if( !NPC->enemy ) {//don't have an enemy, look for one NPC_BSSaberDroid_Patrol(); } else//if ( NPC->enemy ) {//have an enemy if ( !NPC->client->ps.SaberActive() ) { NPC->client->ps.SaberActivate(); if ( NPC->client->ps.legsAnim == BOTH_TURNOFF || NPC->client->ps.legsAnim == BOTH_STAND1 ) { NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_TURNON, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); } } NPC_BSSaberDroid_Attack(); TIMER_Set( NPC, "inactiveDelay", Q_irand( 2000, 4000 ) ); } if ( !NPC->client->ps.weaponTime ) { NPC->client->ps.saberMove = LS_READY; NPC->client->ps.saberBlocking = saberMoveData[LS_READY].blocking; NPC->client->ps.SaberDeactivateTrail( 0 ); NPC->client->ps.saberAnimLevel = SS_MEDIUM; NPC->client->ps.weaponstate = WEAPON_READY; } }
1
0.982952
1
0.982952
game-dev
MEDIA
0.995169
game-dev
0.999253
1
0.999253
Nebukam/PCGExtendedToolkit
4,741
Source/PCGExtendedToolkit/Private/Misc/Picker/PCGExPickerAttributeSet.cpp
// Copyright 2025 Timothé Lapetite and contributors // Released under the MIT license https://opensource.org/license/MIT/ #include "Misc/Pickers/PCGExPickerAttributeSet.h" #include "PCGExHelpers.h" #include "PCGExMath.h" #include "Data/PCGExAttributeHelpers.h" #include "Data/PCGExData.h" #include "Data/PCGExPointIO.h" #define LOCTEXT_NAMESPACE "PCGExCreatePickerConstantSet" #define PCGEX_NAMESPACE CreatePickerConstantSet PCGEX_PICKER_BOILERPLATE(AttributeSet, {}, {}) #if WITH_EDITOR FString UPCGExPickerAttributeSetSettings::GetDisplayName() const { FString DisplayName = TEXT("Pick Set(s)"); if (Config.bTreatAsNormalized) { //DisplayName += FString::Printf(TEXT("%.2f"), Config.RelativeIndex); } else { //DisplayName += FString::Printf(TEXT("%d"), Config.DiscreteIndex); } return DisplayName; } #endif void UPCGExPickerAttributeSetFactory::AddPicks(const int32 InNum, TSet<int32>& OutPicks) const { int32 TargetIndex = 0; const int32 MaxIndex = InNum - 1; if (Config.bTreatAsNormalized) { OutPicks.Reserve(OutPicks.Num() + RelativePicks.Num()); for (const double Pick : RelativePicks) { TargetIndex = PCGExMath::TruncateDbl(static_cast<double>(MaxIndex) * Pick, Config.TruncateMode); if (TargetIndex < 0) { TargetIndex = InNum + TargetIndex; } TargetIndex = PCGExMath::SanitizeIndex(TargetIndex, MaxIndex, Config.Safety); if (FMath::IsWithin(TargetIndex, 0, InNum)) { OutPicks.Add(TargetIndex); } } } else { OutPicks.Reserve(OutPicks.Num() + DiscretePicks.Num()); for (const int32 Pick : DiscretePicks) { TargetIndex = Pick; if (TargetIndex < 0) { TargetIndex = InNum + TargetIndex; } TargetIndex = PCGExMath::SanitizeIndex(TargetIndex, MaxIndex, Config.Safety); if (FMath::IsWithin(TargetIndex, 0, InNum)) { OutPicks.Add(TargetIndex); } } } } PCGExFactories::EPreparationResult UPCGExPickerAttributeSetFactory::InitInternalData(FPCGExContext* InContext) { PCGExFactories::EPreparationResult Result = Super::InitInternalData(InContext); if (Result != PCGExFactories::EPreparationResult::Success) { return Result; } TArray<TSharedPtr<PCGExData::FFacade>> Facades; if (!TryGetFacades(InContext, FName("Indices"), Facades, false, true)) { PCGE_LOG_C(Error, GraphAndLog, InContext, FTEXT("No valid data was found for indices.")); return PCGExFactories::EPreparationResult::Fail; } if (Config.bTreatAsNormalized) { TSet<double> UniqueIndices; for (const TSharedPtr<PCGExData::FFacade>& Facade : Facades) { if (Config.Attributes.IsEmpty()) { const TSharedPtr<PCGEx::FAttributesInfos> Infos = PCGEx::FAttributesInfos::Get(Facade->Source->GetIn()->Metadata); if (Infos->Attributes.IsEmpty()) { PCGE_LOG_C(Error, GraphAndLog, InContext, FTEXT("Some input have no attributes.")); continue; } const TSharedPtr<PCGEx::TAttributeBroadcaster<double>> Values = PCGEx::MakeBroadcaster<double>(Infos->Attributes[0]->Name, Facade->Source); if (!Values) { continue; } Values->GrabUniqueValues(UniqueIndices); } else { for (const FPCGAttributePropertyInputSelector& Selector : Config.Attributes) { const TSharedPtr<PCGEx::TAttributeBroadcaster<double>> Values = PCGEx::MakeBroadcaster<double>(Selector, Facade->Source); if (!Values) { continue; } Values->GrabUniqueValues(UniqueIndices); } } } RelativePicks = UniqueIndices.Array(); } else { TSet<int32> UniqueIndices; for (const TSharedPtr<PCGExData::FFacade>& Facade : Facades) { if (Config.Attributes.IsEmpty()) { const TSharedPtr<PCGEx::FAttributesInfos> Infos = PCGEx::FAttributesInfos::Get(Facade->Source->GetIn()->Metadata); if (Infos->Attributes.IsEmpty()) { PCGE_LOG_C(Error, GraphAndLog, InContext, FTEXT("Some input have no attributes.")); continue; } const TSharedPtr<PCGEx::TAttributeBroadcaster<int32>> Values = PCGEx::MakeBroadcaster<int32>(Infos->Attributes[0]->Name, Facade->Source); if (!Values) { continue; } Values->GrabUniqueValues(UniqueIndices); } else { for (const FPCGAttributePropertyInputSelector& Selector : Config.Attributes) { const TSharedPtr<PCGEx::TAttributeBroadcaster<int32>> Values = PCGEx::MakeBroadcaster<int32>(Selector, Facade->Source); if (!Values) { continue; } Values->GrabUniqueValues(UniqueIndices); } } } DiscretePicks = UniqueIndices.Array(); } return Result; } TArray<FPCGPinProperties> UPCGExPickerAttributeSetSettings::InputPinProperties() const { TArray<FPCGPinProperties> PinProperties = Super::InputPinProperties(); PCGEX_PIN_ANY(FName("Indices"), "Data to read attribute from", Required) return PinProperties; } #undef LOCTEXT_NAMESPACE #undef PCGEX_NAMESPACE
1
0.948119
1
0.948119
game-dev
MEDIA
0.767134
game-dev
0.905397
1
0.905397
thedarkcolour/ForestryCE
3,226
src/main/java/forestry/apiculture/particles/BeeParticleData.java
/******************************************************************************* * Copyright (c) 2011-2014 SirSengir. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ package forestry.apiculture.particles; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import forestry.core.utils.ModUtil; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleType; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.registries.ForgeRegistries; import javax.annotation.Nonnull; import java.util.Locale; public class BeeParticleData implements ParticleOptions { public static final Deserializer<BeeParticleData> DESERIALIZER = new Deserializer<>() { @Nonnull @Override public BeeParticleData fromCommand(@Nonnull ParticleType<BeeParticleData> type, @Nonnull StringReader reader) throws CommandSyntaxException { reader.expect(' '); long direction = reader.readLong(); reader.expect(' '); int color = reader.readInt(); return new BeeParticleData(type, direction, color); } @Override public BeeParticleData fromNetwork(@Nonnull ParticleType<BeeParticleData> type, FriendlyByteBuf buf) { return new BeeParticleData(type, buf.readLong(), buf.readInt()); } }; public static Codec<BeeParticleData> createCodec(ParticleType<BeeParticleData> type) { return RecordCodecBuilder.create(val -> val.group(Codec.LONG.fieldOf("direction").forGetter(data -> data.destination.asLong()), Codec.INT.fieldOf("color").forGetter(data -> data.color)).apply(val, (destination1, color1) -> new BeeParticleData(type, destination1, color1))); } public final ParticleType<BeeParticleData> type; public final BlockPos destination; public final int color; public BeeParticleData(ParticleType<BeeParticleData> type, long destination, int color) { this.type = type; this.destination = BlockPos.of(destination); this.color = color; } public BeeParticleData(ParticleType<BeeParticleData> type, BlockPos destination, int color) { this.type = type; this.destination = destination; this.color = color; } @Nonnull @Override public ParticleType<?> getType() { return this.type; } @Override public void writeToNetwork(@Nonnull FriendlyByteBuf buffer) { buffer.writeRegistryId(ForgeRegistries.PARTICLE_TYPES, this.type); buffer.writeLong(this.destination.asLong()); buffer.writeInt(this.color); } @Nonnull @Override public String writeToString() { return String.format(Locale.ROOT, "%s %d %d %d %d", ModUtil.getRegistryName(getType()), this.destination.getX(), this.destination.getY(), this.destination.getZ(), this.color); } }
1
0.78972
1
0.78972
game-dev
MEDIA
0.896426
game-dev,networking
0.728126
1
0.728126
00-Evan/shattered-pixel-dungeon
2,299
core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java
/* * Pixel Dungeon * Copyright (C) 2012-2015 Oleg Dolya * * Shattered Pixel Dungeon * Copyright (C) 2014-2025 Evan Debenham * * 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.shatteredpixel.shatteredpixeldungeon.items.scrolls; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging; import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.EnergyParticle; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; import com.watabou.noosa.particles.Emitter; public class ScrollOfRecharging extends Scroll { { icon = ItemSpriteSheet.Icons.SCROLL_RECHARGE; } @Override public void doRead() { detach(curUser.belongings.backpack); Buff.affect(curUser, Recharging.class, Recharging.DURATION); charge(curUser); Sample.INSTANCE.play( Assets.Sounds.READ ); Sample.INSTANCE.play( Assets.Sounds.CHARGEUP ); GLog.i( Messages.get(this, "surge") ); SpellSprite.show( curUser, SpellSprite.CHARGE ); identify(); readAnimation(); } public static void charge( Char user ) { if (user.sprite != null) { Emitter e = user.sprite.centerEmitter(); if (e != null) e.burst(EnergyParticle.FACTORY, 15); } } @Override public int value() { return isKnown() ? 30 * quantity : super.value(); } }
1
0.689268
1
0.689268
game-dev
MEDIA
0.985341
game-dev
0.887106
1
0.887106
Dark-Basic-Software-Limited/AGKRepo
2,858
AGK/AgkIde/bullet/BulletDynamics/MLCPSolvers/btMLCPSolver.h
/* Bullet Continuous Collision Detection and Physics Library Copyright (c) 2003-2013 Erwin Coumans http://bulletphysics.org This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ ///original version written by Erwin Coumans, October 2013 #ifndef BT_MLCP_SOLVER_H #define BT_MLCP_SOLVER_H #include "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h" #include "LinearMath/btMatrixX.h" #include "BulletDynamics/MLCPSolvers/btMLCPSolverInterface.h" class btMLCPSolver : public btSequentialImpulseConstraintSolver { protected: btMatrixXu m_A; btVectorXu m_b; btVectorXu m_x; btVectorXu m_lo; btVectorXu m_hi; ///when using 'split impulse' we solve two separate (M)LCPs btVectorXu m_bSplit; btVectorXu m_xSplit; btVectorXu m_bSplit1; btVectorXu m_xSplit2; btAlignedObjectArray<int> m_limitDependencies; btConstraintArray m_allConstraintArray; btMLCPSolverInterface* m_solver; int m_fallback; virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject** bodies, int numBodies, btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer); virtual btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer); virtual void createMLCP(const btContactSolverInfo& infoGlobal); virtual void createMLCPFast(const btContactSolverInfo& infoGlobal); //return true is it solves the problem successfully virtual bool solveMLCP(const btContactSolverInfo& infoGlobal); public: btMLCPSolver( btMLCPSolverInterface* solver); virtual ~btMLCPSolver(); void setMLCPSolver(btMLCPSolverInterface* solver) { m_solver = solver; } int getNumFallbacks() const { return m_fallback; } void setNumFallbacks(int num) { m_fallback = num; } virtual btConstraintSolverType getSolverType() const { return BT_MLCP_SOLVER; } }; #endif //BT_MLCP_SOLVER_H
1
0.709919
1
0.709919
game-dev
MEDIA
0.987902
game-dev
0.794609
1
0.794609
di0ib/Misc
2,610
fml/FML12.ino
#include <HID-Project.h> #include <HID-Settings.h> //number of keys const int keys = 12; //debounce milliseconds const int debounce = 5; //Switch Pins const byte k[12] = { 5, 6, 7, 8, 21, 20, 19, 18, 15, 14, 16, 10 }; //Switch status boolean s[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //M for Media Key, K for Keyboard const char codetype[12] = { 'K', 'K', 'K', 'K', 'K', 'K', 'K', 'K', 'K', 'K', 'K', 'K' }; //Keycodes const ConsumerKeycode ccode[keys] = { MEDIA_VOLUME_MUTE, MEDIA_VOLUME_MUTE, MEDIA_PLAY_PAUSE, MEDIA_PLAY_PAUSE, MEDIA_PLAY_PAUSE, MEDIA_PLAY_PAUSE, MEDIA_PLAY_PAUSE, MEDIA_PLAY_PAUSE, MEDIA_PLAY_PAUSE, MEDIA_PLAY_PAUSE, MEDIA_PLAY_PAUSE, MEDIA_PLAY_PAUSE }; const KeyboardKeycode kcode[keys] = { KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12 }; void setup() { Keyboard.begin(); Consumer.begin(); //setup inputs, turn on pullups for (int i = 0; i < keys; i++) { pinMode(k[i], INPUT); digitalWrite(k[i], 1); } } void loop() { CheckKeys(); delay(debounce); } void CheckKeys() { for (int i = 0; i < keys; i++) { if (codetype[i] == 'M') { if (digitalRead(k[i]) == 0) { if (s[i] == 0) { Consumer.press((ccode[i])); s[i] = 1; } } else { if (s[i] == 1) { s[i] = 0; Consumer.release((ccode[i])); } } } if (codetype[i] == 'K') { if (digitalRead(k[i]) == 0) { if (s[i] == 0) { Keyboard.press((kcode[i])); s[i] = 1; } } else { if (s[i] == 1) { s[i] = 0; Keyboard.release((kcode[i])); } } } } }
1
0.674303
1
0.674303
game-dev
MEDIA
0.685004
game-dev
0.736391
1
0.736391
AudioKit/AUv3-Example-App
1,697
AudioKit/AudioKit/Core/Sporth/ugens/sdelay.c
#include "plumber.h" int sporth_sdelay(sporth_stack *stack, void *ud) { plumber_data *pd = ud; SPFLOAT input; SPFLOAT out; SPFLOAT size; sp_sdelay *sdelay; switch(pd->mode) { case PLUMBER_CREATE: #ifdef DEBUG_MODE plumber_print(pd, "sdelay: Creating\n"); #endif sp_sdelay_create(&sdelay); plumber_add_ugen(pd, SPORTH_SDELAY, sdelay); if(sporth_check_args(stack, "ff") != SPORTH_OK) { plumber_print(pd,"Not enough arguments for sdelay\n"); stack->error++; return PLUMBER_NOTOK; } size = sporth_stack_pop_float(stack); input = sporth_stack_pop_float(stack); sporth_stack_push_float(stack, 0); break; case PLUMBER_INIT: #ifdef DEBUG_MODE plumber_print(pd, "sdelay: Initialising\n"); #endif size = sporth_stack_pop_float(stack); input = sporth_stack_pop_float(stack); sdelay = pd->last->ud; sp_sdelay_init(pd->sp, sdelay, size); sporth_stack_push_float(stack, 0); break; case PLUMBER_COMPUTE: size = sporth_stack_pop_float(stack); input = sporth_stack_pop_float(stack); sdelay = pd->last->ud; sp_sdelay_compute(pd->sp, sdelay, &input, &out); sporth_stack_push_float(stack, out); break; case PLUMBER_DESTROY: sdelay = pd->last->ud; sp_sdelay_destroy(&sdelay); break; default: plumber_print(pd, "sdelay: Unknown mode!\n"); break; } return PLUMBER_OK; }
1
0.767277
1
0.767277
game-dev
MEDIA
0.16614
game-dev
0.627218
1
0.627218
foxgame/W3Rebuild
20,816
Client/Assets/Scripts/JassScripts/elf_ai.cs
// Generated by . public partial class GameDefine { public class elf_ai { //================================================================================================== // $Id: elf.ai,v 1.18 2003/04/23 19:26:00 bfitch Exp $ //================================================================================================== public bool basic_opening = true; public bool archer_opening = true; public int wave = 0; public bool b_acid_breath = false; public bool b_hero1_done = false; public bool b_hero2_done = false; public int c_altar_done = 0; public int c_archer = 0; public int c_archer_done = 0; public int c_ballista = 0; public int c_ballista_done = 0; public int c_bear = 0; public int c_bear_done = 0; public int c_chimaera = 0; public int c_chimaera_done = 0; public int c_dragon_done = 0; public int c_dryad = 0; public int c_dryad_done = 0; public int c_food_made = 0; public int c_food_used = 0; public int c_gold = 0; public int c_gold_owned = 0; public int c_hero1_done = 0; public int c_hero2_done = 0; public int c_hero3_done = 0; public int c_hunt_hall_done = 0; public int c_huntress = 0; public int c_huntress_done = 0; public int c_lore_done = 0; public int c_mines = 0; public int c_mines_done = 0; public int c_moon_well = 0; public int c_moon_well_done = 0; public int c_mtn_giant = 0; public int c_mtn_giant_done = 0; public int c_roost_done = 0; public int c_talon = 0; public int c_talon_done = 0; public int c_tree_ages_done = 0; public int c_tree_etern_done = 0; public int c_tree_life = 0; public int c_tree_life_done = 0; public int c_war_done = 0; public int c_wind_done = 0; public int c_wisp_done = 0; public int c_wonders_done = 0; public int c_zeps = 0; //-------------------------------------------------------------------------------------------------- // set_skills //-------------------------------------------------------------------------------------------------- public void set_skills( ) { // Original JassCode skill[ 1] = SEARING_ARROWS; skill[ 2] = TRUESHOT; skill[ 3] = SEARING_ARROWS; skill[ 4] = TRUESHOT; skill[ 5] = SEARING_ARROWS; skill[ 6] = STARFALL; skill[ 7] = TRUESHOT; skill[ 8] = SCOUT; skill[ 9] = SCOUT; skill[10] = SCOUT; SetSkillArray(1,MOON_CHICK); SetSkillArray(2,MOON_BABE); SetSkillArray(3,MOON_HONEY); skill[ 1] = FORCE_NATURE; skill[ 2] = ENT_ROOTS; skill[ 3] = FORCE_NATURE; skill[ 4] = ENT_ROOTS; skill[ 5] = FORCE_NATURE; skill[ 6] = TRANQUILITY; skill[ 7] = ENT_ROOTS; skill[ 8] = THORNS_AURA; skill[ 9] = THORNS_AURA; skill[10] = THORNS_AURA; SetSkillArray(1,KEEPER); skill[ 1] = ENT_ROOTS; skill[ 2] = THORNS_AURA; skill[ 3] = ENT_ROOTS; skill[ 4] = THORNS_AURA; skill[ 5] = ENT_ROOTS; skill[ 6] = TRANQUILITY; skill[ 7] = THORNS_AURA; skill[ 8] = FORCE_NATURE; skill[ 9] = FORCE_NATURE; skill[10] = FORCE_NATURE; SetSkillArray(2,KEEPER); SetSkillArray(3,KEEPER); skill[ 1] = IMMOLATION; skill[ 2] = MANA_BURN; skill[ 3] = EVASION; skill[ 4] = MANA_BURN; skill[ 5] = EVASION; skill[ 6] = METAMORPHOSIS; skill[ 7] = MANA_BURN; skill[ 8] = EVASION; skill[ 9] = IMMOLATION; skill[10] = IMMOLATION; SetSkillArray(1,DEMON_HUNTER); skill[ 1] = MANA_BURN; skill[ 2] = EVASION; skill[ 3] = MANA_BURN; skill[ 4] = EVASION; skill[ 5] = MANA_BURN; skill[ 6] = METAMORPHOSIS; skill[ 7] = EVASION; skill[ 8] = IMMOLATION; skill[ 9] = IMMOLATION; skill[10] = IMMOLATION; SetSkillArray(2,DEMON_HUNTER); SetSkillArray(3,DEMON_HUNTER); skill[ 1] = FAN_KNIVES; skill[ 2] = SHADOW_TOUCH; skill[ 3] = FAN_KNIVES; skill[ 4] = BLINK; skill[ 5] = FAN_KNIVES; skill[ 6] = VENGEANCE; skill[ 7] = SHADOW_TOUCH; skill[ 8] = BLINK; skill[ 9] = SHADOW_TOUCH; skill[10] = BLINK; SetSkillArray(1,WARDEN); SetSkillArray(2,WARDEN); SetSkillArray(3,WARDEN); } //-------------------------------------------------------------------------------------------------- // setup_force //-------------------------------------------------------------------------------------------------- public void setup_force( ) { // Original JassCode AwaitMeleeHeroes(); InitMeleeGroup(); SetMeleeGroup( hero_id ); SetMeleeGroup( hero_id2 ); SetMeleeGroup( hero_id3 ); SetMeleeGroup( ARCHER ); SetMeleeGroup( HUNTRESS ); SetMeleeGroup( DRUID_TALON ); SetMeleeGroup( DRUID_CLAW ); SetMeleeGroup( DRYAD ); SetMeleeGroup( CHIMAERA ); SetMeleeGroup( MOUNTAIN_GIANT ); SetMeleeGroup( FAERIE_DRAGON ); if( GetUnitCountDone(HIPPO) > 0 ) { SetMeleeGroup( HIPPO ); } if( GetUnitCountDone(HIPPO_RIDER) > 0 ) { SetMeleeGroup( HIPPO_RIDER ); } SetInitialWave(10); } //-------------------------------------------------------------------------------------------------- // force_level //-------------------------------------------------------------------------------------------------- public int force_level( ) { // Original JassCode int level = 4; level = level + c_dragon_done + c_talon_done; level = level + 2 * c_archer_done / 3; level = level + 2 * c_dryad_done; level = level + 3 * c_huntress_done; level = level + 4 * (c_chimaera_done + c_bear_done); level = level + 5 * c_hero3_done; level = level + 6 * (c_hero2_done + c_mtn_giant_done); return level; } //-------------------------------------------------------------------------------------------------- // attack_sequence //-------------------------------------------------------------------------------------------------- public void attack_sequence( ) { // Original JassCode bool needs_exp; bool has_siege; bool air_units; int level; while( true ) { if( c_hero1_done > 0 && c_archer_done >= 2 ) break; Sleep(2); } if( MeleeDifficulty() == MELEE_NEWBIE ) { Sleep(240); } StaggerSleep(0,2); while( true ) { while( true ) { if( ! CaptainRetreating() ) break; Sleep(2); } wave = wave + 1; if( wave == 2 ) { while( true ) { if( c_archer_done >= 4 ) break; Sleep(2); } } setup_force(); level = force_level(); max_creeps = level * 4 / 5; min_creeps = max_creeps - 10; if( min_creeps < 0 ) { min_creeps = 0; } needs_exp = take_exp && (level >= 9 || c_gold_owned < 2000); has_siege = level >= 40 || c_ballista_done > 0 || c_chimaera_done > 0 || c_mtn_giant_done > 0; air_units = c_chimaera_done > 0 || c_dragon_done > 0; allow_air_creeps = air_units || c_archer_done > 3; SingleMeleeAttack(needs_exp,has_siege,false,air_units); if( MeleeDifficulty() == MELEE_NEWBIE ) { Sleep(60); } } } //-------------------------------------------------------------------------------------------------- // init_vars //-------------------------------------------------------------------------------------------------- public void init_vars( ) { // Original JassCode b_acid_breath = GetUpgradeLevel(UPG_CHIM_ACID) >= 1; b_hero1_done = GetUnitCountDone(hero_id) > 0; b_hero2_done = GetUnitCountDone(hero_id2) > 0; c_altar_done = GetUnitCountDone(ELF_ALTAR); c_archer = GetUnitCount(ARCHER); c_archer_done = GetUnitCountDone(ARCHER); c_ballista = GetUnitCount(BALLISTA); c_ballista_done = GetUnitCountDone(BALLISTA); c_bear = TownCount(DRUID_CLAW); c_bear_done = TownCountDone(DRUID_CLAW); c_chimaera = GetUnitCount(CHIMAERA); c_chimaera_done = GetUnitCountDone(CHIMAERA); c_dragon_done = GetUnitCountDone(FAERIE_DRAGON); c_dryad = GetUnitCount(DRYAD); c_dryad_done = GetUnitCountDone(DRYAD); c_food_made = c_tree_life * GetFoodMade(TREE_LIFE) + c_moon_well * GetFoodMade(MOON_WELL); c_food_used = FoodUsed(); c_gold = GetGold(); c_gold_owned = GetGoldOwned(); c_hero1_done = GetUnitCountDone(hero_id); c_hero2_done = GetUnitCountDone(hero_id2); c_hero3_done = GetUnitCountDone(hero_id3); c_hunt_hall_done = GetUnitCountDone(HUNTERS_HALL); c_huntress = GetUnitCount(HUNTRESS); c_huntress_done = GetUnitCountDone(HUNTRESS); c_lore_done = GetUnitCountDone(ANCIENT_LORE); c_mines = GetMinesOwned(); c_mines_done = GetUnitCountDone(ELF_MINE); c_moon_well = GetUnitCount(MOON_WELL); c_moon_well_done = GetUnitCountDone(MOON_WELL); c_mtn_giant = GetUnitCount(MOUNTAIN_GIANT); c_mtn_giant_done = GetUnitCountDone(MOUNTAIN_GIANT); c_roost_done = GetUnitCountDone(CHIMAERA_ROOST); c_talon = TownCount(DRUID_TALON); c_talon_done = TownCountDone(DRUID_TALON); c_tree_ages_done = TownCountDone(TREE_AGES); c_tree_etern_done = TownCountDone(TREE_ETERNITY); c_tree_life = TownCount(TREE_LIFE); c_tree_life_done = TownCountDone(TREE_LIFE); c_war_done = GetUnitCountDone(ANCIENT_WAR); c_wind_done = GetUnitCountDone(ANCIENT_WIND); c_wisp_done = GetUnitCountDone(WISP); c_wonders_done = GetUnitCountDone(DEN_OF_WONDERS); c_zeps = GetUnitCount(ZEPPELIN); if( basic_opening ) { if( b_hero2_done || (MeleeDifficulty() == MELEE_NEWBIE && c_moon_well_done >= 4) ) { basic_opening = false; } if( archer_opening && c_archer_done >= 6 ) { archer_opening = false; } } } //-------------------------------------------------------------------------------------------------- // set_vars //-------------------------------------------------------------------------------------------------- public void set_vars( ) { // Original JassCode while( true ) { init_vars(); Sleep(1); } } //-------------------------------------------------------------------------------------------------- // basics //-------------------------------------------------------------------------------------------------- public void basics( int food ) { // Original JassCode int archers; int hunts; if( archer_opening || c_hunt_hall_done < 1 ) { archers = food / 2; if( archers > 6 ) { archers = 6; } SetBuildUnit( archers, ARCHER ); return; } hunts = (food - 2 * c_archer) / 3; if( hunts > 3 ) { hunts = 3; } SetBuildUnit( hunts, HUNTRESS ); if( food >= 15 ) { SetBuildUnit( 3, ARCHER ); } } //-------------------------------------------------------------------------------------------------- // do_upgrades //-------------------------------------------------------------------------------------------------- public void do_upgrades( ) { // Original JassCode if( c_tree_etern_done >= 1 && c_hunt_hall_done >= 1 ) { SetBuildUpgr( 1, UPG_WELL_SPRING ); } if( c_dryad >= 1 && c_lore_done >= 1 ) { SetBuildUpgr( 1, UPG_ABOLISH ); } if( c_roost_done >= 1 ) { SetBuildUpgr( 1, UPG_CHIM_ACID ); } if( c_hunt_hall_done >= 1 ) { if( c_archer + c_huntress + c_ballista >= 3 ) { SetBuildUpgr( 1, UPG_STR_MOON ); SetBuildUpgr( 1, UPG_MOON_ARMOR ); if( c_tree_ages_done >= 1 ) { SetBuildUpgr( 2, UPG_STR_MOON ); SetBuildUpgr( 2, UPG_MOON_ARMOR ); if( c_tree_etern_done >= 1 ) { SetBuildUpgr( 3, UPG_STR_MOON ); SetBuildUpgr( 3, UPG_MOON_ARMOR ); } } } if( c_dryad + c_mtn_giant + c_chimaera >= 3 ) { SetBuildUpgr( 1, UPG_STR_WILD ); SetBuildUpgr( 1, UPG_HIDES ); if( c_tree_ages_done >= 1 ) { SetBuildUpgr( 2, UPG_STR_WILD ); SetBuildUpgr( 2, UPG_HIDES ); if( c_tree_etern_done >= 1 ) { SetBuildUpgr( 3, UPG_STR_WILD ); SetBuildUpgr( 3, UPG_HIDES ); } } } } if( c_mtn_giant >= 1 && c_tree_etern_done >= 1 && c_wonders_done >= 1 && c_lore_done >= 1 ) { SetBuildUpgr( 1, UPG_HARD_SKIN ); SetBuildUpgr( 1, UPG_RESIST_SKIN ); } if( c_war_done >= 1 ) { if( c_huntress >= 3 && c_tree_etern_done >= 1 && c_hunt_hall_done >= 1 ) { SetBuildUpgr( 1, UPG_GLAIVE ); SetBuildUpgr( 1, UPG_SCOUT ); } if( c_archer >= 3 ) { if( c_tree_ages_done >= 1 ) { SetBuildUpgr( 1, UPG_BOWS ); if( c_tree_etern_done >= 1 && c_hunt_hall_done >= 1 ) { SetBuildUpgr( 1, UPG_MARKSMAN ); } } } if( c_ballista >= 1 ) { SetBuildUpgr( 1, UPG_ULTRAVISION ); SetBuildUpgr( 1, UPG_BOLT ); } } if( c_lore_done >= 1 ) { if( c_bear >= 1 ) { SetBuildUpgr( 1, UPG_DRUID_CLAW ); if( c_tree_etern_done >= 1 ) { SetBuildUpgr( 2, UPG_DRUID_CLAW ); SetBuildUpgr( 1, UPG_MARK_CLAW ); } } if( c_talon >= 1 ) { SetBuildUpgr( 1, UPG_DRUID_TALON ); if( c_tree_etern_done >= 1 ) { SetBuildUpgr( 2, UPG_DRUID_TALON ); SetBuildUpgr( 1, UPG_MARK_TALON ); } } } } //-------------------------------------------------------------------------------------------------- // build_sequence //-------------------------------------------------------------------------------------------------- public void build_sequence( ) { // Original JassCode bool primary_melee; int wisps; InitBuildArray(); if( basic_opening ) { SetBuildUnit( 1, TREE_LIFE ); SetBuildUnit( 5, WISP ); SetBuildUnit( 1, ELF_ALTAR ); SetBuildUnit( 7, WISP ); SetBuildUnit( 1, MOON_WELL ); SetBuildUnit( 8, WISP ); SetBuildUnit( 1, ANCIENT_WAR ); SetBuildUnit( 9, WISP ); SetBuildUnit( 1, hero_id ); SetBuildUnit( 10, WISP ); SetBuildUnit( 2, MOON_WELL ); // ( 1, ARCHER ) basics(2); SetBuildUnit( 1, DEN_OF_WONDERS ); // ( 2, ARCHER ) basics(4); SetBuildUnit( 11, WISP ); // ( 3, ARCHER ) basics(6); SetBuildUnit( 12, WISP ); SetBuildUnit( 1, HUNTERS_HALL ); SetBuildUnit( 3, MOON_WELL ); SetBuildUnit( 13, WISP ); // ( 4, ARCHER ) basics(8); SetBuildUnit( 14, WISP ); //( 5, ARCHER ) basics(10); SetBuildUnit( 15, WISP ); //( 6, ARCHER ) basics(15); //( 1, HUNTRESS ) SetBuildUnit( 1, TREE_AGES ); BasicExpansion( c_mines < 2, TREE_LIFE ); SetBuildUpgr( 1, UPG_STR_MOON ); SetBuildUpgr( 1, UPG_MOON_ARMOR ); SetBuildUnit( 4, MOON_WELL ); if( MeleeDifficulty() != MELEE_NEWBIE ) { SetBuildUnit( 1, hero_id2 ); } return; } if( c_tree_life < 1 && c_wisp_done > 0 ) { MeleeTownHall( 0, TREE_LIFE ); MeleeTownHall( 1, TREE_LIFE ); MeleeTownHall( 2, TREE_LIFE ); } if( c_tree_life_done > 0 ) { wisps = 6 - GetWood() / 200; if( wisps < 3 ) { wisps = 3; } if( c_mines < 2 || c_tree_life_done < 2 ) { wisps = wisps + 5; } else { wisps = wisps + 10; } if( wisps > 15 ) { wisps = 15; } SetBuildNext( wisps, WISP ); } if( c_gold > 500 && GetWood() < 100 ) { SetBuildNext( 15, WISP ); } // having enough gold is the highest priority // if( c_gold_owned < 2000 ) { BasicExpansion( c_mines < 2, TREE_LIFE ); if( MeleeDifficulty() != MELEE_NEWBIE ) { GuardSecondary( 1, 1, ANCIENT_PROTECT ); GuardSecondary( 1, 2, ANCIENT_PROTECT ); } } // get enough moon wells to cover food need // if( c_food_used + 7 > c_food_made ) { SetBuildUnit( c_moon_well_done + 1, MOON_WELL ); } // recover heroes for basic defense // if( c_altar_done >= 1 ) { if( b_hero1_done && MeleeDifficulty() != MELEE_NEWBIE ) { SetBuildUnit( 1, hero_id2 ); } else { SetBuildUnit( 1, hero_id ); } } else { SetBuildUnit( 1, ELF_ALTAR ); } // the primary melee force is the mountain giant // primary_melee = c_lore_done >= 1 && c_wonders_done >= 1 && c_tree_ages_done >= 1; if( primary_melee ) { SetBuildNext( 1, MOUNTAIN_GIANT ); // the backup melee force is the huntress // } else { SetBuildUnit( 1, ANCIENT_WAR ); SetBuildNext( 3, HUNTRESS ); } // the primary ranged force is the dryad // if( c_lore_done >= 1 ) { SetBuildUnit( 2, DRYAD ); // the backup ranged force is the archer // } else { SetBuildUnit( 1, ANCIENT_WAR ); SetBuildUnit( 3, ARCHER ); } // need siege to take out enemy towns and expansions // if( b_acid_breath && c_roost_done >= 1 ) { SetBuildUnit( 2, CHIMAERA ); } else if( c_mtn_giant < 1 ) { SetBuildUnit( 2, BALLISTA ); } // if we have enough gold then advance on the tech tree // if( c_gold > 1000 ) { if( MeleeDifficulty() != MELEE_NEWBIE ) { GuardSecondary( 1, 1, ANCIENT_PROTECT ); GuardSecondary( 1, 2, ANCIENT_PROTECT ); } SetBuildUnit( 1, ANCIENT_WAR ); SetBuildUnit( 1, HUNTERS_HALL ); SetBuildUnit( 1, TREE_AGES ); SetBuildUnit( 1, DEN_OF_WONDERS ); SetBuildUnit( 1, ANCIENT_LORE ); SetBuildUnit( 1, TREE_ETERNITY ); SetBuildUnit( 1, ANCIENT_WIND ); SetBuildUnit( 1, CHIMAERA_ROOST ); do_upgrades(); if( c_gold > 2000 ) { BuildFactory( ANCIENT_LORE ); BuildFactory( ANCIENT_WAR ); BuildFactory( CHIMAERA_ROOST ); BuildFactory( ANCIENT_WIND ); } } else if( c_food_used >= UPKEEP_TIER1 ) { do_upgrades(); } BasicExpansion( c_mines < 2, TREE_LIFE ); if( MeleeDifficulty() != MELEE_NEWBIE ) { GuardSecondary( 1, 1, ANCIENT_PROTECT ); GuardSecondary( 1, 2, ANCIENT_PROTECT ); } if( c_food_used >= UPKEEP_TIER2 - 10 && c_gold < 2000 ) { return; } // build units from whatever buildings we already have // if( primary_melee ) { SetBuildNext( 3, MOUNTAIN_GIANT ); } else { SetBuildNext( 7, HUNTRESS ); } if( c_lore_done >= 1 ) { SetBuildNext( 4, DRYAD ); } else { SetBuildNext( 6, ARCHER ); } if( c_tree_ages_done >= 1 ) { if( c_tree_etern_done >= 1 && c_altar_done >= 1 && MeleeDifficulty() != MELEE_NEWBIE ) { SetBuildUnit( 1, hero_id3 ); } if( c_lore_done >= 1 ) { SetBuildUnit( 1, DRUID_CLAW ); } } if( c_wind_done >= 1 ) { if( c_wonders_done >= 1 ) { SetBuildUnit( 1, FAERIE_DRAGON ); } SetBuildUnit( 1, DRUID_TALON ); } if( c_gold_owned < 10000 ) { BasicExpansion( c_mines < 3, TREE_LIFE ); if( MeleeDifficulty() != MELEE_NEWBIE ) { GuardSecondary( 2, 1, ANCIENT_PROTECT ); GuardSecondary( 2, 2, ANCIENT_PROTECT ); } } if( c_food_used >= 60 && c_zeps < 3 ) { GetZeppelin(); } } //-------------------------------------------------------------------------------------------------- // peon_assignment //-------------------------------------------------------------------------------------------------- public void peon_assignment( ) { // Original JassCode int T; while( true ) { ClearHarvestAI(); T = TownWithMine(); HarvestGold(T,4); HarvestWood(0,1); HarvestGold(T,1); HarvestWood(0,2); if( c_mines_done > 1 ) { HarvestGold(T+1,5); } HarvestWood(0,20); build_sequence(); Sleep(GetRandomInt(1,3)); } } //-------------------------------------------------------------------------------------------------- // main //-------------------------------------------------------------------------------------------------- public void main( ) { // Original JassCode PickMeleeHero(RACE_NIGHTELF); set_skills(); StandardAI(SkillArrays, peon_assignment, attack_sequence); StartThread( set_vars); PlayGame(); } } // class elf_ai }
1
0.918666
1
0.918666
game-dev
MEDIA
0.988972
game-dev
0.97454
1
0.97454
JudsonSS/Jogos
10,058
Labs/Lab11/PacMan/PacMan/Player.cpp
/********************************************************************************** // Player (Cdigo Fonte) // // Criao: 01 Jan 2013 // Atualizao: 25 Ago 2021 // Compilador: Visual C++ 2019 // // Descrio: Player do jogo PacMan // **********************************************************************************/ #include "PacMan.h" #include "Player.h" #include "Pivot.h" // --------------------------------------------------------------------------------- Player::Player() { spriteL = new Sprite("Resources/PacManL.png"); spriteR = new Sprite("Resources/PacManR.png"); spriteU = new Sprite("Resources/PacManU.png"); spriteD = new Sprite("Resources/PacManD.png"); // imagem do pacman 48x48 (com borda transparente de 4 pixels) BBox(new Rect(-20, -20, 20, 20)); MoveTo(480.0f, 450.0f); type = PLAYER; } // --------------------------------------------------------------------------------- Player::~Player() { delete spriteL; delete spriteR; delete spriteU; delete spriteD; } // --------------------------------------------------------------------------------- void Player::Stop() { velX = 0; velY = 0; } // --------------------------------------------------------------------------------- void Player::Up() { velX = 0; velY = -200.0f; } // --------------------------------------------------------------------------------- void Player::Down() { velX = 0; velY = 200.0f; } // --------------------------------------------------------------------------------- void Player::Left() { velX = -200.0f; velY = 0; } // --------------------------------------------------------------------------------- void Player::Right() { velX = 200.0f; velY = 0; } // --------------------------------------------------------------------------------- void Player::OnCollision(Object * obj) { if (obj->Type() == PIVOT) PivotCollision(obj); } // --------------------------------------------------------------------------------- void Player::PivotCollision(Object * obj) { Pivot * p = (Pivot*)obj; switch (currState) { case STOPED: // ----------------------- // CurrentState == STOPED // ----------------------- switch (nextState) { case LEFT: if (p->left) { currState = LEFT; Left(); } break; case RIGHT: if (p->right) { currState = RIGHT; Right(); } break; case UP: if (p->up) { currState = UP; Up(); } break; case DOWN: if (p->down) { currState = DOWN; Down(); } break; } break; case LEFT: // ----------------------- // CurrentState == LEFT // ----------------------- if (x < p->X()) { if (!p->left) { MoveTo(p->X(), Y()); currState = STOPED; Stop(); } } switch (nextState) { case LEFT: if (x < p->X()) { if (!p->left) { MoveTo(p->X(), Y()); currState = STOPED; Stop(); } } break; case RIGHT: currState = RIGHT; Right(); break; case UP: if (x < p->X()) { if (p->up) { MoveTo(p->X(), Y()); currState = UP; Up(); } } break; case DOWN: if (x < p->X()) { if (p->down) { MoveTo(p->X(), Y()); currState = DOWN; Down(); } } break; } break; case RIGHT: // ----------------------- // CurrentState == RIGHT // ----------------------- if (x > p->X()) { if (!p->right) { MoveTo(p->X(), Y()); currState = STOPED; Stop(); } } switch (nextState) { case LEFT: currState = LEFT; Left(); break; case RIGHT: if (x > p->X()) { if (!p->right) { MoveTo(p->X(), Y()); currState = STOPED; Stop(); } } break; case UP: if (x > p->X()) { if (p->up) { MoveTo(p->X(), Y()); currState = UP; Up(); } } break; case DOWN: if (x > p->X()) { if (p->down) { MoveTo(p->X(), Y()); currState = DOWN; Down(); } } break; } break; case UP: // ----------------------- // CurrentState == UP // ----------------------- if (y < p->Y()) { if (!p->up) { MoveTo(x, p->Y()); currState = STOPED; Stop(); } } switch (nextState) { case LEFT: if (y < p->Y()) { if (p->left) { MoveTo(x, p->Y()); currState = LEFT; Left(); } } break; case RIGHT: if (y < p->Y()) { if (p->right) { MoveTo(x, p->Y()); currState = RIGHT; Right(); } } break; case UP: if (y < p->Y()) { if (!p->up) { MoveTo(x, p->Y()); currState = STOPED; Stop(); } } break; case DOWN: currState = DOWN; Down(); break; } break; case DOWN: // ----------------------- // CurrentState == DOWN // ----------------------- if (y > p->Y()) { if (!p->down) { MoveTo(x, p->Y()); currState = STOPED; Stop(); } } switch (nextState) { case LEFT: if (y > p->Y()) { if (p->left) { MoveTo(x, p->Y()); currState = LEFT; Left(); } } break; case RIGHT: if (y > p->Y()) { if (p->right) { MoveTo(x, p->Y()); currState = RIGHT; Right(); } } break; case UP: currState = UP; Up(); break; case DOWN: if (y > p->Y()) { if (!p->down) { MoveTo(x, p->Y()); currState = STOPED; Stop(); } } break; } break; } } // --------------------------------------------------------------------------------- void Player::Update() { if (window->KeyDown(VK_LEFT)) { nextState = LEFT; if (currState == RIGHT || currState == STOPED) { currState = LEFT; Left(); } } if (window->KeyDown(VK_RIGHT)) { nextState = RIGHT; if (currState == LEFT || currState == STOPED) { currState = RIGHT; Right(); } } if (window->KeyDown(VK_UP)) { nextState = UP; if (currState == DOWN || currState == STOPED) { currState = UP; Up(); } } if (window->KeyDown(VK_DOWN)) { nextState = DOWN; if (currState == UP || currState == STOPED) { currState = DOWN; Down(); } } // atualiza posio Translate(velX * gameTime, velY * gameTime); // mantm player dentro da tela if (x+20 < 0) MoveTo(window->Width()+20.f, Y()); if (x-20 > window->Width()) MoveTo(-20.0f, Y()); if (Y()+20 < 0) MoveTo(x, window->Height()+20.0f); if (Y()-20 > window->Height()) MoveTo(x, -20.0f); } // --------------------------------------------------------------------------------- void Player::Draw() { switch(currState) { case LEFT: spriteL->Draw(x, y, Layer::UPPER); break; case RIGHT: spriteR->Draw(x, y, Layer::UPPER); break; case UP: spriteU->Draw(x, y, Layer::UPPER); break; case DOWN: spriteD->Draw(x, y, Layer::UPPER); break; default: switch(nextState) { case LEFT: spriteL->Draw(x, y, Layer::UPPER); break; case RIGHT: spriteR->Draw(x, y, Layer::UPPER); break; case UP: spriteU->Draw(x, y, Layer::UPPER); break; case DOWN: spriteD->Draw(x, y, Layer::UPPER); break; default: spriteL->Draw(x, y, Layer::UPPER); } } } // ---------------------------------------------------------------------------------
1
0.861375
1
0.861375
game-dev
MEDIA
0.730394
game-dev
0.991088
1
0.991088
UnioGame/leoecs.lite.features
1,056
Characteristics/SplashDamage/SplashDamageFeature.cs
namespace Game.Ecs.Characteristics.SplashDamage { using System; using Base; using Components; using Cysharp.Threading.Tasks; using Feature; using Leopotam.EcsLite; using Systems; using UnityEngine; /// <summary> /// allows you to deal damage on the area with default attacks, /// the characteristic increases the damage that opponents receive near the main target /// </summary> [CreateAssetMenu(menuName = "Game/Feature/Characteristics/SplashDamage Feature")] public sealed class SplashDamageFeature : CharacteristicFeature<SplashDamageEcsFeature> { } [Serializable] public sealed class SplashDamageEcsFeature : CharacteristicEcsFeature { protected override UniTask OnInitializeFeatureAsync(IEcsSystems ecsSystems) { ecsSystems.AddCharacteristic<SplashDamageComponent>(); // update Splash Damage value ecsSystems.Add(new RecalculateSplashDamageSystem()); return UniTask.CompletedTask; } } }
1
0.834345
1
0.834345
game-dev
MEDIA
0.985191
game-dev
0.531625
1
0.531625
GJKen/L4d2_plugins
49,596
必选-功能类插件(left4dhooks)(v1.151)(SilverShot)/left4dead2/addons/sourcemod/scripting/include/left4dhooks_stocks.inc
/** * ============================================================================= * Left 4 Dead Stocks Library (C)2011-2012 Buster "Mr. Zero" Nielsen * Syntax Update and merge into "Left 4 DHooks Direct" (C) 2024 "SilverShot" * ============================================================================= * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License, version 3.0, as * published by the Free Software Foundation. * * 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/>. * * As a special exception, AlliedModders LLC gives you permission to link the * code of this program (as well as its derivative works) to "Half-Life 2," * the "Source Engine," the "SourcePawn JIT," and any Game MODs that run on * software by the Valve Corporation. You must obey the GNU General Public * License in all respects for all other code used. Additionally, * AlliedModders LLC grants this exception to all derivative works. * AlliedModders LLC defines further exceptions, found in LICENSE.txt * (as of this writing, version JULY-31-2007), or * <http://www.sourcemod.net/license.php>. */ #if defined _l4d_stocks_included #endinput #endif #define _l4d_stocks_included #pragma newdecls required #tryinclude <left4dhooks_anim> #tryinclude <left4dhooks_silver> #tryinclude <left4dhooks_lux_library> // ==================================================================================================== // VARIOUS STOCKS: "l4d_stocks.inc" by "Mr. Zero" // ==================================================================================================== #include <sdktools> /* Spawn state bit flags */ #define L4D_SPAWNFLAG_CANSPAWN (0 << 0) #define L4D_SPAWNFLAG_DISABLED (1 << 0) #define L4D_SPAWNFLAG_WAITFORSURVIVORS (1 << 1) #define L4D_SPAWNFLAG_WAITFORFINALE (1 << 2) #define L4D_SPAWNFLAG_WAITFORTANKTODIE (1 << 3) #define L4D_SPAWNFLAG_SURVIVORESCAPED (1 << 4) #define L4D_SPAWNFLAG_DIRECTORTIMEOUT (1 << 5) #define L4D_SPAWNFLAG_WAITFORNEXTWAVE (1 << 6) #define L4D_SPAWNFLAG_CANBESEEN (1 << 7) #define L4D_SPAWNFLAG_TOOCLOSE (1 << 8) #define L4D_SPAWNFLAG_RESTRICTEDAREA (1 << 9) #define L4D_SPAWNFLAG_BLOCKED (1 << 10) /* Weapon upgrade bit flags */ #define L4D2_WEPUPGFLAG_NONE (0 << 0) #define L4D2_WEPUPGFLAG_INCENDIARY (1 << 0) #define L4D2_WEPUPGFLAG_EXPLOSIVE (1 << 1) #define L4D2_WEPUPGFLAG_LASER (1 << 2) /* Instructor Hint bit flags */ #define L4D2_IHFLAG_NONE (0 << 0) #define L4D2_IHFLAG_PULSE_SLOW (1 << 0) #define L4D2_IHFLAG_PULSE_FAST (1 << 1) #define L4D2_IHFLAG_PULSE_URGENT (1 << 2) #define L4D2_IHFLAG_ALPHA_SLOW (1 << 3) #define L4D2_IHFLAG_ALPHA_FAST (1 << 4) #define L4D2_IHFLAG_ALPHA_URGENT (1 << 5) #define L4D2_IHFLAG_SHAKE_NARROW (1 << 6) #define L4D2_IHFLAG_SHAKE_WIDE (1 << 7) #define L4D2_IHFLAG_STATIC (1 << 8) /* Survivor intensity -- Equal or less */ #define L4D_SURVIVORINTENSITY_MILD 0.25 #define L4D_SURVIVORINTENSITY_MODERATE 0.50 #define L4D_SURVIVORINTENSITY_HIGH 0.75 #define L4D_SURVIVORINTENSITY_EXTREME 1.00 enum L4DTeam { L4DTeam_Unassigned = 0, L4DTeam_Spectator = 1, L4DTeam_Survivor = 2, L4DTeam_Infected = 3 } enum L4DWeaponSlot { L4DWeaponSlot_Primary = 0, L4DWeaponSlot_Secondary = 1, L4DWeaponSlot_Grenade = 2, L4DWeaponSlot_FirstAid = 3, L4DWeaponSlot_Pills = 4 } enum L4D2GlowType { L4D2Glow_None = 0, L4D2Glow_OnUse = 1, L4D2Glow_OnLookAt = 2, L4D2Glow_Constant = 3 } enum L4D1ZombieClassType { L4D1ZombieClass_Smoker = 1, L4D1ZombieClass_Boomer = 2, L4D1ZombieClass_Hunter = 3, L4D1ZombieClass_Witch = 4, L4D1ZombieClass_Tank = 5, L4D1ZombieClass_NotInfected = 6 } enum L4D2ZombieClassType { L4D2ZombieClass_Smoker = 1, L4D2ZombieClass_Boomer = 2, L4D2ZombieClass_Hunter = 3, L4D2ZombieClass_Spitter = 4, L4D2ZombieClass_Jockey = 5, L4D2ZombieClass_Charger = 6, L4D2ZombieClass_Witch = 7, L4D2ZombieClass_Tank = 8, L4D2ZombieClass_NotInfected = 9 } enum L4D2UseAction { L4D2UseAction_None = 0, // No use action active L4D2UseAction_Healing = 1, // Includes healing yourself or a teammate. L4D2UseAction_AmmoPack = 2, // When deploying the ammo pack that was never added into the game L4D2UseAction_Defibing = 4, // When defib'ing a dead body. L4D2UseAction_GettingDefibed = 5, // When comming back to life from a dead body. L4D2UseAction_DeployIncendiary = 6, // When deploying Incendiary ammo L4D2UseAction_DeployExplosive = 7, // When deploying Explosive ammo L4D2UseAction_PouringGas = 8, // Pouring gas into a generator L4D2UseAction_Cola = 9, // For Dead Center map 2 cola event, when handing over the cola to whitalker. L4D2UseAction_Button = 10, // Such as buttons, timed buttons, generators, etc. L4D2UseAction_UsePointScript = 11 // When using a "point_script_use_target" entity /* List is not fully done, these are just the ones I have found so far */ } enum L4DResourceType { L4DResource_Ping, L4DResource_Score, L4DResource_TankTickets, L4DResource_Deaths, L4DResource_MaxHealth, L4DResource_WantsToPlay, L4DResource_TankTickets2 } stock const char L4D1ZombieClassname[6][] = { "smoker", "boomer", "hunter", "witch", "tank", "error_bad_L4D1ZombieClassType" }; stock const char L4D2ZombieClassname[9][] = { "smoker", "boomer", "hunter", "spitter", "jockey", "charger", "witch", "tank", "error_bad_L4D2ZombieClassType" }; static const char L4DResourceName[L4DResourceType][] = { "m_iPing", "m_iScore", "m_iTankTickets", "m_iDeaths", "m_maxHealth", "m_wantsToPlay", "m_tankTickets" }; /** * Returns the clients team using L4DTeam. * * @param client Player's index. * @return Current L4DTeam of player. * @error Invalid client index. */ stock L4DTeam L4D_GetClientTeam(int client) { int team = GetClientTeam(client); return view_as<L4DTeam>(team); } /** * Returns zombie player L4D1 zombie class. * * @param client Player's index. * @return Current L4D1ZombieClassType of player. * @error Invalid client index. */ // L4D1 only. stock L4D1ZombieClassType L4D1_GetPlayerZombieClass(int client) { return view_as<L4D1ZombieClassType>(GetEntProp(client, Prop_Send, "m_zombieClass")); } /** * Set zombie player L4D1 zombie class. * * @param client Player's index. * @param class L4D1ZombieClassType class symbol. * @noreturn * @error Invalid client index. */ // L4D1 only. stock void L4D1_SetPlayerZombieClass(int client, L4D1ZombieClassType class) { SetEntProp(client, Prop_Send, "m_zombieClass", class); } /** * Returns zombie player L4D2 zombie class. * * @param client Player's index. * @return Current L4D2ZombieClassType of player. * @error Invalid client index. */ // L4D2 only. stock any L4D2_GetPlayerZombieClass(int client) { return view_as<L4D2ZombieClassType>(GetEntProp(client, Prop_Send, "m_zombieClass")); } /** * Set zombie player L4D2 zombie class. * * @param client Player's index. * @param class L4D2ZombieClassType class symbol. * @noreturn * @error Invalid client index. */ // L4D2 only. stock void L4D2_SetPlayerZombieClass(int client, L4D2ZombieClassType class) { SetEntProp(client, Prop_Send, "m_zombieClass", class); } /** * Returns ghost state of zombie player. * * @param client Player index. * @return True if player is ghost, false otherwise. * @error Invalid client index. */ stock bool L4D_IsPlayerGhost(int client) { return view_as<bool>(GetEntProp(client, Prop_Send, "m_isGhost", 1)); } /** * Sets ghost state of zombie player. * * @param client Player index. * @param isGhost Sets ghost status. * @noreturn * @error Invalid client index. */ stock void L4D_SetPlayerGhostState(int client, bool isGhost) { SetEntProp(client, Prop_Send, "m_isGhost", isGhost, 1); } /** * Returns ghost spawn state of zombie player. * * @param client Player index. * @return Player's spawn state bits. * @error Invalid client index. */ stock int L4D_GetPlayerGhostSpawnState(int client) { return GetEntProp(client, Prop_Send, "m_ghostSpawnState"); } /** * Set zombie player's ghost spawn state bits. * * Note: The game updates spawn state bits every frame. * * @param client Player index. * @param bits Ghost spawn state bits. * @noreturn * @error Invalid client index. */ stock void L4D_SetPlayerGhostSpawnState(int client, int bits) { SetEntProp(client, Prop_Send, "m_ghostSpawnState", bits); } /** * Returns whether zombie player is culling. * * @param client Player index. * @return True if player is culling, false otherwise. */ stock bool L4D_IsPlayerCulling(int client) { return view_as<bool>(GetEntProp(client, Prop_Send, "m_isCulling", 1)); } /** * Set culling state of zombie player. * * @param client Player index. * @param isCulling Whether player is culling. * @noreturn * @error Invalid client index. */ stock void L4D_SetPlayerCullingState(int client, bool isCulling) { SetEntProp(client, Prop_Send, "m_isCulling", isCulling, 1); } /** * Returns whether player is incapacitated. * * Note: A tank player will return true when in dying animation. * * @param client Player index. * @return True if incapacitated, false otherwise. * @error Invalid client index. */ stock bool L4D_IsPlayerIncapacitated(int client) { return view_as<bool>(GetEntProp(client, Prop_Send, "m_isIncapacitated", 1)); } /** * Set player's incapacitated state. * * @param client Player index. * @param isIncapacitated Whether the player is incapacitated. * @noreturn * @error Invalid client index. */ stock void L4D_SetPlayerIncapacitatedState(int client, bool isIncapacitated) { SetEntProp(client, Prop_Send, "m_isIncapacitated", isIncapacitated, 1); } /** * Returns survivor player shove penalty. * * @param client Player index. * @return Current shove penalty of player. */ stock int L4D_GetPlayerShovePenalty(int client) { return GetEntProp(client, Prop_Send, "m_iShovePenalty"); } /** * Set survivor player shove penalty. * * @param client Player index. * @param shovePenalty Shove penalty. * @noreturn * @error Invalid client index. */ stock void L4D_SetPlayerShovePenalty(int client, int shovePenalty) { SetEntProp(client, Prop_Send, "m_iShovePenalty", shovePenalty); } /** * Returns tank player's frustration. * * @param client Player index. * @return How frustrated tank player is. * @error Invalid client index. */ stock int L4D_GetTankFrustration(int client) { return GetEntProp(client, Prop_Send, "m_frustration"); } /** * Set tank player's frustration. * * @param client Player index. * @param frustration How frustrated tank player is. * @noreturn * @error Invalid client index. */ stock void L4D_SetTankFrustration(int client, int frustration) { SetEntProp(client, Prop_Send, "m_frustration", frustration); } /** * Returns whether survivor player is idle. * * @param Player index. * @return True if idle, false otherwise. */ stock bool L4D_IsPlayerIdle(int client) { return L4D_GetBotOfIdlePlayer(client) > -1; } /** * Returns survivor bot of idle survivor player. * * @param client Player index. * @return Player index of the bot, -1 if not found. */ stock int L4D_GetBotOfIdlePlayer(int client) { int idleClient; int offset; char netclass[64]; for (int bot = 1; bot <= MaxClients; bot++) { if (!IsClientInGame(bot) || !IsFakeClient(bot) || view_as<L4DTeam>(GetClientTeam(bot)) != L4DTeam_Survivor || !IsPlayerAlive(bot) || GetClientHealth(bot) < 1) { continue; } GetEntityNetClass(bot, netclass, sizeof(netclass)); offset = FindSendPropInfo(netclass, "m_humanSpectatorUserID"); if (offset < 1) { continue; } idleClient = GetClientOfUserId(GetEntProp(bot, Prop_Send, "m_humanSpectatorUserID")); if (idleClient == client) { return bot; } } return -1; } /** * Returns idle survivor player of survivor bot. * * @param bot Player index of bot. * @return Player index of idle client, -1 if not found. * @error Invalid client index. */ stock int L4D_GetIdlePlayerOfBot(int bot) { char netclass[64]; GetEntityNetClass(bot, netclass, sizeof(netclass)); int offset = FindSendPropInfo(netclass, "m_humanSpectatorUserID"); if (offset < 1) { return -1; } return GetClientOfUserId(GetEntProp(bot, Prop_Send, "m_humanSpectatorUserID")); } /** * Returns resource entity. * * @return Entity index of resource entity, -1 if not found. */ stock int L4D_GetResourceEntity() { return FindEntityByClassname(-1, "terror_player_manager"); } /** * Retrieves client data from the resource entity. * * @param client Player's index. * @param type ResourceType constant * @return Value or -1 on failure. * @error Invalid client index, client not in game or failed to find resource entity. */ stock int L4D_GetPlayerResourceData(int client, L4DResourceType type) { if (!IsClientConnected(client)) { return -1; } int offset = FindSendPropInfo("CTerrorPlayerResource", L4DResourceName[type]); if (offset < 1) { return -1; } int entity = L4D_GetResourceEntity(); if (entity == -1) { return -1; } return GetEntData(entity, offset + (client * 4)); } /** * Sets client data in the resource entity. * * Note: The game overwrites these values every frame, so changing them will have very little effect. * * @param client Player's index. * @param type ResourceType constant * @param value Value to set. * @return Value or -1 on failure. * @error Invalid client index, client not in game or failed to find resource entity. */ stock bool L4D_SetPlayerResourceData(int client, L4DResourceType type, any value) { if (!IsClientConnected(client)) { return false; } int offset = FindSendPropInfo("CTerrorPlayerResource", L4DResourceName[type]); if (offset < 1) { return false; } int entity = L4D_GetResourceEntity(); if (entity == -1) { return false; } SetEntData(entity, offset + (client * 4), value); return true; } /** * Removes the weapon from a client's weapon slot * * @param client Player's index. * @param slot Slot index. * @noreturn * @error Invalid client or lack of mod support. */ stock void L4D_RemoveWeaponSlot(int client, L4DWeaponSlot slot) { int weaponIndex; while ((weaponIndex = GetPlayerWeaponSlot(client, view_as<int>(slot))) != -1) { RemovePlayerItem(client, weaponIndex); RemoveEdict(weaponIndex); } } /** * Removes all weapons from a client * * @param client Player's index. * @noreturn * @error Invalid client or lack of mod support. */ stock void L4D_RemoveAllWeapons(int client) { for (int i = 0; i <= 4; i++) { L4D_RemoveWeaponSlot(client, view_as<L4DWeaponSlot>(i)); } } /** * Returns whether the finale is active. * * Note: Finales can also be on other maps than just the finale map. A perfect * example of this is the Swamp Fever map 1 crescendo event. This event is * defined as a finale by Valve for some reason. * * @return True if finale is active, false otherwise. */ stock bool L4D_IsFinaleActive() { int entity = L4D_GetResourceEntity(); if (entity == -1) { return false; } return view_as<bool>(GetEntProp(entity, Prop_Send, "m_isFinale", 1)); } /** * Returns whether any survivor have left the safe area. * * @return True if any survivor have left safe area, false otherwise. */ stock bool L4D_HasAnySurvivorLeftSafeAreaStock() { int entity = L4D_GetResourceEntity(); if (entity == -1) { return false; } return view_as<bool>(GetEntProp(entity, Prop_Send, "m_hasAnySurvivorLeftSafeArea", 1)); } /** * Returns pending tank player. * * @return Player index of pending tank player, -1 if not found. */ stock int L4D_GetPendingTankPlayer() { int entity = L4D_GetResourceEntity(); if (entity == -1) { return -1; } return GetEntProp(entity, Prop_Send, "m_pendingTankPlayerIndex"); } /** * Set entity glow. This is consider safer and more robust over setting each glow property on their own because glow offset will be check first. * * @param entity Entity index. * @parma type Glow type. * @param range Glow max range, 0 for unlimited. * @param minRange Glow min range. * @param colorOverride Glow color, RGB. * @param flashing Whether the glow will be flashing. * @return True if glow was set, false if entity does not support glow. */ // L4D2 only. stock bool L4D2_SetEntityGlow(int entity, L4D2GlowType type, int range, int minRange, int colorOverride[3], bool flashing) { if (!IsValidEntity(entity)) { return false; } char netclass[64]; GetEntityNetClass(entity, netclass, sizeof(netclass)); int offset = FindSendPropInfo(netclass, "m_iGlowType"); if (offset < 1) { return false; } L4D2_SetEntityGlow_Type(entity, type); L4D2_SetEntityGlow_Range(entity, range); L4D2_SetEntityGlow_MinRange(entity, minRange); L4D2_SetEntityGlow_Color(entity, colorOverride); L4D2_SetEntityGlow_Flashing(entity, flashing); return true; } /** * Set entity glow type. * * @param entity Entity index. * @parma type Glow type. * @noreturn * @error Invalid entity index or entity does not support glow. */ // L4D2 only. stock void L4D2_SetEntityGlow_Type(int entity, L4D2GlowType type) { SetEntProp(entity, Prop_Send, "m_iGlowType", type); } /** * Set entity glow range. * * @param entity Entity index. * @parma range Glow range. * @noreturn * @error Invalid entity index or entity does not support glow. */ // L4D2 only. stock void L4D2_SetEntityGlow_Range(int entity, int range) { SetEntProp(entity, Prop_Send, "m_nGlowRange", range); } /** * Set entity glow min range. * * @param entity Entity index. * @parma minRange Glow min range. * @noreturn * @error Invalid entity index or entity does not support glow. */ // L4D2 only. stock void L4D2_SetEntityGlow_MinRange(int entity, int minRange) { SetEntProp(entity, Prop_Send, "m_nGlowRangeMin", minRange); } /** * Set entity glow color. * * @param entity Entity index. * @parma colorOverride Glow color, RGB. * @noreturn * @error Invalid entity index or entity does not support glow. */ // L4D2 only. stock void L4D2_SetEntityGlow_Color(int entity, int colorOverride[3]) { SetEntProp(entity, Prop_Send, "m_glowColorOverride", colorOverride[0] + (colorOverride[1] * 256) + (colorOverride[2] * 65536)); } /** * Set entity glow flashing state. * * @param entity Entity index. * @parma flashing Whether glow will be flashing. * @noreturn * @error Invalid entity index or entity does not support glow. */ // L4D2 only. stock void L4D2_SetEntityGlow_Flashing(int entity, bool flashing) { SetEntProp(entity, Prop_Send, "m_bFlashing", flashing); } /** * Returns entity glow type. * * @param entity Entity index. * @return L4D2 glow type. * @error Invalid entity index or entity does not support glow. */ // L4D2 only. stock L4D2GlowType L4D2_GetEntityGlow_Type(int entity) { return view_as<L4D2GlowType>(GetEntProp(entity, Prop_Send, "m_iGlowType")); } /** * Returns entity glow range. * * @param entity Entity index. * @return Glow range. * @error Invalid entity index or entity does not support glow. */ // L4D2 only. stock int L4D2_GetEntityGlow_Range(int entity) { return GetEntProp(entity, Prop_Send, "m_nGlowRange"); } /** * Returns entity glow min range. * * @param entity Entity index. * @return Glow min range. * @error Invalid entity index or entity does not support glow. */ // L4D2 only. stock int L4D2_GetEntityGlow_MinRange(int entity) { return GetEntProp(entity, Prop_Send, "m_nGlowRangeMin"); } /** * Returns entity glow flashing state. * * @param entity Entity index. * @return Glow flashing state. * @error Invalid entity index or entity does not support glow. */ // L4D2 only. stock bool L4D2_GetEntityGlow_Flashing(int entity) { return view_as<bool>(GetEntProp(entity, Prop_Send, "m_bFlashing")); } /** * Removes entity glow. * * @param entity Entity index. * @return True if glow was removed, false if entity does not * support glow. */ // L4D2 only. stock bool L4D2_RemoveEntityGlow(int entity) { return view_as<bool>(L4D2_SetEntityGlow(entity, L4D2Glow_None, 0, 0, { 0, 0, 0 }, false)); } /** * Removes entity glow override color. * * Note: This only removes the override color and reset it to the default glow * color. * * @param entity Entity index. * @noreturn * @error Invalid entity index or entity does not support glow. */ // L4D2 only. stock void L4D2_RemoveEntityGlow_Color(int entity) { L4D2_SetEntityGlow_Color(entity, { 0, 0, 0 }); } /** * Whether survivor glow for player is enabled. * * @param client Client index. * @return True if survivor glow is enabled, false otherwise. * @error Invalid client index. */ // L4D2 only. stock bool L4D2_IsPlayerSurvivorGlowEnable(int client) { return view_as<bool>(GetEntProp(client, Prop_Send, "m_bSurvivorGlowEnabled")); } /** * Set survivor glow state for player. * * @param client Client index. * @param enabled Whether survivor glow is enabled. * @noreturn * @error Invalid client index. */ // L4D2 only. stock void L4D2_SetPlayerSurvivorGlowState(int client, bool enabled) { SetEntProp(client, Prop_Send, "m_bSurvivorGlowEnabled", enabled); } /** * Return player current revive count. * * @param client Client index. * @return Survivor's current revive count. * @error Invalid client index. */ stock int L4D_GetPlayerReviveCount(int client) { return GetEntProp(client, Prop_Send, "m_currentReviveCount"); } /** * Set player revive count. * * @param client Client index. * @param count Revive count. * @noreturn * @error Invalid client index. */ stock void L4D_SetPlayerReviveCount(int client, int count) { SetEntProp(client, Prop_Send, "m_currentReviveCount", count); } /** * Return player intensity. * * Note: Its percentage. 0.0 - Player is calm, 1.0 - Player is stressed. * * @param client Client index. * @return Intensity. * @error Invalid client index. */ stock float L4D_GetPlayerIntensity(int client) { /* This format is used to keep consistency with the Director which also * uses 0.0 for calm and 1.0 for stressed */ return float(GetEntProp(client, Prop_Send, "m_clientIntensity")) / 100.0; } /** * Returns average survivor intensity. * * Note: Its percentage. 0.0 - All survivors is calm, 1.0 - All survivors is stressed. * * @return Average intensity level for survivors. */ stock float L4D_GetAvgSurvivorIntensity() { int intensityTotal = 0; int intensityMaxTotal = 0; for (int client = 1; client <= MaxClients; client++) { if (!IsClientInGame(client) || view_as<L4DTeam>(GetClientTeam(client)) != L4DTeam_Survivor || !IsPlayerAlive(client) || GetClientHealth(client) < 1) { continue; } intensityMaxTotal += 100; intensityTotal += GetEntProp(client, Prop_Send, "m_clientIntensity"); } /* This format is used to keep consistency with the Director which also uses 0.0 for calm and 1.0 for stressed */ return float(intensityTotal) / float(intensityMaxTotal); } /** * Set player intensity. * * Note: Its percentage. 0.0 - Player is calm, 1.0 - Player is stressed. * * @param client Client index. * @param intensity Intensity. * @noreturn * @error Invalid client index. */ stock void L4D_SetPlayerIntensity(int client, float intensity) { SetEntProp(client, Prop_Send, "m_clientIntensity", RoundToNearest(intensity * 100.0)); } /** * Returns whether player is calm. * * Note: Player is calm means that the player have not taken damage or * fired their weapon for a while. Survivor bots always return false. * * @param client Client index. * @return True if player is calm, false otherwise. * @error Invalid client index. */ stock bool L4D_IsPlayerCalm(int client) { return view_as<bool>(GetEntProp(client, Prop_Send, "m_isCalm")); } /** * Set player is calm state. * * Note: Player is calm means that the player have not taken damage or fired their weapon for a while. * * @param client Client index. * @param isCalm Whether player is calm. * @noreturn * @error Invalid client index. */ stock void L4D_SetPlayerCalmState(int client, bool isCalm) { SetEntProp(client, Prop_Send, "m_isCalm", isCalm); } /** * Returns whether player has visible threats. * * Note: This function should work for all players. Survivors looking upon * specials, witch or tank will be marked as has visible threats. However * looking at commons will not be seen as has visible threats. The common has * to be awaken from its slumber before beings seen as a threat. * * @parma client Client index. * @return True if player has visible threats, false otherwise. * @error Invalid client index. */ stock bool L4D_HasVisibleThreats(int client) { return view_as<bool>(GetEntProp(client, Prop_Send, "m_hasVisibleThreats")); } /** * Returns whether player is on third strike. * * @param client Client index. * @return True if on third strike, false otherwise. * @error Invalid client index. */ stock bool L4D_IsPlayerOnThirdStrike(int client) { return view_as<bool>(GetEntProp(client, Prop_Send, "m_bIsOnThirdStrike")); } /** * Set player third strike state. * * @param client Client index. * @param onThirdStrike Whether survivor is on third strike. * @noreturn * @error Invalid client index. */ stock void L4D_SetPlayerThirdStrikeState(int client, bool onThirdStrike) { SetEntProp(client, Prop_Send, "m_bIsOnThirdStrike", onThirdStrike); } /** * Returns whether player is going to die. * * Note: This is not the same as is player on third strike. While on third * strike defines whether player should die next time they get incapacitated, * this defines whether the survivor should limp when they hit 1hp and make * the character vocalize their "I dont think I'm gonna make it" lines. * * @param client Client index. * @return True if player is going to die, false otherwise. * @error Invalid client index. */ stock bool L4D_IsPlayerGoingToDie(int client) { return view_as<bool>(GetEntProp(client, Prop_Send, "m_isGoingToDie")); } /** * Set player is going to die state. * * @param client Client index. * @param isGoingToDie Whether player is going to die. * @noreturn * @error Invalid client index. */ stock void L4D_SetPlayerIsGoingToDie(int client, bool isGoingToDie) { SetEntProp(client, Prop_Send, "m_isGoingToDie", isGoingToDie); } /** * Returns whether weapon is upgrade compatible. * * @param weapon Weapon entity index. * @return True if compatible with upgrades, false otherwise. * @error Invalid entity index. */ stock bool L4D2_IsWeaponUpgradeCompatible(int weapon) { if( HasEntProp(weapon, Prop_Send, "m_upgradeBitVec") ) return true; return false; } /** * Returns upgraded ammo count for weapon. * * @param weapon Weapon entity index. * @return Upgraded ammo count. * @error Invalid entity index. */ // L4D2 only. stock int L4D2_GetWeaponUpgradeAmmoCount(int weapon) { if( HasEntProp(weapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded") ) return GetEntProp(weapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded"); return 0; } /** * Set upgraded ammo count in weapon. * * @param weapon Weapon entity index. * @param count Upgraded ammo count. * @noreturn * @error Invalid entity index. */ // L4D2 only. stock void L4D2_SetWeaponUpgradeAmmoCount(int weapon, int count) { if( HasEntProp(weapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded") ) SetEntProp(weapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", count); } /** * Returns weapon upgrades of weapon. * * @param weapon Weapon entity index. * @return Weapon upgrade bits. * @error Invalid entity index. */ // L4D2 only. stock int L4D2_GetWeaponUpgrades(int weapon) { if( HasEntProp(weapon, Prop_Send, "m_upgradeBitVec") ) return GetEntProp(weapon, Prop_Send, "m_upgradeBitVec"); return 0; } /** * Set weapon upgrades for weapon. * * @param weapon Weapon entity index. * @param upgrades Weapon upgrade bits. * @noreturn * @error Invalid entity index. */ // L4D2 only. stock void L4D2_SetWeaponUpgrades(int weapon, int upgrades) { if( HasEntProp(weapon, Prop_Send, "m_upgradeBitVec") ) { SetEntProp(weapon, Prop_Send, "m_upgradeBitVec", upgrades); } } /** * Returns infected attacker of survivor victim. * * Note: Infected attacker means the infected player that is currently * pinning down the survivor. Such as hunter, smoker, charger and jockey. * * @param client Survivor client index. * @return Infected attacker index, -1 if not found. * @error Invalid client index. */ // L4D2 only. stock int L4D2_GetInfectedAttacker(int client) { int attacker; /* Charger */ attacker = GetEntPropEnt(client, Prop_Send, "m_pummelAttacker"); if (attacker > 0) { return attacker; } attacker = GetEntPropEnt(client, Prop_Send, "m_carryAttacker"); if (attacker > 0) { return attacker; } /* Hunter */ attacker = GetEntPropEnt(client, Prop_Send, "m_pounceAttacker"); if (attacker > 0) { return attacker; } /* Smoker */ attacker = GetEntPropEnt(client, Prop_Send, "m_tongueOwner"); if (attacker > 0) { return attacker; } /* Jockey */ attacker = GetEntPropEnt(client, Prop_Send, "m_jockeyAttacker"); if (attacker > 0) { return attacker; } return -1; } /** * Returns survivor victim of infected attacker. * * Note: Survivor victim means the survivor player that is currently pinned * down by an attacker. Such as hunter, smoker, charger and jockey. * * @param client Infected client index. * @return Survivor victim index, -1 if not found. * @error Invalid client index. */ // L4D2 only. stock int L4D2_GetSurvivorVictim(int client) { int victim; /* Charger */ victim = GetEntPropEnt(client, Prop_Send, "m_pummelVictim"); if (victim > 0) { return victim; } victim = GetEntPropEnt(client, Prop_Send, "m_carryVictim"); if (victim > 0) { return victim; } /* Hunter */ victim = GetEntPropEnt(client, Prop_Send, "m_pounceVictim"); if (victim > 0) { return victim; } /* Smoker */ victim = GetEntPropEnt(client, Prop_Send, "m_tongueVictim"); if (victim > 0) { return victim; } /* Jockey */ victim = GetEntPropEnt(client, Prop_Send, "m_jockeyVictim"); if (victim > 0) { return victim; } return -1; } /** * Returns whether survivor client was present at survival start. * * @param client Client index. * @return True if survivor was present at survival start, false otherwise. * @error Invalid client index. */ // L4D2 only. stock bool L4D2_WasPresentAtSurvivalStart(int client) { return view_as<bool>(GetEntProp(client, Prop_Send, "m_bWasPresentAtSurvivalStart")); } /** * Sets whether player was present at survival start. * * @param client Client index. * @param wasPresent Whether survivor was present at survival start. * @noreturn * @error Invalid client index. */ // L4D2 only. stock void L4D2_SetPresentAtSurvivalStart(int client, bool wasPresent) { SetEntProp(client, Prop_Send, "m_bWasPresentAtSurvivalStart", wasPresent); } /** * Returns whether player is using a mounted weapon. * * @param client Client index. * @return True if using a mounted weapon, false otherwise. * @error Invalid client index. */ stock bool L4D_IsPlayerUsingMountedWeapon(int client) { return view_as<bool>(GetEntProp(client, Prop_Send, "m_usingMountedWeapon")); } /** * Returns player temporarily health. * * Note: This will not work with mutations or campaigns that alters the decay * rate through vscript'ing. If you want to be sure that it works no matter * the mutation, you will have to detour the OnGetScriptValueFloat function. * Doing so you are able to capture the altered decay rate and calculate the * temp health the same way as this function does. * * @param client Client index. * @return Player's temporarily health, -1 if unable to get. * @error Invalid client index or unable to find pain_pills_decay_rate cvar. */ stock int L4D_GetPlayerTempHealth(int client) { static ConVar painPillsDecayCvar; if (painPillsDecayCvar == null) { painPillsDecayCvar = FindConVar("pain_pills_decay_rate"); if (painPillsDecayCvar == null) { return -1; } } int tempHealth = RoundToCeil(GetEntPropFloat(client, Prop_Send, "m_healthBuffer") - ((GetGameTime() - GetEntPropFloat(client, Prop_Send, "m_healthBufferTime")) * painPillsDecayCvar.FloatValue)) - 1; return tempHealth < 0 ? 0 : tempHealth; } /** * Set players temporarily health. * * @param client Client index. * @param tempHealth Temporarily health. * @noreturn * @error Invalid client index. */ stock void L4D_SetPlayerTempHealth(int client, int tempHealth) { SetEntPropFloat(client, Prop_Send, "m_healthBuffer", float(tempHealth)); SetEntPropFloat(client, Prop_Send, "m_healthBufferTime", GetGameTime()); } /** * Set players temporarily health. Allows for setting above 200 HP. * * @param client Client index. * @param tempHealth Temporarily health. * @noreturn * @error Invalid client index. */ stock void L4D_SetPlayerTempHealthFloat(int client, float tempHealth) { static ConVar painPillsDecayCvar; if (painPillsDecayCvar == null) { painPillsDecayCvar = FindConVar("pain_pills_decay_rate"); if (painPillsDecayCvar == null) { return; } } SetEntPropFloat(client, Prop_Send, "m_healthBuffer", tempHealth); SetEntPropFloat(client, Prop_Send, "m_healthBufferTime", GetGameTime() + ((tempHealth - 200) / painPillsDecayCvar.FloatValue + 1 / painPillsDecayCvar.FloatValue)); } /** * Returns player use action. * * @param client Client index. * @return Use action. * @error Invalid client index. */ // L4D2 only. stock L4D2UseAction L4D2_GetPlayerUseAction(int client) { return view_as<L4D2UseAction>(GetEntProp(client, Prop_Send, "m_iCurrentUseAction")); } /** * Returns player use action target. * * @param client Client index. * @return Entity index. * @error Invalid client index. */ // L4D2 only. stock int L4D2_GetPlayerUseActionTarget(int client) { return GetEntPropEnt(client, Prop_Send, "m_useActionTarget"); } /** * Returns player use action owner. * * @param client Client index. * @return Entity index. * @error Invalid client index. */ // L4D2 only. stock int L4D2_GetPlayerUseActionOwner(int client) { return GetEntPropEnt(client, Prop_Send, "m_useActionOwner"); } /** * Creates an instructor hint. * * Note: Both infected and survivor players will see hint. No more than one at * a time can be shown. The "newest" hint will override the old no matter the * timeout and range. This instructor hint will not be shown if the given * player is dead. * * @param name Instructor hint name. * @param target Entity index of target. * @param caption Caption of hint. * @param color Color of the caption. RGB format. * @param iconOnScreen Icon when hint is on screen. * @param iconOffScreen Icon when hint is off screen. * @param binding Key binding to show. * @param iconOffset Height offset for icon from target entity's origin. * @param range Display range of hint. 0 for unlimited range. * @param timeout Timeout out for hint. 0 will persist until stopped with L4D2_EndInstructorHint. * @param allowNoDrawTarget Whether hint will work with targets that have nodraw set. * @param noOffScreen Whether when hint is off screen it will show an arrow pointing to target. * @param forceCaption Whether the hint and icon will show even when occluded a wall. * @param flags Instructor hint bit flags. See L4D2_IHFLAG_* defines. * @return True if send, false otherwise. */ // L4D2 only. stock bool L4D2_CreateInstructorHint(const char[] name, int target = 0, const char[] caption, int color[3] = {255, 255, 255}, const char[] iconOnScreen = "icon_tip", const char[] iconOffScreen = "icon_tip", const char[] binding = "", float iconOffset = 0.0, float range = 0.0, int timeout = 0, bool allowNoDrawTarget = true, bool noOffScreen = false, bool forceCaption = false, int flags = L4D2_IHFLAG_STATIC) { Event event = CreateEvent("instructor_server_hint_create", true); if (event == null) { return false; } char finalizedColor[16]; Format(finalizedColor, 16, "%d,%d,%d", color[0], color[1], color[2]); event.SetString("hint_name", name); event.SetInt("hint_target", target); event.SetString("hint_caption", caption); event.SetString("hint_color", finalizedColor); event.SetString("hint_icon_onscreen", iconOnScreen); event.SetString("hint_icon_offscreen", iconOffScreen); event.SetString("hint_binding", binding); event.SetFloat("hint_icon_offset", iconOffset); event.SetFloat("hint_range", range); event.SetInt("hint_timeout", timeout); event.SetBool("hint_allow_nodraw_target", allowNoDrawTarget); event.SetBool("hint_nooffscreen", noOffScreen); event.SetBool("hint_forcecaption", forceCaption); event.SetInt("hint_flags", flags); event.Fire(); return true; } /** * Stops all instructor hints with name. * * @param name Name of instructor hint to stop. * @return True if send, false otherwise. */ // L4D2 only. stock bool L4D2_StopInstructorHint(const char[] name) { Event event = CreateEvent("instructor_server_hint_stop", true); if (event == null) { return false; } event.SetString("hint_name", name); event.Fire(); return true; } /** * Returns whether shotgun needs to be pumped. * * @parma weapon Weapon entity index. * @return True if shotgun needs to be pumped, false otherwise. */ // L4D1 only. stock int L4D1_GetShotgunNeedPump(int weapon) { return HasEntProp(weapon, Prop_Send, "m_needPump") && GetEntProp(weapon, Prop_Send, "m_needPump"); } /** * Sets whether shotgun needs to be pumped. * * @parma weapon Weapon entity index. * @parma needPump Whether shotgun needs to be pumped. * @noreturn */ // L4D1 only. stock void L4D1_SetShotgunNeedPump(int weapon, bool needPump) { if( HasEntProp(weapon, Prop_Send, "m_needPump") ) { SetEntProp(weapon, Prop_Send, "m_needPump", view_as<int>(needPump)); } } /** * Sets custom ability cooldown of client. * * Note: Used for the Infected class abilities. * * @param client Client index. * @param time How long before client can use their custom ability. * @return True if set, false if no ability found. */ // L4D2 only. stock bool L4D2_SetCustomAbilityCooldown(int client, float time) { int ability = GetEntPropEnt(client, Prop_Send, "m_customAbility"); if (ability > 0 && IsValidEdict(ability)) { SetEntPropFloat(ability, Prop_Send, "m_duration", time); SetEntPropFloat(ability, Prop_Send, "m_timestamp", GetGameTime() + time); return true; } return false; } // ==================================================================================================== // WEAPON STOCKS: "l4d_weapon_stocks.inc" by "Mr. Zero" // ==================================================================================================== /* Credits to ProdigySim for the weapon details, models and original script */ #if defined _l4d_weapon_stocks_included #endinput #endif #define _l4d_weapon_stocks_included #include <adt_trie> #include <sourcemod> #include <sdktools> enum L4D2WeaponId { L4D2WeaponId_None, // 0 L4D2WeaponId_Pistol, // 1 L4D2WeaponId_Smg, // 2 L4D2WeaponId_Pumpshotgun, // 3 L4D2WeaponId_Autoshotgun, // 4 L4D2WeaponId_Rifle, // 5 L4D2WeaponId_HuntingRifle, // 6 L4D2WeaponId_SmgSilenced, // 7 L4D2WeaponId_ShotgunChrome, // 8 L4D2WeaponId_RifleDesert, // 9 L4D2WeaponId_SniperMilitary, // 10 L4D2WeaponId_ShotgunSpas, // 11 L4D2WeaponId_FirstAidKit, // 12 L4D2WeaponId_Molotov, // 13 L4D2WeaponId_PipeBomb, // 14 L4D2WeaponId_PainPills, // 15 L4D2WeaponId_Gascan, // 16 L4D2WeaponId_PropaneTank, // 17 L4D2WeaponId_OxygenTank, // 18 L4D2WeaponId_Melee, // 19 L4D2WeaponId_Chainsaw, // 20 L4D2WeaponId_GrenadeLauncher, // 21 L4D2WeaponId_AmmoPack, // 22 L4D2WeaponId_Adrenaline, // 23 L4D2WeaponId_Defibrillator, // 24 L4D2WeaponId_Vomitjar, // 25 L4D2WeaponId_RifleAK47, // 26 L4D2WeaponId_GnomeChompski, // 27 L4D2WeaponId_ColaBottles, // 28 L4D2WeaponId_FireworksBox, // 29 L4D2WeaponId_IncendiaryAmmo, // 30 L4D2WeaponId_FragAmmo, // 31 L4D2WeaponId_PistolMagnum, // 32 L4D2WeaponId_SmgMP5, // 33 L4D2WeaponId_RifleSG552, // 34 L4D2WeaponId_SniperAWP, // 35 L4D2WeaponId_SniperScout, // 36 L4D2WeaponId_RifleM60, // 37 L4D2WeaponId_TankClaw, // 38 L4D2WeaponId_HunterClaw, // 39 L4D2WeaponId_ChargerClaw, // 40 L4D2WeaponId_BoomerClaw, // 41 L4D2WeaponId_SmokerClaw, // 42 L4D2WeaponId_SpitterClaw, // 43 L4D2WeaponId_JockeyClaw, // 44 L4D2WeaponId_Machinegun, // 45 L4D2WeaponId_FatalVomit, // 46 L4D2WeaponId_ExplodingSplat, // 47 L4D2WeaponId_LungePounce, // 48 L4D2WeaponId_Lounge, // 49 L4D2WeaponId_FullPull, // 50 L4D2WeaponId_Choke, // 51 L4D2WeaponId_ThrowingRock, // 52 L4D2WeaponId_TurboPhysics, // 53 L4D2WeaponId_Ammo, // 54 L4D2WeaponId_UpgradeItem, // 55 L4D2WeaponId_MAX }; static const char L4D2WeaponName[L4D2WeaponId][] = { "weapon_none", // 0 "weapon_pistol", // 1 "weapon_smg", // 2 "weapon_pumpshotgun", // 3 "weapon_autoshotgun", // 4 "weapon_rifle", // 5 "weapon_hunting_rifle", // 6 "weapon_smg_silenced", // 7 "weapon_shotgun_chrome", // 8 "weapon_rifle_desert", // 9 "weapon_sniper_military", // 10 "weapon_shotgun_spas", // 11 "weapon_first_aid_kit", // 12 "weapon_molotov", // 13 "weapon_pipe_bomb", // 14 "weapon_pain_pills", // 15 "weapon_gascan", // 16 "weapon_propanetank", // 17 "weapon_oxygentank", // 18 "weapon_melee", // 19 "weapon_chainsaw", // 20 "weapon_grenade_launcher", // 21 "weapon_ammo_pack", // 22 "weapon_adrenaline", // 23 "weapon_defibrillator", // 24 "weapon_vomitjar", // 25 "weapon_rifle_ak47", // 26 "weapon_gnome", // 27 "weapon_cola_bottles", // 28 "weapon_fireworkcrate", // 29 "weapon_upgradepack_incendiary", // 30 "weapon_upgradepack_explosive", // 31 "weapon_pistol_magnum", // 32 "weapon_smg_mp5", // 33 "weapon_rifle_sg552", // 34 "weapon_sniper_awp", // 35 "weapon_sniper_scout", // 36 "weapon_rifle_m60", // 37 "weapon_tank_claw", // 38 "weapon_hunter_claw", // 39 "weapon_charger_claw", // 40 "weapon_boomer_claw", // 41 "weapon_smoker_claw", // 42 "weapon_spitter_claw", // 43 "weapon_jockey_claw", // 44 "weapon_machinegun", // 45 "vomit", // 46 "splat", // 47 "pounce", // 48 "lounge", // 49 "pull", // 50 "choke", // 51 "rock", // 52 "physics", // 53 "weapon_ammo", // 54 "upgrade_item", // 55 "" }; static const char L4D2WeaponWorldModel[L4D2WeaponId][] = { "", "/w_models/weapons/w_pistol_b.mdl", "/w_models/weapons/w_smg_uzi.mdl", "/w_models/weapons/w_shotgun.mdl", "/w_models/weapons/w_autoshot_m4super.mdl", "/w_models/weapons/w_rifle_m16a2.mdl", "/w_models/weapons/w_sniper_mini14.mdl", "/w_models/weapons/w_smg_a.mdl", "/w_models/weapons/w_pumpshotgun_a.mdl", "/w_models/weapons/w_desert_rifle.mdl", // "/w_models/weapons/w_rifle_b.mdl" "/w_models/weapons/w_sniper_military.mdl", "/w_models/weapons/w_shotgun_spas.mdl", "/w_models/weapons/w_eq_medkit.mdl", "/w_models/weapons/w_eq_molotov.mdl", "/w_models/weapons/w_eq_pipebomb.mdl", "/w_models/weapons/w_eq_painpills.mdl", "/props_junk/gascan001a.mdl", "/props_junk/propanecanister001.mdl", "/props_equipment/oxygentank01.mdl", "", // "/weapons/w_knife_t.mdl", // "/weapons/melee/w_bat.mdl", // "/weapons/melee/w_chainsaw.mdl // "/weapons/melee/w_cricket_bat.mdl", // "/weapons/melee/w_crowbar.mdl", // "/weapons/melee/w_didgeridoo.mdl", // "/weapons/melee/w_electric_guitar.mdl", // "/weapons/melee/w_fireaxe.mdl", // "/weapons/melee/w_frying_pan.mdl", // "/weapons/melee/w_golfclub.mdl", // "/weapons/melee/w_katana.mdl", // "/weapons/melee/w_machete.mdl", // "/weapons/melee/w_riotshield.mdl", // "/weapons/melee/w_tonfa.mdl" "/weapons/melee/w_chainsaw.mdl", "/w_models/weapons/w_grenade_launcher.mdl", "", "/w_models/weapons/w_eq_adrenaline.mdl", "/w_models/weapons/w_eq_defibrillator.mdl", "/w_models/weapons/w_eq_bile_flask.mdl", "/w_models/weapons/w_rifle_ak47.mdl", "/props_junk/gnome.mdl", "/w_models/weapons/w_cola.mdl", "/props_junk/explosive_box001.mdl", "/w_models/weapons/w_eq_incendiary_ammopack.mdl", "/w_models/weapons/w_eq_explosive_ammopack.mdl", "/w_models/weapons/w_desert_eagle.mdl", "/w_models/weapons/w_smg_mp5.mdl", "/w_models/weapons/w_rifle_sg552.mdl", "/w_models/weapons/w_sniper_awp.mdl", "/w_models/weapons/w_sniper_scout.mdl", "/w_models/weapons/w_m60.mdl", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; StringMap g_hWeaponNameTrie; /** * Returns whether weapon id is valid. * * @param weaponId Weapon id to check for validity. * @return True if weapon id is valid, false otherwise. */ // L4D2 only. stock bool L4D2_IsValidWeaponId(L4D2WeaponId weaponId) { return weaponId >= L4D2WeaponId_None && weaponId < L4D2WeaponId_MAX; } /** * Returns whether weapon name is a valid weapon. * * @param weaponName Weapon name to check for validity. * @return True if weapon name is valid, false otherwise. */ // L4D2 only. stock bool L4D2_IsValidWeaponName(const char[] weaponName) { return L4D2_GetWeaponIdByWeaponName(weaponName) != L4D2WeaponId_None; } /** * Checks to see if a given weapon id has a known WeaponModel in this file's model array. * * Note: The melee weapon have multiple valid models. This function will * return false for melee weapon. * * @param weaponId Weapon id to check for a known weapon model for. * @return True if a valid weapon model exists for weapon id, false otherwise. */ // L4D2 only. stock bool L4D2_HasValidWeaponWorldModel(L4D2WeaponId weaponId) { return L4D2WeaponWorldModel[weaponId][0] != '\0'; } /** * Returns weapon world model by weapon id. * * @note Does not work with melee weapons. * * @param weaponId Weapon id. * @param dest Destination string buffer to copy to. * @param destlen Destination buffer length (includes null terminator). * @return Number of cells written. */ // L4D2 only. stock int L4D2_GetWeaponModelByWeaponId(L4D2WeaponId weaponId, char[] dest, int destlen) { if (!L4D2_IsValidWeaponId(weaponId)) { return 0; } return strcopy(dest, destlen, L4D2WeaponWorldModel[weaponId]); } /** * Returns weapon id by weapon world model. * * @note Does not work with melee weapons. * * @param model Weapon world model. * @return Weapon Id. */ // L4D2 only. stock L4D2WeaponId L4D2_GetWeaponIdByWeaponModel(const char[] model) { for (int i = 0; i < sizeof(L4D2WeaponWorldModel); i++) { if (strcmp(model, L4D2WeaponWorldModel[i], false) == 0) { return view_as<L4D2WeaponId>(i); } } return L4D2WeaponId_None; } /** * Returns weapon id by weapon name. * * @param weaponName Weapon name to get id from. * @return The corresponding weapon id if found, else L4D2WeaponId_None. */ // L4D2 only. stock L4D2WeaponId L4D2_GetWeaponIdByWeaponName(const char[] weaponName) { L4D2_InitWeaponNameTrie(); L4D2WeaponId weaponId; return g_hWeaponNameTrie.GetValue(weaponName, weaponId) ? weaponId : L4D2WeaponId_None; } /** * Returns weapon name by weapon id. * * @param weaponName Weapon id to get name from. * @param dest Destination string buffer to copy to. * @param destlen Destination buffer length (includes null terminator). * @return Number of cells written. */ // L4D2 only. stock int L4D2_GetWeaponNameByWeaponId(L4D2WeaponId weaponId, char[] dest, int destlen) { if (!L4D2_IsValidWeaponId(weaponId)) { return 0; } return strcopy(dest, destlen, L4D2WeaponName[weaponId]); } /** * Returns weapon id of entity. * * @param weapon Entity index of weapon. * @return Weapon id if found, L4D2WeaponId_None otherwise. * @error Invalid entity index. */ // L4D2 only. stock L4D2WeaponId L4D2_GetWeaponId(int weapon) { char classname[64]; if (!GetEdictClassname(weapon, classname, sizeof(classname))) { return L4D2WeaponId_None; } if (strcmp(classname, "weapon_spawn") == 0) { return view_as<L4D2WeaponId>(GetEntProp(weapon, Prop_Send, "m_weaponID")); } int len = strlen(classname); if (len - 6 > 0 && strcmp(classname[len - 6], "_spawn") == 0) { classname[len - 6] = '\0'; } return L4D2_GetWeaponIdByWeaponName(classname); } /** * Initialize the L4D2 weapon names trie. Not necessary to be executed, done by the functions that require the trie. * * @noreturn */ // L4D2 only. stock void L4D2_InitWeaponNameTrie() { if (g_hWeaponNameTrie != null) { return; } g_hWeaponNameTrie = new StringMap(); for (int i = 0; i < view_as<int>(L4D2WeaponId_MAX); i++) { g_hWeaponNameTrie.SetValue(L4D2WeaponName[i], i); } }
1
0.942223
1
0.942223
game-dev
MEDIA
0.965609
game-dev
0.706352
1
0.706352
exteraSquad/exteraGram
1,336
TMessagesProj/jni/voip/webrtc/net/dcsctp/packet/chunk_validators.h
/* * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef NET_DCSCTP_PACKET_CHUNK_VALIDATORS_H_ #define NET_DCSCTP_PACKET_CHUNK_VALIDATORS_H_ #include "net/dcsctp/packet/chunk/sack_chunk.h" namespace dcsctp { // Validates and cleans SCTP chunks. class ChunkValidators { public: // Given a SackChunk, will return `true` if it's valid, and `false` if not. static bool Validate(const SackChunk& sack); // Given a SackChunk, it will return a cleaned and validated variant of it. // RFC4960 doesn't say anything about validity of SACKs or if the Gap ACK // blocks must be sorted, and non-overlapping. While they always are in // well-behaving implementations, this can't be relied on. // // This method internally calls `Validate`, which means that you can always // pass a SackChunk to this method (valid or not), and use the results. static SackChunk Clean(SackChunk&& sack); }; } // namespace dcsctp #endif // NET_DCSCTP_PACKET_CHUNK_VALIDATORS_H_
1
0.805388
1
0.805388
game-dev
MEDIA
0.239073
game-dev
0.60331
1
0.60331
itheima1/BlockChain
44,081
05_第四阶段-springcloud和区块链彩票项目/ppt/css/reveal.scss
/*! * reveal.js * http://revealjs.com * MIT licensed * * Copyright (C) 2017 Hakim El Hattab, http://hakim.se */ /********************************************* * RESET STYLES *********************************************/ html, body, .reveal div, .reveal span, .reveal applet, .reveal object, .reveal iframe, .reveal h1, .reveal h2, .reveal h3, .reveal h4, .reveal h5, .reveal h6, .reveal p, .reveal blockquote, .reveal pre, .reveal a, .reveal abbr, .reveal acronym, .reveal address, .reveal big, .reveal cite, .reveal code, .reveal del, .reveal dfn, .reveal em, .reveal img, .reveal ins, .reveal kbd, .reveal q, .reveal s, .reveal samp, .reveal small, .reveal strike, .reveal strong, .reveal sub, .reveal sup, .reveal tt, .reveal var, .reveal b, .reveal u, .reveal center, .reveal dl, .reveal dt, .reveal dd, .reveal ol, .reveal ul, .reveal li, .reveal fieldset, .reveal form, .reveal label, .reveal legend, .reveal table, .reveal caption, .reveal tbody, .reveal tfoot, .reveal thead, .reveal tr, .reveal th, .reveal td, .reveal article, .reveal aside, .reveal canvas, .reveal details, .reveal embed, .reveal figure, .reveal figcaption, .reveal footer, .reveal header, .reveal hgroup, .reveal menu, .reveal nav, .reveal output, .reveal ruby, .reveal section, .reveal summary, .reveal time, .reveal mark, .reveal audio, .reveal video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } .reveal article, .reveal aside, .reveal details, .reveal figcaption, .reveal figure, .reveal footer, .reveal header, .reveal hgroup, .reveal menu, .reveal nav, .reveal section { display: block; } /********************************************* * GLOBAL STYLES *********************************************/ html, body { width: 100%; height: 100%; overflow: hidden; } body { position: relative; line-height: 1; background-color: #fff; color: #000; } /********************************************* * VIEW FRAGMENTS *********************************************/ .reveal .slides section .fragment { opacity: 0; visibility: hidden; transition: all .2s ease; &.visible { opacity: 1; visibility: inherit; } } .reveal .slides section .fragment.grow { opacity: 1; visibility: inherit; &.visible { transform: scale( 1.3 ); } } .reveal .slides section .fragment.shrink { opacity: 1; visibility: inherit; &.visible { transform: scale( 0.7 ); } } .reveal .slides section .fragment.zoom-in { transform: scale( 0.1 ); &.visible { transform: none; } } .reveal .slides section .fragment.fade-out { opacity: 1; visibility: inherit; &.visible { opacity: 0; visibility: hidden; } } .reveal .slides section .fragment.semi-fade-out { opacity: 1; visibility: inherit; &.visible { opacity: 0.5; visibility: inherit; } } .reveal .slides section .fragment.strike { opacity: 1; visibility: inherit; &.visible { text-decoration: line-through; } } .reveal .slides section .fragment.fade-up { transform: translate(0, 20%); &.visible { transform: translate(0, 0); } } .reveal .slides section .fragment.fade-down { transform: translate(0, -20%); &.visible { transform: translate(0, 0); } } .reveal .slides section .fragment.fade-right { transform: translate(-20%, 0); &.visible { transform: translate(0, 0); } } .reveal .slides section .fragment.fade-left { transform: translate(20%, 0); &.visible { transform: translate(0, 0); } } .reveal .slides section .fragment.current-visible { opacity: 0; visibility: hidden; &.current-fragment { opacity: 1; visibility: inherit; } } .reveal .slides section .fragment.highlight-red, .reveal .slides section .fragment.highlight-current-red, .reveal .slides section .fragment.highlight-green, .reveal .slides section .fragment.highlight-current-green, .reveal .slides section .fragment.highlight-blue, .reveal .slides section .fragment.highlight-current-blue { opacity: 1; visibility: inherit; } .reveal .slides section .fragment.highlight-red.visible { color: #ff2c2d } .reveal .slides section .fragment.highlight-green.visible { color: #17ff2e; } .reveal .slides section .fragment.highlight-blue.visible { color: #1b91ff; } .reveal .slides section .fragment.highlight-current-red.current-fragment { color: #ff2c2d } .reveal .slides section .fragment.highlight-current-green.current-fragment { color: #17ff2e; } .reveal .slides section .fragment.highlight-current-blue.current-fragment { color: #1b91ff; } /********************************************* * DEFAULT ELEMENT STYLES *********************************************/ /* Fixes issue in Chrome where italic fonts did not appear when printing to PDF */ .reveal:after { content: ''; font-style: italic; } .reveal iframe { z-index: 1; } /** Prevents layering issues in certain browser/transition combinations */ .reveal a { position: relative; } .reveal .stretch { max-width: none; max-height: none; } .reveal pre.stretch code { height: 100%; max-height: 100%; box-sizing: border-box; } /********************************************* * CONTROLS *********************************************/ @keyframes bounce-right { 0%, 10%, 25%, 40%, 50% {transform: translateX(0);} 20% {transform: translateX(10px);} 30% {transform: translateX(-5px);} } @keyframes bounce-down { 0%, 10%, 25%, 40%, 50% {transform: translateY(0);} 20% {transform: translateY(10px);} 30% {transform: translateY(-5px);} } $controlArrowSize: 3.6em; $controlArrowSpacing: 1.4em; $controlArrowLength: 2.6em; $controlArrowThickness: 0.5em; $controlsArrowAngle: 45deg; $controlsArrowAngleHover: 40deg; $controlsArrowAngleActive: 36deg; @mixin controlsArrowTransform( $angle ) { &:before { transform: translateX(($controlArrowSize - $controlArrowLength)/2) translateY(($controlArrowSize - $controlArrowThickness)/2) rotate( $angle ); } &:after { transform: translateX(($controlArrowSize - $controlArrowLength)/2) translateY(($controlArrowSize - $controlArrowThickness)/2) rotate( -$angle ); } } .reveal .controls { $spacing: 12px; display: none; position: absolute; top: auto; bottom: $spacing; right: $spacing; left: auto; z-index: 1; color: #000; pointer-events: none; font-size: 10px; button { position: absolute; padding: 0; background-color: transparent; border: 0; outline: 0; cursor: pointer; color: currentColor; transform: scale(.9999); transition: color 0.2s ease, opacity 0.2s ease, transform 0.2s ease; z-index: 2; // above slides pointer-events: auto; font-size: inherit; visibility: hidden; opacity: 0; -webkit-appearance: none; -webkit-tap-highlight-color: rgba( 0, 0, 0, 0 ); } .controls-arrow:before, .controls-arrow:after { content: ''; position: absolute; top: 0; left: 0; width: $controlArrowLength; height: $controlArrowThickness; border-radius: $controlArrowThickness/2; background-color: currentColor; transition: all 0.15s ease, background-color 0.8s ease; transform-origin: floor(($controlArrowThickness/2)*10)/10 50%; will-change: transform; } .controls-arrow { position: relative; width: $controlArrowSize; height: $controlArrowSize; @include controlsArrowTransform( $controlsArrowAngle ); &:hover { @include controlsArrowTransform( $controlsArrowAngleHover ); } &:active { @include controlsArrowTransform( $controlsArrowAngleActive ); } } .navigate-left { right: $controlArrowSize + $controlArrowSpacing*2; bottom: $controlArrowSpacing + $controlArrowSize/2; transform: translateX( -10px ); } .navigate-right { right: 0; bottom: $controlArrowSpacing + $controlArrowSize/2; transform: translateX( 10px ); .controls-arrow { transform: rotate( 180deg ); } &.highlight { animation: bounce-right 2s 50 both ease-out; } } .navigate-up { right: $controlArrowSpacing + $controlArrowSize/2; bottom: $controlArrowSpacing*2 + $controlArrowSize; transform: translateY( -10px ); .controls-arrow { transform: rotate( 90deg ); } } .navigate-down { right: $controlArrowSpacing + $controlArrowSize/2; bottom: 0; transform: translateY( 10px ); .controls-arrow { transform: rotate( -90deg ); } &.highlight { animation: bounce-down 2s 50 both ease-out; } } // Back arrow style: "faded": // Deemphasize backwards navigation arrows in favor of drawing // attention to forwards navigation &[data-controls-back-arrows="faded"] .navigate-left.enabled, &[data-controls-back-arrows="faded"] .navigate-up.enabled { opacity: 0.3; &:hover { opacity: 1; } } // Back arrow style: "hidden": // Never show arrows for backwards navigation &[data-controls-back-arrows="hidden"] .navigate-left.enabled, &[data-controls-back-arrows="hidden"] .navigate-up.enabled { opacity: 0; visibility: hidden; } // Any control button that can be clicked is "enabled" .enabled { visibility: visible; opacity: 0.9; cursor: pointer; transform: none; } // Any control button that leads to showing or hiding // a fragment .enabled.fragmented { opacity: 0.5; } .enabled:hover, .enabled.fragmented:hover { opacity: 1; } } // Adjust the layout when there are no vertical slides .reveal:not(.has-vertical-slides) .controls .navigate-left { bottom: $controlArrowSpacing; right: 0.5em + $controlArrowSpacing + $controlArrowSize; } .reveal:not(.has-vertical-slides) .controls .navigate-right { bottom: $controlArrowSpacing; right: 0.5em; } // Adjust the layout when there are no horizontal slides .reveal:not(.has-horizontal-slides) .controls .navigate-up { right: $controlArrowSpacing; bottom: $controlArrowSpacing + $controlArrowSize; } .reveal:not(.has-horizontal-slides) .controls .navigate-down { right: $controlArrowSpacing; bottom: 0.5em; } // Invert arrows based on background color .reveal.has-dark-background .controls { color: #fff; } .reveal.has-light-background .controls { color: #000; } // Disable active states on touch devices .reveal.no-hover .controls .controls-arrow:hover, .reveal.no-hover .controls .controls-arrow:active { @include controlsArrowTransform( $controlsArrowAngle ); } // Edge aligned controls layout @media screen and (min-width: 500px) { $spacing: 8px; .reveal .controls[data-controls-layout="edges"] { & { top: 0; right: 0; bottom: 0; left: 0; } .navigate-left, .navigate-right, .navigate-up, .navigate-down { bottom: auto; right: auto; } .navigate-left { top: 50%; left: $spacing; margin-top: -$controlArrowSize/2; } .navigate-right { top: 50%; right: $spacing; margin-top: -$controlArrowSize/2; } .navigate-up { top: $spacing; left: 50%; margin-left: -$controlArrowSize/2; } .navigate-down { bottom: $spacing; left: 50%; margin-left: -$controlArrowSize/2; } } } /********************************************* * PROGRESS BAR *********************************************/ .reveal .progress { position: absolute; display: none; height: 3px; width: 100%; bottom: 0; left: 0; z-index: 10; background-color: rgba( 0, 0, 0, 0.2 ); color: #fff; } .reveal .progress:after { content: ''; display: block; position: absolute; height: 10px; width: 100%; top: -10px; } .reveal .progress span { display: block; height: 100%; width: 0px; background-color: currentColor; transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985); } /********************************************* * SLIDE NUMBER *********************************************/ .reveal .slide-number { position: fixed; display: block; right: 8px; bottom: 8px; z-index: 31; font-family: Helvetica, sans-serif; font-size: 12px; line-height: 1; color: #fff; background-color: rgba( 0, 0, 0, 0.4 ); padding: 5px; } .reveal .slide-number-delimiter { margin: 0 3px; } /********************************************* * SLIDES *********************************************/ .reveal { position: relative; width: 100%; height: 100%; overflow: hidden; touch-action: none; } // Mobile Safari sometimes overlays a header at the top // of the page when in landscape mode. Using fixed // positioning ensures that reveal.js reduces its height // when this header is visible. @media only screen and (orientation : landscape) { .reveal.ua-iphone { position: fixed; } } .reveal .slides { position: absolute; width: 100%; height: 100%; top: 0; right: 0; bottom: 0; left: 0; margin: auto; pointer-events: none; overflow: visible; z-index: 1; text-align: center; perspective: 600px; perspective-origin: 50% 40%; } .reveal .slides>section { -ms-perspective: 600px; } .reveal .slides>section, .reveal .slides>section>section { display: none; position: absolute; width: 100%; padding: 20px 0px; pointer-events: auto; z-index: 10; transform-style: flat; transition: transform-origin 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985), transform 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985), visibility 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985), opacity 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985); } /* Global transition speed settings */ .reveal[data-transition-speed="fast"] .slides section { transition-duration: 400ms; } .reveal[data-transition-speed="slow"] .slides section { transition-duration: 1200ms; } /* Slide-specific transition speed overrides */ .reveal .slides section[data-transition-speed="fast"] { transition-duration: 400ms; } .reveal .slides section[data-transition-speed="slow"] { transition-duration: 1200ms; } .reveal .slides>section.stack { padding-top: 0; padding-bottom: 0; } .reveal .slides>section.present, .reveal .slides>section>section.present { display: block; z-index: 11; opacity: 1; } .reveal .slides>section:empty, .reveal .slides>section>section:empty, .reveal .slides>section[data-background-interactive], .reveal .slides>section>section[data-background-interactive] { pointer-events: none; } .reveal.center, .reveal.center .slides, .reveal.center .slides section { min-height: 0 !important; } /* Don't allow interaction with invisible slides */ .reveal .slides>section.future, .reveal .slides>section>section.future, .reveal .slides>section.past, .reveal .slides>section>section.past { pointer-events: none; } .reveal.overview .slides>section, .reveal.overview .slides>section>section { pointer-events: auto; } .reveal .slides>section.past, .reveal .slides>section.future, .reveal .slides>section>section.past, .reveal .slides>section>section.future { opacity: 0; } /********************************************* * Mixins for readability of transitions *********************************************/ @mixin transition-global($style) { .reveal .slides section[data-transition=#{$style}], .reveal.#{$style} .slides section:not([data-transition]) { @content; } } @mixin transition-stack($style) { .reveal .slides section[data-transition=#{$style}].stack, .reveal.#{$style} .slides section.stack { @content; } } @mixin transition-horizontal-past($style) { .reveal .slides>section[data-transition=#{$style}].past, .reveal .slides>section[data-transition~=#{$style}-out].past, .reveal.#{$style} .slides>section:not([data-transition]).past { @content; } } @mixin transition-horizontal-future($style) { .reveal .slides>section[data-transition=#{$style}].future, .reveal .slides>section[data-transition~=#{$style}-in].future, .reveal.#{$style} .slides>section:not([data-transition]).future { @content; } } @mixin transition-vertical-past($style) { .reveal .slides>section>section[data-transition=#{$style}].past, .reveal .slides>section>section[data-transition~=#{$style}-out].past, .reveal.#{$style} .slides>section>section:not([data-transition]).past { @content; } } @mixin transition-vertical-future($style) { .reveal .slides>section>section[data-transition=#{$style}].future, .reveal .slides>section>section[data-transition~=#{$style}-in].future, .reveal.#{$style} .slides>section>section:not([data-transition]).future { @content; } } /********************************************* * SLIDE TRANSITION * Aliased 'linear' for backwards compatibility *********************************************/ @each $stylename in slide, linear { .reveal.#{$stylename} section { backface-visibility: hidden; } @include transition-horizontal-past(#{$stylename}) { transform: translate(-150%, 0); } @include transition-horizontal-future(#{$stylename}) { transform: translate(150%, 0); } @include transition-vertical-past(#{$stylename}) { transform: translate(0, -150%); } @include transition-vertical-future(#{$stylename}) { transform: translate(0, 150%); } } /********************************************* * CONVEX TRANSITION * Aliased 'default' for backwards compatibility *********************************************/ @each $stylename in default, convex { @include transition-stack(#{$stylename}) { transform-style: preserve-3d; } @include transition-horizontal-past(#{$stylename}) { transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0); } @include transition-horizontal-future(#{$stylename}) { transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0); } @include transition-vertical-past(#{$stylename}) { transform: translate3d(0, -300px, 0) rotateX(70deg) translate3d(0, -300px, 0); } @include transition-vertical-future(#{$stylename}) { transform: translate3d(0, 300px, 0) rotateX(-70deg) translate3d(0, 300px, 0); } } /********************************************* * CONCAVE TRANSITION *********************************************/ @include transition-stack(concave) { transform-style: preserve-3d; } @include transition-horizontal-past(concave) { transform: translate3d(-100%, 0, 0) rotateY(90deg) translate3d(-100%, 0, 0); } @include transition-horizontal-future(concave) { transform: translate3d(100%, 0, 0) rotateY(-90deg) translate3d(100%, 0, 0); } @include transition-vertical-past(concave) { transform: translate3d(0, -80%, 0) rotateX(-70deg) translate3d(0, -80%, 0); } @include transition-vertical-future(concave) { transform: translate3d(0, 80%, 0) rotateX(70deg) translate3d(0, 80%, 0); } /********************************************* * ZOOM TRANSITION *********************************************/ @include transition-global(zoom) { transition-timing-function: ease; } @include transition-horizontal-past(zoom) { visibility: hidden; transform: scale(16); } @include transition-horizontal-future(zoom) { visibility: hidden; transform: scale(0.2); } @include transition-vertical-past(zoom) { transform: translate(0, -150%); } @include transition-vertical-future(zoom) { transform: translate(0, 150%); } /********************************************* * CUBE TRANSITION * * WARNING: * this is deprecated and will be removed in a * future version. *********************************************/ .reveal.cube .slides { perspective: 1300px; } .reveal.cube .slides section { padding: 30px; min-height: 700px; backface-visibility: hidden; box-sizing: border-box; transform-style: preserve-3d; } .reveal.center.cube .slides section { min-height: 0; } .reveal.cube .slides section:not(.stack):before { content: ''; position: absolute; display: block; width: 100%; height: 100%; left: 0; top: 0; background: rgba(0,0,0,0.1); border-radius: 4px; transform: translateZ( -20px ); } .reveal.cube .slides section:not(.stack):after { content: ''; position: absolute; display: block; width: 90%; height: 30px; left: 5%; bottom: 0; background: none; z-index: 1; border-radius: 4px; box-shadow: 0px 95px 25px rgba(0,0,0,0.2); transform: translateZ(-90px) rotateX( 65deg ); } .reveal.cube .slides>section.stack { padding: 0; background: none; } .reveal.cube .slides>section.past { transform-origin: 100% 0%; transform: translate3d(-100%, 0, 0) rotateY(-90deg); } .reveal.cube .slides>section.future { transform-origin: 0% 0%; transform: translate3d(100%, 0, 0) rotateY(90deg); } .reveal.cube .slides>section>section.past { transform-origin: 0% 100%; transform: translate3d(0, -100%, 0) rotateX(90deg); } .reveal.cube .slides>section>section.future { transform-origin: 0% 0%; transform: translate3d(0, 100%, 0) rotateX(-90deg); } /********************************************* * PAGE TRANSITION * * WARNING: * this is deprecated and will be removed in a * future version. *********************************************/ .reveal.page .slides { perspective-origin: 0% 50%; perspective: 3000px; } .reveal.page .slides section { padding: 30px; min-height: 700px; box-sizing: border-box; transform-style: preserve-3d; } .reveal.page .slides section.past { z-index: 12; } .reveal.page .slides section:not(.stack):before { content: ''; position: absolute; display: block; width: 100%; height: 100%; left: 0; top: 0; background: rgba(0,0,0,0.1); transform: translateZ( -20px ); } .reveal.page .slides section:not(.stack):after { content: ''; position: absolute; display: block; width: 90%; height: 30px; left: 5%; bottom: 0; background: none; z-index: 1; border-radius: 4px; box-shadow: 0px 95px 25px rgba(0,0,0,0.2); -webkit-transform: translateZ(-90px) rotateX( 65deg ); } .reveal.page .slides>section.stack { padding: 0; background: none; } .reveal.page .slides>section.past { transform-origin: 0% 0%; transform: translate3d(-40%, 0, 0) rotateY(-80deg); } .reveal.page .slides>section.future { transform-origin: 100% 0%; transform: translate3d(0, 0, 0); } .reveal.page .slides>section>section.past { transform-origin: 0% 0%; transform: translate3d(0, -40%, 0) rotateX(80deg); } .reveal.page .slides>section>section.future { transform-origin: 0% 100%; transform: translate3d(0, 0, 0); } /********************************************* * FADE TRANSITION *********************************************/ .reveal .slides section[data-transition=fade], .reveal.fade .slides section:not([data-transition]), .reveal.fade .slides>section>section:not([data-transition]) { transform: none; transition: opacity 0.5s; } .reveal.fade.overview .slides section, .reveal.fade.overview .slides>section>section { transition: none; } /********************************************* * NO TRANSITION *********************************************/ @include transition-global(none) { transform: none; transition: none; } /********************************************* * PAUSED MODE *********************************************/ .reveal .pause-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: black; visibility: hidden; opacity: 0; z-index: 100; transition: all 1s ease; } .reveal.paused .pause-overlay { visibility: visible; opacity: 1; } /********************************************* * FALLBACK *********************************************/ .no-transforms { overflow-y: auto; } .no-transforms .reveal .slides { position: relative; width: 80%; height: auto !important; top: 0; left: 50%; margin: 0; text-align: center; } .no-transforms .reveal .controls, .no-transforms .reveal .progress { display: none !important; } .no-transforms .reveal .slides section { display: block !important; opacity: 1 !important; position: relative !important; height: auto; min-height: 0; top: 0; left: -50%; margin: 70px 0; transform: none; } .no-transforms .reveal .slides section section { left: 0; } .reveal .no-transition, .reveal .no-transition * { transition: none !important; } /********************************************* * PER-SLIDE BACKGROUNDS *********************************************/ .reveal .backgrounds { position: absolute; width: 100%; height: 100%; top: 0; left: 0; perspective: 600px; } .reveal .slide-background { display: none; position: absolute; width: 100%; height: 100%; opacity: 0; visibility: hidden; overflow: hidden; background-color: rgba( 0, 0, 0, 0 ); background-position: 50% 50%; background-repeat: no-repeat; background-size: cover; transition: all 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985); } .reveal .slide-background.stack { display: block; } .reveal .slide-background.present { opacity: 1; visibility: visible; z-index: 2; } .print-pdf .reveal .slide-background { opacity: 1 !important; visibility: visible !important; } /* Video backgrounds */ .reveal .slide-background video { position: absolute; width: 100%; height: 100%; max-width: none; max-height: none; top: 0; left: 0; object-fit: cover; } .reveal .slide-background[data-background-size="contain"] video { object-fit: contain; } /* Immediate transition style */ .reveal[data-background-transition=none]>.backgrounds .slide-background, .reveal>.backgrounds .slide-background[data-background-transition=none] { transition: none; } /* Slide */ .reveal[data-background-transition=slide]>.backgrounds .slide-background, .reveal>.backgrounds .slide-background[data-background-transition=slide] { opacity: 1; backface-visibility: hidden; } .reveal[data-background-transition=slide]>.backgrounds .slide-background.past, .reveal>.backgrounds .slide-background.past[data-background-transition=slide] { transform: translate(-100%, 0); } .reveal[data-background-transition=slide]>.backgrounds .slide-background.future, .reveal>.backgrounds .slide-background.future[data-background-transition=slide] { transform: translate(100%, 0); } .reveal[data-background-transition=slide]>.backgrounds .slide-background>.slide-background.past, .reveal>.backgrounds .slide-background>.slide-background.past[data-background-transition=slide] { transform: translate(0, -100%); } .reveal[data-background-transition=slide]>.backgrounds .slide-background>.slide-background.future, .reveal>.backgrounds .slide-background>.slide-background.future[data-background-transition=slide] { transform: translate(0, 100%); } /* Convex */ .reveal[data-background-transition=convex]>.backgrounds .slide-background.past, .reveal>.backgrounds .slide-background.past[data-background-transition=convex] { opacity: 0; transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0); } .reveal[data-background-transition=convex]>.backgrounds .slide-background.future, .reveal>.backgrounds .slide-background.future[data-background-transition=convex] { opacity: 0; transform: translate3d(100%, 0, 0) rotateY(90deg) translate3d(100%, 0, 0); } .reveal[data-background-transition=convex]>.backgrounds .slide-background>.slide-background.past, .reveal>.backgrounds .slide-background>.slide-background.past[data-background-transition=convex] { opacity: 0; transform: translate3d(0, -100%, 0) rotateX(90deg) translate3d(0, -100%, 0); } .reveal[data-background-transition=convex]>.backgrounds .slide-background>.slide-background.future, .reveal>.backgrounds .slide-background>.slide-background.future[data-background-transition=convex] { opacity: 0; transform: translate3d(0, 100%, 0) rotateX(-90deg) translate3d(0, 100%, 0); } /* Concave */ .reveal[data-background-transition=concave]>.backgrounds .slide-background.past, .reveal>.backgrounds .slide-background.past[data-background-transition=concave] { opacity: 0; transform: translate3d(-100%, 0, 0) rotateY(90deg) translate3d(-100%, 0, 0); } .reveal[data-background-transition=concave]>.backgrounds .slide-background.future, .reveal>.backgrounds .slide-background.future[data-background-transition=concave] { opacity: 0; transform: translate3d(100%, 0, 0) rotateY(-90deg) translate3d(100%, 0, 0); } .reveal[data-background-transition=concave]>.backgrounds .slide-background>.slide-background.past, .reveal>.backgrounds .slide-background>.slide-background.past[data-background-transition=concave] { opacity: 0; transform: translate3d(0, -100%, 0) rotateX(-90deg) translate3d(0, -100%, 0); } .reveal[data-background-transition=concave]>.backgrounds .slide-background>.slide-background.future, .reveal>.backgrounds .slide-background>.slide-background.future[data-background-transition=concave] { opacity: 0; transform: translate3d(0, 100%, 0) rotateX(90deg) translate3d(0, 100%, 0); } /* Zoom */ .reveal[data-background-transition=zoom]>.backgrounds .slide-background, .reveal>.backgrounds .slide-background[data-background-transition=zoom] { transition-timing-function: ease; } .reveal[data-background-transition=zoom]>.backgrounds .slide-background.past, .reveal>.backgrounds .slide-background.past[data-background-transition=zoom] { opacity: 0; visibility: hidden; transform: scale(16); } .reveal[data-background-transition=zoom]>.backgrounds .slide-background.future, .reveal>.backgrounds .slide-background.future[data-background-transition=zoom] { opacity: 0; visibility: hidden; transform: scale(0.2); } .reveal[data-background-transition=zoom]>.backgrounds .slide-background>.slide-background.past, .reveal>.backgrounds .slide-background>.slide-background.past[data-background-transition=zoom] { opacity: 0; visibility: hidden; transform: scale(16); } .reveal[data-background-transition=zoom]>.backgrounds .slide-background>.slide-background.future, .reveal>.backgrounds .slide-background>.slide-background.future[data-background-transition=zoom] { opacity: 0; visibility: hidden; transform: scale(0.2); } /* Global transition speed settings */ .reveal[data-transition-speed="fast"]>.backgrounds .slide-background { transition-duration: 400ms; } .reveal[data-transition-speed="slow"]>.backgrounds .slide-background { transition-duration: 1200ms; } /********************************************* * OVERVIEW *********************************************/ .reveal.overview { perspective-origin: 50% 50%; perspective: 700px; .slides { // Fixes overview rendering errors in FF48+, not applied to // other browsers since it degrades performance -moz-transform-style: preserve-3d; } .slides section { height: 100%; top: 0 !important; opacity: 1 !important; overflow: hidden; visibility: visible !important; cursor: pointer; box-sizing: border-box; } .slides section:hover, .slides section.present { outline: 10px solid rgba(150,150,150,0.4); outline-offset: 10px; } .slides section .fragment { opacity: 1; transition: none; } .slides section:after, .slides section:before { display: none !important; } .slides>section.stack { padding: 0; top: 0 !important; background: none; outline: none; overflow: visible; } .backgrounds { perspective: inherit; // Fixes overview rendering errors in FF48+, not applied to // other browsers since it degrades performance -moz-transform-style: preserve-3d; } .backgrounds .slide-background { opacity: 1; visibility: visible; // This can't be applied to the slide itself in Safari outline: 10px solid rgba(150,150,150,0.1); outline-offset: 10px; } .backgrounds .slide-background.stack { overflow: visible; } } // Disable transitions transitions while we're activating // or deactivating the overview mode. .reveal.overview .slides section, .reveal.overview-deactivating .slides section { transition: none; } .reveal.overview .backgrounds .slide-background, .reveal.overview-deactivating .backgrounds .slide-background { transition: none; } /********************************************* * RTL SUPPORT *********************************************/ .reveal.rtl .slides, .reveal.rtl .slides h1, .reveal.rtl .slides h2, .reveal.rtl .slides h3, .reveal.rtl .slides h4, .reveal.rtl .slides h5, .reveal.rtl .slides h6 { direction: rtl; font-family: sans-serif; } .reveal.rtl pre, .reveal.rtl code { direction: ltr; } .reveal.rtl ol, .reveal.rtl ul { text-align: right; } .reveal.rtl .progress span { float: right } /********************************************* * PARALLAX BACKGROUND *********************************************/ .reveal.has-parallax-background .backgrounds { transition: all 0.8s ease; } /* Global transition speed settings */ .reveal.has-parallax-background[data-transition-speed="fast"] .backgrounds { transition-duration: 400ms; } .reveal.has-parallax-background[data-transition-speed="slow"] .backgrounds { transition-duration: 1200ms; } /********************************************* * LINK PREVIEW OVERLAY *********************************************/ .reveal .overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; background: rgba( 0, 0, 0, 0.9 ); opacity: 0; visibility: hidden; transition: all 0.3s ease; } .reveal .overlay.visible { opacity: 1; visibility: visible; } .reveal .overlay .spinner { position: absolute; display: block; top: 50%; left: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px; z-index: 10; background-image: url(data:image/gif;base64,R0lGODlhIAAgAPMAAJmZmf%2F%2F%2F6%2Bvr8nJybW1tcDAwOjo6Nvb26ioqKOjo7Ozs%2FLy8vz8%2FAAAAAAAAAAAACH%2FC05FVFNDQVBFMi4wAwEAAAAh%2FhpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh%2BQQJCgAAACwAAAAAIAAgAAAE5xDISWlhperN52JLhSSdRgwVo1ICQZRUsiwHpTJT4iowNS8vyW2icCF6k8HMMBkCEDskxTBDAZwuAkkqIfxIQyhBQBFvAQSDITM5VDW6XNE4KagNh6Bgwe60smQUB3d4Rz1ZBApnFASDd0hihh12BkE9kjAJVlycXIg7CQIFA6SlnJ87paqbSKiKoqusnbMdmDC2tXQlkUhziYtyWTxIfy6BE8WJt5YJvpJivxNaGmLHT0VnOgSYf0dZXS7APdpB309RnHOG5gDqXGLDaC457D1zZ%2FV%2FnmOM82XiHRLYKhKP1oZmADdEAAAh%2BQQJCgAAACwAAAAAIAAgAAAE6hDISWlZpOrNp1lGNRSdRpDUolIGw5RUYhhHukqFu8DsrEyqnWThGvAmhVlteBvojpTDDBUEIFwMFBRAmBkSgOrBFZogCASwBDEY%2FCZSg7GSE0gSCjQBMVG023xWBhklAnoEdhQEfyNqMIcKjhRsjEdnezB%2BA4k8gTwJhFuiW4dokXiloUepBAp5qaKpp6%2BHo7aWW54wl7obvEe0kRuoplCGepwSx2jJvqHEmGt6whJpGpfJCHmOoNHKaHx61WiSR92E4lbFoq%2BB6QDtuetcaBPnW6%2BO7wDHpIiK9SaVK5GgV543tzjgGcghAgAh%2BQQJCgAAACwAAAAAIAAgAAAE7hDISSkxpOrN5zFHNWRdhSiVoVLHspRUMoyUakyEe8PTPCATW9A14E0UvuAKMNAZKYUZCiBMuBakSQKG8G2FzUWox2AUtAQFcBKlVQoLgQReZhQlCIJesQXI5B0CBnUMOxMCenoCfTCEWBsJColTMANldx15BGs8B5wlCZ9Po6OJkwmRpnqkqnuSrayqfKmqpLajoiW5HJq7FL1Gr2mMMcKUMIiJgIemy7xZtJsTmsM4xHiKv5KMCXqfyUCJEonXPN2rAOIAmsfB3uPoAK%2B%2BG%2Bw48edZPK%2BM6hLJpQg484enXIdQFSS1u6UhksENEQAAIfkECQoAAAAsAAAAACAAIAAABOcQyEmpGKLqzWcZRVUQnZYg1aBSh2GUVEIQ2aQOE%2BG%2BcD4ntpWkZQj1JIiZIogDFFyHI0UxQwFugMSOFIPJftfVAEoZLBbcLEFhlQiqGp1Vd140AUklUN3eCA51C1EWMzMCezCBBmkxVIVHBWd3HHl9JQOIJSdSnJ0TDKChCwUJjoWMPaGqDKannasMo6WnM562R5YluZRwur0wpgqZE7NKUm%2BFNRPIhjBJxKZteWuIBMN4zRMIVIhffcgojwCF117i4nlLnY5ztRLsnOk%2BaV%2BoJY7V7m76PdkS4trKcdg0Zc0tTcKkRAAAIfkECQoAAAAsAAAAACAAIAAABO4QyEkpKqjqzScpRaVkXZWQEximw1BSCUEIlDohrft6cpKCk5xid5MNJTaAIkekKGQkWyKHkvhKsR7ARmitkAYDYRIbUQRQjWBwJRzChi9CRlBcY1UN4g0%2FVNB0AlcvcAYHRyZPdEQFYV8ccwR5HWxEJ02YmRMLnJ1xCYp0Y5idpQuhopmmC2KgojKasUQDk5BNAwwMOh2RtRq5uQuPZKGIJQIGwAwGf6I0JXMpC8C7kXWDBINFMxS4DKMAWVWAGYsAdNqW5uaRxkSKJOZKaU3tPOBZ4DuK2LATgJhkPJMgTwKCdFjyPHEnKxFCDhEAACH5BAkKAAAALAAAAAAgACAAAATzEMhJaVKp6s2nIkolIJ2WkBShpkVRWqqQrhLSEu9MZJKK9y1ZrqYK9WiClmvoUaF8gIQSNeF1Er4MNFn4SRSDARWroAIETg1iVwuHjYB1kYc1mwruwXKC9gmsJXliGxc%2BXiUCby9ydh1sOSdMkpMTBpaXBzsfhoc5l58Gm5yToAaZhaOUqjkDgCWNHAULCwOLaTmzswadEqggQwgHuQsHIoZCHQMMQgQGubVEcxOPFAcMDAYUA85eWARmfSRQCdcMe0zeP1AAygwLlJtPNAAL19DARdPzBOWSm1brJBi45soRAWQAAkrQIykShQ9wVhHCwCQCACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq%2BE71SRQeyqUToLA7VxF0JDyIQh%2FMVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiRMDjI0Fd30%2FiI2UA5GSS5UDj2l6NoqgOgN4gksEBgYFf0FDqKgHnyZ9OX8HrgYHdHpcHQULXAS2qKpENRg7eAMLC7kTBaixUYFkKAzWAAnLC7FLVxLWDBLKCwaKTULgEwbLA4hJtOkSBNqITT3xEgfLpBtzE%2FjiuL04RGEBgwWhShRgQExHBAAh%2BQQJCgAAACwAAAAAIAAgAAAE7xDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfZiCqGk5dTESJeaOAlClzsJsqwiJwiqnFrb2nS9kmIcgEsjQydLiIlHehhpejaIjzh9eomSjZR%2BipslWIRLAgMDOR2DOqKogTB9pCUJBagDBXR6XB0EBkIIsaRsGGMMAxoDBgYHTKJiUYEGDAzHC9EACcUGkIgFzgwZ0QsSBcXHiQvOwgDdEwfFs0sDzt4S6BK4xYjkDOzn0unFeBzOBijIm1Dgmg5YFQwsCMjp1oJ8LyIAACH5BAkKAAAALAAAAAAgACAAAATwEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq%2BE71SRQeyqUToLA7VxF0JDyIQh%2FMVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GGl6NoiPOH16iZKNlH6KmyWFOggHhEEvAwwMA0N9GBsEC6amhnVcEwavDAazGwIDaH1ipaYLBUTCGgQDA8NdHz0FpqgTBwsLqAbWAAnIA4FWKdMLGdYGEgraigbT0OITBcg5QwPT4xLrROZL6AuQAPUS7bxLpoWidY0JtxLHKhwwMJBTHgPKdEQAACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq%2BE71SRQeyqUToLA7VxF0JDyIQh%2FMVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GAULDJCRiXo1CpGXDJOUjY%2BYip9DhToJA4RBLwMLCwVDfRgbBAaqqoZ1XBMHswsHtxtFaH1iqaoGNgAIxRpbFAgfPQSqpbgGBqUD1wBXeCYp1AYZ19JJOYgH1KwA4UBvQwXUBxPqVD9L3sbp2BNk2xvvFPJd%2BMFCN6HAAIKgNggY0KtEBAAh%2BQQJCgAAACwAAAAAIAAgAAAE6BDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfYIDMaAFdTESJeaEDAIMxYFqrOUaNW4E4ObYcCXaiBVEgULe0NJaxxtYksjh2NLkZISgDgJhHthkpU4mW6blRiYmZOlh4JWkDqILwUGBnE6TYEbCgevr0N1gH4At7gHiRpFaLNrrq8HNgAJA70AWxQIH1%2BvsYMDAzZQPC9VCNkDWUhGkuE5PxJNwiUK4UfLzOlD4WvzAHaoG9nxPi5d%2BjYUqfAhhykOFwJWiAAAIfkECQoAAAAsAAAAACAAIAAABPAQyElpUqnqzaciSoVkXVUMFaFSwlpOCcMYlErAavhOMnNLNo8KsZsMZItJEIDIFSkLGQoQTNhIsFehRww2CQLKF0tYGKYSg%2BygsZIuNqJksKgbfgIGepNo2cIUB3V1B3IvNiBYNQaDSTtfhhx0CwVPI0UJe0%2Bbm4g5VgcGoqOcnjmjqDSdnhgEoamcsZuXO1aWQy8KAwOAuTYYGwi7w5h%2BKr0SJ8MFihpNbx%2B4Erq7BYBuzsdiH1jCAzoSfl0rVirNbRXlBBlLX%2BBP0XJLAPGzTkAuAOqb0WT5AH7OcdCm5B8TgRwSRKIHQtaLCwg1RAAAOwAAAAAAAAAAAA%3D%3D); visibility: visible; opacity: 0.6; transition: all 0.3s ease; } .reveal .overlay header { position: absolute; left: 0; top: 0; width: 100%; height: 40px; z-index: 2; border-bottom: 1px solid #222; } .reveal .overlay header a { display: inline-block; width: 40px; height: 40px; line-height: 36px; padding: 0 10px; float: right; opacity: 0.6; box-sizing: border-box; } .reveal .overlay header a:hover { opacity: 1; } .reveal .overlay header a .icon { display: inline-block; width: 20px; height: 20px; background-position: 50% 50%; background-size: 100%; background-repeat: no-repeat; } .reveal .overlay header a.close .icon { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABkklEQVRYR8WX4VHDMAxG6wnoJrABZQPYBCaBTWAD2g1gE5gg6OOsXuxIlr40d81dfrSJ9V4c2VLK7spHuTJ/5wpM07QXuXc5X0opX2tEJcadjHuV80li/FgxTIEK/5QBCICBD6xEhSMGHgQPgBgLiYVAB1dpSqKDawxTohFw4JSEA3clzgIBPCURwE2JucBR7rhPJJv5OpJwDX+SfDjgx1wACQeJG1aChP9K/IMmdZ8DtESV1WyP3Bt4MwM6sj4NMxMYiqUWHQu4KYA/SYkIjOsm3BXYWMKFDwU2khjCQ4ELJUJ4SmClRArOCmSXGuKma0fYD5CbzHxFpCSGAhfAVSSUGDUk2BWZaff2g6GE15BsBQ9nwmpIGDiyHQddwNTMKkbZaf9fajXQca1EX44puJZUsnY0ObGmITE3GVLCbEhQUjGVt146j6oasWN+49Vph2w1pZ5EansNZqKBm1txbU57iRRcZ86RWMDdWtBJUHBHwoQPi1GV+JCbntmvok7iTX4/Up9mgyTc/FJYDTcndgH/AA5A/CHsyEkVAAAAAElFTkSuQmCC); } .reveal .overlay header a.external .icon { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAcElEQVRYR+2WSQoAIQwEzf8f7XiOMkUQxUPlGkM3hVmiQfQR9GYnH1SsAQlI4DiBqkCMoNb9y2e90IAEJPAcgdznU9+engMaeJ7Azh5Y1U67gAho4DqBqmB1buAf0MB1AlVBek83ZPkmJMGc1wAR+AAqod/B97TRpQAAAABJRU5ErkJggg==); } .reveal .overlay .viewport { position: absolute; display: flex; top: 40px; right: 0; bottom: 0; left: 0; } .reveal .overlay.overlay-preview .viewport iframe { width: 100%; height: 100%; max-width: 100%; max-height: 100%; border: 0; opacity: 0; visibility: hidden; transition: all 0.3s ease; } .reveal .overlay.overlay-preview.loaded .viewport iframe { opacity: 1; visibility: visible; } .reveal .overlay.overlay-preview.loaded .viewport-inner { position: absolute; z-index: -1; left: 0; top: 45%; width: 100%; text-align: center; letter-spacing: normal; } .reveal .overlay.overlay-preview .x-frame-error { opacity: 0; transition: opacity 0.3s ease 0.3s; } .reveal .overlay.overlay-preview.loaded .x-frame-error { opacity: 1; } .reveal .overlay.overlay-preview.loaded .spinner { opacity: 0; visibility: hidden; transform: scale(0.2); } .reveal .overlay.overlay-help .viewport { overflow: auto; color: #fff; } .reveal .overlay.overlay-help .viewport .viewport-inner { width: 600px; margin: auto; padding: 20px 20px 80px 20px; text-align: center; letter-spacing: normal; } .reveal .overlay.overlay-help .viewport .viewport-inner .title { font-size: 20px; } .reveal .overlay.overlay-help .viewport .viewport-inner table { border: 1px solid #fff; border-collapse: collapse; font-size: 16px; } .reveal .overlay.overlay-help .viewport .viewport-inner table th, .reveal .overlay.overlay-help .viewport .viewport-inner table td { width: 200px; padding: 14px; border: 1px solid #fff; vertical-align: middle; } .reveal .overlay.overlay-help .viewport .viewport-inner table th { padding-top: 20px; padding-bottom: 20px; } /********************************************* * PLAYBACK COMPONENT *********************************************/ .reveal .playback { position: absolute; left: 15px; bottom: 20px; z-index: 30; cursor: pointer; transition: all 400ms ease; -webkit-tap-highlight-color: rgba( 0, 0, 0, 0 ); } .reveal.overview .playback { opacity: 0; visibility: hidden; } /********************************************* * ROLLING LINKS *********************************************/ .reveal .roll { display: inline-block; line-height: 1.2; overflow: hidden; vertical-align: top; perspective: 400px; perspective-origin: 50% 50%; } .reveal .roll:hover { background: none; text-shadow: none; } .reveal .roll span { display: block; position: relative; padding: 0 2px; pointer-events: none; transition: all 400ms ease; transform-origin: 50% 0%; transform-style: preserve-3d; backface-visibility: hidden; } .reveal .roll:hover span { background: rgba(0,0,0,0.5); transform: translate3d( 0px, 0px, -45px ) rotateX( 90deg ); } .reveal .roll span:after { content: attr(data-title); display: block; position: absolute; left: 0; top: 0; padding: 0 2px; backface-visibility: hidden; transform-origin: 50% 0%; transform: translate3d( 0px, 110%, 0px ) rotateX( -90deg ); } /********************************************* * SPEAKER NOTES *********************************************/ // Hide on-page notes .reveal aside.notes { display: none; } // An interface element that can optionally be used to show the // speaker notes to all viewers, on top of the presentation .reveal .speaker-notes { display: none; position: absolute; width: 25vw; height: 100%; top: 0; left: 100%; padding: 14px 18px 14px 18px; z-index: 1; font-size: 18px; line-height: 1.4; border: 1px solid rgba( 0, 0, 0, 0.05 ); color: #222; background-color: #f5f5f5; overflow: auto; box-sizing: border-box; text-align: left; font-family: Helvetica, sans-serif; -webkit-overflow-scrolling: touch; .notes-placeholder { color: #ccc; font-style: italic; } &:focus { outline: none; } &:before { content: 'Speaker notes'; display: block; margin-bottom: 10px; opacity: 0.5; } } .reveal.show-notes { max-width: 75vw; overflow: visible; } .reveal.show-notes .speaker-notes { display: block; } @media screen and (min-width: 1600px) { .reveal .speaker-notes { font-size: 20px; } } @media screen and (max-width: 1024px) { .reveal.show-notes { border-left: 0; max-width: none; max-height: 70%; overflow: visible; } .reveal.show-notes .speaker-notes { top: 100%; left: 0; width: 100%; height: (30/0.7)*1%; } } @media screen and (max-width: 600px) { .reveal.show-notes { max-height: 60%; } .reveal.show-notes .speaker-notes { top: 100%; height: (40/0.6)*1%; } .reveal .speaker-notes { font-size: 14px; } } /********************************************* * ZOOM PLUGIN *********************************************/ .zoomed .reveal *, .zoomed .reveal *:before, .zoomed .reveal *:after { backface-visibility: visible !important; } .zoomed .reveal .progress, .zoomed .reveal .controls { opacity: 0; } .zoomed .reveal .roll span { background: none; } .zoomed .reveal .roll span:after { visibility: hidden; }
1
0.723032
1
0.723032
game-dev
MEDIA
0.535055
game-dev
0.524438
1
0.524438
Aussiemon/Darktide-Source-Code
7,953
dialogues/generated/mission_vo_dm_forge_ogryn_c.lua
-- chunkname: @dialogues/generated/mission_vo_dm_forge_ogryn_c.lua local mission_vo_dm_forge_ogryn_c = { event_demolition_first_corruptor_destroyed_a_enginseer = { randomize_indexes_n = 0, sound_events_n = 4, sound_events = { "loc_ogryn_c__event_demolition_first_corruptor_destroyed_a_01", "loc_ogryn_c__event_demolition_first_corruptor_destroyed_a_02", "loc_ogryn_c__event_demolition_first_corruptor_destroyed_a_03", "loc_ogryn_c__event_demolition_first_corruptor_destroyed_a_04", }, sound_events_duration = { 3.975531, 2.595833, 1.766031, 2.07475, }, sound_event_weights = { 0.25, 0.25, 0.25, 0.25, }, randomize_indexes = {}, }, mission_forge_alive = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_alive_01", [2] = "loc_ogryn_c__mission_forge_alive_02", }, sound_events_duration = { [1] = 6.117625, [2] = 3.474833, }, randomize_indexes = {}, }, mission_forge_elevator_conversation_one_a = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_elevator_conversation_one_a_01", [2] = "loc_ogryn_c__mission_forge_elevator_conversation_one_a_02", }, sound_events_duration = { [1] = 2.010438, [2] = 2.339708, }, randomize_indexes = {}, }, mission_forge_elevator_conversation_one_c = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_elevator_conversation_one_c_01", [2] = "loc_ogryn_c__mission_forge_elevator_conversation_one_c_02", }, sound_events_duration = { [1] = 6.838646, [2] = 5.720385, }, randomize_indexes = {}, }, mission_forge_elevator_conversation_three_a = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_elevator_conversation_three_a_01", [2] = "loc_ogryn_c__mission_forge_elevator_conversation_three_a_02", }, sound_events_duration = { [1] = 5.649177, [2] = 5.020885, }, randomize_indexes = {}, }, mission_forge_elevator_conversation_three_c = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_elevator_conversation_three_c_01", [2] = "loc_ogryn_c__mission_forge_elevator_conversation_three_c_02", }, sound_events_duration = { [1] = 6.454844, [2] = 2.646333, }, randomize_indexes = {}, }, mission_forge_elevator_conversation_two_a = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_elevator_conversation_two_a_01", [2] = "loc_ogryn_c__mission_forge_elevator_conversation_two_a_02", }, sound_events_duration = { [1] = 4.213469, [2] = 4.746448, }, randomize_indexes = {}, }, mission_forge_elevator_conversation_two_c = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_elevator_conversation_two_c_01", [2] = "loc_ogryn_c__mission_forge_elevator_conversation_two_c_02", }, sound_events_duration = { [1] = 4.086021, [2] = 3.815146, }, randomize_indexes = {}, }, mission_forge_find_smelter = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_find_smelter_01", [2] = "loc_ogryn_c__mission_forge_find_smelter_02", }, sound_events_duration = { [1] = 2.923333, [2] = 2.938594, }, randomize_indexes = {}, }, mission_forge_first_objective_response = { randomize_indexes_n = 0, sound_events_n = 10, sound_events = { "loc_ogryn_c__guidance_starting_area_01", "loc_ogryn_c__guidance_starting_area_02", "loc_ogryn_c__guidance_starting_area_03", "loc_ogryn_c__guidance_starting_area_04", "loc_ogryn_c__guidance_starting_area_05", "loc_ogryn_c__guidance_starting_area_06", "loc_ogryn_c__guidance_starting_area_07", "loc_ogryn_c__guidance_starting_area_08", "loc_ogryn_c__guidance_starting_area_09", "loc_ogryn_c__guidance_starting_area_10", }, sound_events_duration = { 2.687979, 2.8775, 3.552531, 2.388438, 3.068083, 4.558521, 3.969979, 3.13975, 3.403104, 3.747969, }, sound_event_weights = { 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, }, randomize_indexes = {}, }, mission_forge_hellhole = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_hellhole_01", [2] = "loc_ogryn_c__mission_forge_hellhole_02", }, sound_events_duration = { [1] = 4.240708, [2] = 4.4395, }, randomize_indexes = {}, }, mission_forge_lifeless = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_lifeless_01", [2] = "loc_ogryn_c__mission_forge_lifeless_02", }, sound_events_duration = { [1] = 3.998885, [2] = 4.365667, }, randomize_indexes = {}, }, mission_forge_main_entrance = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_main_entrance_01", [2] = "loc_ogryn_c__mission_forge_main_entrance_02", }, sound_events_duration = { [1] = 1.491781, [2] = 3.254917, }, randomize_indexes = {}, }, mission_forge_main_entrance_response = { randomize_indexes_n = 0, sound_events_n = 3, sound_events = { "loc_ogryn_c__region_mechanicus_01", "loc_ogryn_c__region_mechanicus_02", "loc_ogryn_c__region_mechanicus_03", }, sound_events_duration = { 2.711, 3.097885, 3.112188, }, sound_event_weights = { 0.3333333, 0.3333333, 0.3333333, }, randomize_indexes = {}, }, mission_forge_propaganda = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_propaganda_01", [2] = "loc_ogryn_c__mission_forge_propaganda_02", }, sound_events_duration = { [1] = 4.708469, [2] = 5.907875, }, randomize_indexes = {}, }, mission_forge_stand_ground = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_stand_ground_01", [2] = "loc_ogryn_c__mission_forge_stand_ground_02", }, sound_events_duration = { [1] = 2.925823, [2] = 3.536375, }, randomize_indexes = {}, }, mission_forge_start_banter_a = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_start_banter_a_01", [2] = "loc_ogryn_c__mission_forge_start_banter_a_02", }, sound_events_duration = { [1] = 6.616333, [2] = 3.894656, }, randomize_indexes = {}, }, mission_forge_start_banter_c = { randomize_indexes_n = 0, sound_events_n = 3, sound_events = { "loc_ogryn_c__zone_tank_foundry_01", "loc_ogryn_c__zone_tank_foundry_02", "loc_ogryn_c__zone_tank_foundry_03", }, sound_events_duration = { 3.948375, 6.343948, 4.031031, }, sound_event_weights = { 0.3333333, 0.3333333, 0.3333333, }, randomize_indexes = {}, }, mission_forge_strategic_asset = { randomize_indexes_n = 0, sound_events_n = 2, sound_events = { [1] = "loc_ogryn_c__mission_forge_strategic_asset_01", [2] = "loc_ogryn_c__mission_forge_strategic_asset_02", }, sound_events_duration = { [1] = 4.876396, [2] = 5.453906, }, randomize_indexes = {}, }, mission_forge_tutorial_corruptor = { randomize_indexes_n = 0, sound_events_n = 5, sound_events = { "loc_ogryn_c__asset_nurgle_growth_01", "loc_ogryn_c__asset_nurgle_growth_02", "loc_ogryn_c__asset_nurgle_growth_03", "loc_ogryn_c__asset_nurgle_growth_04", "loc_ogryn_c__asset_nurgle_growth_05", }, sound_events_duration = { 4.444156, 3.377219, 2.444167, 4.585563, 2.456958, }, sound_event_weights = { 0.2, 0.2, 0.2, 0.2, 0.2, }, randomize_indexes = {}, }, } return settings("mission_vo_dm_forge_ogryn_c", mission_vo_dm_forge_ogryn_c)
1
0.72984
1
0.72984
game-dev
MEDIA
0.972666
game-dev
0.683451
1
0.683451
ParadiseSS13/Paradise
7,150
code/game/objects/items/weapons/pneumaticCannon.dm
/obj/item/pneumatic_cannon name = "pneumatic cannon" desc = "A gas-powered cannon that can fire any object loaded into it." icon = 'icons/obj/pneumaticCannon.dmi' icon_state = "pneumaticCannon" inhand_icon_state = "bulldog" lefthand_file = 'icons/mob/inhands/guns_lefthand.dmi' righthand_file = 'icons/mob/inhands/guns_righthand.dmi' armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, RAD = 0, FIRE = 60, ACID = 50) w_class = WEIGHT_CLASS_BULKY force = 8 //Very heavy attack_verb = list("bludgeoned", "smashed", "beaten") new_attack_chain = TRUE ///The max weight of items that can fit into the cannon var/max_weight_class = 20 ///The weight of items currently in the cannon var/loaded_weight_class = 0 ///The gas tank that is drawn from to fire things var/obj/item/tank/internals/tank = null ///If the cannon needs a tank at all var/requires_tank = TRUE ///How many moles of gas is drawn from a tank's pressure to fire var/gas_per_throw = 3 ///The items loaded into the cannon that will be fired out var/list/loaded_items = list() ///How powerful the cannon is - higher pressure = more gas but more powerful throws var/pressure_setting = 1 ///In case we want a really strong cannon var/max_pressure_setting = 3 /obj/item/pneumatic_cannon/Destroy() QDEL_NULL(tank) QDEL_LIST_CONTENTS(loaded_items) return ..() /obj/item/pneumatic_cannon/examine(mob/user) . = ..() if(!in_range(user, src)) . += "<span class='notice'>You'll need to get closer to see any more.</span>" else if(tank) . += "<span class='notice'>[bicon(tank)] It has [tank] mounted onto it.</span>" for(var/obj/item/I in loaded_items) . += "<span class='notice'>[bicon(I)] It has [I] loaded.</span>" /** * Arguments: * * I - item to load into the cannon * * user - the person loading the item in * * Returns: * * True if item was loaded, false if it failed */ /obj/item/pneumatic_cannon/proc/load_item(obj/item/I, mob/user) if((loaded_weight_class + I.w_class) > max_weight_class) to_chat(user, "<span class='warning'>[I] won't fit into [src]!</span>") return FALSE if(I.w_class > w_class) to_chat(user, "<span class='warning'>[I] is too large to fit into [src]!</span>") return FALSE if(!user.unequip(I) || I.flags & (ABSTRACT | NODROP | DROPDEL)) to_chat(user, "<span class='warning'>You can't put [I] into [src]!</span>") return FALSE loaded_items.Add(I) loaded_weight_class += I.w_class I.forceMove(src) return TRUE /obj/item/pneumatic_cannon/wrench_act(mob/living/user, obj/item/I) adjust_setting(user) return TRUE /obj/item/pneumatic_cannon/proc/adjust_setting(mob/living/user) if(pressure_setting == max_pressure_setting) pressure_setting = 1 else pressure_setting++ to_chat(user, "<span class='notice'>You tweak [src]'s pressure output to [pressure_setting].</span>") /obj/item/pneumatic_cannon/item_interaction(mob/living/user, obj/item/used, list/modifiers) if(istype(used, /obj/item/tank/internals) && !tank) if(istype(used, /obj/item/tank/internals/emergency_oxygen)) to_chat(user, "<span class='warning'>[used] is too small for [src].</span>") return ITEM_INTERACT_COMPLETE add_tank(used, user) return ITEM_INTERACT_COMPLETE if(used.type == type) to_chat(user, "<span class='warning'>You're fairly certain that putting a pneumatic cannon inside another pneumatic cannon would cause a spacetime disruption.</span>") return ITEM_INTERACT_COMPLETE load_item(used, user) return ..() /obj/item/pneumatic_cannon/screwdriver_act(mob/living/user, obj/item/I) remove_tank(user) return TRUE /obj/item/pneumatic_cannon/ranged_interact_with_atom(atom/target, mob/living/user, list/modifiers) fire(user, target) return ITEM_INTERACT_COMPLETE /obj/item/pneumatic_cannon/interact_with_atom(atom/target, mob/living/user, list/modifiers) if(get_turf(user) == get_turf(target)) return ..() if(user.a_intent != INTENT_HELP) // I know this seems backwards but other guns also have point blank shooting being locked to help intent return ..() fire(user, target) return ITEM_INTERACT_COMPLETE /obj/item/pneumatic_cannon/proc/fire(mob/living/carbon/human/user, atom/target) if(!istype(user) && !target) return var/has_discharged = FALSE if(!loaded_items || !loaded_weight_class) to_chat(user, "<span class='warning'>[src] has nothing loaded.</span>") return if(requires_tank) if(!tank) to_chat(user, "<span class='warning'>[src] can't fire without a source of gas.</span>") return if(!tank.air_contents.boolean_remove(gas_per_throw * pressure_setting)) to_chat(user, "<span class='warning'>[src] lets out a weak hiss and doesn't react!</span>") return if(user && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(75)) user.visible_message("<span class='warning'>[user] loses [user.p_their()] grip on [src], causing it to go off!</span>", "<span class='userdanger'>[src] slips out of your hands and goes off!</span>") user.drop_item() has_discharged = TRUE if(prob(10)) target = user else var/list/possible_targets = range(3,src) target = pick(possible_targets) if(!has_discharged) user.visible_message("<span class='danger'>[user] fires [src]!</span>", \ "<span class='danger'>You fire [src]!</span>") add_attack_logs(user, target, "Fired [src]") playsound(loc, 'sound/weapons/sonic_jackhammer.ogg', 50, TRUE) for(var/obj/item/loaded_item in loaded_items) loaded_items.Remove(loaded_item) loaded_weight_class -= loaded_item.w_class loaded_item.throw_speed = pressure_setting * 2 loaded_item.forceMove(get_turf(src)) loaded_item.throw_at(target, pressure_setting * 5, pressure_setting * 2, user) if(pressure_setting >= 3 && user) user.visible_message("<span class='warning'>[user] is thrown down by the force of the cannon!</span>", "<span class='userdanger'>[src] slams into your shoulder, knocking you down!") user.KnockDown(3 SECONDS) /obj/item/pneumatic_cannon/proc/add_tank(obj/item/tank/new_tank, mob/living/carbon/human/user) if(tank) to_chat(user, "<span class='warning'>[src] already has a tank.</span>") return if(!user.unequip(new_tank)) return to_chat(user, "<span class='notice'>You hook [new_tank] up to [src].</span>") new_tank.forceMove(src) tank = new_tank update_icons() /obj/item/pneumatic_cannon/proc/remove_tank(mob/living/carbon/human/user) if(!tank) return FALSE to_chat(user, "<span class='notice'>You detach [tank] from [src].</span>") user.put_in_hands(tank) tank = null update_icons() /obj/item/pneumatic_cannon/proc/update_icons() src.overlays.Cut() if(!tank) return src.overlays += image('icons/obj/pneumaticCannon.dmi', "[tank.icon_state]") src.update_icon() /obj/item/pneumatic_cannon/admin name = "admin pnuematic cannon" desc = "Infinite gas and infinite capacity, go crazy." requires_tank = FALSE max_weight_class = INFINITY /// Obtainable by improvised methods; more gas per use, less capacity, but smaller /obj/item/pneumatic_cannon/ghetto name = "improvised pneumatic cannon" desc = "A gas-powered, object-firing cannon made out of common parts." force = 5 w_class = WEIGHT_CLASS_NORMAL max_weight_class = 7 gas_per_throw = 5
1
0.955993
1
0.955993
game-dev
MEDIA
0.938997
game-dev
0.580265
1
0.580265
ggnkua/Atari_ST_Sources
2,493
GFA Basic/CVSD/UNPACK.C_V/UNPACK.S
**************************************************************** * * * Here come the PC1 unpacking rout, this routine was written * * for gfa owners and lovers. If you want another rout for * * gfa (Sprite, etc...) please contact me on : * * * * ATARI-FORUM.COM or on our website : * * * * CEREBRAL-VORTEX.NET * * * * This routine only unpack low res picture, coz i wanted to * * do a little and faster routine than other, yes i know doing * * 3 resolution rout will only speed down a little bit the rout * * but i think, this routine will be mainly used for demo or * * games. If you want med or high rout, you know what you do !! * * * * GT Turbo (C.V.) * * * * Fast greetings to : Tobe, Zorro2, Floopy (Mjj team) * * Orion, Napo (Yaronet crew) * * Atomus (No extra !) * * All Atari forumers i know * * All Atari Legend team * * Firecooler (Enjoy Gfa coding !) * * * * * **************************************************************** opt a+,d- Depack_pc1: * movem.l d0-d7/a0-a6,-(a7) move.w #200-1,d4 * 200 lines moveq #6,d7 * moveq #40,d6 * 40 bytes per plane All_lines: move.l a1,a2 * Destination moveq #3,d1 * 4 Bit planes Debut_line: move.l a2,a3 moveq #0,d3 moveq #1,d5 Recup_code: moveq #0,d0 move.b (a0)+,d0 bmi.s Repete_code Copy: move.b (a0)+,(a2) addq.b #1,d3 add.w d5,a2 eor.w d7,d5 dbra d0,Copy bra.s End_line Repete_code: neg.b d0 move.b (a0)+,d2 Recopy_code: move.b d2,(a2) addq.b #1,d3 add.w d5,a2 eor.w d7,d5 dbra d0,Recopy_code End_line: cmp.b d6,d3 bne.s Recup_code move.l a3,a2 addq.w #2,a2 * Next plane dbra d1,Debut_line lea 160(a1),a1 * Next line dbra d4,All_lines * movem.l (a7)+,d0-d7/a0-a6 rts
1
0.629363
1
0.629363
game-dev
MEDIA
0.918284
game-dev
0.87455
1
0.87455
Illumina/Nirvana
4,018
VariantAnnotation/NSA/NgaReader.cs
using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.Text; using Compression.Algorithms; using Compression.FileHandling; using ErrorHandling.Exceptions; using IO; using VariantAnnotation.Interface.Providers; using VariantAnnotation.Providers; using VariantAnnotation.SA; namespace VariantAnnotation.NSA { public sealed class NgaReader { public readonly IDataSourceVersion Version; public readonly string JsonKey; private readonly bool _isArray; private readonly Dictionary<string, List<string>> _geneSymbolToJsonStrings; private NgaReader(IDataSourceVersion version, string jsonKey, bool isArray, Dictionary<string, List<string>> geneSymbolToJsonStrings) { Version = version; JsonKey = jsonKey; _isArray = isArray; _geneSymbolToJsonStrings = geneSymbolToJsonStrings; } public static NgaReader Read(Stream stream) { (IDataSourceVersion version, string jsonKey, bool isArray) = ReadHeader(stream); Dictionary<string, List<string>> geneSymbolToJsonStrings; using (var blockStream = new BlockStream(new Zstandard(), stream, CompressionMode.Decompress)) using (var reader = new ExtendedBinaryReader(blockStream)) { int geneCount = reader.ReadOptInt32(); geneSymbolToJsonStrings = new Dictionary<string, List<string>>(geneCount); for (var i = 0; i < geneCount; i++) { string geneSymbol = reader.ReadAsciiString(); int numEntries = reader.ReadOptInt32(); var entries = new List<string>(numEntries); for (var j = 0; j < numEntries; j++) { entries.Add(reader.ReadString()); } geneSymbolToJsonStrings[geneSymbol] = entries; } } return new NgaReader(version, jsonKey, isArray, geneSymbolToJsonStrings); } private static (IDataSourceVersion Version, string JsonKey, bool IsArray) ReadHeader(Stream stream) { IDataSourceVersion version; string jsonKey; bool isArray; using (var reader = new ExtendedBinaryReader(stream, Encoding.UTF8, true)) { string identifier = reader.ReadString(); if (identifier != SaCommon.NgaIdentifier) { throw new InvalidDataException($"Expected the NGA identifier ({SaCommon.NgaIdentifier}), but found another value: ({identifier})"); } version = DataSourceVersion.Read(reader); jsonKey = reader.ReadString(); isArray = reader.ReadBoolean(); ushort schemaVersion = reader.ReadUInt16(); if (schemaVersion != SaCommon.SchemaVersion) { throw new UserErrorException($"Expected the schema version {SaCommon.SchemaVersion}, but found another value: ({schemaVersion}) for {jsonKey}"); } uint guard = reader.ReadUInt32(); if (guard != SaCommon.GuardInt) { throw new InvalidDataException($"Expected a guard integer ({SaCommon.GuardInt}), but found another value: ({guard})"); } } return (version, jsonKey, isArray); } public string GetAnnotation(string geneName) => _geneSymbolToJsonStrings.TryGetValue(geneName, out List<string> annotations) ? GetJsonString(annotations) : null; private string GetJsonString(List<string> annotations) { if (_isArray) return "[" + string.Join(',', annotations) + "]"; return annotations[0]; } } }
1
0.865259
1
0.865259
game-dev
MEDIA
0.223446
game-dev
0.982021
1
0.982021
lua9520/source-engine-2018-hl2_src
5,716
tier1/kvpacker.cpp
//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: Contains a branch-neutral binary packer for KeyValues trees. // // $NoKeywords: $ // //=============================================================================// #include <KeyValues.h> #include "kvpacker.h" #include "tier0/dbg.h" #include "utlbuffer.h" // memdbgon must be the last include file in a .cpp file!!! #include <tier0/memdbgon.h> #define KEYVALUES_TOKEN_SIZE 1024 // writes KeyValue as binary data to buffer bool KVPacker::WriteAsBinary( KeyValues *pNode, CUtlBuffer &buffer ) { if ( buffer.IsText() ) // must be a binary buffer return false; if ( !buffer.IsValid() ) // must be valid, no overflows etc return false; // Write subkeys: // loop through all our peers for ( KeyValues *dat = pNode; dat != NULL; dat = dat->GetNextKey() ) { // write type switch ( dat->GetDataType() ) { case KeyValues::TYPE_NONE: { buffer.PutUnsignedChar( PACKTYPE_NONE ); break; } case KeyValues::TYPE_STRING: { buffer.PutUnsignedChar( PACKTYPE_STRING ); break; } case KeyValues::TYPE_WSTRING: { buffer.PutUnsignedChar( PACKTYPE_WSTRING ); break; } case KeyValues::TYPE_INT: { buffer.PutUnsignedChar( PACKTYPE_INT ); break; } case KeyValues::TYPE_UINT64: { buffer.PutUnsignedChar( PACKTYPE_UINT64 ); break; } case KeyValues::TYPE_FLOAT: { buffer.PutUnsignedChar( PACKTYPE_FLOAT ); break; } case KeyValues::TYPE_COLOR: { buffer.PutUnsignedChar( PACKTYPE_COLOR ); break; } case KeyValues::TYPE_PTR: { buffer.PutUnsignedChar( PACKTYPE_PTR ); break; } default: break; } // write name buffer.PutString( dat->GetName() ); // write value switch ( dat->GetDataType() ) { case KeyValues::TYPE_NONE: { if( !WriteAsBinary( dat->GetFirstSubKey(), buffer ) ) return false; break; } case KeyValues::TYPE_STRING: { if (dat->GetString() && *(dat->GetString())) { buffer.PutString( dat->GetString() ); } else { buffer.PutString( "" ); } break; } case KeyValues::TYPE_WSTRING: { int nLength = dat->GetWString() ? Q_wcslen( dat->GetWString() ) : 0; buffer.PutShort( nLength ); for( int k = 0; k < nLength; ++ k ) { buffer.PutShort( ( unsigned short ) dat->GetWString()[k] ); } break; } case KeyValues::TYPE_INT: { buffer.PutInt( dat->GetInt() ); break; } case KeyValues::TYPE_UINT64: { buffer.PutInt64( dat->GetUint64() ); break; } case KeyValues::TYPE_FLOAT: { buffer.PutFloat( dat->GetFloat() ); break; } case KeyValues::TYPE_COLOR: { Color color = dat->GetColor(); buffer.PutUnsignedChar( color[0] ); buffer.PutUnsignedChar( color[1] ); buffer.PutUnsignedChar( color[2] ); buffer.PutUnsignedChar( color[3] ); break; } case KeyValues::TYPE_PTR: { buffer.PutUnsignedInt( (int)dat->GetPtr() ); break; } default: break; } } // write tail, marks end of peers buffer.PutUnsignedChar( PACKTYPE_NULLMARKER ); return buffer.IsValid(); } // read KeyValues from binary buffer, returns true if parsing was successful bool KVPacker::ReadAsBinary( KeyValues *pNode, CUtlBuffer &buffer ) { if ( buffer.IsText() ) // must be a binary buffer return false; if ( !buffer.IsValid() ) // must be valid, no overflows etc return false; pNode->Clear(); char token[KEYVALUES_TOKEN_SIZE]; KeyValues *dat = pNode; EPackType ePackType = (EPackType)buffer.GetUnsignedChar(); // loop through all our peers while ( true ) { if ( ePackType == PACKTYPE_NULLMARKER ) break; // no more peers buffer.GetString( token ); token[KEYVALUES_TOKEN_SIZE-1] = 0; dat->SetName( token ); switch ( ePackType ) { case PACKTYPE_NONE: { KeyValues *pNewNode = new KeyValues(""); dat->AddSubKey( pNewNode ); if( !ReadAsBinary( pNewNode, buffer ) ) return false; break; } case PACKTYPE_STRING: { buffer.GetString( token ); token[KEYVALUES_TOKEN_SIZE-1] = 0; dat->SetStringValue( token ); break; } case PACKTYPE_WSTRING: { int nLength = buffer.GetShort(); if ( nLength >= 0 && nLength*sizeof( uint16 ) <= (uint)buffer.GetBytesRemaining() ) { if ( nLength > 0 ) { wchar_t *pTemp = (wchar_t *)malloc( sizeof( wchar_t ) * (1 + nLength) ); for ( int k = 0; k < nLength; ++k ) { pTemp[k] = buffer.GetShort(); // ugly, but preserving existing behavior } pTemp[nLength] = 0; dat->SetWString( NULL, pTemp ); free( pTemp ); } else dat->SetWString( NULL, L"" ); } break; } case PACKTYPE_INT: { dat->SetInt( NULL, buffer.GetInt() ); break; } case PACKTYPE_UINT64: { dat->SetUint64( NULL, (uint64)buffer.GetInt64() ); break; } case PACKTYPE_FLOAT: { dat->SetFloat( NULL, buffer.GetFloat() ); break; } case PACKTYPE_COLOR: { Color color( buffer.GetUnsignedChar(), buffer.GetUnsignedChar(), buffer.GetUnsignedChar(), buffer.GetUnsignedChar() ); dat->SetColor( NULL, color ); break; } case PACKTYPE_PTR: { dat->SetPtr( NULL, (void*)buffer.GetUnsignedInt() ); break; } default: break; } if ( !buffer.IsValid() ) // error occured return false; ePackType = (EPackType)buffer.GetUnsignedChar(); if ( ePackType == PACKTYPE_NULLMARKER ) break; // new peer follows KeyValues *pNewPeer = new KeyValues(""); dat->SetNextKey( pNewPeer ); dat = pNewPeer; } return buffer.IsValid(); }
1
0.936522
1
0.936522
game-dev
MEDIA
0.137838
game-dev
0.987397
1
0.987397
snakefoot/cgridlistctrlex
5,573
CGridListCtrlEx/CGridColumnTraitMultilineEdit.cpp
//------------------------------------------------------------------------ // Author: Rolf Kristensen // Source: http://www.codeproject.com/KB/list/CGridListCtrlEx.aspx // License: Free to use for all (New BSD License) //------------------------------------------------------------------------ #include "stdafx.h" #include "CGridColumnTraitMultilineEdit.h" #include "CGridColumnTraitVisitor.h" #include "CGridListCtrlEx.h" //------------------------------------------------------------------------ //! CGridColumnTraitMultilineEdit - Constructor //------------------------------------------------------------------------ CGridColumnTraitMultilineEdit::CGridColumnTraitMultilineEdit() :m_EditMaxLines(4) { m_EditStyle |= ES_MULTILINE | ES_WANTRETURN | ES_AUTOVSCROLL; } //------------------------------------------------------------------------ //! Accept Visitor Pattern //------------------------------------------------------------------------ void CGridColumnTraitMultilineEdit::Accept(CGridColumnTraitVisitor& visitor) { visitor.Visit(*this); } //------------------------------------------------------------------------ //! Set max number of lines that can the CEdit will display at a time //! For multiline editing then add these styles ES_MULTILINE | ES_WANTRETURN | ES_AUTOVSCROLL //! //! @param nMaxLines The text limit, in lines. //------------------------------------------------------------------------ void CGridColumnTraitMultilineEdit::SetMaxLines(UINT nMaxLines) { m_EditMaxLines = nMaxLines; } //------------------------------------------------------------------------ //! Get max number of lines that can the CEdit will display at a time //! //! @return Max number of display lines for the multiline CEdit //------------------------------------------------------------------------ UINT CGridColumnTraitMultilineEdit::GetMaxLines() const { return m_EditMaxLines; } namespace { int CharacterCount(const CString& csHaystack, LPCTSTR sNeedle) { if (csHaystack.IsEmpty()) return 0; int nFind = -1; int nCount = 0; do { nCount++; nFind = csHaystack.Find(sNeedle, nFind + 1); } while (nFind != -1); return nCount - 1; } } //------------------------------------------------------------------------ //! Create a CEdit as cell value editor //! //! @param owner The list control starting a cell edit //! @param nRow The index of the row //! @param nCol The index of the column //! @param dwStyle The windows style to use when creating the CEdit //! @param rect The rectangle where the inplace cell value editor should be placed //! @return Pointer to the cell editor to use //------------------------------------------------------------------------ CEdit* CGridColumnTraitMultilineEdit::CreateEdit(CGridListCtrlEx& owner, int nRow, int nCol, DWORD dwStyle, const CRect& rect) { CGridMultilineEditorText* pEdit = new CGridMultilineEditorText(nRow, nCol); CRect limitRect(rect); if (m_EditMaxLines > 1 && GetStyle() & ES_MULTILINE) { // Calculate the number of lines in the cell text, expand the CEdit to match this CString cellText = owner.GetItemText(nRow, nCol); int nLineHeight = GetCellFontHeight(owner); int nLineCount = CharacterCount(cellText, _T("\n")); if (nLineCount > 0) { if (static_cast<UINT>(nLineCount) > m_EditMaxLines - 1) nLineCount = m_EditMaxLines - 1; limitRect.bottom += nLineHeight*nLineCount; } pEdit->SetMaxLines(m_EditMaxLines); pEdit->SetLineHeight(nLineHeight); } VERIFY(pEdit->Create(WS_CHILD | dwStyle, static_cast<RECT>(limitRect), static_cast<CWnd*>(&owner), 0)); return pEdit; } //------------------------------------------------------------------------ // CGridMultilineEditorText (For internal use) //------------------------------------------------------------------------ IMPLEMENT_DYNAMIC(CGridMultilineEditorText, CGridEditorText) BEGIN_MESSAGE_MAP(CGridMultilineEditorText, CGridEditorText) //{{AFX_MSG_MAP(CGridEditorText) ON_CONTROL_REFLECT(EN_CHANGE, OnEnChange) //}}AFX_MSG_MAP END_MESSAGE_MAP() //------------------------------------------------------------------------ //! CGridMultilineEditorText - Constructor //------------------------------------------------------------------------ CGridMultilineEditorText::CGridMultilineEditorText(int nRow, int nCol) : CGridEditorText(nRow, nCol) , m_LineHeight(0) , m_MaxLines(0) { } //------------------------------------------------------------------------ //! EN_CHANGE notification handler to monitor text modifications //------------------------------------------------------------------------ void CGridMultilineEditorText::OnEnChange() { if (m_InitialModify && (GetStyle() & ES_MULTILINE)) m_InitialModify = false;// ES_MULTILINE causes EN_CHANGE not to fire at initial SetWindowText // If multiline support, then resize the edit according to contents if ((m_MaxLines > 1) && (GetStyle() & ES_MULTILINE) && (m_LineHeight > 0)) { // Get number of text lines CString cellText; GetWindowText(cellText); int nLineCount = CharacterCount(cellText, _T("\n")); if (nLineCount > 0) { if (static_cast<UINT>(nLineCount) > m_MaxLines - 1) nLineCount = m_MaxLines - 1; } // Check if the current rect matches the number of lines CRect rect; GetWindowRect(&rect); if (rect.Height() / m_LineHeight != nLineCount + 1) { rect.bottom += (nLineCount + 1 - rect.Height() / m_LineHeight) * m_LineHeight; GetParent()->ScreenToClient(&rect); MoveWindow(rect.left, rect.top, rect.Width(), rect.Height(), TRUE); } } CGridEditorText::OnEnChange(); }
1
0.821792
1
0.821792
game-dev
MEDIA
0.475144
game-dev
0.965664
1
0.965664
KitsuneX07/Dataset_Maker_for_Galgames
168,513
[KEY]青空_AIR/seens/SEEN0400.ke
{-# cp utf8 #- Disassembled with Kprl 1.41 -} #file 'SEEN0400.TXT' #resource 'SEEN0400.utf' #kidoku_type 2 #entrypoint 000 intB[2] = 1 intF[2] = 0 intF[3] = 1 intF[4] = 1 title (#res<0000>) msgHide intF[1107] = 1 grpMulti ('DAY_000', 0, copy('DAY_801', 0)) farcall (9070, 0) intF[1107] = 1 strS[1000] = 'BG009' goto_unless (intF[1107] == 1) @1 intF[1107] = 0 msgHide @1 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @5 goto_unless (!intF[4]) @2 strS[1003] = 'SDT07' goto @3 @2 goto_unless (intF[4] == 1) @3 strS[1003] = 'SDT08' @3 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @4 objBgMove (83, 16, 16) goto @5 @4 goto_unless (intB[2] == 1) @5 objBgMove (83, 16, 66) @5 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @6 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @6 bgrMulti (strS[1000], 102) bgmLoop ('BGM16') goto_unless (intF[1107] == 1) @7 intF[1107] = 0 msgHide @7 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @11 goto_unless (!intF[4]) @8 strS[1003] = 'SDT07' goto @9 @8 goto_unless (intF[4] == 1) @9 strS[1003] = 'SDT08' @9 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @10 objBgMove (83, 16, 16) goto @11 @10 goto_unless (intB[2] == 1) @11 objBgMove (83, 16, 66) @11 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @12 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @12 bgrMulti (strS[1000], 60, copy('CGMZ24P', 61)) koePlay (2121000) #res<0001> pause koePlay (2121001) #res<0002> pause koePlay (2121002) #res<0003> pause goto_unless (intF[1107] == 1) @13 intF[1107] = 0 msgHide @13 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @17 goto_unless (!intF[4]) @14 strS[1003] = 'SDT07' goto @15 @14 goto_unless (intF[4] == 1) @15 strS[1003] = 'SDT08' @15 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @16 objBgMove (83, 16, 16) goto @17 @16 goto_unless (intB[2] == 1) @17 objBgMove (83, 16, 66) @17 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @18 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @18 bgrMulti (strS[1000], 0) koePlay (2121003) #res<0004> pause koePlay (2121004) #res<0005> pause koePlay (2121005) #res<0006> pause koePlay (2121006) #res<0007> pause koePlay (2121007) #res<0008> pause koePlay (2121008) #res<0009> pause koePlay (2121009) #res<0010> pause koePlay (2121010) #res<0011> pause koePlay (2121011) #res<0012> pause koePlay (2121012) #res<0013> pause koePlay (2121013) #res<0014> pause koePlay (2121014) #res<0015> pause #res<0016> pause #res<0017> pause koePlay (2121015) #res<0018> pause #res<0019> pause #res<0020> pause goto_unless (intF[1107] == 1) @19 intF[1107] = 0 msgHide @19 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @23 goto_unless (!intF[4]) @20 strS[1003] = 'SDT07' goto @21 @20 goto_unless (intF[4] == 1) @21 strS[1003] = 'SDT08' @21 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @22 objBgMove (83, 16, 16) goto @23 @22 goto_unless (intB[2] == 1) @23 objBgMove (83, 16, 66) @23 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @24 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @24 bgrMulti (strS[1000], 60, copy('CGMZ20P', 61)) koePlay (2121016) #res<0021> pause #res<0022> pause koePlay (2121017) #res<0023> pause goto_unless (intF[1107] == 1) @25 intF[1107] = 0 msgHide @25 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @29 goto_unless (!intF[4]) @26 strS[1003] = 'SDT07' goto @27 @26 goto_unless (intF[4] == 1) @27 strS[1003] = 'SDT08' @27 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @28 objBgMove (83, 16, 16) goto @29 @28 goto_unless (intB[2] == 1) @29 objBgMove (83, 16, 66) @29 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @30 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @30 bgrMulti (strS[1000], 60, copy('CGMZ26P', 61)) koePlay (2121018) #res<0024> pause goto_unless (intF[1107] == 1) @31 intF[1107] = 0 msgHide @31 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @35 goto_unless (!intF[4]) @32 strS[1003] = 'SDT07' goto @33 @32 goto_unless (intF[4] == 1) @33 strS[1003] = 'SDT08' @33 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @34 objBgMove (83, 16, 16) goto @35 @34 goto_unless (intB[2] == 1) @35 objBgMove (83, 16, 66) @35 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @36 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @36 bgrMulti (strS[1000], 0) #res<0025> pause #res<0026> pause #res<0027> pause msgHide intF[1107] = 1 grpOpenBg ('KURO', 48) intF[1107] = 1 strS[1000] = 'BG009' goto_unless (intF[1107] == 1) @37 intF[1107] = 0 msgHide @37 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @41 goto_unless (!intF[4]) @38 strS[1003] = 'SDT07' goto @39 @38 goto_unless (intF[4] == 1) @39 strS[1003] = 'SDT08' @39 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @40 objBgMove (83, 16, 16) goto @41 @40 goto_unless (intB[2] == 1) @41 objBgMove (83, 16, 66) @41 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @42 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @42 bgrMulti (strS[1000], 48) #res<0028> pause #res<0029> pause koePlay (2121019) #res<0030> pause #res<0031> pause koePlay (2121020) #res<0032> pause #res<0033> pause #res<0034> pause koePlay (2121021) #res<0035> pause koePlay (2121022) #res<0036> pause koePlay (2121023) #res<0037> pause koePlay (2121024) #res<0038> pause #res<0039> pause intF[1107] = 1 strS[1000] = 'BG009N2' goto_unless (intF[1107] == 1) @43 intF[1107] = 0 msgHide @43 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @47 goto_unless (!intF[4]) @44 strS[1003] = 'SDT07' goto @45 @44 goto_unless (intF[4] == 1) @45 strS[1003] = 'SDT08' @45 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @46 objBgMove (83, 16, 16) goto @47 @46 goto_unless (intB[2] == 1) @47 objBgMove (83, 16, 66) @47 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @48 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @48 bgrMulti (strS[1000], 102) wait (1000) msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) wait (1000) intF[3] = 2 intF[4] = 1 title (#res<0040>) msgHide intF[1107] = 1 grpMulti ('DAY_000', 0, copy('DAY_802', 0)) farcall (9070, 0) intF[1107] = 1 strS[1000] = 'BG009' goto_unless (intF[1107] == 1) @49 intF[1107] = 0 msgHide @49 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @53 goto_unless (!intF[4]) @50 strS[1003] = 'SDT07' goto @51 @50 goto_unless (intF[4] == 1) @51 strS[1003] = 'SDT08' @51 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @52 objBgMove (83, 16, 16) goto @53 @52 goto_unless (intB[2] == 1) @53 objBgMove (83, 16, 66) @53 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @54 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @54 bgrMulti (strS[1000], 102) koePlay (2121025) #res<0041> pause koePlay (2121026) #res<0042> pause goto_unless (intF[1107] == 1) @55 intF[1107] = 0 msgHide @55 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @59 goto_unless (!intF[4]) @56 strS[1003] = 'SDT07' goto @57 @56 goto_unless (intF[4] == 1) @57 strS[1003] = 'SDT08' @57 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @58 objBgMove (83, 16, 16) goto @59 @58 goto_unless (intB[2] == 1) @59 objBgMove (83, 16, 66) @59 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @60 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @60 bgrMulti (strS[1000], 60, copy('CGMZ25P', 61)) koePlay (2121027) #res<0043> pause #res<0044> pause goto_unless (intF[1107] == 1) @61 intF[1107] = 0 msgHide @61 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @65 goto_unless (!intF[4]) @62 strS[1003] = 'SDT07' goto @63 @62 goto_unless (intF[4] == 1) @63 strS[1003] = 'SDT08' @63 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @64 objBgMove (83, 16, 16) goto @65 @64 goto_unless (intB[2] == 1) @65 objBgMove (83, 16, 66) @65 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @66 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @66 bgrMulti (strS[1000], 60, copy('CGMZ24P', 61)) koePlay (2121028) #res<0045> pause koePlay (2121029) #res<0046> pause koePlay (2121030) #res<0047> pause koePlay (2121031) #res<0048> pause koePlay (2121032) #res<0049> pause #res<0050> pause msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) intF[1107] = 1 strS[1000] = 'BG009N2' goto_unless (intF[1107] == 1) @67 intF[1107] = 0 msgHide @67 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @71 goto_unless (!intF[4]) @68 strS[1003] = 'SDT07' goto @69 @68 goto_unless (intF[4] == 1) @69 strS[1003] = 'SDT08' @69 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @70 objBgMove (83, 16, 16) goto @71 @70 goto_unless (intB[2] == 1) @71 objBgMove (83, 16, 66) @71 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @72 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @72 bgrMulti (strS[1000], 102) koePlay (2121033) #res<0051> pause koePlay (2121034) #res<0052> pause koePlay (2121035) #res<0053> pause koePlay (2121036) #res<0054> pause koePlay (2121037) #res<0055> pause goto_unless (intF[1107] == 1) @73 intF[1107] = 0 msgHide @73 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @77 goto_unless (!intF[4]) @74 strS[1003] = 'SDT07' goto @75 @74 goto_unless (intF[4] == 1) @75 strS[1003] = 'SDT08' @75 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @76 objBgMove (83, 16, 16) goto @77 @76 goto_unless (intB[2] == 1) @77 objBgMove (83, 16, 66) @77 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @78 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @78 bgrMulti (strS[1000], 0) #res<0056> pause goto_unless (intF[1107] == 1) @79 intF[1107] = 0 msgHide @79 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @83 goto_unless (!intF[4]) @80 strS[1003] = 'SDT07' goto @81 @80 goto_unless (intF[4] == 1) @81 strS[1003] = 'SDT08' @81 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @82 objBgMove (83, 16, 16) goto @83 @82 goto_unless (intB[2] == 1) @83 objBgMove (83, 16, 66) @83 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @84 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @84 bgrMulti (strS[1000], 60, copy('CGMZ21PN', 61)) koePlay (2121038) #res<0057> pause koePlay (2121039) #res<0058> pause koePlay (2121040) #res<0059> pause koePlay (2121041) #res<0060> pause koePlay (2121042) #res<0061> pause koePlay (2121043) #res<0062> pause #res<0063> pause #res<0064> pause goto_unless (intF[1107] == 1) @85 intF[1107] = 0 msgHide @85 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @89 goto_unless (!intF[4]) @86 strS[1003] = 'SDT07' goto @87 @86 goto_unless (intF[4] == 1) @87 strS[1003] = 'SDT08' @87 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @88 objBgMove (83, 16, 16) goto @89 @88 goto_unless (intB[2] == 1) @89 objBgMove (83, 16, 66) @89 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @90 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @90 bgrMulti (strS[1000], 60, copy('CGMZ22PN', 61)) koePlay (2121044) #res<0065> pause koePlay (2121045) #res<0066> pause koePlay (2121046) #res<0067> pause koePlay (2121047) #res<0068> pause koePlay (2121048) #res<0069> pause koePlay (2121049) #res<0070> pause koePlay (2121050) #res<0071> pause koePlay (2121051) #res<0072> pause koePlay (2121052) #res<0073> pause koePlay (2121053) #res<0074> pause koePlay (2121054) #res<0075> pause koePlay (2121055) #res<0076> pause koePlay (2121056) #res<0077> pause bgmFadeOut (1200) koePlay (2121057) #res<0078> pause goto_unless (intF[1107] == 1) @91 intF[1107] = 0 msgHide @91 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @95 goto_unless (!intF[4]) @92 strS[1003] = 'SDT07' goto @93 @92 goto_unless (intF[4] == 1) @93 strS[1003] = 'SDT08' @93 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @94 objBgMove (83, 16, 16) goto @95 @94 goto_unless (intB[2] == 1) @95 objBgMove (83, 16, 66) @95 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @96 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @96 bgrMulti (strS[1000], 0) bgmFadeOutEx bgmLoop ('BGM14') koePlay (2121058) #res<0079> pause #res<0080> pause #res<0081> pause #res<0082> pause #res<0083> pause #res<0084> pause goto_unless (intF[1107] == 1) @97 intF[1107] = 0 msgHide @97 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @101 goto_unless (!intF[4]) @98 strS[1003] = 'SDT07' goto @99 @98 goto_unless (intF[4] == 1) @99 strS[1003] = 'SDT08' @99 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @100 objBgMove (83, 16, 16) goto @101 @100 goto_unless (intB[2] == 1) @101 objBgMove (83, 16, 66) @101 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @102 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @102 bgrMulti (strS[1000], 60, copy('CGMZ21PN', 61)) #res<0085> pause #res<0086> pause #res<0087> pause goto_unless (intF[1107] == 1) @103 intF[1107] = 0 msgHide @103 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @107 goto_unless (!intF[4]) @104 strS[1003] = 'SDT07' goto @105 @104 goto_unless (intF[4] == 1) @105 strS[1003] = 'SDT08' @105 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @106 objBgMove (83, 16, 16) goto @107 @106 goto_unless (intB[2] == 1) @107 objBgMove (83, 16, 66) @107 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @108 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @108 bgrMulti (strS[1000], 0) #res<0088> pause #res<0089> pause #res<0090> pause #res<0091> pause #res<0092> pause goto_unless (intF[1107] == 1) @109 intF[1107] = 0 msgHide @109 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @113 goto_unless (!intF[4]) @110 strS[1003] = 'SDT07' goto @111 @110 goto_unless (intF[4] == 1) @111 strS[1003] = 'SDT08' @111 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @112 objBgMove (83, 16, 16) goto @113 @112 goto_unless (intB[2] == 1) @113 objBgMove (83, 16, 66) @113 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @114 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @114 bgrMulti (strS[1000], 60, copy('CGMZ23PN', 61)) koePlay (2121059) #res<0093> pause #res<0094> pause #res<0095> pause koePlay (2121060) #res<0096> pause koePlay (2121061) #res<0097> pause goto_unless (intF[1107] == 1) @115 intF[1107] = 0 msgHide @115 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @119 goto_unless (!intF[4]) @116 strS[1003] = 'SDT07' goto @117 @116 goto_unless (intF[4] == 1) @117 strS[1003] = 'SDT08' @117 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @118 objBgMove (83, 16, 16) goto @119 @118 goto_unless (intB[2] == 1) @119 objBgMove (83, 16, 66) @119 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @120 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @120 bgrMulti (strS[1000], 60, copy('CGMZ22PN', 61)) koePlay (2121062) #res<0098> pause koePlay (2121063) #res<0099> pause goto_unless (intF[1107] == 1) @121 intF[1107] = 0 msgHide @121 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @125 goto_unless (!intF[4]) @122 strS[1003] = 'SDT07' goto @123 @122 goto_unless (intF[4] == 1) @123 strS[1003] = 'SDT08' @123 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @124 objBgMove (83, 16, 16) goto @125 @124 goto_unless (intB[2] == 1) @125 objBgMove (83, 16, 66) @125 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @126 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @126 bgrMulti (strS[1000], 0) msgHide wait (1000) msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) wait (1000) intF[3] = 3 intF[4] = 1 title (#res<0100>) msgHide intF[1107] = 1 grpMulti ('DAY_000', 0, copy('DAY_803', 0)) farcall (9070, 0) msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) wait (1000) intF[1107] = 1 strS[1000] = 'BG009' goto_unless (intF[1107] == 1) @127 intF[1107] = 0 msgHide @127 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @131 goto_unless (!intF[4]) @128 strS[1003] = 'SDT07' goto @129 @128 goto_unless (intF[4] == 1) @129 strS[1003] = 'SDT08' @129 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @130 objBgMove (83, 16, 16) goto @131 @130 goto_unless (intB[2] == 1) @131 objBgMove (83, 16, 66) @131 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @132 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @132 bgrMulti (strS[1000], 102) #res<0101> pause #res<0102> pause #res<0103> pause #res<0104> pause #res<0105> pause #res<0106> pause #res<0107> pause koePlay (2121064) #res<0108> pause #res<0109> pause koePlay (2121065) #res<0110> pause koePlay (2121066) #res<0111> pause koePlay (2121067) #res<0112> pause #res<0113> pause #res<0114> pause #res<0115> pause #res<0116> pause #res<0117> pause #res<0118> pause #res<0119> pause msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) #res<0120> pause #res<0121> pause intF[1107] = 1 strS[1000] = 'BG009N2' goto_unless (intF[1107] == 1) @133 intF[1107] = 0 msgHide @133 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @137 goto_unless (!intF[4]) @134 strS[1003] = 'SDT07' goto @135 @134 goto_unless (intF[4] == 1) @135 strS[1003] = 'SDT08' @135 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @136 objBgMove (83, 16, 16) goto @137 @136 goto_unless (intB[2] == 1) @137 objBgMove (83, 16, 66) @137 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @138 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @138 bgrMulti (strS[1000], 0) #res<0122> pause #res<0123> pause #res<0124> pause #res<0125> pause #res<0126> pause #res<0127> pause #res<0128> pause #res<0129> pause #res<0130> pause goto_unless (intF[1107] == 1) @139 intF[1107] = 0 msgHide @139 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @143 goto_unless (!intF[4]) @140 strS[1003] = 'SDT07' goto @141 @140 goto_unless (intF[4] == 1) @141 strS[1003] = 'SDT08' @141 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @142 objBgMove (83, 16, 16) goto @143 @142 goto_unless (intB[2] == 1) @143 objBgMove (83, 16, 66) @143 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @144 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @144 bgrMulti (strS[1000], 60, copy('CGMZ22PN', 61)) koePlay (2121068) #res<0131> pause koePlay (2121069) #res<0132> pause goto_unless (intF[1107] == 1) @145 intF[1107] = 0 msgHide @145 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @149 goto_unless (!intF[4]) @146 strS[1003] = 'SDT07' goto @147 @146 goto_unless (intF[4] == 1) @147 strS[1003] = 'SDT08' @147 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @148 objBgMove (83, 16, 16) goto @149 @148 goto_unless (intB[2] == 1) @149 objBgMove (83, 16, 66) @149 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @150 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @150 bgrMulti (strS[1000], 0) #res<0133> pause #res<0134> pause #res<0135> pause #res<0136> pause bgmFadeOut (50) #res<0137> pause #res<0138> pause #res<0139> pause #res<0140> pause #res<0141> pause #res<0142> pause #res<0143> pause #res<0144> pause #res<0145> pause #res<0146> pause msgHide intF[1107] = 1 recOpenBg ('SIRO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) #res<0147> pause intB[2] = 1 stackClear wipe (1, 0, 0, 0) grpBuffer ('BG009N2', 3) grpCopy (0, 50, 639, 429, 3, 0, 50, 1) bgmLoop ('BGM11') grpMono (0, 0, 639, 479, 1) grpCopy (1, 0) intF[1107] = 1 strS[1000] = 'OP_F00A' goto_unless (intF[1107] == 1) @151 intF[1107] = 0 msgHide @151 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @155 goto_unless (!intF[4]) @152 strS[1003] = 'SDT07' goto @153 @152 goto_unless (intF[4] == 1) @153 strS[1003] = 'SDT08' @153 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @154 objBgMove (83, 16, 16) goto @155 @154 goto_unless (intB[2] == 1) @155 objBgMove (83, 16, 66) @155 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @156 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @156 bgrMulti (strS[1000], 0) #res<0148> pause intF[1107] = 1 strS[1000] = 'OP_F00C' goto_unless (intF[1107] == 1) @157 intF[1107] = 0 msgHide @157 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @161 goto_unless (!intF[4]) @158 strS[1003] = 'SDT07' goto @159 @158 goto_unless (intF[4] == 1) @159 strS[1003] = 'SDT08' @159 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @160 objBgMove (83, 16, 16) goto @161 @160 goto_unless (intB[2] == 1) @161 objBgMove (83, 16, 66) @161 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @162 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @162 bgrMulti (strS[1000], 0) #res<0149> pause intF[1107] = 1 strS[1000] = 'OP_F00E' goto_unless (intF[1107] == 1) @163 intF[1107] = 0 msgHide @163 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @167 goto_unless (!intF[4]) @164 strS[1003] = 'SDT07' goto @165 @164 goto_unless (intF[4] == 1) @165 strS[1003] = 'SDT08' @165 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @166 objBgMove (83, 16, 16) goto @167 @166 goto_unless (intB[2] == 1) @167 objBgMove (83, 16, 66) @167 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @168 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @168 bgrMulti (strS[1000], 0) #res<0150> pause intF[1107] = 1 strS[1000] = 'OP_F00I' goto_unless (intF[1107] == 1) @169 intF[1107] = 0 msgHide @169 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @173 goto_unless (!intF[4]) @170 strS[1003] = 'SDT07' goto @171 @170 goto_unless (intF[4] == 1) @171 strS[1003] = 'SDT08' @171 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @172 objBgMove (83, 16, 16) goto @173 @172 goto_unless (intB[2] == 1) @173 objBgMove (83, 16, 66) @173 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @174 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @174 bgrMulti (strS[1000], 0) #res<0151> pause intF[1107] = 1 strS[1000] = 'OP_F00K' goto_unless (intF[1107] == 1) @175 intF[1107] = 0 msgHide @175 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @179 goto_unless (!intF[4]) @176 strS[1003] = 'SDT07' goto @177 @176 goto_unless (intF[4] == 1) @177 strS[1003] = 'SDT08' @177 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @178 objBgMove (83, 16, 16) goto @179 @178 goto_unless (intB[2] == 1) @179 objBgMove (83, 16, 66) @179 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @180 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @180 bgrMulti (strS[1000], 0) #res<0152> pause intF[1107] = 1 strS[1000] = 'OP_F00O' goto_unless (intF[1107] == 1) @181 intF[1107] = 0 msgHide @181 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @185 goto_unless (!intF[4]) @182 strS[1003] = 'SDT07' goto @183 @182 goto_unless (intF[4] == 1) @183 strS[1003] = 'SDT08' @183 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @184 objBgMove (83, 16, 16) goto @185 @184 goto_unless (intB[2] == 1) @185 objBgMove (83, 16, 66) @185 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @186 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @186 bgrMulti (strS[1000], 0) wait (300) intF[1107] = 1 strS[1000] = 'SIRO' goto_unless (intF[1107] == 1) @187 intF[1107] = 0 msgHide @187 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @191 goto_unless (!intF[4]) @188 strS[1003] = 'SDT07' goto @189 @188 goto_unless (intF[4] == 1) @189 strS[1003] = 'SDT08' @189 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @190 objBgMove (83, 16, 16) goto @191 @190 goto_unless (intB[2] == 1) @191 objBgMove (83, 16, 66) @191 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @192 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @192 bgrMulti (strS[1000], 0) bgmFadeOut (50) #res<0153> pause intB[2] = 1 recFill (0, 0, 640, 480, 1, 0, 0, 0) recLoad ('BG003', 1, 0, 50, 640, 380, 0, 50) grpMono (0, 0, 639, 479, 1) msgHide intF[1107] = 1 grpOpenBg ('?', 0, 0, 639, 479, 0, 0, 800, 50, 0, 0, 0, 0, 0, 0, 255, 0) #res<0154> pause #res<0155> pause #res<0156> pause #res<0157> pause #res<0158> pause #res<0159> pause #res<0160> pause #res<0161> pause #res<0162> pause #res<0163> pause #res<0164> pause bgmLoop ('BGM05') koePlay (2121070) #res<0165> pause #res<0166> pause #res<0167> pause grpBuffer ('BG003', 1) grpMono (0, 0, 639, 479, 1) msgHide intF[1107] = 1 grpOpenBg ('?', 26) msgHide intF[1107] = 1 grpOpenBg ('BG003', 26) #res<0168> pause koePlay (2121071) #res<0169> pause #res<0170> pause #res<0171> pause #res<0172> pause koePlay (2121072) #res<0173> pause msgHide intF[1107] = 1 grpOpenBg ('BG051', 26) #res<0174> pause #res<0175> pause #res<0176> pause #res<0177> pause #res<0178> pause #res<0179> pause #res<0180> pause #res<0181> pause #res<0182> pause #res<0183> pause #res<0184> pause #res<0185> pause bgmFadeOut (50) msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) #res<0186> pause #res<0187> pause #res<0188> pause #res<0189> pause #res<0190> pause #res<0191> pause #res<0192> pause #res<0193> pause #res<0194> pause koePlay (2121073) #res<0195> pause #res<0196> pause #res<0197> pause #res<0198> pause #res<0199> pause #res<0200> pause #res<0201> pause #res<0202> pause #res<0203> pause #res<0204> pause intF[1107] = 1 strS[1000] = 'BG009N2' goto_unless (intF[1107] == 1) @193 intF[1107] = 0 msgHide @193 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @197 goto_unless (!intF[4]) @194 strS[1003] = 'SDT07' goto @195 @194 goto_unless (intF[4] == 1) @195 strS[1003] = 'SDT08' @195 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @196 objBgMove (83, 16, 16) goto @197 @196 goto_unless (intB[2] == 1) @197 objBgMove (83, 16, 66) @197 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @198 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @198 bgrMulti (strS[1000], 0) #res<0205> pause #res<0206> pause #res<0207> pause #res<0208> pause #res<0209> pause bgmLoop ('BGM08') #res<0210> pause #res<0211> pause #res<0212> pause #res<0213> pause #res<0214> pause #res<0215> pause #res<0216> pause #res<0217> pause #res<0218> pause #res<0219> pause #res<0220> pause #res<0221> pause #res<0222> pause #res<0223> pause #res<0224> pause #res<0225> pause #res<0226> pause #res<0227> pause #res<0228> pause #res<0229> pause #res<0230> pause #res<0231> pause #res<0232> pause #res<0233> pause #res<0234> pause #res<0235> pause #res<0236> pause #res<0237> pause #res<0238> pause #res<0239> pause koePlay (2121074) #res<0240> pause koePlay (2121075) #res<0241> pause #res<0242> pause #res<0243> pause #res<0244> pause #res<0245> pause #res<0246> pause #res<0247> pause #res<0248> pause #res<0249> pause #res<0250> pause #res<0251> pause #res<0252> pause #res<0253> pause #res<0254> pause #res<0255> pause #res<0256> pause #res<0257> pause #res<0258> pause #res<0259> pause #res<0260> pause #res<0261> pause #res<0262> pause #res<0263> pause #res<0264> pause #res<0265> pause #res<0266> pause #res<0267> pause #res<0268> pause #res<0269> pause #res<0270> pause #res<0271> pause #res<0272> pause #res<0273> pause #res<0274> pause #res<0275> pause bgmFadeOut (1200) msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) #res<0276> pause #res<0277> pause intF[1107] = 1 strS[1000] = 'BG009N2' goto_unless (intF[1107] == 1) @199 intF[1107] = 0 msgHide @199 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @203 goto_unless (!intF[4]) @200 strS[1003] = 'SDT07' goto @201 @200 goto_unless (intF[4] == 1) @201 strS[1003] = 'SDT08' @201 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @202 objBgMove (83, 16, 16) goto @203 @202 goto_unless (intB[2] == 1) @203 objBgMove (83, 16, 66) @203 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @204 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @204 bgrMulti (strS[1000], 0) #res<0278> pause #res<0279> pause #res<0280> pause #res<0281> pause #res<0282> pause #res<0283> pause bgmLoop ('BGM14') #res<0284> pause #res<0285> pause #res<0286> pause #res<0287> pause #res<0288> pause #res<0289> pause #res<0290> pause #res<0291> pause #res<0292> pause #res<0293> pause #res<0294> pause #res<0295> pause #res<0296> pause #res<0297> pause #res<0298> pause #res<0299> pause #res<0300> pause #res<0301> pause #res<0302> pause #res<0303> pause #res<0304> pause #res<0305> pause #res<0306> pause #res<0307> pause #res<0308> pause #res<0309> pause #res<0310> pause #res<0311> pause #res<0312> pause #res<0313> pause #res<0314> pause #res<0315> pause #res<0316> pause #res<0317> pause #res<0318> pause #res<0319> pause #res<0320> pause #res<0321> pause #res<0322> pause #res<0323> pause #res<0324> pause #res<0325> pause #res<0326> pause #res<0327> pause #res<0328> pause #res<0329> pause #res<0330> pause #res<0331> pause #res<0332> pause #res<0333> pause #res<0334> pause #res<0335> pause #res<0336> pause #res<0337> pause #res<0338> pause #res<0339> pause #res<0340> pause #res<0341> pause #res<0342> pause #res<0343> pause #res<0344> pause bgmFadeOut (1200) #res<0345> pause #res<0346> pause bgmFadeOutEx bgmLoop ('BGM24') koePlay (2121076) #res<0347> pause #res<0348> pause #res<0349> pause #res<0350> pause #res<0351> pause #res<0352> pause #res<0353> pause #res<0354> pause #res<0355> pause #res<0356> pause #res<0357> pause #res<0358> pause #res<0359> pause #res<0360> pause #res<0361> pause #res<0362> pause #res<0363> pause #res<0364> pause #res<0365> pause #res<0366> pause #res<0367> pause #res<0368> pause #res<0369> pause #res<0370> pause #res<0371> pause #res<0372> pause #res<0373> pause #res<0374> pause #res<0375> pause #res<0376> pause #res<0377> pause bgmFadeOut (1200) koePlay (2121077) #res<0378> pause msgHide intF[1107] = 1 grpOpenBg ('FGMZ23A', 26) koePlay (2121078) #res<0379> pause koePlay (2121079) #res<0380> pause koePlay (2121080) #res<0381> pause koePlay (2121081) #res<0382> pause koePlay (2121082) #res<0383> pause koePlay (2121083) #res<0384> pause koePlay (2121084) #res<0385> pause bgmLoop ('BGM12') msgHide intF[1107] = 1 grpOpenBg ('FGMZ23B', 0) koePlay (2121085) #res<0386> pause koePlay (2121086) #res<0387> pause koePlay (2121087) #res<0388> pause koePlay (2121088) #res<0389> pause koePlay (2121089) #res<0390> pause koePlay (2121090) #res<0391> pause #res<0392> pause #res<0393> pause #res<0394> pause #res<0395> pause #res<0396> pause koePlay (2121091) #res<0397> pause #res<0398> pause #res<0399> pause #res<0400> pause #res<0401> pause koePlay (2121092) #res<0402> pause koePlay (2121093) #res<0403> pause #res<0404> pause #res<0405> pause #res<0406> pause koePlay (2121094) #res<0407> pause koePlay (2121095) #res<0408> pause koePlay (2121096) #res<0409> pause koePlay (2121097) #res<0410> pause koePlay (2121098) #res<0411> pause koePlay (2121099) #res<0412> pause koePlay (2121100) #res<0413> pause koePlay (2121101) #res<0414> pause #res<0415> pause #res<0416> pause #res<0417> pause #res<0418> pause #res<0419> pause #res<0420> pause koePlay (2121102) #res<0421> pause #res<0422> pause #res<0423> pause #res<0424> pause #res<0425> pause koePlay (2121103) #res<0426> pause bgmFadeOut (1200) msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) #res<0427> pause #res<0428> pause msgHide intF[3] = 4 intF[4] = 1 title (#res<0429>) wait (3000) bgmFadeOutEx bgmLoop ('BGM19') wait (2000) msgHide intF[1107] = 1 grpOpenBg ('SIRO', 26) #res<0430> pause #res<0431> pause #res<0432> pause #res<0433> pause #res<0434> pause #res<0435> pause msgHide intF[1107] = 1 grpOpenBg ('FGMZ23C', 26) wait (2000) koePlay (2121104) #res<0436> pause koePlay (2121105) #res<0437> pause koePlay (2121106) #res<0438> pause koePlay (2121107) #res<0439> pause koePlay (2121108) #res<0440> pause #res<0441> pause koePlay (2121109) #res<0442> pause koePlay (2121110) #res<0443> pause koePlay (2121111) #res<0444> pause koePlay (2121112) #res<0445> pause koePlay (2121113) #res<0446> pause koePlay (2121114) #res<0447> pause koePlay (2121115) #res<0448> pause koePlay (2121116) #res<0449> pause koePlay (2121117) #res<0450> pause koePlay (2121118) #res<0451> pause koePlay (2121119) #res<0452> pause koePlay (2121120) #res<0453> pause koePlay (2121121) #res<0454> pause koePlay (2121122) #res<0455> pause #res<0456> pause #res<0457> pause #res<0458> pause #res<0459> pause #res<0460> pause koePlay (2121123) #res<0461> pause koePlay (2121124) #res<0462> pause koePlay (2121125) #res<0463> pause koePlay (2121126) #res<0464> pause koePlay (2121127) #res<0465> pause msgHide intF[1107] = 1 grpOpenBg ('BG051', 26) #res<0466> pause #res<0467> pause #res<0468> pause #res<0469> pause #res<0470> pause bgmFadeOut (1200) msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) wavStop wavLoop ('ABURA_LOW', 0) intF[1107] = 1 strS[1000] = 'BG009' goto_unless (intF[1107] == 1) @205 intF[1107] = 0 msgHide @205 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @209 goto_unless (!intF[4]) @206 strS[1003] = 'SDT07' goto @207 @206 goto_unless (intF[4] == 1) @207 strS[1003] = 'SDT08' @207 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @208 objBgMove (83, 16, 16) goto @209 @208 goto_unless (intB[2] == 1) @209 objBgMove (83, 16, 66) @209 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @210 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @210 bgrMulti (strS[1000], 0) goto_unless (intF[1107] == 1) @211 intF[1107] = 0 msgHide @211 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @215 goto_unless (!intF[4]) @212 strS[1003] = 'SDT07' goto @213 @212 goto_unless (intF[4] == 1) @213 strS[1003] = 'SDT08' @213 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @214 objBgMove (83, 16, 16) goto @215 @214 goto_unless (intB[2] == 1) @215 objBgMove (83, 16, 66) @215 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @216 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @216 bgrMulti (strS[1000], 60, copy('CGMZ20P', 61)) koePlay (2121128) #res<0471> pause goto_unless (intF[1107] == 1) @217 intF[1107] = 0 msgHide @217 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @221 goto_unless (!intF[4]) @218 strS[1003] = 'SDT07' goto @219 @218 goto_unless (intF[4] == 1) @219 strS[1003] = 'SDT08' @219 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @220 objBgMove (83, 16, 16) goto @221 @220 goto_unless (intB[2] == 1) @221 objBgMove (83, 16, 66) @221 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @222 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @222 bgrMulti (strS[1000], 60, copy('CGMZ26P', 61)) koePlay (2121129) #res<0472> pause goto_unless (intF[1107] == 1) @223 intF[1107] = 0 msgHide @223 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @227 goto_unless (!intF[4]) @224 strS[1003] = 'SDT07' goto @225 @224 goto_unless (intF[4] == 1) @225 strS[1003] = 'SDT08' @225 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @226 objBgMove (83, 16, 16) goto @227 @226 goto_unless (intB[2] == 1) @227 objBgMove (83, 16, 66) @227 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @228 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @228 bgrMulti (strS[1000], 0) #res<0473> pause koePlay (2121130) #res<0474> pause koePlay (2121131) #res<0475> pause wavStopAll intF[1107] = 1 strS[1000] = 'BG005' goto_unless (intF[1107] == 1) @229 intF[1107] = 0 msgHide @229 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @233 goto_unless (!intF[4]) @230 strS[1003] = 'SDT07' goto @231 @230 goto_unless (intF[4] == 1) @231 strS[1003] = 'SDT08' @231 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @232 objBgMove (83, 16, 16) goto @233 @232 goto_unless (intB[2] == 1) @233 objBgMove (83, 16, 66) @233 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @234 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @234 bgrMulti (strS[1000], 102) wavStop wavLoop ('ABURA', 0) #res<0476> pause #res<0477> pause #res<0478> pause #res<0479> pause #res<0480> pause koePlay (2121132) #res<0481> pause koePlay (2121133) #res<0482> pause koePlay (2121134) #res<0483> pause koePlay (2121135) #res<0484> pause #res<0485> pause koePlay (2121136) #res<0486> pause #res<0487> pause intF[1107] = 1 strS[1000] = 'BG003' goto_unless (intF[1107] == 1) @235 intF[1107] = 0 msgHide @235 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @239 goto_unless (!intF[4]) @236 strS[1003] = 'SDT07' goto @237 @236 goto_unless (intF[4] == 1) @237 strS[1003] = 'SDT08' @237 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @238 objBgMove (83, 16, 16) goto @239 @238 goto_unless (intB[2] == 1) @239 objBgMove (83, 16, 66) @239 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @240 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @240 bgrMulti (strS[1000], 0) koePlay (2121137) #res<0488> pause koePlay (2121138) #res<0489> pause koePlay (2121139) #res<0490> pause #res<0491> pause koePlay (2121140) #res<0492> pause koePlay (2121141) #res<0493> pause koePlay (2121142) #res<0494> pause koePlay (2121143) #res<0495> pause koePlay (2121144) #res<0496> pause koePlay (2121145) #res<0497> pause #res<0498> pause #res<0499> pause koePlay (2121146) #res<0500> pause koePlay (2121147) #res<0501> pause koePlay (2121148) #res<0502> pause koePlay (2121149) #res<0503> pause koePlay (2121150) #res<0504> pause koePlay (2121151) #res<0505> pause koePlay (2121152) #res<0506> pause koePlay (2121153) #res<0507> pause koePlay (2121154) #res<0508> pause koePlay (2121155) #res<0509> pause #res<0510> pause koePlay (2121156) #res<0511> pause #res<0512> pause wavStopAll bgmLoop ('BGM05') msgHide intF[1107] = 1 grpOpenBg ('FGMZ06', 0) koePlay (2121157) #res<0513> pause koePlay (2121158) #res<0514> pause #res<0515> pause koePlay (2121159) #res<0516> pause koePlay (2121160) #res<0517> pause koePlay (2121161) #res<0518> pause koePlay (2121162) #res<0519> pause koePlay (2121163) #res<0520> pause koePlay (2121164) #res<0521> pause koePlay (2121165) #res<0522> pause koePlay (2121166) #res<0523> pause koePlay (2121167) #res<0524> pause koePlay (2121168) #res<0525> pause koePlay (2121169) #res<0526> pause koePlay (2121170) #res<0527> pause koePlay (2121171) #res<0528> pause koePlay (2121172) #res<0529> pause koePlay (2121173) #res<0530> pause koePlay (2121174) #res<0531> pause #res<0532> pause #res<0533> pause intF[1107] = 1 strS[1000] = 'BG003' goto_unless (intF[1107] == 1) @241 intF[1107] = 0 msgHide @241 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @245 goto_unless (!intF[4]) @242 strS[1003] = 'SDT07' goto @243 @242 goto_unless (intF[4] == 1) @243 strS[1003] = 'SDT08' @243 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @244 objBgMove (83, 16, 16) goto @245 @244 goto_unless (intB[2] == 1) @245 objBgMove (83, 16, 66) @245 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @246 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @246 bgrMulti (strS[1000], 0) #res<0534> pause #res<0535> pause #res<0536> pause #res<0537> pause goto_unless (intF[1107] == 1) @247 intF[1107] = 0 msgHide @247 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @251 goto_unless (!intF[4]) @248 strS[1003] = 'SDT07' goto @249 @248 goto_unless (intF[4] == 1) @249 strS[1003] = 'SDT08' @249 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @250 objBgMove (83, 16, 16) goto @251 @250 goto_unless (intB[2] == 1) @251 objBgMove (83, 16, 66) @251 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @252 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @252 bgrMulti (strS[1000], 60, copy('CGHR25S', 61)) koePlay (2121175) #res<0538> pause koePlay (2121176) #res<0539> pause koePlay (2121177) #res<0540> pause goto_unless (intF[1107] == 1) @253 intF[1107] = 0 msgHide @253 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @257 goto_unless (!intF[4]) @254 strS[1003] = 'SDT07' goto @255 @254 goto_unless (intF[4] == 1) @255 strS[1003] = 'SDT08' @255 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @256 objBgMove (83, 16, 16) goto @257 @256 goto_unless (intB[2] == 1) @257 objBgMove (83, 16, 66) @257 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @258 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @258 bgrMulti (strS[1000], 0) #res<0541> pause goto_unless (intF[1107] == 1) @259 intF[1107] = 0 msgHide @259 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @263 goto_unless (!intF[4]) @260 strS[1003] = 'SDT07' goto @261 @260 goto_unless (intF[4] == 1) @261 strS[1003] = 'SDT08' @261 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @262 objBgMove (83, 16, 16) goto @263 @262 goto_unless (intB[2] == 1) @263 objBgMove (83, 16, 66) @263 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @264 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @264 bgrMulti (strS[1000], 60, copy('CGHR14S', 61)) #res<0542> pause goto_unless (intF[1107] == 1) @265 intF[1107] = 0 msgHide @265 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @269 goto_unless (!intF[4]) @266 strS[1003] = 'SDT07' goto @267 @266 goto_unless (intF[4] == 1) @267 strS[1003] = 'SDT08' @267 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @268 objBgMove (83, 16, 16) goto @269 @268 goto_unless (intB[2] == 1) @269 objBgMove (83, 16, 66) @269 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @270 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @270 bgrMulti (strS[1000], 60, copy('CGHR12S', 61)) koePlay (2121178) #res<0543> pause goto_unless (intF[1107] == 1) @271 intF[1107] = 0 msgHide @271 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @275 goto_unless (!intF[4]) @272 strS[1003] = 'SDT07' goto @273 @272 goto_unless (intF[4] == 1) @273 strS[1003] = 'SDT08' @273 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @274 objBgMove (83, 16, 16) goto @275 @274 goto_unless (intB[2] == 1) @275 objBgMove (83, 16, 66) @275 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @276 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @276 bgrMulti (strS[1000], 60, copy('CGHR11S', 61)) koePlay (2121179) #res<0544> pause #res<0545> pause #res<0546> pause #res<0547> pause koePlay (2121180) #res<0548> pause koePlay (2121181) #res<0549> pause koePlay (2121182) #res<0550> pause goto_unless (intF[1107] == 1) @277 intF[1107] = 0 msgHide @277 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @281 goto_unless (!intF[4]) @278 strS[1003] = 'SDT07' goto @279 @278 goto_unless (intF[4] == 1) @279 strS[1003] = 'SDT08' @279 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @280 objBgMove (83, 16, 16) goto @281 @280 goto_unless (intB[2] == 1) @281 objBgMove (83, 16, 66) @281 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @282 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @282 bgrMulti (strS[1000], 60, copy('CGHR13S', 61)) koePlay (2121183) #res<0551> pause koePlay (2121184) #res<0552> pause koePlay (2121185) #res<0553> pause goto_unless (intF[1107] == 1) @283 intF[1107] = 0 msgHide @283 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @287 goto_unless (!intF[4]) @284 strS[1003] = 'SDT07' goto @285 @284 goto_unless (intF[4] == 1) @285 strS[1003] = 'SDT08' @285 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @286 objBgMove (83, 16, 16) goto @287 @286 goto_unless (intB[2] == 1) @287 objBgMove (83, 16, 66) @287 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @288 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @288 bgrMulti (strS[1000], 60, copy('CGHR11S', 61)) koePlay (2121186) #res<0554> pause koePlay (2121187) #res<0555> pause koePlay (2121188) #res<0556> pause koePlay (2121189) #res<0557> pause #res<0558> pause koePlay (2121190) #res<0559> pause koePlay (2121191) #res<0560> pause koePlay (2121192) #res<0561> pause koePlay (2121193) #res<0562> pause koePlay (2121194) #res<0563> pause koePlay (2121195) #res<0564> pause koePlay (2121196) #res<0565> pause goto_unless (intF[1107] == 1) @289 intF[1107] = 0 msgHide @289 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @293 goto_unless (!intF[4]) @290 strS[1003] = 'SDT07' goto @291 @290 goto_unless (intF[4] == 1) @291 strS[1003] = 'SDT08' @291 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @292 objBgMove (83, 16, 16) goto @293 @292 goto_unless (intB[2] == 1) @293 objBgMove (83, 16, 66) @293 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @294 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @294 bgrMulti (strS[1000], 60, copy('CGHR14S', 61)) koePlay (2121197) #res<0566> pause koePlay (2121198) #res<0567> pause goto_unless (intF[1107] == 1) @295 intF[1107] = 0 msgHide @295 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @299 goto_unless (!intF[4]) @296 strS[1003] = 'SDT07' goto @297 @296 goto_unless (intF[4] == 1) @297 strS[1003] = 'SDT08' @297 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @298 objBgMove (83, 16, 16) goto @299 @298 goto_unless (intB[2] == 1) @299 objBgMove (83, 16, 66) @299 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @300 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @300 bgrMulti (strS[1000], 60, copy('CGHR25S', 61)) koePlay (2121199) #res<0568> pause koePlay (2121200) #res<0569> pause koePlay (2121201) #res<0570> pause koePlay (2121202) #res<0571> pause koePlay (2121203) #res<0572> pause koePlay (2121204) #res<0573> pause koePlay (2121205) #res<0574> pause koePlay (2121206) #res<0575> pause koePlay (2121207) #res<0576> pause koePlay (2121208) #res<0577> pause koePlay (2121209) #res<0578> pause goto_unless (intF[1107] == 1) @301 intF[1107] = 0 msgHide @301 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @305 goto_unless (!intF[4]) @302 strS[1003] = 'SDT07' goto @303 @302 goto_unless (intF[4] == 1) @303 strS[1003] = 'SDT08' @303 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @304 objBgMove (83, 16, 16) goto @305 @304 goto_unless (intB[2] == 1) @305 objBgMove (83, 16, 66) @305 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @306 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @306 bgrMulti (strS[1000], 60, copy('CGHR12S', 61)) koePlay (2121210) #res<0579> pause koePlay (2121211) #res<0580> pause koePlay (2121212) #res<0581> pause goto_unless (intF[1107] == 1) @307 intF[1107] = 0 msgHide @307 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @311 goto_unless (!intF[4]) @308 strS[1003] = 'SDT07' goto @309 @308 goto_unless (intF[4] == 1) @309 strS[1003] = 'SDT08' @309 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @310 objBgMove (83, 16, 16) goto @311 @310 goto_unless (intB[2] == 1) @311 objBgMove (83, 16, 66) @311 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @312 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @312 bgrMulti (strS[1000], 60, copy('CGHR13S', 61)) koePlay (2121213) #res<0582> pause koePlay (2121214) #res<0583> pause koePlay (2121215) #res<0584> pause goto_unless (intF[1107] == 1) @313 intF[1107] = 0 msgHide @313 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @317 goto_unless (!intF[4]) @314 strS[1003] = 'SDT07' goto @315 @314 goto_unless (intF[4] == 1) @315 strS[1003] = 'SDT08' @315 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @316 objBgMove (83, 16, 16) goto @317 @316 goto_unless (intB[2] == 1) @317 objBgMove (83, 16, 66) @317 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @318 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @318 bgrMulti (strS[1000], 60, copy('CGHR12S', 61)) koePlay (2121216) #res<0585> pause goto_unless (intF[1107] == 1) @319 intF[1107] = 0 msgHide @319 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @323 goto_unless (!intF[4]) @320 strS[1003] = 'SDT07' goto @321 @320 goto_unless (intF[4] == 1) @321 strS[1003] = 'SDT08' @321 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @322 objBgMove (83, 16, 16) goto @323 @322 goto_unless (intB[2] == 1) @323 objBgMove (83, 16, 66) @323 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @324 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @324 bgrMulti (strS[1000], 60, copy('CGHR25S', 61)) koePlay (2121217) #res<0586> pause koePlay (2121218) #res<0587> pause koePlay (2121219) #res<0588> pause koePlay (2121220) #res<0589> pause goto_unless (intF[1107] == 1) @325 intF[1107] = 0 msgHide @325 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @329 goto_unless (!intF[4]) @326 strS[1003] = 'SDT07' goto @327 @326 goto_unless (intF[4] == 1) @327 strS[1003] = 'SDT08' @327 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @328 objBgMove (83, 16, 16) goto @329 @328 goto_unless (intB[2] == 1) @329 objBgMove (83, 16, 66) @329 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @330 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @330 bgrMulti (strS[1000], 60, copy('CGHR26S', 61)) koePlay (2121221) #res<0590> pause koePlay (2121222) #res<0591> pause koePlay (2121223) #res<0592> pause goto_unless (intF[1107] == 1) @331 intF[1107] = 0 msgHide @331 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @335 goto_unless (!intF[4]) @332 strS[1003] = 'SDT07' goto @333 @332 goto_unless (intF[4] == 1) @333 strS[1003] = 'SDT08' @333 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @334 objBgMove (83, 16, 16) goto @335 @334 goto_unless (intB[2] == 1) @335 objBgMove (83, 16, 66) @335 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @336 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @336 bgrMulti (strS[1000], 60, copy('CGHR25S', 61)) koePlay (2121224) #res<0593> pause koePlay (2121225) #res<0594> pause koePlay (2121226) #res<0595> pause koePlay (2121227) #res<0596> pause koePlay (2121228) #res<0597> pause koePlay (2121229) #res<0598> pause goto_unless (intF[1107] == 1) @337 intF[1107] = 0 msgHide @337 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @341 goto_unless (!intF[4]) @338 strS[1003] = 'SDT07' goto @339 @338 goto_unless (intF[4] == 1) @339 strS[1003] = 'SDT08' @339 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @340 objBgMove (83, 16, 16) goto @341 @340 goto_unless (intB[2] == 1) @341 objBgMove (83, 16, 66) @341 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @342 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @342 bgrMulti (strS[1000], 60, copy('CGHR26S', 61)) koePlay (2121230) #res<0599> pause koePlay (2121231) #res<0600> pause goto_unless (intF[1107] == 1) @343 intF[1107] = 0 msgHide @343 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @347 goto_unless (!intF[4]) @344 strS[1003] = 'SDT07' goto @345 @344 goto_unless (intF[4] == 1) @345 strS[1003] = 'SDT08' @345 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @346 objBgMove (83, 16, 16) goto @347 @346 goto_unless (intB[2] == 1) @347 objBgMove (83, 16, 66) @347 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @348 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @348 bgrMulti (strS[1000], 60, copy('CGHR25S', 61)) koePlay (2121232) #res<0601> pause koePlay (2121233) #res<0602> pause koePlay (2121234) #res<0603> pause goto_unless (intF[1107] == 1) @349 intF[1107] = 0 msgHide @349 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @353 goto_unless (!intF[4]) @350 strS[1003] = 'SDT07' goto @351 @350 goto_unless (intF[4] == 1) @351 strS[1003] = 'SDT08' @351 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @352 objBgMove (83, 16, 16) goto @353 @352 goto_unless (intB[2] == 1) @353 objBgMove (83, 16, 66) @353 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @354 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @354 bgrMulti (strS[1000], 60, copy('CGHR11S', 61)) koePlay (2121235) #res<0604> pause goto_unless (intF[1107] == 1) @355 intF[1107] = 0 msgHide @355 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @359 goto_unless (!intF[4]) @356 strS[1003] = 'SDT07' goto @357 @356 goto_unless (intF[4] == 1) @357 strS[1003] = 'SDT08' @357 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @358 objBgMove (83, 16, 16) goto @359 @358 goto_unless (intB[2] == 1) @359 objBgMove (83, 16, 66) @359 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @360 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @360 bgrMulti (strS[1000], 60, copy('CGHR13S', 61)) koePlay (2121236) #res<0605> pause goto_unless (intF[1107] == 1) @361 intF[1107] = 0 msgHide @361 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @365 goto_unless (!intF[4]) @362 strS[1003] = 'SDT07' goto @363 @362 goto_unless (intF[4] == 1) @363 strS[1003] = 'SDT08' @363 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @364 objBgMove (83, 16, 16) goto @365 @364 goto_unless (intB[2] == 1) @365 objBgMove (83, 16, 66) @365 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @366 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @366 bgrMulti (strS[1000], 60, copy('CGHR25S', 61)) koePlay (2121237) #res<0606> pause koePlay (2121238) #res<0607> pause koePlay (2121239) #res<0608> pause goto_unless (intF[1107] == 1) @367 intF[1107] = 0 msgHide @367 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @371 goto_unless (!intF[4]) @368 strS[1003] = 'SDT07' goto @369 @368 goto_unless (intF[4] == 1) @369 strS[1003] = 'SDT08' @369 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @370 objBgMove (83, 16, 16) goto @371 @370 goto_unless (intB[2] == 1) @371 objBgMove (83, 16, 66) @371 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @372 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @372 bgrMulti (strS[1000], 60, copy('CGHR26S', 61)) koePlay (2121240) #res<0609> pause koePlay (2121241) #res<0610> pause goto_unless (intF[1107] == 1) @373 intF[1107] = 0 msgHide @373 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @377 goto_unless (!intF[4]) @374 strS[1003] = 'SDT07' goto @375 @374 goto_unless (intF[4] == 1) @375 strS[1003] = 'SDT08' @375 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @376 objBgMove (83, 16, 16) goto @377 @376 goto_unless (intB[2] == 1) @377 objBgMove (83, 16, 66) @377 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @378 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @378 bgrMulti (strS[1000], 60, copy('CGHR25S', 61)) koePlay (2121242) #res<0611> pause goto_unless (intF[1107] == 1) @379 intF[1107] = 0 msgHide @379 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @383 goto_unless (!intF[4]) @380 strS[1003] = 'SDT07' goto @381 @380 goto_unless (intF[4] == 1) @381 strS[1003] = 'SDT08' @381 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @382 objBgMove (83, 16, 16) goto @383 @382 goto_unless (intB[2] == 1) @383 objBgMove (83, 16, 66) @383 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @384 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @384 bgrMulti (strS[1000], 0) koePlay (2121243) #res<0612> pause koePlay (2121244) #res<0613> pause goto_unless (intF[1107] == 1) @385 intF[1107] = 0 msgHide @385 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @389 goto_unless (!intF[4]) @386 strS[1003] = 'SDT07' goto @387 @386 goto_unless (intF[4] == 1) @387 strS[1003] = 'SDT08' @387 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @388 objBgMove (83, 16, 16) goto @389 @388 goto_unless (intB[2] == 1) @389 objBgMove (83, 16, 66) @389 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @390 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @390 bgrMulti (strS[1000], 60, copy('CGHR24S', 61)) koePlay (2121245) #res<0614> pause koePlay (2121246) #res<0615> pause koePlay (2121247) #res<0616> pause goto_unless (intF[1107] == 1) @391 intF[1107] = 0 msgHide @391 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @395 goto_unless (!intF[4]) @392 strS[1003] = 'SDT07' goto @393 @392 goto_unless (intF[4] == 1) @393 strS[1003] = 'SDT08' @393 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @394 objBgMove (83, 16, 16) goto @395 @394 goto_unless (intB[2] == 1) @395 objBgMove (83, 16, 66) @395 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @396 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @396 bgrMulti (strS[1000], 60, copy('CGHR13S', 61)) koePlay (2121248) #res<0617> pause koePlay (2121249) #res<0618> pause goto_unless (intF[1107] == 1) @397 intF[1107] = 0 msgHide @397 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @401 goto_unless (!intF[4]) @398 strS[1003] = 'SDT07' goto @399 @398 goto_unless (intF[4] == 1) @399 strS[1003] = 'SDT08' @399 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @400 objBgMove (83, 16, 16) goto @401 @400 goto_unless (intB[2] == 1) @401 objBgMove (83, 16, 66) @401 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @402 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @402 bgrMulti (strS[1000], 60, copy('CGHR24S', 61)) koePlay (2121250) #res<0619> pause koePlay (2121251) #res<0620> pause koePlay (2121252) #res<0621> pause koePlay (2121253) #res<0622> pause goto_unless (intF[1107] == 1) @403 intF[1107] = 0 msgHide @403 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @407 goto_unless (!intF[4]) @404 strS[1003] = 'SDT07' goto @405 @404 goto_unless (intF[4] == 1) @405 strS[1003] = 'SDT08' @405 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @406 objBgMove (83, 16, 16) goto @407 @406 goto_unless (intB[2] == 1) @407 objBgMove (83, 16, 66) @407 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @408 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @408 bgrMulti (strS[1000], 0) #res<0623> pause koePlay (2121254) #res<0624> pause #res<0625> pause #res<0626> pause bgmFadeOut (1200) goto_unless (intF[1107] == 1) @409 intF[1107] = 0 msgHide @409 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @413 goto_unless (!intF[4]) @410 strS[1003] = 'SDT07' goto @411 @410 goto_unless (intF[4] == 1) @411 strS[1003] = 'SDT08' @411 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @412 objBgMove (83, 16, 16) goto @413 @412 goto_unless (intB[2] == 1) @413 objBgMove (83, 16, 66) @413 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @414 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @414 bgrMulti (strS[1000], 60, copy('CGHR24S', 61)) koePlay (2121255) #res<0627> pause #res<0628> pause koePlay (2121256) #res<0629> pause koePlay (2121257) #res<0630> pause koePlay (2121258) #res<0631> pause goto_unless (intF[1107] == 1) @415 intF[1107] = 0 msgHide @415 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @419 goto_unless (!intF[4]) @416 strS[1003] = 'SDT07' goto @417 @416 goto_unless (intF[4] == 1) @417 strS[1003] = 'SDT08' @417 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @418 objBgMove (83, 16, 16) goto @419 @418 goto_unless (intB[2] == 1) @419 objBgMove (83, 16, 66) @419 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @420 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @420 bgrMulti (strS[1000], 0) #res<0632> pause msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) bgmLoop ('BGM16') #res<0633> pause #res<0634> pause #res<0635> pause #res<0636> pause #res<0637> pause #res<0638> pause intF[1107] = 1 strS[1000] = 'BG009' goto_unless (intF[1107] == 1) @421 intF[1107] = 0 msgHide @421 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @425 goto_unless (!intF[4]) @422 strS[1003] = 'SDT07' goto @423 @422 goto_unless (intF[4] == 1) @423 strS[1003] = 'SDT08' @423 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @424 objBgMove (83, 16, 16) goto @425 @424 goto_unless (intB[2] == 1) @425 objBgMove (83, 16, 66) @425 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @426 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @426 bgrMulti (strS[1000], 0) goto_unless (intF[1107] == 1) @427 intF[1107] = 0 msgHide @427 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @431 goto_unless (!intF[4]) @428 strS[1003] = 'SDT07' goto @429 @428 goto_unless (intF[4] == 1) @429 strS[1003] = 'SDT08' @429 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @430 objBgMove (83, 16, 16) goto @431 @430 goto_unless (intB[2] == 1) @431 objBgMove (83, 16, 66) @431 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @432 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @432 bgrMulti (strS[1000], 60, copy('CGHR24', 61)) koePlay (2121259) #res<0639> pause koePlay (2121260) #res<0640> pause koePlay (2121261) #res<0641> pause koePlay (2121262) #res<0642> pause koePlay (2121263) #res<0643> pause koePlay (2121264) #res<0644> pause koePlay (2121265) #res<0645> pause goto_unless (intF[1107] == 1) @433 intF[1107] = 0 msgHide @433 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @437 goto_unless (!intF[4]) @434 strS[1003] = 'SDT07' goto @435 @434 goto_unless (intF[4] == 1) @435 strS[1003] = 'SDT08' @435 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @436 objBgMove (83, 16, 16) goto @437 @436 goto_unless (intB[2] == 1) @437 objBgMove (83, 16, 66) @437 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @438 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @438 bgrMulti (strS[1000], 0) #res<0646> pause koePlay (2121266) #res<0647> pause goto_unless (intF[1107] == 1) @439 intF[1107] = 0 msgHide @439 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @443 goto_unless (!intF[4]) @440 strS[1003] = 'SDT07' goto @441 @440 goto_unless (intF[4] == 1) @441 strS[1003] = 'SDT08' @441 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @442 objBgMove (83, 16, 16) goto @443 @442 goto_unless (intB[2] == 1) @443 objBgMove (83, 16, 66) @443 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @444 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @444 bgrMulti (strS[1000], 60, copy('CGHR24', 61)) koePlay (2121267) #res<0648> pause koePlay (2121268) #res<0649> pause koePlay (2121269) #res<0650> pause koePlay (2121270) #res<0651> pause goto_unless (intF[1107] == 1) @445 intF[1107] = 0 msgHide @445 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @449 goto_unless (!intF[4]) @446 strS[1003] = 'SDT07' goto @447 @446 goto_unless (intF[4] == 1) @447 strS[1003] = 'SDT08' @447 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @448 objBgMove (83, 16, 16) goto @449 @448 goto_unless (intB[2] == 1) @449 objBgMove (83, 16, 66) @449 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @450 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @450 bgrMulti (strS[1000], 60, copy('CGHR23', 61)) koePlay (2121271) #res<0652> pause goto_unless (intF[1107] == 1) @451 intF[1107] = 0 msgHide @451 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @455 goto_unless (!intF[4]) @452 strS[1003] = 'SDT07' goto @453 @452 goto_unless (intF[4] == 1) @453 strS[1003] = 'SDT08' @453 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @454 objBgMove (83, 16, 16) goto @455 @454 goto_unless (intB[2] == 1) @455 objBgMove (83, 16, 66) @455 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @456 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @456 bgrMulti (strS[1000], 0) koePlay (2121272) #res<0653> pause koePlay (2121273) #res<0654> pause koePlay (2121274) #res<0655> pause koePlay (2121275) #res<0656> pause koePlay (2121276) #res<0657> pause koePlay (2121277) #res<0658> pause #res<0659> pause koePlay (2121278) #res<0660> pause koePlay (2121279) #res<0661> pause koePlay (2121280) #res<0662> pause koePlay (2121281) #res<0663> pause goto_unless (intF[1107] == 1) @457 intF[1107] = 0 msgHide @457 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @461 goto_unless (!intF[4]) @458 strS[1003] = 'SDT07' goto @459 @458 goto_unless (intF[4] == 1) @459 strS[1003] = 'SDT08' @459 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @460 objBgMove (83, 16, 16) goto @461 @460 goto_unless (intB[2] == 1) @461 objBgMove (83, 16, 66) @461 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @462 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @462 bgrMulti (strS[1000], 60, copy('CGHR24', 61)) koePlay (2121282) #res<0664> pause koePlay (2121283) #res<0665> pause koePlay (2121284) #res<0666> pause koePlay (2121285) #res<0667> pause koePlay (2121286) #res<0668> pause koePlay (2121287) #res<0669> pause koePlay (2121288) #res<0670> pause koePlay (2121289) #res<0671> pause goto_unless (intF[1107] == 1) @463 intF[1107] = 0 msgHide @463 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @467 goto_unless (!intF[4]) @464 strS[1003] = 'SDT07' goto @465 @464 goto_unless (intF[4] == 1) @465 strS[1003] = 'SDT08' @465 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @466 objBgMove (83, 16, 16) goto @467 @466 goto_unless (intB[2] == 1) @467 objBgMove (83, 16, 66) @467 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @468 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @468 bgrMulti (strS[1000], 60, copy('CGHR23', 61)) koePlay (2121290) #res<0672> pause koePlay (2121291) #res<0673> pause goto_unless (intF[1107] == 1) @469 intF[1107] = 0 msgHide @469 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @473 goto_unless (!intF[4]) @470 strS[1003] = 'SDT07' goto @471 @470 goto_unless (intF[4] == 1) @471 strS[1003] = 'SDT08' @471 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @472 objBgMove (83, 16, 16) goto @473 @472 goto_unless (intB[2] == 1) @473 objBgMove (83, 16, 66) @473 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @474 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @474 bgrMulti (strS[1000], 60, copy('CGHR25', 61)) koePlay (2121292) #res<0674> pause koePlay (2121293) #res<0675> pause koePlay (2121294) #res<0676> pause koePlay (2121295) #res<0677> pause koePlay (2121296) #res<0678> pause goto_unless (intF[1107] == 1) @475 intF[1107] = 0 msgHide @475 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @479 goto_unless (!intF[4]) @476 strS[1003] = 'SDT07' goto @477 @476 goto_unless (intF[4] == 1) @477 strS[1003] = 'SDT08' @477 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @478 objBgMove (83, 16, 16) goto @479 @478 goto_unless (intB[2] == 1) @479 objBgMove (83, 16, 66) @479 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @480 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @480 bgrMulti (strS[1000], 0) #res<0679> pause koePlay (2121297) #res<0680> pause koePlay (2121298) #res<0681> pause koePlay (2121299) #res<0682> pause koePlay (2121300) #res<0683> pause goto_unless (intF[1107] == 1) @481 intF[1107] = 0 msgHide @481 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @485 goto_unless (!intF[4]) @482 strS[1003] = 'SDT07' goto @483 @482 goto_unless (intF[4] == 1) @483 strS[1003] = 'SDT08' @483 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @484 objBgMove (83, 16, 16) goto @485 @484 goto_unless (intB[2] == 1) @485 objBgMove (83, 16, 66) @485 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @486 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @486 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121301) #res<0684> pause koePlay (2121302) #res<0685> pause koePlay (2121303) #res<0686> pause koePlay (2121304) #res<0687> pause koePlay (2121305) #res<0688> pause goto_unless (intF[1107] == 1) @487 intF[1107] = 0 msgHide @487 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @491 goto_unless (!intF[4]) @488 strS[1003] = 'SDT07' goto @489 @488 goto_unless (intF[4] == 1) @489 strS[1003] = 'SDT08' @489 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @490 objBgMove (83, 16, 16) goto @491 @490 goto_unless (intB[2] == 1) @491 objBgMove (83, 16, 66) @491 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @492 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @492 bgrMulti (strS[1000], 60, copy('CGHR24', 61)) koePlay (2121306) #res<0689> pause koePlay (2121307) #res<0690> pause koePlay (2121308) #res<0691> pause #res<0692> pause koePlay (2121309) #res<0693> pause koePlay (2121310) #res<0694> pause koePlay (2121311) #res<0695> pause koePlay (2121312) #res<0696> pause koePlay (2121313) #res<0697> pause koePlay (2121314) #res<0698> pause koePlay (2121315) #res<0699> pause goto_unless (intF[1107] == 1) @493 intF[1107] = 0 msgHide @493 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @497 goto_unless (!intF[4]) @494 strS[1003] = 'SDT07' goto @495 @494 goto_unless (intF[4] == 1) @495 strS[1003] = 'SDT08' @495 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @496 objBgMove (83, 16, 16) goto @497 @496 goto_unless (intB[2] == 1) @497 objBgMove (83, 16, 66) @497 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @498 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @498 bgrMulti (strS[1000], 60, copy('CGHR25', 61)) #res<0700> pause koePlay (2121316) #res<0701> pause koePlay (2121317) #res<0702> pause koePlay (2121318) #res<0703> pause koePlay (2121319) #res<0704> pause koePlay (2121320) #res<0705> pause koePlay (2121321) #res<0706> pause koePlay (2121322) #res<0707> pause koePlay (2121323) #res<0708> pause koePlay (2121324) #res<0709> pause koePlay (2121325) #res<0710> pause koePlay (2121326) #res<0711> pause goto_unless (intF[1107] == 1) @499 intF[1107] = 0 msgHide @499 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @503 goto_unless (!intF[4]) @500 strS[1003] = 'SDT07' goto @501 @500 goto_unless (intF[4] == 1) @501 strS[1003] = 'SDT08' @501 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @502 objBgMove (83, 16, 16) goto @503 @502 goto_unless (intB[2] == 1) @503 objBgMove (83, 16, 66) @503 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @504 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @504 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121327) #res<0712> pause #res<0713> pause goto_unless (intF[1107] == 1) @505 intF[1107] = 0 msgHide @505 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @509 goto_unless (!intF[4]) @506 strS[1003] = 'SDT07' goto @507 @506 goto_unless (intF[4] == 1) @507 strS[1003] = 'SDT08' @507 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @508 objBgMove (83, 16, 16) goto @509 @508 goto_unless (intB[2] == 1) @509 objBgMove (83, 16, 66) @509 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @510 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @510 bgrMulti (strS[1000], 60, copy('CGHR25', 61)) koePlay (2121328) #res<0714> pause #res<0715> pause koePlay (2121329) #res<0716> pause koePlay (2121330) #res<0717> pause koePlay (2121331) #res<0718> pause goto_unless (intF[1107] == 1) @511 intF[1107] = 0 msgHide @511 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @515 goto_unless (!intF[4]) @512 strS[1003] = 'SDT07' goto @513 @512 goto_unless (intF[4] == 1) @513 strS[1003] = 'SDT08' @513 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @514 objBgMove (83, 16, 16) goto @515 @514 goto_unless (intB[2] == 1) @515 objBgMove (83, 16, 66) @515 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @516 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @516 bgrMulti (strS[1000], 0) #res<0719> pause #res<0720> pause #res<0721> pause bgmFadeOut (1200) msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) #res<0722> pause #res<0723> pause #res<0724> pause intF[1107] = 1 strS[1000] = 'BG009' goto_unless (intF[1107] == 1) @517 intF[1107] = 0 msgHide @517 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @521 goto_unless (!intF[4]) @518 strS[1003] = 'SDT07' goto @519 @518 goto_unless (intF[4] == 1) @519 strS[1003] = 'SDT08' @519 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @520 objBgMove (83, 16, 16) goto @521 @520 goto_unless (intB[2] == 1) @521 objBgMove (83, 16, 66) @521 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @522 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @522 bgrMulti (strS[1000], 0) bgmFadeOutEx bgmLoop ('BGM19') #res<0725> pause #res<0726> pause goto_unless (intF[1107] == 1) @523 intF[1107] = 0 msgHide @523 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @527 goto_unless (!intF[4]) @524 strS[1003] = 'SDT07' goto @525 @524 goto_unless (intF[4] == 1) @525 strS[1003] = 'SDT08' @525 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @526 objBgMove (83, 16, 16) goto @527 @526 goto_unless (intB[2] == 1) @527 objBgMove (83, 16, 66) @527 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @528 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @528 bgrMulti (strS[1000], 60, copy('CGMZ25P', 61)) koePlay (2121332) #res<0727> pause koePlay (2121333) #res<0728> pause goto_unless (intF[1107] == 1) @529 intF[1107] = 0 msgHide @529 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @533 goto_unless (!intF[4]) @530 strS[1003] = 'SDT07' goto @531 @530 goto_unless (intF[4] == 1) @531 strS[1003] = 'SDT08' @531 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @532 objBgMove (83, 16, 16) goto @533 @532 goto_unless (intB[2] == 1) @533 objBgMove (83, 16, 66) @533 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @534 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @534 bgrMulti (strS[1000], 60, copy('CGMZ23P', 61)) koePlay (2121334) #res<0729> pause goto_unless (intF[1107] == 1) @535 intF[1107] = 0 msgHide @535 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @539 goto_unless (!intF[4]) @536 strS[1003] = 'SDT07' goto @537 @536 goto_unless (intF[4] == 1) @537 strS[1003] = 'SDT08' @537 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @538 objBgMove (83, 16, 16) goto @539 @538 goto_unless (intB[2] == 1) @539 objBgMove (83, 16, 66) @539 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @540 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @540 bgrMulti (strS[1000], 60, copy('CGMZ25P', 61)) koePlay (2121335) #res<0730> pause #res<0731> pause goto_unless (intF[1107] == 1) @541 intF[1107] = 0 msgHide @541 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @545 goto_unless (!intF[4]) @542 strS[1003] = 'SDT07' goto @543 @542 goto_unless (intF[4] == 1) @543 strS[1003] = 'SDT08' @543 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @544 objBgMove (83, 16, 16) goto @545 @544 goto_unless (intB[2] == 1) @545 objBgMove (83, 16, 66) @545 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @546 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @546 bgrMulti (strS[1000], 60, copy('CGMZ24P', 61)) koePlay (2121336) #res<0732> pause koePlay (2121337) #res<0733> pause goto_unless (intF[1107] == 1) @547 intF[1107] = 0 msgHide @547 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @551 goto_unless (!intF[4]) @548 strS[1003] = 'SDT07' goto @549 @548 goto_unless (intF[4] == 1) @549 strS[1003] = 'SDT08' @549 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @550 objBgMove (83, 16, 16) goto @551 @550 goto_unless (intB[2] == 1) @551 objBgMove (83, 16, 66) @551 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @552 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @552 bgrMulti (strS[1000], 0) #res<0734> pause #res<0735> pause goto_unless (intF[1107] == 1) @553 intF[1107] = 0 msgHide @553 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @557 goto_unless (!intF[4]) @554 strS[1003] = 'SDT07' goto @555 @554 goto_unless (intF[4] == 1) @555 strS[1003] = 'SDT08' @555 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @556 objBgMove (83, 16, 16) goto @557 @556 goto_unless (intB[2] == 1) @557 objBgMove (83, 16, 66) @557 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @558 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @558 bgrMulti (strS[1000], 60, copy('CGMZ24P', 61)) koePlay (2121338) #res<0736> pause koePlay (2121339) #res<0737> pause koePlay (2121340) #res<0738> pause koePlay (2121341) #res<0739> pause koePlay (2121342) #res<0740> pause koePlay (2121343) #res<0741> pause koePlay (2121344) #res<0742> pause goto_unless (intF[1107] == 1) @559 intF[1107] = 0 msgHide @559 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @563 goto_unless (!intF[4]) @560 strS[1003] = 'SDT07' goto @561 @560 goto_unless (intF[4] == 1) @561 strS[1003] = 'SDT08' @561 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @562 objBgMove (83, 16, 16) goto @563 @562 goto_unless (intB[2] == 1) @563 objBgMove (83, 16, 66) @563 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @564 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @564 bgrMulti (strS[1000], 60, copy('CGMZ21P', 61)) koePlay (2121345) #res<0743> pause goto_unless (intF[1107] == 1) @565 intF[1107] = 0 msgHide @565 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @569 goto_unless (!intF[4]) @566 strS[1003] = 'SDT07' goto @567 @566 goto_unless (intF[4] == 1) @567 strS[1003] = 'SDT08' @567 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @568 objBgMove (83, 16, 16) goto @569 @568 goto_unless (intB[2] == 1) @569 objBgMove (83, 16, 66) @569 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @570 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @570 bgrMulti (strS[1000], 60, copy('CGMZ22P', 61)) koePlay (2121346) #res<0744> pause #res<0745> pause goto_unless (intF[1107] == 1) @571 intF[1107] = 0 msgHide @571 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @575 goto_unless (!intF[4]) @572 strS[1003] = 'SDT07' goto @573 @572 goto_unless (intF[4] == 1) @573 strS[1003] = 'SDT08' @573 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @574 objBgMove (83, 16, 16) goto @575 @574 goto_unless (intB[2] == 1) @575 objBgMove (83, 16, 66) @575 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @576 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @576 bgrMulti (strS[1000], 0) #res<0746> pause msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) intF[1107] = 1 strS[1000] = 'BG009' goto_unless (intF[1107] == 1) @577 intF[1107] = 0 msgHide @577 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @581 goto_unless (!intF[4]) @578 strS[1003] = 'SDT07' goto @579 @578 goto_unless (intF[4] == 1) @579 strS[1003] = 'SDT08' @579 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @580 objBgMove (83, 16, 16) goto @581 @580 goto_unless (intB[2] == 1) @581 objBgMove (83, 16, 66) @581 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @582 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @582 bgrMulti (strS[1000], 0) goto_unless (intF[1107] == 1) @583 intF[1107] = 0 msgHide @583 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @587 goto_unless (!intF[4]) @584 strS[1003] = 'SDT07' goto @585 @584 goto_unless (intF[4] == 1) @585 strS[1003] = 'SDT08' @585 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @586 objBgMove (83, 16, 16) goto @587 @586 goto_unless (intB[2] == 1) @587 objBgMove (83, 16, 66) @587 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @588 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @588 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121347) #res<0747> pause koePlay (2121348) #res<0748> pause koePlay (2121349) #res<0749> pause goto_unless (intF[1107] == 1) @589 intF[1107] = 0 msgHide @589 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @593 goto_unless (!intF[4]) @590 strS[1003] = 'SDT07' goto @591 @590 goto_unless (intF[4] == 1) @591 strS[1003] = 'SDT08' @591 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @592 objBgMove (83, 16, 16) goto @593 @592 goto_unless (intB[2] == 1) @593 objBgMove (83, 16, 66) @593 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @594 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @594 bgrMulti (strS[1000], 60, copy('CGHR25', 61)) koePlay (2121350) #res<0750> pause koePlay (2121351) #res<0751> pause goto_unless (intF[1107] == 1) @595 intF[1107] = 0 msgHide @595 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @599 goto_unless (!intF[4]) @596 strS[1003] = 'SDT07' goto @597 @596 goto_unless (intF[4] == 1) @597 strS[1003] = 'SDT08' @597 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @598 objBgMove (83, 16, 16) goto @599 @598 goto_unless (intB[2] == 1) @599 objBgMove (83, 16, 66) @599 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @600 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @600 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121352) #res<0752> pause koePlay (2121353) #res<0753> pause koePlay (2121354) #res<0754> pause goto_unless (intF[1107] == 1) @601 intF[1107] = 0 msgHide @601 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @605 goto_unless (!intF[4]) @602 strS[1003] = 'SDT07' goto @603 @602 goto_unless (intF[4] == 1) @603 strS[1003] = 'SDT08' @603 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @604 objBgMove (83, 16, 16) goto @605 @604 goto_unless (intB[2] == 1) @605 objBgMove (83, 16, 66) @605 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @606 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @606 bgrMulti (strS[1000], 0) #res<0755> pause #res<0756> pause goto_unless (intF[1107] == 1) @607 intF[1107] = 0 msgHide @607 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @611 goto_unless (!intF[4]) @608 strS[1003] = 'SDT07' goto @609 @608 goto_unless (intF[4] == 1) @609 strS[1003] = 'SDT08' @609 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @610 objBgMove (83, 16, 16) goto @611 @610 goto_unless (intB[2] == 1) @611 objBgMove (83, 16, 66) @611 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @612 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @612 bgrMulti (strS[1000], 60, copy('CGHR25', 61)) koePlay (2121355) #res<0757> pause #res<0758> pause goto_unless (intF[1107] == 1) @613 intF[1107] = 0 msgHide @613 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @617 goto_unless (!intF[4]) @614 strS[1003] = 'SDT07' goto @615 @614 goto_unless (intF[4] == 1) @615 strS[1003] = 'SDT08' @615 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @616 objBgMove (83, 16, 16) goto @617 @616 goto_unless (intB[2] == 1) @617 objBgMove (83, 16, 66) @617 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @618 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @618 bgrMulti (strS[1000], 0) #res<0759> pause #res<0760> pause goto_unless (intF[1107] == 1) @619 intF[1107] = 0 msgHide @619 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @623 goto_unless (!intF[4]) @620 strS[1003] = 'SDT07' goto @621 @620 goto_unless (intF[4] == 1) @621 strS[1003] = 'SDT08' @621 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @622 objBgMove (83, 16, 16) goto @623 @622 goto_unless (intB[2] == 1) @623 objBgMove (83, 16, 66) @623 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @624 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @624 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121356) #res<0761> pause #res<0762> pause koePlay (2121357) #res<0763> pause goto_unless (intF[1107] == 1) @625 intF[1107] = 0 msgHide @625 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @629 goto_unless (!intF[4]) @626 strS[1003] = 'SDT07' goto @627 @626 goto_unless (intF[4] == 1) @627 strS[1003] = 'SDT08' @627 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @628 objBgMove (83, 16, 16) goto @629 @628 goto_unless (intB[2] == 1) @629 objBgMove (83, 16, 66) @629 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @630 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @630 bgrMulti (strS[1000], 60, copy('CGHR11', 61)) koePlay (2121358) #res<0764> pause goto_unless (intF[1107] == 1) @631 intF[1107] = 0 msgHide @631 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @635 goto_unless (!intF[4]) @632 strS[1003] = 'SDT07' goto @633 @632 goto_unless (intF[4] == 1) @633 strS[1003] = 'SDT08' @633 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @634 objBgMove (83, 16, 16) goto @635 @634 goto_unless (intB[2] == 1) @635 objBgMove (83, 16, 66) @635 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @636 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @636 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121359) #res<0765> pause goto_unless (intF[1107] == 1) @637 intF[1107] = 0 msgHide @637 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @641 goto_unless (!intF[4]) @638 strS[1003] = 'SDT07' goto @639 @638 goto_unless (intF[4] == 1) @639 strS[1003] = 'SDT08' @639 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @640 objBgMove (83, 16, 16) goto @641 @640 goto_unless (intB[2] == 1) @641 objBgMove (83, 16, 66) @641 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @642 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @642 bgrMulti (strS[1000], 0) #res<0766> pause goto_unless (intF[1107] == 1) @643 intF[1107] = 0 msgHide @643 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @647 goto_unless (!intF[4]) @644 strS[1003] = 'SDT07' goto @645 @644 goto_unless (intF[4] == 1) @645 strS[1003] = 'SDT08' @645 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @646 objBgMove (83, 16, 16) goto @647 @646 goto_unless (intB[2] == 1) @647 objBgMove (83, 16, 66) @647 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @648 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @648 bgrMulti (strS[1000], 60, copy('CGMZ23P', 61)) koePlay (2121360) #res<0767> pause #res<0768> pause koePlay (2121361) #res<0769> pause goto_unless (intF[1107] == 1) @649 intF[1107] = 0 msgHide @649 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @653 goto_unless (!intF[4]) @650 strS[1003] = 'SDT07' goto @651 @650 goto_unless (intF[4] == 1) @651 strS[1003] = 'SDT08' @651 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @652 objBgMove (83, 16, 16) goto @653 @652 goto_unless (intB[2] == 1) @653 objBgMove (83, 16, 66) @653 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @654 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @654 bgrMulti (strS[1000], 60, copy('CGMZ20P', 61)) koePlay (2121362) #res<0770> pause koePlay (2121363) #res<0771> pause koePlay (2121364) #res<0772> pause goto_unless (intF[1107] == 1) @655 intF[1107] = 0 msgHide @655 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @659 goto_unless (!intF[4]) @656 strS[1003] = 'SDT07' goto @657 @656 goto_unless (intF[4] == 1) @657 strS[1003] = 'SDT08' @657 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @658 objBgMove (83, 16, 16) goto @659 @658 goto_unless (intB[2] == 1) @659 objBgMove (83, 16, 66) @659 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @660 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @660 bgrMulti (strS[1000], 60, copy('CGMZ24P', 61)) koePlay (2121365) #res<0773> pause koePlay (2121366) #res<0774> pause goto_unless (intF[1107] == 1) @661 intF[1107] = 0 msgHide @661 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @665 goto_unless (!intF[4]) @662 strS[1003] = 'SDT07' goto @663 @662 goto_unless (intF[4] == 1) @663 strS[1003] = 'SDT08' @663 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @664 objBgMove (83, 16, 16) goto @665 @664 goto_unless (intB[2] == 1) @665 objBgMove (83, 16, 66) @665 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @666 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @666 bgrMulti (strS[1000], 60, copy('CGMZ22P', 61)) #res<0775> pause koePlay (2121367) #res<0776> pause goto_unless (intF[1107] == 1) @667 intF[1107] = 0 msgHide @667 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @671 goto_unless (!intF[4]) @668 strS[1003] = 'SDT07' goto @669 @668 goto_unless (intF[4] == 1) @669 strS[1003] = 'SDT08' @669 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @670 objBgMove (83, 16, 16) goto @671 @670 goto_unless (intB[2] == 1) @671 objBgMove (83, 16, 66) @671 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @672 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @672 bgrMulti (strS[1000], 0) #res<0777> pause goto_unless (intF[1107] == 1) @673 intF[1107] = 0 msgHide @673 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @677 goto_unless (!intF[4]) @674 strS[1003] = 'SDT07' goto @675 @674 goto_unless (intF[4] == 1) @675 strS[1003] = 'SDT08' @675 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @676 objBgMove (83, 16, 16) goto @677 @676 goto_unless (intB[2] == 1) @677 objBgMove (83, 16, 66) @677 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @678 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @678 bgrMulti (strS[1000], 60, copy('CGHR11', 61)) koePlay (2121368) #res<0778> pause #res<0779> pause koePlay (2121369) #res<0780> pause #res<0781> pause goto_unless (intF[1107] == 1) @679 intF[1107] = 0 msgHide @679 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @683 goto_unless (!intF[4]) @680 strS[1003] = 'SDT07' goto @681 @680 goto_unless (intF[4] == 1) @681 strS[1003] = 'SDT08' @681 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @682 objBgMove (83, 16, 16) goto @683 @682 goto_unless (intB[2] == 1) @683 objBgMove (83, 16, 66) @683 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @684 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @684 bgrMulti (strS[1000], 60, copy('CGHR14', 61)) koePlay (2121370) #res<0782> pause goto_unless (intF[1107] == 1) @685 intF[1107] = 0 msgHide @685 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @689 goto_unless (!intF[4]) @686 strS[1003] = 'SDT07' goto @687 @686 goto_unless (intF[4] == 1) @687 strS[1003] = 'SDT08' @687 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @688 objBgMove (83, 16, 16) goto @689 @688 goto_unless (intB[2] == 1) @689 objBgMove (83, 16, 66) @689 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @690 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @690 bgrMulti (strS[1000], 60, copy('CGHR11', 61)) koePlay (2121371) #res<0783> pause koePlay (2121372) #res<0784> pause #res<0785> pause goto_unless (intF[1107] == 1) @691 intF[1107] = 0 msgHide @691 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @695 goto_unless (!intF[4]) @692 strS[1003] = 'SDT07' goto @693 @692 goto_unless (intF[4] == 1) @693 strS[1003] = 'SDT08' @693 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @694 objBgMove (83, 16, 16) goto @695 @694 goto_unless (intB[2] == 1) @695 objBgMove (83, 16, 66) @695 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @696 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @696 bgrMulti (strS[1000], 60, copy('CGMZ22P', 61)) koePlay (2121373) #res<0786> pause koePlay (2121374) #res<0787> pause koePlay (2121375) #res<0788> pause goto_unless (intF[1107] == 1) @697 intF[1107] = 0 msgHide @697 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @701 goto_unless (!intF[4]) @698 strS[1003] = 'SDT07' goto @699 @698 goto_unless (intF[4] == 1) @699 strS[1003] = 'SDT08' @699 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @700 objBgMove (83, 16, 16) goto @701 @700 goto_unless (intB[2] == 1) @701 objBgMove (83, 16, 66) @701 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @702 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @702 bgrMulti (strS[1000], 0) koePlay (2121376) #res<0789> pause koePlay (2121377) #res<0790> pause goto_unless (intF[1107] == 1) @703 intF[1107] = 0 msgHide @703 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @707 goto_unless (!intF[4]) @704 strS[1003] = 'SDT07' goto @705 @704 goto_unless (intF[4] == 1) @705 strS[1003] = 'SDT08' @705 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @706 objBgMove (83, 16, 16) goto @707 @706 goto_unless (intB[2] == 1) @707 objBgMove (83, 16, 66) @707 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @708 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @708 bgrMulti (strS[1000], 60, copy('CGHR25', 61)) koePlay (2121378) #res<0791> pause koePlay (2121379) #res<0792> pause koePlay (2121380) #res<0793> pause koePlay (2121381) #res<0794> pause koePlay (2121382) #res<0795> pause koePlay (2121383) #res<0796> pause koePlay (2121384) #res<0797> pause koePlay (2121385) #res<0798> pause koePlay (2121386) #res<0799> pause koePlay (2121387) #res<0800> pause koePlay (2121388) #res<0801> pause koePlay (2121389) #res<0802> pause #res<0803> pause koePlay (2121390) #res<0804> pause goto_unless (intF[1107] == 1) @709 intF[1107] = 0 msgHide @709 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @713 goto_unless (!intF[4]) @710 strS[1003] = 'SDT07' goto @711 @710 goto_unless (intF[4] == 1) @711 strS[1003] = 'SDT08' @711 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @712 objBgMove (83, 16, 16) goto @713 @712 goto_unless (intB[2] == 1) @713 objBgMove (83, 16, 66) @713 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @714 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @714 bgrMulti (strS[1000], 0) #res<0805> pause #res<0806> pause goto_unless (intF[1107] == 1) @715 intF[1107] = 0 msgHide @715 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @719 goto_unless (!intF[4]) @716 strS[1003] = 'SDT07' goto @717 @716 goto_unless (intF[4] == 1) @717 strS[1003] = 'SDT08' @717 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @718 objBgMove (83, 16, 16) goto @719 @718 goto_unless (intB[2] == 1) @719 objBgMove (83, 16, 66) @719 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @720 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @720 bgrMulti (strS[1000], 60, copy('CGMZ22P', 61)) #res<0807> pause koePlay (2121391) #res<0808> pause #res<0809> pause koePlay (2121392) #res<0810> pause koePlay (2121393) #res<0811> pause koePlay (2121394) #res<0812> pause koePlay (2121395) #res<0813> pause goto_unless (intF[1107] == 1) @721 intF[1107] = 0 msgHide @721 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @725 goto_unless (!intF[4]) @722 strS[1003] = 'SDT07' goto @723 @722 goto_unless (intF[4] == 1) @723 strS[1003] = 'SDT08' @723 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @724 objBgMove (83, 16, 16) goto @725 @724 goto_unless (intB[2] == 1) @725 objBgMove (83, 16, 66) @725 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @726 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @726 bgrMulti (strS[1000], 0) koePlay (2121396) #res<0814> pause #res<0815> pause koePlay (2121397) #res<0816> pause koePlay (2121398) #res<0817> pause goto_unless (intF[1107] == 1) @727 intF[1107] = 0 msgHide @727 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @731 goto_unless (!intF[4]) @728 strS[1003] = 'SDT07' goto @729 @728 goto_unless (intF[4] == 1) @729 strS[1003] = 'SDT08' @729 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @730 objBgMove (83, 16, 16) goto @731 @730 goto_unless (intB[2] == 1) @731 objBgMove (83, 16, 66) @731 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @732 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @732 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121399) #res<0818> pause koePlay (2121400) #res<0819> pause koePlay (2121401) #res<0820> pause goto_unless (intF[1107] == 1) @733 intF[1107] = 0 msgHide @733 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @737 goto_unless (!intF[4]) @734 strS[1003] = 'SDT07' goto @735 @734 goto_unless (intF[4] == 1) @735 strS[1003] = 'SDT08' @735 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @736 objBgMove (83, 16, 16) goto @737 @736 goto_unless (intB[2] == 1) @737 objBgMove (83, 16, 66) @737 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @738 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @738 bgrMulti (strS[1000], 60, copy('CGHR25', 61)) koePlay (2121402) #res<0821> pause koePlay (2121403) #res<0822> pause koePlay (2121404) #res<0823> pause koePlay (2121405) #res<0824> pause koePlay (2121406) #res<0825> pause goto_unless (intF[1107] == 1) @739 intF[1107] = 0 msgHide @739 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @743 goto_unless (!intF[4]) @740 strS[1003] = 'SDT07' goto @741 @740 goto_unless (intF[4] == 1) @741 strS[1003] = 'SDT08' @741 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @742 objBgMove (83, 16, 16) goto @743 @742 goto_unless (intB[2] == 1) @743 objBgMove (83, 16, 66) @743 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @744 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @744 bgrMulti (strS[1000], 60, copy('CGHR11', 61)) koePlay (2121407) #res<0826> pause koePlay (2121408) #res<0827> pause goto_unless (intF[1107] == 1) @745 intF[1107] = 0 msgHide @745 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @749 goto_unless (!intF[4]) @746 strS[1003] = 'SDT07' goto @747 @746 goto_unless (intF[4] == 1) @747 strS[1003] = 'SDT08' @747 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @748 objBgMove (83, 16, 16) goto @749 @748 goto_unless (intB[2] == 1) @749 objBgMove (83, 16, 66) @749 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @750 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @750 bgrMulti (strS[1000], 0) goto_unless (intF[1107] == 1) @751 intF[1107] = 0 msgHide @751 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @755 goto_unless (!intF[4]) @752 strS[1003] = 'SDT07' goto @753 @752 goto_unless (intF[4] == 1) @753 strS[1003] = 'SDT08' @753 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @754 objBgMove (83, 16, 16) goto @755 @754 goto_unless (intB[2] == 1) @755 objBgMove (83, 16, 66) @755 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @756 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @756 bgrMulti (strS[1000], 60, copy('CGMZ21P', 61)) koePlay (2121409) #res<0828> pause goto_unless (intF[1107] == 1) @757 intF[1107] = 0 msgHide @757 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @761 goto_unless (!intF[4]) @758 strS[1003] = 'SDT07' goto @759 @758 goto_unless (intF[4] == 1) @759 strS[1003] = 'SDT08' @759 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @760 objBgMove (83, 16, 16) goto @761 @760 goto_unless (intB[2] == 1) @761 objBgMove (83, 16, 66) @761 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @762 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @762 bgrMulti (strS[1000], 60, copy('CGMZ26P', 61)) koePlay (2121410) #res<0829> pause goto_unless (intF[1107] == 1) @763 intF[1107] = 0 msgHide @763 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @767 goto_unless (!intF[4]) @764 strS[1003] = 'SDT07' goto @765 @764 goto_unless (intF[4] == 1) @765 strS[1003] = 'SDT08' @765 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @766 objBgMove (83, 16, 16) goto @767 @766 goto_unless (intB[2] == 1) @767 objBgMove (83, 16, 66) @767 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @768 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @768 bgrMulti (strS[1000], 0) #res<0830> pause #res<0831> pause #res<0832> pause #res<0833> pause goto_unless (intF[1107] == 1) @769 intF[1107] = 0 msgHide @769 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @773 goto_unless (!intF[4]) @770 strS[1003] = 'SDT07' goto @771 @770 goto_unless (intF[4] == 1) @771 strS[1003] = 'SDT08' @771 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @772 objBgMove (83, 16, 16) goto @773 @772 goto_unless (intB[2] == 1) @773 objBgMove (83, 16, 66) @773 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @774 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @774 bgrMulti (strS[1000], 60, copy('CGHR13', 61)) koePlay (2121411) #res<0834> pause #res<0835> pause koePlay (2121412) #res<0836> pause koePlay (2121413) #res<0837> pause koePlay (2121414) #res<0838> pause goto_unless (intF[1107] == 1) @775 intF[1107] = 0 msgHide @775 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @779 goto_unless (!intF[4]) @776 strS[1003] = 'SDT07' goto @777 @776 goto_unless (intF[4] == 1) @777 strS[1003] = 'SDT08' @777 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @778 objBgMove (83, 16, 16) goto @779 @778 goto_unless (intB[2] == 1) @779 objBgMove (83, 16, 66) @779 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @780 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @780 bgrMulti (strS[1000], 60, copy('CGHR11', 61)) koePlay (2121415) #res<0839> pause koePlay (2121416) #res<0840> pause koePlay (2121417) #res<0841> pause goto_unless (intF[1107] == 1) @781 intF[1107] = 0 msgHide @781 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @785 goto_unless (!intF[4]) @782 strS[1003] = 'SDT07' goto @783 @782 goto_unless (intF[4] == 1) @783 strS[1003] = 'SDT08' @783 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @784 objBgMove (83, 16, 16) goto @785 @784 goto_unless (intB[2] == 1) @785 objBgMove (83, 16, 66) @785 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @786 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @786 bgrMulti (strS[1000], 60, copy('CGHR17', 61)) #res<0842> pause koePlay (2121418) #res<0843> pause goto_unless (intF[1107] == 1) @787 intF[1107] = 0 msgHide @787 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @791 goto_unless (!intF[4]) @788 strS[1003] = 'SDT07' goto @789 @788 goto_unless (intF[4] == 1) @789 strS[1003] = 'SDT08' @789 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @790 objBgMove (83, 16, 16) goto @791 @790 goto_unless (intB[2] == 1) @791 objBgMove (83, 16, 66) @791 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @792 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @792 bgrMulti (strS[1000], 60, copy('CGHR12', 61)) koePlay (2121419) #res<0844> pause koePlay (2121420) #res<0845> pause goto_unless (intF[1107] == 1) @793 intF[1107] = 0 msgHide @793 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @797 goto_unless (!intF[4]) @794 strS[1003] = 'SDT07' goto @795 @794 goto_unless (intF[4] == 1) @795 strS[1003] = 'SDT08' @795 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @796 objBgMove (83, 16, 16) goto @797 @796 goto_unless (intB[2] == 1) @797 objBgMove (83, 16, 66) @797 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @798 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @798 bgrMulti (strS[1000], 60, copy('CGHR17', 61)) koePlay (2121421) #res<0846> pause koePlay (2121422) #res<0847> pause koePlay (2121423) #res<0848> pause #res<0849> pause koePlay (2121424) #res<0850> pause goto_unless (intF[1107] == 1) @799 intF[1107] = 0 msgHide @799 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @803 goto_unless (!intF[4]) @800 strS[1003] = 'SDT07' goto @801 @800 goto_unless (intF[4] == 1) @801 strS[1003] = 'SDT08' @801 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @802 objBgMove (83, 16, 16) goto @803 @802 goto_unless (intB[2] == 1) @803 objBgMove (83, 16, 66) @803 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @804 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @804 bgrMulti (strS[1000], 60, copy('CGHR11', 61)) koePlay (2121425) #res<0851> pause #res<0852> pause goto_unless (intF[1107] == 1) @805 intF[1107] = 0 msgHide @805 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @809 goto_unless (!intF[4]) @806 strS[1003] = 'SDT07' goto @807 @806 goto_unless (intF[4] == 1) @807 strS[1003] = 'SDT08' @807 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @808 objBgMove (83, 16, 16) goto @809 @808 goto_unless (intB[2] == 1) @809 objBgMove (83, 16, 66) @809 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @810 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @810 bgrMulti (strS[1000], 60, copy('CGHR14', 61)) koePlay (2121426) #res<0853> pause koePlay (2121427) #res<0854> pause goto_unless (intF[1107] == 1) @811 intF[1107] = 0 msgHide @811 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @815 goto_unless (!intF[4]) @812 strS[1003] = 'SDT07' goto @813 @812 goto_unless (intF[4] == 1) @813 strS[1003] = 'SDT08' @813 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @814 objBgMove (83, 16, 16) goto @815 @814 goto_unless (intB[2] == 1) @815 objBgMove (83, 16, 66) @815 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @816 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @816 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121428) #res<0855> pause goto_unless (intF[1107] == 1) @817 intF[1107] = 0 msgHide @817 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @821 goto_unless (!intF[4]) @818 strS[1003] = 'SDT07' goto @819 @818 goto_unless (intF[4] == 1) @819 strS[1003] = 'SDT08' @819 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @820 objBgMove (83, 16, 16) goto @821 @820 goto_unless (intB[2] == 1) @821 objBgMove (83, 16, 66) @821 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @822 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @822 bgrMulti (strS[1000], 0) #res<0856> pause goto_unless (intF[1107] == 1) @823 intF[1107] = 0 msgHide @823 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @827 goto_unless (!intF[4]) @824 strS[1003] = 'SDT07' goto @825 @824 goto_unless (intF[4] == 1) @825 strS[1003] = 'SDT08' @825 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @826 objBgMove (83, 16, 16) goto @827 @826 goto_unless (intB[2] == 1) @827 objBgMove (83, 16, 66) @827 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @828 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @828 bgrMulti (strS[1000], 60, copy('CGMZ26P', 61)) koePlay (2121429) #res<0857> pause bgmFadeOut (1200) msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) intF[1107] = 1 strS[1000] = 'BG009' goto_unless (intF[1107] == 1) @829 intF[1107] = 0 msgHide @829 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @833 goto_unless (!intF[4]) @830 strS[1003] = 'SDT07' goto @831 @830 goto_unless (intF[4] == 1) @831 strS[1003] = 'SDT08' @831 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @832 objBgMove (83, 16, 16) goto @833 @832 goto_unless (intB[2] == 1) @833 objBgMove (83, 16, 66) @833 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @834 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @834 bgrMulti (strS[1000], 0) bgmFadeOutEx bgmLoop ('BGM19') goto_unless (intF[1107] == 1) @835 intF[1107] = 0 msgHide @835 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @839 goto_unless (!intF[4]) @836 strS[1003] = 'SDT07' goto @837 @836 goto_unless (intF[4] == 1) @837 strS[1003] = 'SDT08' @837 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @838 objBgMove (83, 16, 16) goto @839 @838 goto_unless (intB[2] == 1) @839 objBgMove (83, 16, 66) @839 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @840 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @840 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121430) #res<0858> pause koePlay (2121431) #res<0859> pause goto_unless (intF[1107] == 1) @841 intF[1107] = 0 msgHide @841 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @845 goto_unless (!intF[4]) @842 strS[1003] = 'SDT07' goto @843 @842 goto_unless (intF[4] == 1) @843 strS[1003] = 'SDT08' @843 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @844 objBgMove (83, 16, 16) goto @845 @844 goto_unless (intB[2] == 1) @845 objBgMove (83, 16, 66) @845 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @846 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @846 bgrMulti (strS[1000], 60, copy('CGHR11', 61)) koePlay (2121432) #res<0860> pause #res<0861> pause koePlay (2121433) #res<0862> pause goto_unless (intF[1107] == 1) @847 intF[1107] = 0 msgHide @847 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @851 goto_unless (!intF[4]) @848 strS[1003] = 'SDT07' goto @849 @848 goto_unless (intF[4] == 1) @849 strS[1003] = 'SDT08' @849 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @850 objBgMove (83, 16, 16) goto @851 @850 goto_unless (intB[2] == 1) @851 objBgMove (83, 16, 66) @851 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @852 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @852 bgrMulti (strS[1000], 60, copy('CGHR25', 61)) koePlay (2121434) #res<0863> pause koePlay (2121435) #res<0864> pause goto_unless (intF[1107] == 1) @853 intF[1107] = 0 msgHide @853 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @857 goto_unless (!intF[4]) @854 strS[1003] = 'SDT07' goto @855 @854 goto_unless (intF[4] == 1) @855 strS[1003] = 'SDT08' @855 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @856 objBgMove (83, 16, 16) goto @857 @856 goto_unless (intB[2] == 1) @857 objBgMove (83, 16, 66) @857 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @858 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @858 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121436) #res<0865> pause koePlay (2121437) #res<0866> pause goto_unless (intF[1107] == 1) @859 intF[1107] = 0 msgHide @859 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @863 goto_unless (!intF[4]) @860 strS[1003] = 'SDT07' goto @861 @860 goto_unless (intF[4] == 1) @861 strS[1003] = 'SDT08' @861 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @862 objBgMove (83, 16, 16) goto @863 @862 goto_unless (intB[2] == 1) @863 objBgMove (83, 16, 66) @863 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @864 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @864 bgrMulti (strS[1000], 60, copy('CGHR12', 61)) koePlay (2121438) #res<0867> pause koePlay (2121439) #res<0868> pause goto_unless (intF[1107] == 1) @865 intF[1107] = 0 msgHide @865 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @869 goto_unless (!intF[4]) @866 strS[1003] = 'SDT07' goto @867 @866 goto_unless (intF[4] == 1) @867 strS[1003] = 'SDT08' @867 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @868 objBgMove (83, 16, 16) goto @869 @868 goto_unless (intB[2] == 1) @869 objBgMove (83, 16, 66) @869 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @870 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @870 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121440) #res<0869> pause goto_unless (intF[1107] == 1) @871 intF[1107] = 0 msgHide @871 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @875 goto_unless (!intF[4]) @872 strS[1003] = 'SDT07' goto @873 @872 goto_unless (intF[4] == 1) @873 strS[1003] = 'SDT08' @873 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @874 objBgMove (83, 16, 16) goto @875 @874 goto_unless (intB[2] == 1) @875 objBgMove (83, 16, 66) @875 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @876 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @876 bgrMulti (strS[1000], 0) intF[1107] = 1 strS[1000] = 'BG007o' goto_unless (intF[1107] == 1) @877 intF[1107] = 0 msgHide @877 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @881 goto_unless (!intF[4]) @878 strS[1003] = 'SDT07' goto @879 @878 goto_unless (intF[4] == 1) @879 strS[1003] = 'SDT08' @879 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @880 objBgMove (83, 16, 16) goto @881 @880 goto_unless (intB[2] == 1) @881 objBgMove (83, 16, 66) @881 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @882 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @882 bgrMulti (strS[1000], 0) #res<0870> pause goto_unless (intF[1107] == 1) @883 intF[1107] = 0 msgHide @883 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @887 goto_unless (!intF[4]) @884 strS[1003] = 'SDT07' goto @885 @884 goto_unless (intF[4] == 1) @885 strS[1003] = 'SDT08' @885 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @886 objBgMove (83, 16, 16) goto @887 @886 goto_unless (intB[2] == 1) @887 objBgMove (83, 16, 66) @887 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @888 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @888 bgrMulti (strS[1000], 60, copy('CGMZ24P', 61)) koePlay (2121441) #res<0871> pause koePlay (2121442) #res<0872> pause goto_unless (intF[1107] == 1) @889 intF[1107] = 0 msgHide @889 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @893 goto_unless (!intF[4]) @890 strS[1003] = 'SDT07' goto @891 @890 goto_unless (intF[4] == 1) @891 strS[1003] = 'SDT08' @891 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @892 objBgMove (83, 16, 16) goto @893 @892 goto_unless (intB[2] == 1) @893 objBgMove (83, 16, 66) @893 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @894 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @894 bgrMulti (strS[1000], 60, copy('CGMZ26P', 61)) koePlay (2121443) #res<0873> pause goto_unless (intF[1107] == 1) @895 intF[1107] = 0 msgHide @895 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @899 goto_unless (!intF[4]) @896 strS[1003] = 'SDT07' goto @897 @896 goto_unless (intF[4] == 1) @897 strS[1003] = 'SDT08' @897 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @898 objBgMove (83, 16, 16) goto @899 @898 goto_unless (intB[2] == 1) @899 objBgMove (83, 16, 66) @899 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @900 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @900 bgrMulti (strS[1000], 0) #res<0874> pause goto_unless (intF[1107] == 1) @901 intF[1107] = 0 msgHide @901 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @905 goto_unless (!intF[4]) @902 strS[1003] = 'SDT07' goto @903 @902 goto_unless (intF[4] == 1) @903 strS[1003] = 'SDT08' @903 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @904 objBgMove (83, 16, 16) goto @905 @904 goto_unless (intB[2] == 1) @905 objBgMove (83, 16, 66) @905 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @906 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @906 bgrMulti (strS[1000], 60, copy('CGHR25', 61)) koePlay (2121444) #res<0875> pause koePlay (2121445) #res<0876> pause goto_unless (intF[1107] == 1) @907 intF[1107] = 0 msgHide @907 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @911 goto_unless (!intF[4]) @908 strS[1003] = 'SDT07' goto @909 @908 goto_unless (intF[4] == 1) @909 strS[1003] = 'SDT08' @909 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @910 objBgMove (83, 16, 16) goto @911 @910 goto_unless (intB[2] == 1) @911 objBgMove (83, 16, 66) @911 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @912 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @912 bgrMulti (strS[1000], 0) #res<0877> pause goto_unless (intF[1107] == 1) @913 intF[1107] = 0 msgHide @913 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @917 goto_unless (!intF[4]) @914 strS[1003] = 'SDT07' goto @915 @914 goto_unless (intF[4] == 1) @915 strS[1003] = 'SDT08' @915 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @916 objBgMove (83, 16, 16) goto @917 @916 goto_unless (intB[2] == 1) @917 objBgMove (83, 16, 66) @917 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @918 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @918 bgrMulti (strS[1000], 60, copy('CGHR12', 61)) koePlay (2121446) #res<0878> pause koePlay (2121447) #res<0879> pause goto_unless (intF[1107] == 1) @919 intF[1107] = 0 msgHide @919 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @923 goto_unless (!intF[4]) @920 strS[1003] = 'SDT07' goto @921 @920 goto_unless (intF[4] == 1) @921 strS[1003] = 'SDT08' @921 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @922 objBgMove (83, 16, 16) goto @923 @922 goto_unless (intB[2] == 1) @923 objBgMove (83, 16, 66) @923 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @924 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @924 bgrMulti (strS[1000], 60, copy('CGHR11', 61)) koePlay (2121448) #res<0880> pause koePlay (2121449) #res<0881> pause koePlay (2121450) #res<0882> pause koePlay (2121451) #res<0883> pause koePlay (2121452) #res<0884> pause #res<0885> pause koePlay (2121453) #res<0886> pause koePlay (2121454) #res<0887> pause koePlay (2121455) #res<0888> pause koePlay (2121456) #res<0889> pause koePlay (2121457) #res<0890> pause koePlay (2121458) #res<0891> pause koePlay (2121459) #res<0892> pause goto_unless (intF[1107] == 1) @925 intF[1107] = 0 msgHide @925 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @929 goto_unless (!intF[4]) @926 strS[1003] = 'SDT07' goto @927 @926 goto_unless (intF[4] == 1) @927 strS[1003] = 'SDT08' @927 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @928 objBgMove (83, 16, 16) goto @929 @928 goto_unless (intB[2] == 1) @929 objBgMove (83, 16, 66) @929 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @930 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @930 bgrMulti (strS[1000], 0) #res<0893> pause #res<0894> pause goto_unless (intF[1107] == 1) @931 intF[1107] = 0 msgHide @931 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @935 goto_unless (!intF[4]) @932 strS[1003] = 'SDT07' goto @933 @932 goto_unless (intF[4] == 1) @933 strS[1003] = 'SDT08' @933 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @934 objBgMove (83, 16, 16) goto @935 @934 goto_unless (intB[2] == 1) @935 objBgMove (83, 16, 66) @935 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @936 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @936 bgrMulti (strS[1000], 60, copy('CGHR25', 61)) koePlay (2121460) #res<0895> pause koePlay (2121461) #res<0896> pause goto_unless (intF[1107] == 1) @937 intF[1107] = 0 msgHide @937 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @941 goto_unless (!intF[4]) @938 strS[1003] = 'SDT07' goto @939 @938 goto_unless (intF[4] == 1) @939 strS[1003] = 'SDT08' @939 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @940 objBgMove (83, 16, 16) goto @941 @940 goto_unless (intB[2] == 1) @941 objBgMove (83, 16, 66) @941 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @942 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @942 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121462) #res<0897> pause goto_unless (intF[1107] == 1) @943 intF[1107] = 0 msgHide @943 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @947 goto_unless (!intF[4]) @944 strS[1003] = 'SDT07' goto @945 @944 goto_unless (intF[4] == 1) @945 strS[1003] = 'SDT08' @945 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @946 objBgMove (83, 16, 16) goto @947 @946 goto_unless (intB[2] == 1) @947 objBgMove (83, 16, 66) @947 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @948 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @948 bgrMulti (strS[1000], 60, copy('CGHR25', 61)) koePlay (2121463) #res<0898> pause koePlay (2121464) #res<0899> pause goto_unless (intF[1107] == 1) @949 intF[1107] = 0 msgHide @949 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @953 goto_unless (!intF[4]) @950 strS[1003] = 'SDT07' goto @951 @950 goto_unless (intF[4] == 1) @951 strS[1003] = 'SDT08' @951 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @952 objBgMove (83, 16, 16) goto @953 @952 goto_unless (intB[2] == 1) @953 objBgMove (83, 16, 66) @953 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @954 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @954 bgrMulti (strS[1000], 60, copy('CGHR26', 61)) koePlay (2121465) #res<0900> pause koePlay (2121466) #res<0901> pause koePlay (2121467) #res<0902> pause msgHide intF[1107] = 1 grpOpenBg ('FGMZ07', 26) koePlay (2121468) #res<0903> pause koePlay (2121469) #res<0904> pause koePlay (2121470) #res<0905> pause koePlay (2121471) #res<0906> pause #res<0907> pause koePlay (2121472) #res<0908> pause koePlay (2121473) #res<0909> pause koePlay (2121474) #res<0910> pause koePlay (2121475) #res<0911> pause koePlay (2121476) #res<0912> pause koePlay (2121477) #res<0913> pause koePlay (2121478) #res<0914> pause koePlay (2121479) #res<0915> pause koePlay (2121480) #res<0916> pause koePlay (2121481) #res<0917> pause koePlay (2121482) #res<0918> pause koePlay (2121483) #res<0919> pause koePlay (2121484) #res<0920> pause koePlay (2121485) #res<0921> pause koePlay (2121486) #res<0922> pause koePlay (2121487) #res<0923> pause koePlay (2121488) #res<0924> pause koePlay (2121489) #res<0925> pause koePlay (2121490) #res<0926> pause koePlay (2121491) #res<0927> pause koePlay (2121492) #res<0928> pause koePlay (2121493) #res<0929> pause koePlay (2121494) #res<0930> pause koePlay (2121495) #res<0931> pause koePlay (2121496) #res<0932> pause koePlay (2121497) #res<0933> pause koePlay (2121498) #res<0934> pause #res<0935> pause koePlay (2121499) #res<0936> pause koePlay (2121500) #res<0937> pause koePlay (2121501) #res<0938> pause koePlay (2121502) #res<0939> pause koePlay (2121503) #res<0940> pause koePlay (2121504) #res<0941> pause koePlay (2121505) #res<0942> pause koePlay (2121506) #res<0943> pause koePlay (2121507) #res<0944> pause koePlay (2121508) #res<0945> pause koePlay (2121509) #res<0946> pause koePlay (2121510) #res<0947> pause koePlay (2121511) #res<0948> pause koePlay (2121512) #res<0949> pause koePlay (2121513) #res<0950> pause koePlay (2121514) #res<0951> pause intF[1107] = 1 strS[1000] = 'BG007o' goto_unless (intF[1107] == 1) @955 intF[1107] = 0 msgHide @955 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @959 goto_unless (!intF[4]) @956 strS[1003] = 'SDT07' goto @957 @956 goto_unless (intF[4] == 1) @957 strS[1003] = 'SDT08' @957 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @958 objBgMove (83, 16, 16) goto @959 @958 goto_unless (intB[2] == 1) @959 objBgMove (83, 16, 66) @959 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @960 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @960 bgrMulti (strS[1000], 0) #res<0952> pause koePlay (2121515) #res<0953> pause koePlay (2121516) #res<0954> pause koePlay (2121517) #res<0955> pause koePlay (2121518) #res<0956> pause #res<0957> pause goto_unless (intF[1107] == 1) @961 intF[1107] = 0 msgHide @961 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @965 goto_unless (!intF[4]) @962 strS[1003] = 'SDT07' goto @963 @962 goto_unless (intF[4] == 1) @963 strS[1003] = 'SDT08' @963 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @964 objBgMove (83, 16, 16) goto @965 @964 goto_unless (intB[2] == 1) @965 objBgMove (83, 16, 66) @965 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @966 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @966 bgrMulti (strS[1000], 60, copy('CGHR15', 61)) koePlay (2121519) #res<0958> pause koePlay (2121520) #res<0959> pause koePlay (2121521) #res<0960> pause goto_unless (intF[1107] == 1) @967 intF[1107] = 0 msgHide @967 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @971 goto_unless (!intF[4]) @968 strS[1003] = 'SDT07' goto @969 @968 goto_unless (intF[4] == 1) @969 strS[1003] = 'SDT08' @969 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @970 objBgMove (83, 16, 16) goto @971 @970 goto_unless (intB[2] == 1) @971 objBgMove (83, 16, 66) @971 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @972 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @972 bgrMulti (strS[1000], 60, copy('CGHR10', 61)) koePlay (2121522) #res<0961> pause koePlay (2121523) #res<0962> pause goto_unless (intF[1107] == 1) @973 intF[1107] = 0 msgHide @973 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @977 goto_unless (!intF[4]) @974 strS[1003] = 'SDT07' goto @975 @974 goto_unless (intF[4] == 1) @975 strS[1003] = 'SDT08' @975 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @976 objBgMove (83, 16, 16) goto @977 @976 goto_unless (intB[2] == 1) @977 objBgMove (83, 16, 66) @977 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @978 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @978 bgrMulti (strS[1000], 0) #res<0963> pause goto_unless (intF[1107] == 1) @979 intF[1107] = 0 msgHide @979 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @983 goto_unless (!intF[4]) @980 strS[1003] = 'SDT07' goto @981 @980 goto_unless (intF[4] == 1) @981 strS[1003] = 'SDT08' @981 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @982 objBgMove (83, 16, 16) goto @983 @982 goto_unless (intB[2] == 1) @983 objBgMove (83, 16, 66) @983 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @984 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @984 bgrMulti (strS[1000], 60, copy('CGHR17', 61)) koePlay (2121524) #res<0964> pause goto_unless (intF[1107] == 1) @985 intF[1107] = 0 msgHide @985 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @989 goto_unless (!intF[4]) @986 strS[1003] = 'SDT07' goto @987 @986 goto_unless (intF[4] == 1) @987 strS[1003] = 'SDT08' @987 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @988 objBgMove (83, 16, 16) goto @989 @988 goto_unless (intB[2] == 1) @989 objBgMove (83, 16, 66) @989 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @990 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @990 bgrMulti (strS[1000], 0) #res<0965> pause koePlay (2121525) #res<0966> pause goto_unless (intF[1107] == 1) @991 intF[1107] = 0 msgHide @991 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @995 goto_unless (!intF[4]) @992 strS[1003] = 'SDT07' goto @993 @992 goto_unless (intF[4] == 1) @993 strS[1003] = 'SDT08' @993 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @994 objBgMove (83, 16, 16) goto @995 @994 goto_unless (intB[2] == 1) @995 objBgMove (83, 16, 66) @995 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @996 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @996 bgrMulti (strS[1000], 60, copy('CGHR15', 61)) koePlay (2121526) #res<0967> pause koePlay (2121527) #res<0968> pause koePlay (2121528) #res<0969> pause goto_unless (intF[1107] == 1) @997 intF[1107] = 0 msgHide @997 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @1001 goto_unless (!intF[4]) @998 strS[1003] = 'SDT07' goto @999 @998 goto_unless (intF[4] == 1) @999 strS[1003] = 'SDT08' @999 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @1000 objBgMove (83, 16, 16) goto @1001 @1000 goto_unless (intB[2] == 1) @1001 objBgMove (83, 16, 66) @1001 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @1002 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @1002 bgrMulti (strS[1000], 60, copy('CGHR11', 61)) koePlay (2121529) #res<0970> pause koePlay (2121530) #res<0971> pause koePlay (2121531) #res<0972> pause koePlay (2121532) #res<0973> pause koePlay (2121533) #res<0974> pause koePlay (2121534) #res<0975> pause koePlay (2121535) #res<0976> pause goto_unless (intF[1107] == 1) @1003 intF[1107] = 0 msgHide @1003 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @1007 goto_unless (!intF[4]) @1004 strS[1003] = 'SDT07' goto @1005 @1004 goto_unless (intF[4] == 1) @1005 strS[1003] = 'SDT08' @1005 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @1006 objBgMove (83, 16, 16) goto @1007 @1006 goto_unless (intB[2] == 1) @1007 objBgMove (83, 16, 66) @1007 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @1008 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @1008 bgrMulti (strS[1000], 60, copy('CGHR12', 61)) koePlay (2121536) #res<0977> pause goto_unless (intF[1107] == 1) @1009 intF[1107] = 0 msgHide @1009 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @1013 goto_unless (!intF[4]) @1010 strS[1003] = 'SDT07' goto @1011 @1010 goto_unless (intF[4] == 1) @1011 strS[1003] = 'SDT08' @1011 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @1012 objBgMove (83, 16, 16) goto @1013 @1012 goto_unless (intB[2] == 1) @1013 objBgMove (83, 16, 66) @1013 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @1014 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @1014 bgrMulti (strS[1000], 0) koePlay (2121537) #res<0978> pause goto_unless (intF[1107] == 1) @1015 intF[1107] = 0 msgHide @1015 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @1019 goto_unless (!intF[4]) @1016 strS[1003] = 'SDT07' goto @1017 @1016 goto_unless (intF[4] == 1) @1017 strS[1003] = 'SDT08' @1017 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @1018 objBgMove (83, 16, 16) goto @1019 @1018 goto_unless (intB[2] == 1) @1019 objBgMove (83, 16, 66) @1019 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @1020 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @1020 bgrMulti (strS[1000], 60, copy('CGMZ36H', 61)) koePlay (2121538) #res<0979> pause koePlay (2121539) #res<0980> pause goto_unless (intF[1107] == 1) @1021 intF[1107] = 0 msgHide @1021 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @1025 goto_unless (!intF[4]) @1022 strS[1003] = 'SDT07' goto @1023 @1022 goto_unless (intF[4] == 1) @1023 strS[1003] = 'SDT08' @1023 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @1024 objBgMove (83, 16, 16) goto @1025 @1024 goto_unless (intB[2] == 1) @1025 objBgMove (83, 16, 66) @1025 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @1026 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @1026 bgrMulti (strS[1000], 60, copy('CGMZ31H', 61)) koePlay (2121540) #res<0981> pause koePlay (2121541) #res<0982> pause koePlay (2121542) #res<0983> pause goto_unless (intF[1107] == 1) @1027 intF[1107] = 0 msgHide @1027 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @1031 goto_unless (!intF[4]) @1028 strS[1003] = 'SDT07' goto @1029 @1028 goto_unless (intF[4] == 1) @1029 strS[1003] = 'SDT08' @1029 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @1030 objBgMove (83, 16, 16) goto @1031 @1030 goto_unless (intB[2] == 1) @1031 objBgMove (83, 16, 66) @1031 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @1032 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @1032 bgrMulti (strS[1000], 60, copy('CGMZ30H', 61)) koePlay (2121543) #res<0984> pause goto_unless (intF[1107] == 1) @1033 intF[1107] = 0 msgHide @1033 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @1037 goto_unless (!intF[4]) @1034 strS[1003] = 'SDT07' goto @1035 @1034 goto_unless (intF[4] == 1) @1035 strS[1003] = 'SDT08' @1035 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @1036 objBgMove (83, 16, 16) goto @1037 @1036 goto_unless (intB[2] == 1) @1037 objBgMove (83, 16, 66) @1037 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @1038 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @1038 bgrMulti (strS[1000], 60, copy('CGMZ31H', 61)) koePlay (2121544) #res<0985> pause #res<0986> pause koePlay (2121545) #res<0987> pause koePlay (2121546) #res<0988> pause goto_unless (intF[1107] == 1) @1039 intF[1107] = 0 msgHide @1039 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @1043 goto_unless (!intF[4]) @1040 strS[1003] = 'SDT07' goto @1041 @1040 goto_unless (intF[4] == 1) @1041 strS[1003] = 'SDT08' @1041 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @1042 objBgMove (83, 16, 16) goto @1043 @1042 goto_unless (intB[2] == 1) @1043 objBgMove (83, 16, 66) @1043 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @1044 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @1044 bgrMulti (strS[1000], 0) koePlay (2121547) #res<0989> pause #res<0990> pause koePlay (2121548) #res<0991> pause goto_unless (intF[1107] == 1) @1045 intF[1107] = 0 msgHide @1045 stackClear objBgClear (83) op<1:060:00001, 0> (83) goto_unless (intF[2] == 1) @1049 goto_unless (!intF[4]) @1046 strS[1003] = 'SDT07' goto @1047 @1046 goto_unless (intF[4] == 1) @1047 strS[1003] = 'SDT08' @1047 strS[0] = itoa (intF[3], 2) strS[1003] += strS[0] objBgOfFile (83, strS[1003], 1) goto_unless (!intB[2]) @1048 objBgMove (83, 16, 16) goto @1049 @1048 goto_unless (intB[2] == 1) @1049 objBgMove (83, 16, 66) @1049 objBgClear (81) objBgClear (82) op<1:060:00001, 0> (81) op<1:060:00001, 0> (82) goto_unless (intB[2] == 1) @1050 objBgOfRect (81, 0, 0, 640, 50, 1) objBgOfRect (82, 0, 430, 640, 50, 1) objBgColour (81, 0, 0, 0, 255) objBgColour (82, 0, 0, 0, 255) @1050 bgrMulti (strS[1000], 60, copy('CGMZ32H', 61)) koePlay (2121549) #res<0992> pause koePlay (2121550) #res<0993> pause bgmFadeOut (1200) msgHide intF[1107] = 1 recOpenBg ('KURO', 0, 0, 640, 480, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 255, 0) jump (410) eof
1
0.578049
1
0.578049
game-dev
MEDIA
0.473684
game-dev
0.699186
1
0.699186
mohsansaleem/Idle-Miner
4,205
Assets/Plugins/Zenject/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinder2.cs
using System; namespace Zenject { [NoReflectionBaking] public class FactorySubContainerBinder<TParam1, TParam2, TContract> : FactorySubContainerBinderWithParams<TContract> { public FactorySubContainerBinder( DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo, object subIdentifier) : base(bindContainer, bindInfo, factoryBindInfo, subIdentifier) { } public ScopeConcreteIdArgConditionCopyNonLazyBinder ByMethod(Action<DiContainer, TParam1, TParam2> installerMethod) { var subcontainerBindInfo = new SubContainerCreatorBindInfo(); ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByMethod<TParam1, TParam2>( container, subcontainerBindInfo, installerMethod), false); return new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo); } #if !NOT_UNITY3D public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewGameObjectMethod( Action<DiContainer, TParam1, TParam2> installerMethod) { var gameObjectInfo = new GameObjectCreationParameters(); ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByNewGameObjectMethod<TParam1, TParam2>( container, gameObjectInfo, installerMethod), false); return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( Func<InjectContext, UnityEngine.Object> prefabGetter, Action<DiContainer, TParam1, TParam2> installerMethod) { var gameObjectInfo = new GameObjectCreationParameters(); ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2>( container, new PrefabProviderCustom(prefabGetter), gameObjectInfo, installerMethod), false); return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabMethod( UnityEngine.Object prefab, Action<DiContainer, TParam1, TParam2> installerMethod) { BindingUtil.AssertIsValidPrefab(prefab); var gameObjectInfo = new GameObjectCreationParameters(); ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2>( container, new PrefabProvider(prefab), gameObjectInfo, installerMethod), false); return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResourceMethod( string resourcePath, Action<DiContainer, TParam1, TParam2> installerMethod) { BindingUtil.AssertIsValidResourcePath(resourcePath); var gameObjectInfo = new GameObjectCreationParameters(); ProviderFunc = (container) => new SubContainerDependencyProvider( ContractType, SubIdentifier, new SubContainerCreatorByNewPrefabMethod<TParam1, TParam2>( container, new PrefabProviderResource(resourcePath), gameObjectInfo, installerMethod), false); return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo); } #endif } }
1
0.829287
1
0.829287
game-dev
MEDIA
0.886282
game-dev
0.72911
1
0.72911
CrucibleMC/Crucible
4,406
bukkit/src/main/java/org/bukkit/command/defaults/GiveCommand.java
package org.bukkit.command.defaults; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.util.StringUtil; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; public class GiveCommand extends VanillaCommand { private static List<String> materials; static { ArrayList<String> materialList = new ArrayList<String>(); for (Material material : Material.values()) { materialList.add(material.name()); } Collections.sort(materialList); materials = ImmutableList.copyOf(materialList); } public GiveCommand() { super("give"); this.description = "Gives the specified player a certain amount of items"; this.usageMessage = "/give <player> <item> [amount [data]]"; this.setPermission("bukkit.command.give"); } @Override public boolean execute(CommandSender sender, String currentAlias, String[] args) { if (!testPermission(sender)) return true; if ((args.length < 2)) { sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); return false; } Player player = Bukkit.getPlayerExact(args[0]); if (player != null) { Material material = Material.matchMaterial(args[1]); if (material == null) { material = Bukkit.getUnsafe().getMaterialFromInternalName(args[1]); } if (material != null) { int amount = 1; short data = 0; if (args.length >= 3) { amount = this.getInteger(sender, args[2], 1, 64); if (args.length >= 4) { try { data = Short.parseShort(args[3]); } catch (NumberFormatException ex) {} } } ItemStack stack = new ItemStack(material, amount, data); if (args.length >= 5) { try { stack = Bukkit.getUnsafe().modifyItemStack(stack, Joiner.on(' ').join(Arrays.asList(args).subList(4, args.length))); } catch (Throwable t) { player.sendMessage("Not a valid tag"); return true; } } player.getInventory().addItem(stack); Command.broadcastCommandMessage(sender, "Gave " + player.getName() + " some " + material.getId() + " (" + material + ")"); } else { sender.sendMessage("There's no item called " + args[1]); } } else { sender.sendMessage("Can't find player " + args[0]); } return true; } @Override public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { Validate.notNull(sender, "Sender cannot be null"); Validate.notNull(args, "Arguments cannot be null"); Validate.notNull(alias, "Alias cannot be null"); if (args.length == 1) { return super.tabComplete(sender, alias, args); } if (args.length == 2) { final String arg = args[1]; final List<String> materials = GiveCommand.materials; List<String> completion = new ArrayList<String>(); final int size = materials.size(); int i = Collections.binarySearch(materials, arg, String.CASE_INSENSITIVE_ORDER); if (i < 0) { // Insertion (start) index i = -1 - i; } for ( ; i < size; i++) { String material = materials.get(i); if (StringUtil.startsWithIgnoreCase(material, arg)) { completion.add(material); } else { break; } } return Bukkit.getUnsafe().tabCompleteInternalMaterialName(arg, completion); } return ImmutableList.of(); } }
1
0.81051
1
0.81051
game-dev
MEDIA
0.911499
game-dev
0.767787
1
0.767787
pret/pokeheartgold
6,149
files/fielddata/script/scr_seq/scr_seq_0874_T23R0501.s
#include "constants/scrcmd.h" #include "fielddata/script/scr_seq/event_T23R0501.h" #include "msgdata/msg/msg_0571_T23R0501.h" .include "asm/macros/script.inc" .rodata scrdef scr_seq_T23R0501_000 scrdef scr_seq_T23R0501_001 scrdef scr_seq_T23R0501_002 scrdef scr_seq_T23R0501_003 scrdef scr_seq_T23R0501_004 scrdef scr_seq_T23R0501_005 scrdef scr_seq_T23R0501_006 scrdef_end scr_seq_T23R0501_000: goto_if_set FLAG_BEAT_AZALEA_ROCKETS, _002F setflag FLAG_HIDE_AZALEA_SLOWPOKES end _002F: clearflag FLAG_HIDE_AZALEA_SLOWPOKES end scr_seq_T23R0501_005: scrcmd_609 lockall setvar VAR_UNK_4080, 3 apply_movement obj_T23R0501_gantetsu, _02B0 wait_movement buffer_players_name 0 npc_msg msg_0571_T23R0501_00001 setvar VAR_SPECIAL_x8004, 492 setvar VAR_SPECIAL_x8005, 1 callstd std_obtain_item_verbose setflag FLAG_UNK_07C releaseall goto _011A end scr_seq_T23R0501_001: goto_if_set FLAG_UNK_07C, _011A play_se SEQ_SE_DP_SELECT lockall faceplayer buffer_players_name 0 npc_msg msg_0571_T23R0501_00000 wait_button closemsg get_player_facing VAR_TEMP_x4001 compare VAR_TEMP_x4001, 0 goto_if_ne _00A7 goto _00C7 _00A1: goto _00AF _00A7: apply_movement obj_T23R0501_gantetsu, _02E0 _00AF: wait_movement _00B1: releaseall hide_person obj_T23R0501_gantetsu wait_fanfare setflag FLAG_UNK_077 setflag FLAG_UNK_19E setflag FLAG_UNK_19F end _00C7: toggle_following_pokemon_movement 0 wait_following_pokemon_movement following_pokemon_movement 56 get_person_coords 253, VAR_TEMP_x4002, VAR_TEMP_x4003 compare VAR_TEMP_x4002, 5 goto_if_ne _00F4 apply_movement obj_T23R0501_gantetsu, _02E8 goto _0108 _00F4: play_se SEQ_SE_DP_WALL_HIT apply_movement obj_T23R0501_gantetsu, _02E0 apply_movement obj_player, _02C8 _0108: wait_movement wait_following_pokemon_movement toggle_following_pokemon_movement 1 following_pokemon_movement 48 goto _00B1 _011A: play_se SEQ_SE_DP_SELECT lockall faceplayer scrcmd_735 VAR_SPECIAL_x8000 compare VAR_SPECIAL_x8000, 0 goto_if_ne _01A5 get_total_apricorn_count VAR_SPECIAL_RESULT compare VAR_SPECIAL_RESULT, 0 goto_if_eq _020F apply_movement obj_T23R0501_gantetsu, _02BC wait_movement npc_msg msg_0571_T23R0501_00004 closemsg fade_screen 6, 1, 0, RGB_BLACK wait_fade scrcmd_739 restore_overworld fade_screen 6, 1, 1, RGB_BLACK wait_fade scrcmd_735 VAR_SPECIAL_RESULT compare VAR_SPECIAL_RESULT, 0 goto_if_ne _0189 npc_msg msg_0571_T23R0501_00006 goto _0190 _0189: setflag FLAG_DAILY_KURT_MAKING_BALLS npc_msg msg_0571_T23R0501_00005 _0190: wait_button_or_walk_away closemsg compare VAR_UNK_4080, 3 goto_if_eq _022D releaseall end _01A5: goto_if_set FLAG_DAILY_KURT_MAKING_BALLS, _0204 buffer_players_name 0 npc_msg msg_0571_T23R0501_00008 scrcmd_737 VAR_SPECIAL_x8004 hasspaceforitem VAR_SPECIAL_x8004, VAR_SPECIAL_x8000, VAR_SPECIAL_RESULT copyvar VAR_SPECIAL_x8005, VAR_SPECIAL_x8000 callstd std_give_item_verbose clear_kurt_apricorn compare VAR_UNK_413B, 10 goto_if_ge _01EE addvar VAR_UNK_413B, 1 compare VAR_UNK_413B, 10 call_if_ge _0227 _01EE: npc_msg msg_0571_T23R0501_00010 goto _021F end _01F9: npc_msg msg_0571_T23R0501_00009 goto _021F end _0204: npc_msg msg_0571_T23R0501_00007 goto _021F end _020F: npc_msg msg_0571_T23R0501_00003 compare VAR_UNK_4080, 3 goto_if_eq _022D _021F: wait_button_or_walk_away closemsg releaseall end _0227: setflag FLAG_UNK_127 return _022D: setvar VAR_UNK_4080, 4 apply_movement obj_T23R0501_gsbabygirl1, _02FC wait_movement apply_movement obj_player, _02D4 wait_movement npc_msg msg_0571_T23R0501_00015 _024A: touchscreen_menu_hide getmenuchoice VAR_SPECIAL_RESULT touchscreen_menu_show compare VAR_SPECIAL_RESULT, 0 goto_if_eq _026E compare VAR_SPECIAL_RESULT, 1 goto_if_ge _0289 end _026E: buffer_players_name 0 npc_msg msg_0571_T23R0501_00016 play_fanfare SEQ_ME_POKEGEAR_REGIST wait_fanfare register_gear_number PHONE_CONTACT_KURT npc_msg msg_0571_T23R0501_00017 wait_button_or_walk_away closemsg releaseall end _0289: npc_msg msg_0571_T23R0501_00018 wait_button_or_walk_away closemsg releaseall end _0294: apply_movement 1, _0304 wait_movement releaseall end _02A2: npc_msg msg_0571_T23R0501_00019 goto _024A end .balign 4, 0 _02B0: step 65, 1 step 37, 1 step_end .balign 4, 0 _02BC: step 75, 1 step 63, 1 step_end .balign 4, 0 _02C8: step 18, 1 step 65, 1 step_end .balign 4, 0 _02D4: step 39, 1 step 3, 1 step_end .balign 4, 0 _02E0: step 17, 5 step_end .balign 4, 0 _02E8: step 18, 1 step 17, 2 step 19, 1 step 17, 3 step_end .balign 4, 0 _02FC: step 14, 1 step_end .balign 4, 0 _0304: step 39, 1 step 15, 1 step 38, 1 step_end scr_seq_T23R0501_002: play_se SEQ_SE_DP_SELECT lockall faceplayer goto_if_set FLAG_UNK_077, _0332 npc_msg msg_0571_T23R0501_00011 wait_button_or_walk_away closemsg releaseall end _0332: goto_if_set FLAG_BEAT_AZALEA_ROCKETS, _0348 npc_msg msg_0571_T23R0501_00012 wait_button_or_walk_away closemsg releaseall end _0348: check_registered_phone_number PHONE_CONTACT_KURT, VAR_TEMP_x4001 compare VAR_TEMP_x4001, 0 goto_if_eq _02A2 goto_if_set FLAG_GAME_CLEAR, _0371 npc_msg msg_0571_T23R0501_00013 wait_button_or_walk_away closemsg releaseall end _0371: npc_msg msg_0571_T23R0501_00014 wait_button_or_walk_away closemsg releaseall end scr_seq_T23R0501_003: play_se SEQ_SE_DP_SELECT lockall faceplayer play_cry SPECIES_SLOWPOKE, 0 npc_msg msg_0571_T23R0501_00020 wait_cry wait_button_or_walk_away closemsg releaseall end scr_seq_T23R0501_004: simple_npc_msg msg_0571_T23R0501_00021 end scr_seq_T23R0501_006: play_se SEQ_SE_DP_SELECT lockall faceplayer compare VAR_SCENE_ROCKET_TAKEOVER, 2 goto_if_ne _03C8 npc_msg msg_0571_T23R0501_00024 goto _03F7 _03C8: compare VAR_SCENE_ROCKET_TAKEOVER, 3 goto_if_ne _03DE npc_msg msg_0571_T23R0501_00024 goto _03F7 _03DE: compare VAR_SCENE_ROCKET_TAKEOVER, 4 goto_if_ne _03F4 npc_msg msg_0571_T23R0501_00024 goto _03F7 _03F4: npc_msg msg_0571_T23R0501_00023 _03F7: wait_button_or_walk_away closemsg releaseall end .balign 4, 0
1
0.617756
1
0.617756
game-dev
MEDIA
0.902402
game-dev
0.735118
1
0.735118
lord-ruby/Entropy
35,468
compat/cryptid/other_consumables.lua
local downpour = Entropy.SealSpectral("downpour", {x=12,y=7}, "entr_cerulean",2000+24, "c_cry_typhoon", {art = {"Lil. Mr. Slipstream"}}) local rift = { key = "rift", set = "Omen", atlas = "consumables", object_type = "Consumable", order = 2000+24.5, dependencies = { items = { "set_entr_inversions" } }, config = { num = 2 }, pos = {x=11,y=8}, inversion = "c_cry_meld", use = function(self, card2) local cards = Entropy.GetHighlightedCards({G.jokers, G.consumeables, G.hand}, card2, 1, card2.ability.num) Entropy.FlipThen(cards, function(card) card:juice_up() card:set_edition(Entropy.pseudorandom_element(G.P_CENTER_POOLS.Edition, pseudoseed("rift"),function(e) return G.GAME.banned_keys[e.key] or e.no_doe end).key) end) end, can_use = function(self, card) local cards = Entropy.GetHighlightedCards({G.jokers, G.consumeables, G.hand}, card, 1, card.ability.num) return #cards > 0 and #cards <= card.ability.num end, loc_vars = function(self, q, card) return { vars = { card.ability.num } } end, entr_credits = { art = {"Lil. Mr. Slipstream"} }, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local script = Entropy.SealSpectral("script", {x=6,y=8}, "entr_verdant",2000+25, "c_cry_source", {art = {"Lil. Mr. Slipstream"}}) local dispel = { dependencies = { items = { "set_entr_inversions", } }, object_type = "Consumable", order = 2000 + 17, key = "dispel", set = "Omen", inversion = "c_cry_lock", atlas = "consumables", config = { select = 1, }, pos = {x=11,y=6}, --soul_pos = { x = 5, y = 0}, use = function(self, card, area, copier) for i, v in pairs(Entropy.GetHighlightedCards({G.jokers}, card, 1, card.ability.select)) do if not v.entr_aleph then v:start_dissolve() G.GAME.banned_keys[v.config.center.key] = true end end end, can_use = function(self, card) local cards = Entropy.GetHighlightedCards({G.jokers}, card, 1, card.ability.select) return #cards > 0 and #cards <= card.ability.select end, loc_vars = function(self, q, card) return { vars = { card.ability.select, } } end, entr_credits = { art = {"Lil. Mr. Slipstream"} }, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local cleanse = { dependencies = { items = { "set_entr_inversions", } }, object_type = "Consumable", order = 2000 + 18, key = "cleanse", set = "Omen", inversion = "c_cry_vacuum", atlas = "consumables", config = { dollarpc = 1 }, pos = {x=7,y=7}, --soul_pos = { x = 5, y = 0}, use = function(self, card2, area, copier) local total = 0 for i, card in pairs(G.hand.cards) do if card.ability and card.ability.effect == 'Stone Card' then total = total + (10 + card.ability.perma_bonus) * card2.ability.dollarpc card:set_ability(G.P_CENTERS.c_base, true, nil) else total = total + (card.base.nominal-1 + card.ability.perma_bonus) * card2.ability.dollarpc end card.ability.perma_bonus = 0 end Entropy.FlipThen(G.hand.cards, function(card, area) total = total + (card.base.nominal-1) * card2.ability.dollarpc SMODS.change_base(card, "entr_nilsuit", "entr_nilrank") end) delay(1) ease_dollars(total) end, can_use = function(self, card) return G.hand and #G.hand.cards > 0 end, loc_vars = function(self, q, card) return { vars = { card.ability.dollarpc } } end, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local fusion = { dependencies = { items = { "set_entr_inversions", } }, object_type = "Consumable", order = 2000 + 19, key = "fusion", set = "Omen", inversion = "c_cry_hammerspace", atlas = "consumables", config = { num = 3, }, pos = {x=10,y=7}, --soul_pos = { x = 5, y = 0}, use = function(self, card2, area, copier) local cards = {} for i, v in ipairs(G.hand.cards) do cards[#cards+1]=v end pseudoshuffle(cards, pseudoseed("fusion")) local actual = {} for i = 1, card2.ability.num do actual[#actual+1] = cards[i] end Entropy.FlipThen(actual, function(card,area) local sel = Entropy.GetHighlightedCards({G.jokers, G.consumeables, G.hand}, card2, 1, 1, {c_base=true})[1] if sel then local enhancement_type = sel.ability and sel.ability.set or sel.config.center.set if sel.area == G.hand then Entropy.randomize_rank_suit(card, true, true, "fusion") card:set_ability(G.P_CENTERS.c_base) else local enhancement = pseudorandom_element(G.P_CENTER_POOLS[enhancement_type], pseudoseed("fusion")).key while G.P_CENTERS[enhancement].no_doe or (G.P_CENTERS[enhancement].soul_rate and pseudorandom("fusion") > 0.02) or G.GAME.banned_keys[enhancement] do enhancement = pseudorandom_element(G.P_CENTER_POOLS[enhancement_type], pseudoseed("fusion")).key end card:set_ability(G.P_CENTERS[enhancement]) end end G.hand:remove_from_highlighted(card) end) end, can_use = function(self, card) return G.hand and #G.hand.cards > 0 and #Entropy.GetHighlightedCards({G.jokers, G.consumeables, G.hand}, card, 1, 1, {c_base=true}) == 1 end, loc_vars = function(self, q, card) return { vars = { card.ability.num, } } end, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local substitute = { dependencies = { items = { "set_entr_inversions", } }, object_type = "Consumable", order = 2000 + 20, key = "substitute", set = "Omen", inversion = "c_cry_trade", atlas = "consumables", config = { num = 3, }, pos = {x=6,y=7}, --soul_pos = { x = 5, y = 0}, use = function(self, card2, area, copier) local usable_vouchers = {} local voucher = pseudorandom_element(G.vouchers.cards, pseudoseed("substitute")) local tries = 100 local uvouchers = {} while (SMODS.is_eternal(voucher) or voucher.ability.cry_absolute or Entropy.GetHigherVoucherTier(voucher.config.center.key) == nil) and tries > 0 do voucher = pseudorandom_element(G.vouchers.cards, pseudoseed("substitute")) tries = tries - 1 end uvouchers[#uvouchers+1] = voucher for i, v in pairs(voucher.config.center.requires or {}) do if Entropy.InTable(G.vouchers.cards, v) then local voucher2 = G.vouchers.cards[Entropy.InTable(G.vouchers.cards, v)] for i2, v2 in pairs(voucher2.config.center.requires or {}) do if Entropy.InTable(G.vouchers.cards, v2) then local voucher3 = G.vouchers.cards[Entropy.InTable(G.vouchers.cards, v2)] uvouchers[#uvouchers+1] = voucher3 end end uvouchers[#uvouchers+1] = voucher2 end end --Entropy.GetHigherVoucherTier(voucher.config.center.key) local area if G.STATE == G.STATES.HAND_PLAYED then if not G.redeemed_vouchers_during_hand then G.redeemed_vouchers_during_hand = CardArea(G.play.T.x, G.play.T.y, G.play.T.w, G.play.T.h, { type = "play", card_limit = 5 }) end area = G.redeemed_vouchers_during_hand else area = G.play end for i, v in pairs(uvouchers) do local card2 = copy_card(v) card2.ability.extra = copy_table(v.ability.extra) if card2.facing == "back" then card2:flip() end card2:start_materialize() area:emplace(card2) card2.cost = 0 card2.shop_voucher = false local current_round_voucher = G.GAME.current_round.voucher card2:unredeem() G.GAME.current_round.voucher = current_round_voucher G.E_MANAGER:add_event(Event({ trigger = "after", delay = 0, func = function() card2:start_dissolve() v:start_dissolve() return true end, })) end local area if G.STATE == G.STATES.HAND_PLAYED then if not G.redeemed_vouchers_during_hand then G.redeemed_vouchers_during_hand = CardArea(G.play.T.x, G.play.T.y, G.play.T.w, G.play.T.h, { type = "play", card_limit = 5 }) end area = G.redeemed_vouchers_during_hand else area = G.play end local card = create_card("Voucher", G.vouchers, nil, nil, nil, nil, nil, "entr_subby") card:set_ability(G.P_CENTERS[Entropy.GetHigherVoucherTier(voucher.config.center.key) or voucher.config.center.key] or G.P_CENTERS[voucher.config.center.key]) card:add_to_deck() area:emplace(card) card.cost = 0 card.shop_voucher = false local current_round_voucher = G.GAME.current_round.voucher card:redeem() G.GAME.current_round.voucher = current_round_voucher G.E_MANAGER:add_event(Event({ trigger = "after", delay = 0, func = function() card:start_dissolve() return true end, })) end, can_use = function(self, card) local usable_count = 0 for _, v in pairs(G.vouchers.cards) do if not SMODS.is_eternal(v) and Entropy.GetHigherVoucherTier(v.config.center.key) and not v.ability.cry_absolute then usable_count = usable_count + 1 end end if usable_count > 0 then return true else return false end end, loc_vars = function(self, q, card) return { vars = { card.ability.num, } } end, entr_credits = { art = {"Lil. Mr. Slipstream"} }, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local evocation = { dependencies = { items = { "set_entr_inversions", } }, object_type = "Consumable", order = 2000 + 21, key = "evocation", set = "Omen", inversion = "c_cry_summoning", atlas = "consumables", config = { num = 1, hands = 1 }, pos = {x=7,y=8}, --soul_pos = { x = 5, y = 0}, use = function(self, card2, area, copier) for i, v in pairs(G.jokers.cards) do if not v.highlighted and not v.ability.cry_absolute and not SMODS.is_eternal(v) then v:remove_from_deck() v:start_dissolve() end end for i, card in pairs(G.jokers.highlighted) do card:remove_from_deck() card:start_dissolve() local rare = nil if card.config.center.rarity ~= "j_entr_entropic" then rare = Entropy.GetNextRarity(card.config.center.rarity or 1) or card.config.center.rarity end if rare == 1 then rare = "Common" end if rare == 2 then rare = "Uncommon" end if rare == 4 then card = create_card("Joker", G.jokers, true, 4, nil, nil, nil, 'evocation') else card = create_card("Joker", G.jokers, nil, rare, nil, nil, nil, 'evocation') end card:juice_up(0.3, 0.3) card:add_to_deck() G.jokers:emplace(card) end G.GAME.round_resets.hands = G.GAME.round_resets.hands - card2.ability.hands ease_hands_played(-card2.ability.hands) end, can_use = function(self, card) return G.jokers and #G.jokers.highlighted > 0 and #G.jokers.highlighted <= card.ability.num end, loc_vars = function(self, q, card) return { vars = { card.ability.num, -card.ability.hands } } end, entr_credits = { art = {"Lil. Mr. Slipstream"} }, } local mimic = { dependencies = { items = { "set_entr_inversions", } }, object_type = "Consumable", order = 2000 + 22, key = "mimic", set = "Omen", atlas = "consumables", inversion="c_cry_replica", config = { num = 1, }, pos = {x=12,y=6}, --soul_pos = { x = 5, y = 0}, use = function(self, card2, area, copier) local orig = Entropy.GetHighlightedCards({G.shop_booster, G.shop_jokers, G.shop_vouchers, G.hand, G.consumeables, G.jokers, G.pack_cards}, card2, 1, 1)[1] local newcard = copy_card(orig) newcard:add_to_deck() newcard.ability.perishable = true newcard.ability.banana = true newcard.area = orig.area if newcard.ability.set == "Booster" and orig.area ~= G.hand then newcard.area = G.consumeables newcard:add_to_deck() table.insert(newcard.area.cards, newcard) elseif newcard.ability.set == "Voucher" and orig.area ~= G.hand then newcard.area = G.consumeables newcard:add_to_deck() table.insert(newcard.area.cards, newcard) else orig.area:emplace(newcard) if orig.area.config.type == "shop" then local ref = G.FUNCS.check_for_buy_space(c1) newcard.ability.infinitesimal = true newcard.cost = 0 G.FUNCS.buy_from_shop({config={ref_table=newcard}}) end end end, can_use = function(self, card) return #Entropy.GetHighlightedCards({G.shop_booster, G.shop_jokers, G.shop_vouchers, G.hand, G.consumeables, G.jokers, G.pack_cards}, card, 1, card.ability.num) == card.ability.num end, loc_vars = function(self, q, card) return { vars = { card.ability.num, } } end, entr_credits = { art = {"Lil. Mr. Slipstream"} }, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local superego = { dependencies = { items = { "set_entr_inversions", } }, object_type = "Consumable", order = 2000 + 23, key = "superego", set = "Omen", inversion = "c_cry_analog", atlas = "consumables", config = { num = 1, }, pos = {x=8,y=6}, --soul_pos = { x = 5, y = 0}, use = function(self, card2, area, copier) local cards = Entropy.GetHighlightedCards({G.jokers}, card2, 1, card2.ability.num) for i, card in ipairs(cards) do card.ability.superego = true card.ability.superego_copies = 0 card:set_debuff(true) card.sell_cost = 0 card:juice_up() end end, can_use = function(self, card) local num = #Entropy.GetHighlightedCards({G.jokers}, card, 1, card.ability.num) return num <= card.ability.num and num > 0 end, loc_vars = function(self, q, card) q[#q+1] = {key="superego", set="Other", vars = {0}} return { vars = { card.ability.num, } } end, entr_credits = { art = {"LFMoth"} }, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local superego_sticker = { dependencies = { items = { "set_entr_inversions", } }, object_type = "Sticker", order = 2500 + 2, atlas = "entr_stickers", pos = { x = 4, y = 1 }, key = "superego", no_sticker_sheet = true, prefix_config = { key = false }, badge_colour = HEX("FF00FF"), apply = function(self,card,val) card.ability.superego = true card.ability.superego_copies = 0 card.ability.debuff = true end, loc_vars = function(self, q, card) return {vars={card.ability and math.floor(card.ability.superego_copies or 0) or 0}} end } local engulf = { dependencies = { items = { "set_entr_inversions", "e_entr_solar" } }, object_type = "Consumable", order = 2000 + 26, key = "engulf", set = "Omen", inversion = "c_cry_ritual", atlas = "consumables", config = { num = 1, }, pos = {x=8,y=7}, --soul_pos = { x = 5, y = 0}, use = function(self, card2, area, copier) for i, v in pairs(Entropy.GetHighlightedCards({G.hand}, card2, 1, card2.ability.num) ) do v:set_edition("e_entr_solar") v:juice_up() end end, can_use = function(self, card) local num = #Entropy.GetHighlightedCards({G.hand}, card, 1, card.ability.num) return num <= card.ability.num and num > 0 end, loc_vars = function(self, q, card) q[#q+1] = G.P_CENTERS.e_entr_solar return { vars = { card.ability.num, } } end, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local offering = { dependencies = { items = { "set_entr_inversions", } }, object_type = "Consumable", order = 2000 + 27, key = "offering", set = "Omen", inversion = "c_cry_adversary", atlas = "consumables", config = { sellmult = 0.75, }, pos = {x=9,y=7}, --soul_pos = { x = 5, y = 0}, use = function(self, card2, area, copier) Entropy.FlipThen(G.jokers.cards, function(card, area) card.ability.rental = true end) G.E_MANAGER:add_event(Event({ func = function() G.GAME.entr_shop_price_modifier = (G.GAME.entr_shop_price_modifier or 1) * card2.ability.sellmult for k, v in pairs(G.I.CARD) do if v.set_cost then v:set_cost() end end return true end, })) end, can_use = function(self, card) return G.jokers and #G.jokers.cards > 0 end, loc_vars = function(self, q, card) q[#q+1] = {key="rental",set="Other", vars = {3}} return { vars = { card.ability.sellmult, } } end, entr_credits = { art = {"Lil. Mr. Slipstream"} }, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local entomb = { dependencies = { items = { "set_entr_inversions", } }, object_type = "Consumable", order = 2000 + 28, key = "entomb", set = "Omen", inversion = "c_cry_chambered", atlas = "consumables", config = { num = 1 }, pos = {x=9,y=6}, --soul_pos = { x = 5, y = 0}, use = function(self, card2, area, copier) for i, v in pairs(Entropy.GetHighlightedCards({G.consumeables}, card2, 1, card2.ability.num)) do local c if v.config.center.set == "Booster" then c = copy_card(v) else c = create_card("Booster", G.consumeables, nil, nil, nil, nil, key) c:set_ability(G.P_CENTERS[Entropy.BoosterSets[v.config.center.set] or "p_standard_normal_1"]) end c:add_to_deck() c.T.w = c.T.w * 2.0/2.6 c.T.h = c.T.h * 2.0/2.6 table.insert(G.consumeables.cards, c) c.area = G.consumeables G.consumeables:align_cards() end end, can_use = function(self, card) return G.consumeables and #Entropy.GetHighlightedCards({G.consumeables}, card, 1, card.ability.num) > 0 and #Entropy.GetHighlightedCards({G.consumeables}, card, 1, card.ability.num) <= card.ability.num end, loc_vars = function(self, q, card) return { vars = { card.ability.num, } } end, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local conduct = { dependencies = { items = { "set_entr_inversions", } }, object_type = "Consumable", order = 2000 + 29, key = "conduct", set = "Omen", inversion = "c_cry_conduit", atlas = "consumables", pos = {x=10,y=6}, --soul_pos = { x = 5, y = 0}, use = function(self, card2, area, copier) local card = Entropy.GetHighlightedCards({G.hand, G.jokers, G.consumeables, G.pack_cards}, card2, 1, 1)[1] local area = card.area local edition = Entropy.FindPreviousInPool(card.edition.key, "Edition") local cards = {} for i, v in pairs(area.cards) do if area.cards[i+1] == card or area.cards[i-1] == card then cards[#cards+1]=v end end Entropy.FlipThen(cards, function(card3, area, indx) card3:set_edition(edition) card3:add_to_deck() end) Entropy.Unhighlight({G.hand, G.jokers, G.consumeables, G.pack_cards}) end, can_use = function(self, card) return #Entropy.GetHighlightedCards({G.hand, G.jokers, G.consumeables, G.pack_cards}, card, 1, 1) == 1 and Entropy.GetHighlightedCards({G.hand, G.jokers, G.consumeables, G.pack_cards}, card, 1, 1)[1].edition and Entropy.GetHighlightedCards({G.hand, G.jokers, G.consumeables, G.pack_cards}, card, 1, 1)[1].edition.key end, loc_vars = function(self,q,card) local str = "none" if #Entropy.GetHighlightedCards({G.hand, G.jokers, G.consumeables, G.pack_cards}, card) == 1 and Entropy.GetHighlightedCards({G.hand, G.jokers, G.consumeables, G.pack_cards}, card, 1, 1)[1].edition and Entropy.FindPreviousInPool(Entropy.GetHighlightedCards({G.hand, G.jokers, G.consumeables, G.pack_cards}, card, 1, 1)[1].edition.key, "Edition") then str = G.localization.descriptions.Edition[Entropy.FindPreviousInPool(Entropy.GetHighlightedCards({G.hand, G.jokers, G.consumeables, G.pack_cards}, card, 1, 1)[1].edition.key, "Edition")].name end return { vars = { str } } end, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local pulsar = { dependencies = { items = { "set_entr_inversions", } }, object_type = "Consumable", order = 2000 + 30, key = "pulsar", set = "Omen", inversion = "c_cry_white_hole", atlas = "consumables", config = { level = 4 }, no_select = true, soul_rate = 0, hidden = true, pos = {x=6,y=3}, --soul_pos = { x = 5, y = 0}, use = function(self, card, area, copier,amt) local amt = amt or 1 local used_consumable = copier or card delay(0.4) update_hand_text( { sound = "button", volume = 0.7, pitch = 0.8, delay = 0.3 }, { handname = localize('k_all_hands'), chips = "...", mult = "...", level = "" } ) for i, v in pairs(G.GAME.hands) do v.AscensionPower = to_big(v.AscensionPower or 0) + to_big(card.ability.level*amt) end delay(1.0) G.E_MANAGER:add_event(Event({ trigger = "after", delay = 0.2, func = function() play_sound("tarot1") ease_colour(G.C.UI_CHIPS, copy_table(G.C.GOLD), 0.1) ease_colour(G.C.UI_MULT, copy_table(G.C.GOLD), 0.1) Cryptid.pulse_flame(0.01, sunlevel) used_consumable:juice_up(0.8, 0.5) G.E_MANAGER:add_event(Event({ trigger = "after", blockable = false, blocking = false, delay = 1.2, func = function() ease_colour(G.C.UI_CHIPS, G.C.BLUE, 1) ease_colour(G.C.UI_MULT, G.C.RED, 1) return true end, })) return true end, })) update_hand_text({ sound = "button", volume = 0.7, pitch = 0.9, delay = 0 }, { level = "+"..card.ability.level*amt }) delay(2.6) update_hand_text( { sound = "button", volume = 0.7, pitch = 1.1, delay = 0 }, { mult = 0, chips = 0, handname = "", level = "" } ) end, no_select = true, bulk_use = function(self,card,area,copier,amt) self.use(self,card,area,copier,amt) end, can_use = function(self, card) return true end, loc_vars = function(self, q, card) return { vars = { card.ability.level } } end, entr_credits = { art = {"Lil. Mr. Slipstream"} }, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local beyond = { object_type = "Consumable", order = 2000 + 31, key = "beyond", inversion = "c_cry_gateway", pos = {x = 0, y = 0}, tsoul_pos = {x=2, y=0, extra = {x=1,y=0}}, dependencies = { items = {"set_entr_entropics", "set_entr_inversions"} }, atlas = "consumables", set = "Omen", no_select = true, hidden=true, soul_rate = 0, use = function(self, card) local deletable_jokers = {} for k, v in pairs(G.jokers.cards) do if not SMODS.is_eternal(v) then if not Entropy.DeckOrSleeve("doc") or to_big(G.GAME.entropy or 0) < to_big(100) then deletable_jokers[#deletable_jokers + 1] = v end end end if Entropy.DeckOrSleeve("doc") then ease_entropy(-G.GAME.entropy) end local _first_dissolve = nil G.E_MANAGER:add_event(Event({ trigger = "before", delay = 0.75, func = function() for k, v in pairs(deletable_jokers) do if v.config.center.rarity == "cry_exotic" then check_for_unlock({ type = "what_have_you_done" }) end v:start_dissolve(nil, _first_dissolve) _first_dissolve = true end return true end, })) G.E_MANAGER:add_event(Event({ trigger = "after", delay = 0.4, func = function() play_sound("timpani") local card = create_card("Joker", G.jokers, nil, "entr_entropic", nil, nil, nil, "entr_beyond") card:add_to_deck() G.jokers:emplace(card) card:juice_up(0.3, 0.5) return true end, })) delay(0.6) end, can_use = function() return true end, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local penumbra = { key = "penumbra", set = "Fraud", atlas = "fraud", object_type = "Consumable", order = -901+22, dependencies = { items = { "set_entr_inversions" } }, config = { select = 1 }, pos = {x=2,y=2}, inversion = "c_cry_eclipse", use = function(self, card2) local cards = Entropy.GetHighlightedCards({G.hand}, card2, 1, card2.ability.select) for i, v in pairs(cards) do local card = cards[i] G.E_MANAGER:add_event(Event({ func = function() card:start_dissolve() if card.config.center.key ~= "c_base" then G.GAME.banned_keys[card.config.center.key] = true end return true end })) end end, can_use = function(self, card) local num = #Entropy.GetHighlightedCards({G.hand}, card, 1, card.ability.select) return num > 0 and num <= card.ability.select end, loc_vars = function(self, q, card) return { vars = { card.ability.select } } end, entr_credits = { art = {"Grahkon"} }, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local prophecy = { key = "prophecy", set = "Fraud", atlas = "fraud", object_type = "Consumable", order = -900+23, dependencies = { items = { "set_entr_inversions" } }, inversion = "c_cry_theblessing", pos = {x=3,y=2}, config = { counter = 2 }, use = function(self, card, area, copier) G.GAME.next_inversions_prophecy = G.GAME.last_fraud.key G.GAME.last_fraud = nil G.GAME.inversions_prophecy_counter = card.ability.counter end, can_use = function(self, card) return G.GAME.last_fraud end, loc_vars = function(self, q, card) card.ability.last_fraud = G.GAME.last_fraud and G.GAME.last_fraud.set and G.localization.descriptions[G.GAME.last_fraud.set][G.GAME.last_fraud.key].name or "None" return { vars = { card.ability.counter }, main_end = (card.area and (card.area == G.consumeables or card.area == G.pack_cards or card.area == G.hand)) and { { n = G.UIT.C, config = { align = "bm", minh = 0.4 }, nodes = { { n = G.UIT.C, config = { ref_table = card, align = "m", colour = G.C.JOKER_GREY, r = 0.05, padding = 0.1, func = "has_fraud", }, nodes = { { n = G.UIT.T, config = { ref_table = card.ability, ref_value = "last_fraud", colour = G.C.UI.TEXT_LIGHT, scale = 0.32*0.8, }, }, }, }, }, }, } or nil, } end, entr_credits = { idea = {"cassknows"}, art = {"Grahkon"} }, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local imp = { key = "imp", set = "Fraud", atlas = "fraud", object_type = "Consumable", order = -901+24, dependencies = { items = { "set_entr_inversions" } }, config = { select = 2 }, pos = {x=4,y=2}, inversion = "c_cry_seraph", use = function(self, card2) local cards = Entropy.GetHighlightedCards({G.hand}, card2, 1, card2.ability.select) Entropy.FlipThen(cards, function(card) card:set_ability(G.P_CENTERS.m_entr_dark) G.hand:remove_from_highlighted(card) end) end, can_use = function(self, card) local num = #Entropy.GetHighlightedCards({G.hand}, card, 1, card.ability.select) return num > 0 and num <= card.ability.select end, loc_vars = function(self, q, card) q[#q+1] = G.P_CENTERS.m_entr_dark return { vars = { card.ability.select } } end, entr_credits = { art = {"LFMoth"} }, demicoloncompat = true, force_use = function(self, card) self:use(card) end } local integrity = { key = "integrity", set = "Fraud", atlas = "fraud", object_type = "Consumable", order = -901+25, dependencies = { items = { "set_entr_inversions" } }, config = { select = 2 }, pos = {x=5,y=2}, inversion = "c_cry_instability", use = function(self, card2) local cards = Entropy.FilterTable(Entropy.GetHighlightedCards({G.hand}, card2, 1, card2.ability.select), function(card) return card.config.center.key ~= "c_base" end) Entropy.FlipThen(cards, function(card) local edition = Entropy.pseudorandom_element(G.P_CENTER_POOLS.Edition, pseudoseed("entropy"),function(e) return G.GAME.banned_keys[e.key] or e.no_doe end).key local seal = Entropy.pseudorandom_element(G.P_CENTER_POOLS.Seal, pseudoseed("entropy"),function(e) return G.GAME.banned_keys[e.key] or e.no_doe end).key card:set_edition(edition) card:set_seal(seal) card:set_ability(G.P_CENTERS.c_base) G.hand:remove_from_highlighted(card) end) end, can_use = function(self, card) local num = #Entropy.FilterTable(Entropy.GetHighlightedCards({G.hand}, card, 1, card.ability.select), function(card) return card.config.center.key ~= "c_base" end) return num > 0 and num <= card.ability.select end, loc_vars = function(self, q, card) return { vars = { card.ability.select } } end, demicoloncompat = true, force_use = function(self, card) self:use(card) end, entr_credits = { art = {"LFMoth"} } } local mallet = { key = "mallet", set = "Fraud", atlas = "fraud", object_type = "Consumable", order = -901+32, dependencies = { items = { "set_entr_inversions" } }, config = { create = 1 }, pos = {x=6,y=2}, inversion = "c_cry_automaton", use = function(self, card2) local cards = {} for i, v in pairs(G.hand.cards) do cards[#cards+1]=v end pseudoshuffle(cards, pseudoseed('immolate')) local actual = {} for i = 1, card2.ability.create do actual[i] = cards[i] end for i, v in ipairs(actual) do G.E_MANAGER:add_event(Event({ func = function() if G.consumeables.config.card_count < G.consumeables.config.card_limit then SMODS.add_card({ set = "Command", area = G.consumeables, key_append = "entr_mallet" }) end return true end })) v:start_dissolve() end end, can_use = function(self, card) return G.hand and #G.hand.cards > 0 end, loc_vars = function(self, q, card) return { vars = { card.ability.create } } end, demicoloncompat = true, force_use = function(self, card) self:use(card) end, entr_credits = { art = {"LFMoth"} } } return { items = { --Omen dispel, cleanse, fusion, substitute, evocation, mimic, project, downpour, rift, script, engulf, offering, entomb, conduct, pulsar, beyond, superego, superego_sticker, --Fraud penumbra, prophecy, imp, integrity, mallet } }
1
0.936791
1
0.936791
game-dev
MEDIA
0.989305
game-dev
0.937536
1
0.937536
DonBruce64/MinecraftTransportSimulator
56,969
mccore/src/main/java/minecrafttransportsimulator/entities/instances/EntityVehicleF_Physics.java
package minecrafttransportsimulator.entities.instances; import java.util.HashSet; import java.util.List; import java.util.Set; import minecrafttransportsimulator.baseclasses.BoundingBox; import minecrafttransportsimulator.baseclasses.ColorRGB; import minecrafttransportsimulator.baseclasses.ComputedVariable; import minecrafttransportsimulator.baseclasses.Point3D; import minecrafttransportsimulator.baseclasses.TowingConnection; import minecrafttransportsimulator.baseclasses.TransformationMatrix; import minecrafttransportsimulator.entities.components.AEntityB_Existing; import minecrafttransportsimulator.entities.components.AEntityG_Towable; import minecrafttransportsimulator.items.instances.ItemVehicle; import minecrafttransportsimulator.mcinterface.AWrapperWorld; import minecrafttransportsimulator.mcinterface.IWrapperNBT; import minecrafttransportsimulator.mcinterface.IWrapperPlayer; import minecrafttransportsimulator.mcinterface.InterfaceManager; import minecrafttransportsimulator.systems.ConfigSystem; /** * This class adds the final layer of physics calculations on top of the * existing entity calculations. Various control surfaces are present, as * well as helper functions and logic for controlling those surfaces. * Note that angle variables here should be divided by 10 to get actual angle. * * @author don_bruce */ public class EntityVehicleF_Physics extends AEntityVehicleE_Powered { //Aileron. public final ComputedVariable aileronInputVar; public final ComputedVariable aileronAngleVar; public final ComputedVariable aileronTrimVar; public final ComputedVariable aileronAreaVar; public static final double MAX_AILERON_ANGLE = 25; public static final double MAX_AILERON_TRIM = 10; public static final double AILERON_DAMPEN_RATE = 0.6; //Elevator. public final ComputedVariable elevatorInputVar; public final ComputedVariable elevatorAngleVar; public final ComputedVariable elevatorTrimVar; public final ComputedVariable elevatorAreaVar; public static final double MAX_ELEVATOR_ANGLE = 25; public static final double MAX_ELEVATOR_TRIM = 10; public static final double ELEVATOR_DAMPEN_RATE = 0.6; //Rudder. public final ComputedVariable rudderInputVar; public final ComputedVariable rudderAngleVar; public final ComputedVariable rudderTrimVar; public final ComputedVariable rudderAreaVar; public static final double MAX_RUDDER_ANGLE = 45; public static final double MAX_RUDDER_TRIM = 10; public static final double RUDDER_DAMPEN_RATE = 2.0; public static final double RUDDER_DAMPEN_RETURN_RATE = 4.0; //Wings/flaps. public static final short MAX_FLAP_ANGLE_REFERENCE = 350; public final ComputedVariable wingAreaVar; public final ComputedVariable wingSpanVar; public final ComputedVariable flapDesiredAngleVar; public final ComputedVariable flapActualAngleVar; //Autopilot. public final ComputedVariable autopilotValueVar; public final ComputedVariable autolevelEnabledVar; //Open top. public final ComputedVariable openTopVar; //External state control. public boolean turningLeft; public boolean turningRight; public byte turningCooldown; public double airDensity; public double seaLevel = ConfigSystem.settings.general.seaLevel.value; public int controllerCount; public IWrapperPlayer lastController; //Internal states. public double indicatedSpeed; private boolean hasRotors; private double trackAngle; private final Point3D normalizedVelocityVector = new Point3D(); private final Point3D verticalVector = new Point3D(); private final Point3D sideVector = new Point3D(); private final Point3D hitchPrevOffset = new Point3D(); private final Point3D hitchCurrentOffset = new Point3D(); private final Set<AEntityG_Towable<?>> towedEntitiesCheckedForWeights = new HashSet<>(); //Physics properties public final ComputedVariable dragCoefficientVar; public final ComputedVariable ballastControlVar; public final ComputedVariable ballastVolumeVar; public final ComputedVariable waterBallastFactorVar; public final ComputedVariable gravityFactorVar; public final ComputedVariable axleRatioVar; //Coefficients. private double wingLiftCoeff; private double aileronLiftCoeff; private double elevatorLiftCoeff; private double rudderLiftCoeff; private double dragCoeff; //Forces. private double dragForce;//kg*m/ticks^2 private double wingForce;//kg*m/ticks^2 private double aileronForce;//kg*m/ticks^2 private double elevatorForce;//kg*m/ticks^2 private double rudderForce;//kg*m/ticks^2 private double ballastForce;//kg*m/ticks^2 private double gravitationalForce;//kg*m/ticks^2 private final Point3D thrustForce = new Point3D();//kg*m/ticks^2 private double thrustForceValue; private final Point3D towingThrustForce = new Point3D();//kg*m/ticks^2 private final Point3D totalForce = new Point3D();//kg*m/ticks^2 //Torques. private double momentRoll;//kg*m^2 private double momentPitch;//kg*m^2 private double momentYaw;//kg*m^2 private double aileronTorque;//kg*m^2/ticks^2 private double elevatorTorque;//kg*m^2/ticks^2 private double rudderTorque;//kg*m^2/ticks^2 private final Point3D thrustTorque = new Point3D();//kg*m^2/ticks^2 private final Point3D totalTorque = new Point3D();//kg*m^2/ticks^2 private final Point3D rotorRotation = new Point3D();//degrees public EntityVehicleF_Physics(AWrapperWorld world, IWrapperPlayer placingPlayer, ItemVehicle item, IWrapperNBT data) { super(world, placingPlayer, item, data); addVariable(this.aileronInputVar = new ComputedVariable(this, "input_aileron", data)); addVariable(this.aileronAngleVar = new ComputedVariable(this, "aileron", data)); addVariable(this.aileronTrimVar = new ComputedVariable(this, "trim_aileron", data)); addVariable(this.aileronAreaVar = new ComputedVariable(this, "aileronArea")); addVariable(this.elevatorInputVar = new ComputedVariable(this, "input_elevator", data)); addVariable(this.elevatorAngleVar = new ComputedVariable(this, "elevator", data)); addVariable(this.elevatorTrimVar = new ComputedVariable(this, "trim_elevator", data)); addVariable(this.elevatorAreaVar = new ComputedVariable(this, "elevatorArea")); addVariable(this.rudderInputVar = new ComputedVariable(this, "input_rudder", data)); addVariable(this.rudderAngleVar = new ComputedVariable(this, "rudder", data)); addVariable(this.rudderTrimVar = new ComputedVariable(this, "trim_rudder", data)); addVariable(this.rudderAreaVar = new ComputedVariable(this, "rudderArea")); addVariable(this.wingAreaVar = new ComputedVariable(this, "wingArea")); addVariable(this.wingSpanVar = new ComputedVariable(this, "wingSpan")); addVariable(this.flapDesiredAngleVar = new ComputedVariable(this, "flaps_setpoint", data)); addVariable(this.flapActualAngleVar = new ComputedVariable(this, "flaps_actual", data)); addVariable(this.autopilotValueVar = new ComputedVariable(this, "autopilot", data)); addVariable(this.autolevelEnabledVar = new ComputedVariable(this, "auto_level", data)); addVariable(this.openTopVar = new ComputedVariable(this, "hasOpenTop", data)); addVariable(this.dragCoefficientVar = new ComputedVariable(this, "dragCoefficient")); addVariable(this.ballastControlVar = new ComputedVariable(this, "ballastControl", data)); addVariable(this.ballastVolumeVar = new ComputedVariable(this, "ballastVolume")); addVariable(this.waterBallastFactorVar = new ComputedVariable(this, "waterBallastFactor")); addVariable(this.gravityFactorVar = new ComputedVariable(this, "gravityFactor")); addVariable(this.axleRatioVar = new ComputedVariable(this, "axleRatio")); } @Override public void update() { super.update(); world.beginProfiling("VehicleF_Level", true); indicatedSpeed = axialVelocity * speedFactor * 20; //Set vectors. verticalVector.set(0D, 1D, 0D).rotate(orientation); normalizedVelocityVector.set(motion).normalize(); sideVector.set(verticalVector.crossProduct(headingVector)); world.endProfiling(); } @Override public boolean requiresDeltaUpdates() { return true; } @Override public double getMass() { //Need to use a list here to make sure we don't end up with infinite recursion due to bad trailer linkings. //This could lock up a world if not detected! double combinedMass = super.getMass(); if (!towingConnections.isEmpty()) { AEntityG_Towable<?> towedEntity; for (TowingConnection connection : towingConnections) { //Only check once per base entity. towedEntity = connection.towedVehicle; if (towedEntitiesCheckedForWeights.contains(towedEntity)) { InterfaceManager.coreInterface.logError("Infinite loop detected on weight checking code! Is a trailer towing the thing that's towing it?"); break; } else { towedEntitiesCheckedForWeights.add(towedEntity); combinedMass += towedEntity.getMass(); towedEntitiesCheckedForWeights.clear(); } } } return combinedMass; } @Override protected double getSteeringAngle() { return -rudderInputVar.currentValue / (float) MAX_RUDDER_ANGLE; } @Override protected void addToSteeringAngle(double degrees) { //Invert the degrees, as rudder is inverted from normal steering. double delta; if (rudderInputVar.currentValue - degrees > MAX_RUDDER_ANGLE) { delta = MAX_RUDDER_ANGLE - rudderInputVar.currentValue; } else if (rudderInputVar.currentValue - degrees < -MAX_RUDDER_ANGLE) { delta = -MAX_RUDDER_ANGLE - rudderInputVar.currentValue; } else { delta = -degrees; } rudderInputVar.adjustBy(delta, true); } @Override public void setVariableDefaults() { super.setVariableDefaults(); aileronAreaVar.setTo(definition.motorized.aileronArea, false); aileronAngleVar.setTo(aileronInputVar.currentValue, false); elevatorAngleVar.setTo(elevatorInputVar.currentValue, false); elevatorAreaVar.setTo(definition.motorized.elevatorArea, false); rudderAngleVar.setTo(rudderInputVar.currentValue, false); rudderAreaVar.setTo(definition.motorized.rudderArea, false); wingAreaVar.setTo(definition.motorized.wingArea + definition.motorized.wingArea * 0.15F * flapActualAngleVar.currentValue / MAX_FLAP_ANGLE_REFERENCE, false); wingSpanVar.setTo(definition.motorized.wingSpan, false); //Run flap defaults after wings. This lets wings get the last-state value, which might have been modified post-default-value setting. if (definition.motorized.flapNotches != null && !definition.motorized.flapNotches.isEmpty()) { if (flapActualAngleVar.currentValue < flapDesiredAngleVar.currentValue) { flapActualAngleVar.setTo(flapActualAngleVar.currentValue + definition.motorized.flapSpeed, false); } else if (flapActualAngleVar.currentValue > flapDesiredAngleVar.currentValue) { flapActualAngleVar.setTo(flapActualAngleVar.currentValue - definition.motorized.flapSpeed, false); } if (Math.abs(flapActualAngleVar.currentValue - flapDesiredAngleVar.currentValue) < definition.motorized.flapSpeed) { flapActualAngleVar.setTo(flapDesiredAngleVar.currentValue, false); } } openTopVar.setActive(definition.motorized.hasOpenTop, false); dragCoefficientVar.setTo(definition.motorized.dragCoefficient, false); ballastControlVar.setTo(elevatorInputVar.currentValue, false); ballastVolumeVar.setTo(definition.motorized.ballastVolume, false); waterBallastFactorVar.setTo(definition.motorized.waterBallastFactor, false); if (definition.motorized.gravityFactor != 0) { gravityFactorVar.setTo(definition.motorized.gravityFactor,false); } else if (!definition.motorized.isAircraft) { gravityFactorVar.setTo(ConfigSystem.settings.general.gravityFactor.value,false); } else { gravityFactorVar.setTo(1,false); } axleRatioVar.setTo(definition.motorized.axleRatio, false); } @Override protected void getForcesAndMotions() { //Get engine thrust force contributions. This happens for all vehicles, towed or not. //The only exception are mounted towed vehicles, which are static. hasRotors = false; thrustForce.set(0, 0, 0); thrustTorque.set(0, 0, 0); rotorRotation.set(0, 0, 0); thrustForceValue = 0; if (towedByConnection == null || !towedByConnection.hitchConnection.mounted) { for (APart part : allParts) { if (part instanceof PartEngine) { thrustForceValue += ((PartEngine) part).addToForceOutput(thrustForce, thrustTorque); } else if (part instanceof PartPropeller) { PartPropeller propeller = (PartPropeller) part; thrustForceValue += propeller.addToForceOutput(thrustForce, thrustTorque); if (propeller.definition.propeller.isRotor && groundDeviceCollective.isAnythingOnGround()) { hasRotors = true; if (!autopilotValueVar.isActive && autolevelEnabledVar.isActive) { rotorRotation.set((-(elevatorAngleVar.currentValue + elevatorTrimVar.currentValue) - orientation.angles.x) / MAX_ELEVATOR_ANGLE, -5D * rudderAngleVar.currentValue / MAX_RUDDER_ANGLE, ((aileronAngleVar.currentValue + aileronTrimVar.currentValue) - orientation.angles.z) / MAX_AILERON_ANGLE); } else { if (!autopilotValueVar.isActive) { rotorRotation.set(-5D * elevatorAngleVar.currentValue / MAX_ELEVATOR_ANGLE, -5D * rudderAngleVar.currentValue / MAX_RUDDER_ANGLE, 5D * aileronAngleVar.currentValue / MAX_AILERON_ANGLE); } else { if (orientation.angles.x < -1) { rotorRotation.x = 1; } else if (orientation.angles.x > 1) { rotorRotation.x = -1; } else { rotorRotation.x = -orientation.angles.x; } if (orientation.angles.z < -1) { rotorRotation.z = 1; } else if (orientation.angles.z > 1) { rotorRotation.z = -1; } else { rotorRotation.z = -orientation.angles.z; } rotorRotation.y = -5D * rudderAngleVar.currentValue / MAX_RUDDER_ANGLE; } } //Utilize control surface areas to increase or decrease factors for helicopter behaviors. rotorRotation.x *= (1 + elevatorAreaVar.currentValue); rotorRotation.y *= (1 + rudderAreaVar.currentValue); rotorRotation.z *= (1 + aileronAreaVar.currentValue); } } } } //If we are free, do normal updates. But if we are towed by a vehicle, do trailer forces instead. //This prevents trailers from behaving badly and flinging themselves into the abyss. if (towedByConnection == null) { //Set moments and air density. airDensity = 1.225 * Math.pow(2, -(position.y-seaLevel) / (500D * world.getMaxHeight() / 256D)); momentRoll = definition.motorized.emptyMass * (1.5F + fuelTank.getFluidLevel() / 10000F); momentPitch = 2D * currentMass; momentYaw = 3D * currentMass; //If we are towing any non-mounted vehicles, get their thrust contributions as well. double towedThrust = getRecursiveTowingThrust(); if (towedThrust != 0) { towingThrustForce.set(0, 0, towedThrust).rotate(orientation); thrustForce.add(towingThrustForce); } //Get the track angle. This is used for control surfaces. trackAngle = -Math.toDegrees(Math.asin(verticalVector.dotProduct(normalizedVelocityVector, true))); //Remove pitch and roll torque if we aren't supposed to use it. if (!definition.motorized.hasThrustVectoring) { thrustTorque.x = 0; thrustTorque.z = 0; } //Set blimp-specific states before calculating forces. if (definition.motorized.isBlimp) { //If we have the brake pressed at a slow speed, stop the blimp. //This is needed to prevent runaway blimps. if (Math.hypot(motion.x, motion.z) < 0.15 && (brakeVar.isActive || parkingBrakeVar.isActive)) { motion.x = 0; motion.z = 0; thrustForce.set(0D, 0D, 0D); thrustTorque.set(0D, 0D, 0D); } } //Get the lift coefficients and states for control surfaces. double yawAngleDelta = Math.toDegrees(Math.asin(sideVector.dotProduct(normalizedVelocityVector, true))); wingLiftCoeff = getLiftCoeff(trackAngle, 2 + flapActualAngleVar.currentValue / MAX_FLAP_ANGLE_REFERENCE); aileronLiftCoeff = getLiftCoeff((aileronAngleVar.currentValue + aileronTrimVar.currentValue), 2); elevatorLiftCoeff = getLiftCoeff(-2.5 + trackAngle - (elevatorAngleVar.currentValue + elevatorTrimVar.currentValue), 2); rudderLiftCoeff = getLiftCoeff(yawAngleDelta - (rudderAngleVar.currentValue + rudderTrimVar.currentValue), 2); //Get the drag coefficient and force. if (definition.motorized.isBlimp) { dragCoeff = 0.004F * Math.pow(Math.abs(yawAngleDelta), 2) + dragCoefficientVar.currentValue; } else if (definition.motorized.isAircraft) { //Aircraft are 0.03 by default, or whatever is specified. dragCoeff = 0.0004F * Math.pow(trackAngle, 2) + dragCoefficientVar.currentValue; } else { dragCoeff = dragCoefficientVar.currentValue; //If we aren't an aircraft, check for grounded ground devices. //If we don't have any grounded ground devices, assume we are in the air or in water. //This results in an increase in drag due to poor airflow. if (groundDeviceCollective.groundedGroundDevices.isEmpty()) { dragCoeff *= 3D; } } if (definition.motorized.crossSectionalArea > 0) { dragForce = 0.5F * airDensity * velocity * velocity * definition.motorized.crossSectionalArea * dragCoeff; } else if (wingSpanVar.currentValue > 0) { dragForce = 0.5F * airDensity * velocity * velocity * wingAreaVar.currentValue * (dragCoeff + wingLiftCoeff * wingLiftCoeff / (Math.PI * wingSpanVar.currentValue * wingSpanVar.currentValue / wingAreaVar.currentValue * 0.8)); } else { dragForce = 0.5F * airDensity * velocity * velocity * 5.0F * dragCoeff; } //Get ballast force. if (ballastVolumeVar.currentValue > 0) { //Ballast gets less effective at applying positive lift at higher altitudes. //This prevents blimps from ascending into space. //Also take into account motionY, as we should provide less force if we are already going in the same direction. if (ballastControlVar.currentValue < 0) { ballastForce = airDensity * ballastVolumeVar.currentValue * -ballastControlVar.currentValue / 10D; } else if (ballastControlVar.currentValue > 0) { ballastForce = 1.225 * ballastVolumeVar.currentValue * -ballastControlVar.currentValue / 10D; } else if (motion.y < -0.15 || motion.y > 0.15) { ballastForce = 1.225 * ballastVolumeVar.currentValue * 10D * -motion.y; } else { ballastForce = 0; motion.y = 0; } if (motion.y * ballastForce != 0) { ballastForce /= Math.pow(1 + Math.abs(motion.y), 2); } } //Get all other forces. wingForce = 0.5F * airDensity * axialVelocity * axialVelocity * wingAreaVar.currentValue * wingLiftCoeff; //Helicopters have rotors and shouldn't do control surface calculations. if (hasRotors) { aileronForce = 0; elevatorForce = 0; rudderForce = 0; } else { aileronForce = 0.5F * airDensity * axialVelocity * axialVelocity * aileronAreaVar.currentValue * aileronLiftCoeff; elevatorForce = 0.5F * airDensity * axialVelocity * axialVelocity * elevatorAreaVar.currentValue * elevatorLiftCoeff; rudderForce = 0.5F * airDensity * axialVelocity * axialVelocity * rudderAreaVar.currentValue * rudderLiftCoeff; } //Get torques. Point for ailerons is 0.75% to the edge of the wing. aileronTorque = aileronForce * wingSpanVar.currentValue * 0.5F * 0.75F; elevatorTorque = elevatorForce * definition.motorized.tailDistance; rudderTorque = rudderForce * definition.motorized.tailDistance; //If the elevator torque is low, don't apply it. This prevents elevators from //having effects at slow speeds. We use a faux-torque here from the main plane //body to check if we are below this point. if (Math.abs(elevatorTorque) < 2D * currentMass / 400D) { elevatorTorque = 0; } //Do more blimp-specific things for the forces. if (definition.motorized.isBlimp) { //Roll and pitch are applied only if we aren't level. //This only happens if we fall out of the sky and land on the ground and tilt. if (orientation.angles.z > 0) { aileronTorque = -Math.min(0.5F, orientation.angles.z) * currentMass / 100; } else if (orientation.angles.z < 0) { aileronTorque = -Math.max(-0.5F, orientation.angles.z) * currentMass / 100; } else { aileronTorque = 0; } if (orientation.angles.x > 0) { elevatorTorque = -Math.min(0.5F, orientation.angles.x) * currentMass / 100; } else if (orientation.angles.x < 0) { elevatorTorque = -Math.max(-0.5F, orientation.angles.x) * currentMass / 100; } else { elevatorTorque = 0; } //If we are turning with the rudder, don't let us heel out of line easily. //Rudder force should be minimal for blimps due to their moment of inertia. if (rudderTorque * rudderAngleVar.currentValue > 0) { rudderTorque = 0; } } //As a special case, if the vehicle is a stalled plane, add a forwards pitch to allow the plane to right itself. //This is needed to prevent the plane from getting stuck in a vertical position and crashing. if (wingAreaVar.currentValue > 0 && trackAngle > 40 && orientation.angles.x < 45 && motion.y < -0.1 && groundDeviceCollective.isAnythingOnGround()) { elevatorTorque += 100; } //If we are dead, don't apply forces. if (outOfHealth) { wingForce = 0; elevatorForce = 0; aileronForce = 0; rudderForce = 0; elevatorTorque = 0; aileronTorque = 0; rudderTorque = 0; ballastForce = 0; } //Finally, get gravity. Blimps sink when dead. gravitationalForce = !ballastVolumeVar.isActive || outOfHealth ? currentMass * 0.0245D * gravityFactorVar.currentValue : 0; if (waterBallastFactorVar.isActive && world.isBlockLiquid(position)) { gravitationalForce -= gravitationalForce * waterBallastFactorVar.currentValue; elevatorTorque = -orientation.angles.x * 2; aileronTorque = -orientation.angles.z * 2; } //Add all forces to the main force matrix and apply them. if (ConfigSystem.settings.general.maxFlightHeight.value > 0 && position.y > ConfigSystem.settings.general.maxFlightHeight.value) { wingForce = 0; thrustForce.y = 0; } totalForce.set(0D, wingForce - elevatorForce, 0D).rotate(orientation); totalForce.add(thrustForce); totalForce.addScaled(normalizedVelocityVector, -dragForce); totalForce.y += ballastForce - gravitationalForce; motion.addScaled(totalForce, 1 / currentMass); //Add all torques to the main torque matrix and apply them. totalTorque.set(elevatorTorque, rudderTorque, aileronTorque).add(thrustTorque).scale(180D / Math.PI); totalTorque.x /= momentPitch; totalTorque.y /= momentYaw; totalTorque.z /= momentRoll; rotation.angles.set(totalTorque).add(rotorRotation); } else if (!lockedOnRoad) { towedByConnection.hookupPriorPosition.set(towedByConnection.hookupCurrentPosition); //If we are a trailer that is mounted, just orient the vehicle to the exact position of the trailer connection. //Otherwise, do is relative to the vehicle orientations. if (towedByConnection.hitchConnection.mounted || towedByConnection.hitchConnection.restricted) { rotation.set(towedByConnection.towingEntity.orientation); if (towedByConnection.hitchConnection.rot != null) { rotation.multiply(towedByConnection.hitchConnection.rot); } if (towedByConnection.hookupConnection.rot != null) { rotation.multiply(towedByConnection.hookupConnection.rot); } if (towedByConnection.hitchConnection.restricted) { rotation.angles.x = orientation.angles.x; rotation.angles.z = orientation.angles.z; rotation.updateToAngles(); } towedByConnection.hookupCurrentPosition.set(towedByConnection.hookupConnection.pos).multiply(towedByConnection.towedEntity.scale).rotate(rotation).add(towedByConnection.towedEntity.position); } else if (!towedByConnection.hitchPriorPosition.isZero()) {//Can't update on the first tick. //Need to apply both motion to move the trailer, and yaw to adjust the trailer's angle relative to the truck. //Yaw is applied based on the current and next position of the truck's hookup. //Motion is applied after yaw corrections to ensure the trailer follows the truck. //Start by getting the hitch offsets. We save the current offset as we'll change it for angle calculations. //For these offsets, we want them to be local to our coordinates, as that is what system we will need to apply yaw in. if (towedByConnection.hookupConnection.pos.x != 0) { //Need to offset reference point to account for offset hookup location relative to center-line. hitchPrevOffset.set(-towedByConnection.hookupConnection.pos.x, 0, 0).rotate(prevOrientation); hitchCurrentOffset.set(-towedByConnection.hookupConnection.pos.x, 0, 0).rotate(orientation); hitchPrevOffset.add(towedByConnection.hitchPriorPosition).subtract(prevPosition); hitchCurrentOffset.add(towedByConnection.hitchCurrentPosition).subtract(position); } else { hitchPrevOffset.set(towedByConnection.hitchPriorPosition).subtract(prevPosition); hitchCurrentOffset.set(towedByConnection.hitchCurrentPosition).subtract(position); } //Calculate how much yaw we need to apply to rotate ourselves to match the hitch point. hitchPrevOffset.y = 0; hitchCurrentOffset.y = 0; hitchPrevOffset.normalize(); hitchCurrentOffset.normalize(); double rotationDelta = Math.toDegrees(Math.acos(hitchPrevOffset.dotProduct(hitchCurrentOffset, true))); if (hitchPrevOffset.crossProduct(hitchCurrentOffset).y < 0) { rotationDelta = -rotationDelta; } rotation.angles.set(0, rotationDelta, 0); rotation.updateToAngles(); //Update hookup position now that rotation is current. towedByConnection.hookupCurrentPosition.set(towedByConnection.hookupConnection.pos).multiply(towedByConnection.towedEntity.scale).rotate(towedByConnection.towedEntity.orientation).rotate(rotation).add(towedByConnection.towedEntity.position); } //Now get positional delta. This assumes perfectly-aligned orientation. motion.set(towedByConnection.hitchCurrentPosition).subtract(towedByConnection.hookupCurrentPosition).scale(1 / speedFactor); } else { //Towed vehicle on a road with towing vehicle. Just use same deltas. motion.set(towedByConnection.towingVehicle.motion); rotation.angles.set(0, 0, 0); } } @Override protected void adjustControlSurfaces() { if (!definition.motorized.isAircraft && autopilotValueVar.isActive) { //Car, do cruise control. if (indicatedSpeed < autopilotValueVar.currentValue) { if (throttleVar.currentValue < MAX_THROTTLE) { throttleVar.adjustBy(MAX_THROTTLE / 100D, true); } } else if (indicatedSpeed > autopilotValueVar.currentValue) { if (throttleVar.currentValue > 0) { throttleVar.adjustBy(-MAX_THROTTLE / 100D, true); } } } if (hasRotors) { //Helicopter. Do auto-hover code if required. if (autopilotValueVar.isActive) { //Change throttle to maintain altitude. //Only do this once every 1/2 second to allow for thrust changes. if (ticksExisted % 10 == 0) { if (motion.y < 0 && throttleVar.currentValue < MAX_THROTTLE) { throttleVar.adjustBy(MAX_THROTTLE / 100D, true); } else if (motion.y > 0 && throttleVar.currentValue < MAX_THROTTLE) { throttleVar.adjustBy(-MAX_THROTTLE / 100D, true); } } //Change pitch/roll based on movement. double forwardsVelocity = motion.dotProduct(headingVector, false); double sidewaysVelocity = motion.dotProduct(sideVector, false); double forwardsDelta = forwardsVelocity - prevMotion.dotProduct(headingVector, false); double sidewaysDelta = sidewaysVelocity - prevMotion.dotProduct(sideVector, false); if (forwardsDelta > 0 && forwardsVelocity > 0 && elevatorTrimVar.currentValue < MAX_ELEVATOR_TRIM) { elevatorTrimVar.adjustBy(1, true); } else if (forwardsDelta < 0 && forwardsVelocity < 0 && elevatorTrimVar.currentValue > -MAX_ELEVATOR_TRIM) { elevatorTrimVar.adjustBy(-1, true); } if (sidewaysVelocity > 0 && sidewaysDelta > 0 && aileronTrimVar.currentValue < MAX_AILERON_TRIM) { aileronTrimVar.adjustBy(1, true); } else if (sidewaysVelocity < 0 && sidewaysDelta < 0 && aileronTrimVar.currentValue > -MAX_AILERON_TRIM) { aileronTrimVar.adjustBy(-1, true); } } else { //Reset trim to prevent directional surges. if (elevatorTrimVar.currentValue < 0) { elevatorTrimVar.adjustBy(1, true); } else if (elevatorTrimVar.currentValue > 0) { elevatorTrimVar.adjustBy(-1, true); } if (aileronTrimVar.currentValue < 0) { aileronTrimVar.adjustBy(1, true); } else if (aileronTrimVar.currentValue > 0) { aileronTrimVar.adjustBy(-1, true); } } } else if (definition.motorized.isAircraft && autopilotValueVar.isActive) { //Normal aircraft. Do autopilot operations if required. //If we are not flying at a steady elevation, angle the elevator to compensate if (-motion.y * 10 > elevatorTrimVar.currentValue + 1 && elevatorTrimVar.currentValue < MAX_ELEVATOR_TRIM) { elevatorTrimVar.adjustBy(0.1, true); } else if (-motion.y * 10 < elevatorTrimVar.currentValue - 1 && elevatorTrimVar.currentValue > -MAX_ELEVATOR_TRIM) { elevatorTrimVar.adjustBy(-0.1, true); } //Keep the roll angle at 0. if (-orientation.angles.z > aileronTrimVar.currentValue + 0.1 && aileronTrimVar.currentValue < MAX_AILERON_TRIM) { aileronTrimVar.adjustBy(0.1, true); } else if (-orientation.angles.z < aileronTrimVar.currentValue - 0.1 && aileronTrimVar.currentValue > -MAX_AILERON_TRIM) { aileronTrimVar.adjustBy(-0.1, true); } } //If we don't have controllers, reset control states to 0. //Don't do this on roads, since those manually set our controls. if (!lockedOnRoad && controllerCount == 0) { if (aileronInputVar.currentValue > AILERON_DAMPEN_RATE) { aileronInputVar.increment(-AILERON_DAMPEN_RATE, 0, MAX_AILERON_ANGLE, true); } else if (aileronInputVar.currentValue < -AILERON_DAMPEN_RATE) { aileronInputVar.increment(AILERON_DAMPEN_RATE, -MAX_AILERON_ANGLE, 0, true); } else if (aileronInputVar.currentValue != 0) { aileronInputVar.setTo(0, true); } if (elevatorInputVar.currentValue > ELEVATOR_DAMPEN_RATE) { elevatorInputVar.increment(-ELEVATOR_DAMPEN_RATE, 0, MAX_ELEVATOR_ANGLE, true); } else if (elevatorInputVar.currentValue < -ELEVATOR_DAMPEN_RATE) { elevatorInputVar.increment(ELEVATOR_DAMPEN_RATE, -MAX_ELEVATOR_ANGLE, 0, true); } else if (elevatorInputVar.currentValue != 0) { elevatorInputVar.setTo(0, true); } if (rudderInputVar.currentValue > RUDDER_DAMPEN_RATE) { rudderInputVar.increment(-RUDDER_DAMPEN_RATE, 0, MAX_RUDDER_ANGLE, true); } else if (rudderInputVar.currentValue < -RUDDER_DAMPEN_RATE) { rudderInputVar.increment(RUDDER_DAMPEN_RATE, -MAX_RUDDER_ANGLE, 0, true); } else if (rudderInputVar.currentValue != 0) { rudderInputVar.setTo(0, true); } } } protected double getRecursiveTowingThrust() { if (!towingConnections.isEmpty()) { double thrust = 0; for (TowingConnection connection : towingConnections) { if (!connection.hitchConnection.mounted) { thrust += connection.towedVehicle.thrustForceValue + connection.towedVehicle.getRecursiveTowingThrust(); } } return thrust; } else { return 0; } } protected static double getLiftCoeff(double angleOfAttack, double maxLiftCoeff) { if (angleOfAttack == 0) { return 0; } else if (Math.abs(angleOfAttack) <= 15 * 1.25) { return maxLiftCoeff * Math.sin(Math.PI / 2 * angleOfAttack / 15); } else if (Math.abs(angleOfAttack) <= 15 * 1.5) { if (angleOfAttack > 0) { return maxLiftCoeff * (0.4 + 1 / (angleOfAttack - 15)); } else { return maxLiftCoeff * (-0.4 + 1 / (angleOfAttack + 15)); } } else { return maxLiftCoeff * Math.sin(Math.PI / 6 * angleOfAttack / 15); } } @Override public ComputedVariable getOrCreateVariable(String variable) { //If we are a forwarded variable and are a connected trailer, do that now. if (definition.motorized.isTrailer && definition.motorized.hookupVariables.contains(variable)) { if (towedByConnection != null) { //We are being towed, send request to towing vehicle. return towedByConnection.towingVehicle.getOrCreateVariable(variable); } else { //Not towed. Check if variable exists. If so, use it. Otherwise, make a 0 variable. ComputedVariable computedVar = computedVariables.get(variable); if (computedVar == null) { computedVar = new ComputedVariable(false); computedVariables.put(variable, computedVar); } return computedVar; } } else { return super.getOrCreateVariable(variable); } } @Override public ComputedVariable createComputedVariable(String variable, boolean createDefaultIfNotPresent) { //Not a part of a forwarded variable. Just return new ComputedVariable(this, variable, partialTicks -> normally. switch (variable) { //Vehicle world state cases. case ("yaw"): return new ComputedVariable(this, variable, partialTicks -> orientation.angles.y, false); case ("heading"): return new ComputedVariable(this, variable, partialTicks -> { double heading = -orientation.angles.y; if (ConfigSystem.client.controlSettings.north360.value) heading += 180; while (heading < 0) heading += 360; while (heading > 360) heading -= 360; return heading; }, false); case ("pitch"): return new ComputedVariable(this, variable, partialTicks -> orientation.angles.x, false); case ("roll"): return new ComputedVariable(this, variable, partialTicks -> orientation.angles.z, false); case ("altitude"): return new ComputedVariable(this, variable, partialTicks -> position.y - seaLevel, false); case ("speed"): return new ComputedVariable(this, variable, partialTicks -> indicatedSpeed, false); case ("speed_scaled"): return new ComputedVariable(this, variable, partialTicks -> indicatedSpeed / speedFactor, false); case ("velocity"): return new ComputedVariable(this, variable, partialTicks -> velocity * speedFactor * 20F, false); case ("velocity_scaled"): return new ComputedVariable(this, variable, partialTicks -> velocity * 20F, false); case ("speed_factor"): return new ComputedVariable(this, variable, partialTicks -> speedFactor, false); case ("acceleration"): return new ComputedVariable(this, variable, partialTicks -> motion.length() - prevMotion.length(), false); case ("road_angle_front"): return new ComputedVariable(this, variable, partialTicks -> frontFollower != null ? frontFollower.getCurrentYaw() - orientation.angles.y : 0, false); case ("road_angle_rear"): return new ComputedVariable(this, variable, partialTicks -> rearFollower != null ? rearFollower.getCurrentYaw() - orientation.angles.y : 0, false); //Vehicle state cases. case("autopilot_present"): return new ComputedVariable(this, variable, partialTicks -> definition.motorized.hasAutopilot ? 1 : 0, false); case ("fuel"): return new ComputedVariable(this, variable, partialTicks -> fuelTank.getFluidLevel() / fuelTank.getMaxLevel(), false); case ("mass"): return new ComputedVariable(this, variable, partialTicks -> currentMass, false); case ("electric_power"): return new ComputedVariable(this, variable, partialTicks -> electricPower, false); case ("electric_usage"): return new ComputedVariable(this, variable, partialTicks -> electricFlow * 20D, false); case ("engines_on"): return new ComputedVariable(this, variable, partialTicks -> enginesOn ? 1 : 0, false); case ("engines_starting"): return new ComputedVariable(this, variable, partialTicks -> enginesStarting ? 1 : 0, false); case ("engines_running"): return new ComputedVariable(this, variable, partialTicks -> enginesRunning ? 1 : 0, false); case ("reverser"): return new ComputedVariable(this, variable, partialTicks -> reverseThrustVar.isActive ? 1 : 0, false); case ("reverser_present"): return new ComputedVariable(this, variable, partialTicks -> hasReverseThrust ? 1 : 0, false); case ("locked"): return new ComputedVariable(this, variable, partialTicks -> lockedVar.isActive ? 1 : 0, false); case ("door"): return new ComputedVariable(this, variable, partialTicks -> parkingBrakeVar.isActive && velocity < 0.25 ? 1 : 0, false); case ("fueling"): return new ComputedVariable(this, variable, partialTicks -> beingFueled ? 1 : 0, false); case ("thrust"): return new ComputedVariable(this, variable, partialTicks -> thrustForceValue, false); case ("vertical_acceleration"): return new ComputedVariable(this, variable, partialTicks -> -((Math.toRadians(rotation.angles.x) * 20F) * indicatedSpeed), false); case ("lateral_acceleration"): return new ComputedVariable(this, variable, partialTicks -> -((Math.toRadians(rotation.angles.y) * 20F) * indicatedSpeed), false); case ("vertical_acceleration_scaled"): return new ComputedVariable(this, variable, partialTicks -> -((Math.toRadians(rotation.angles.x) * 20F) * (indicatedSpeed / speedFactor)), false); case ("lateral_acceleration_scaled"): return new ComputedVariable(this, variable, partialTicks -> -((Math.toRadians(rotation.angles.y) * 20F) * (indicatedSpeed / speedFactor)), false); case ("load_factor"): return new ComputedVariable(this, variable, partialTicks -> (((Math.toRadians(-rotation.angles.x) * 20F) * indicatedSpeed) + 9.8) / 9.8, false); case ("load_factor_scaled"): return new ComputedVariable(this, variable, partialTicks -> (((Math.toRadians(-rotation.angles.x) * 20F) * (indicatedSpeed / speedFactor)) + 9.8) / 9.8, false); //State cases generally used on aircraft. case ("flaps_moving"): return new ComputedVariable(this, variable, partialTicks -> flapActualAngleVar.currentValue != flapDesiredAngleVar.currentValue ? 1 : 0, false); case ("flaps_increasing"): return new ComputedVariable(this, variable, partialTicks -> flapActualAngleVar.currentValue < flapDesiredAngleVar.currentValue ? 1 : 0, false); case ("flaps_decreasing"): return new ComputedVariable(this, variable, partialTicks -> flapActualAngleVar.currentValue > flapDesiredAngleVar.currentValue ? 1 : 0, false); case ("vertical_speed"): return new ComputedVariable(this, variable, partialTicks -> motion.y * speedFactor * 20, false); case ("lift_reserve"): return new ComputedVariable(this, variable, partialTicks -> -trackAngle, false); case ("turn_coordinator"): return new ComputedVariable(this, variable, partialTicks -> ((rotation.angles.z) / 10 + rotation.angles.y) / 0.15D * 25, false); case ("turn_indicator"): return new ComputedVariable(this, variable, partialTicks -> (rotation.angles.y) / 0.15F * 25F, false); case ("pitch_indicator"): return new ComputedVariable(this, variable, partialTicks -> (rotation.angles.x) / 0.15F * 25F, false); case ("slip"): return new ComputedVariable(this, variable, partialTicks -> 75 * sideVector.dotProduct(normalizedVelocityVector, true), false); case ("slip_degrees"): return new ComputedVariable(this, variable, partialTicks -> -Math.toDegrees(Math.asin(sideVector.dotProduct(normalizedVelocityVector, false))), false); case ("slip_understeer"): return new ComputedVariable(this, variable, partialTicks -> getSteeringAngle() * (1 - Math.max(0, Math.min(1, Math.abs(turningForce) / 10))), false); case ("gear_present"): return new ComputedVariable(this, variable, partialTicks -> definition.motorized.gearSequenceDuration != 0 ? 1 : 0, false); case ("gear_moving"): return new ComputedVariable(this, variable, partialTicks -> (retractGearVar.isActive ? gearMovementTime != definition.motorized.gearSequenceDuration : gearMovementTime != 0) ? 1 : 0, false); case ("beacon_connected"): return new ComputedVariable(this, variable, partialTicks -> selectedBeacon != null ? 1 : 0, false); case ("beacon_direction"): return new ComputedVariable(this, variable, partialTicks -> selectedBeacon != null ? orientation.angles.getClampedYDelta(Math.toDegrees(Math.atan2(selectedBeacon.position.x - position.x, selectedBeacon.position.z - position.z))) : 0, false); case ("beacon_bearing_setpoint"): return new ComputedVariable(this, variable, partialTicks -> selectedBeacon != null ? selectedBeacon.bearing : 0, false); case ("beacon_bearing_delta"): return new ComputedVariable(this, variable, partialTicks -> selectedBeacon != null ? selectedBeacon.getBearingDelta(this) : 0, false); case ("beacon_glideslope_setpoint"): return new ComputedVariable(this, variable, partialTicks -> selectedBeacon != null ? selectedBeacon.glideSlope : 0, false); case ("beacon_glideslope_actual"): return new ComputedVariable(this, variable, partialTicks -> selectedBeacon != null ? Math.toDegrees(Math.asin((position.y - selectedBeacon.position.y) / position.distanceTo(selectedBeacon.position))) : 0, false); case ("beacon_glideslope_delta"): return new ComputedVariable(this, variable, partialTicks -> selectedBeacon != null ? selectedBeacon.glideSlope - Math.toDegrees(Math.asin((position.y - selectedBeacon.position.y) / position.distanceTo(selectedBeacon.position))) : 0, false); case ("beacon_distance"): return new ComputedVariable(this, variable, partialTicks -> selectedBeacon != null ? Math.hypot(-selectedBeacon.position.z + position.z,-selectedBeacon.position.x + position.x) : 0, false); case ("radar_detected"): return new ComputedVariable(this, variable, partialTicks -> radarsTracking.isEmpty() ? 0 : 1, false); case ("missile_incoming"): return new ComputedVariable(this, variable, partialTicks -> missilesIncoming.isEmpty() ? 0 : 1, false); default: { //Missile incoming variables. //Variable is in the form of missile_X_variablename. if (variable.startsWith("missile_") && !variable.endsWith("incoming")) { final String missileVariable = variable.substring(variable.lastIndexOf("_") + 1); final int missileNumber = ComputedVariable.getVariableNumber(variable.replaceAll("\\D", "")); return new ComputedVariable(this, variable, partialTicks -> { if (missilesIncoming.size() > missileNumber) { switch (missileVariable) { case ("distance"): return missilesIncoming.get(missileNumber).targetDistance; case ("direction"): { Point3D missilePos = missilesIncoming.get(missileNumber).position; return Math.toDegrees(Math.atan2(-missilePos.z + position.z, -missilePos.x + position.x)) + 90 + orientation.angles.y; } } } return 0; }, false); }else if (variable.startsWith("radar_")) { final String[] parsedVariable = variable.split("_"); //First check if we are seeing with our own radar, or being seen. //Variable is in the form of radar_X_variablename for inbound, radar_T_X_variablename for outbound. if(parsedVariable.length == 3) { //Inbound contact from another radar. final int radarNumber = Integer.parseInt(parsedVariable[1]) - 1; switch (parsedVariable[2]) { case ("detected"): return new ComputedVariable(this, variable, partialTicks -> radarsTracking.size() > radarNumber ? 1 : 0, false); case ("distance"): return new ComputedVariable(this, variable, partialTicks -> radarsTracking.size() > radarNumber ? radarsTracking.get(radarNumber).position.distanceTo(position) : 0, false); case ("direction"): { return new ComputedVariable(this, variable, partialTicks -> { if(radarsTracking.size() > radarNumber) { Point3D entityPos = radarsTracking.get(radarNumber).position; return Math.toDegrees(Math.atan2(-entityPos.z + position.z, -entityPos.x + position.x)) + 90 + orientation.angles.y; }else { return 0; } }, false); } } }else if(parsedVariable.length == 4) { //Outbound radar found, do logic. final List<EntityVehicleF_Physics> radarList; switch (parsedVariable[1]) { case ("aircraft"): { radarList = aircraftOnRadar; break; } case ("ground"): { radarList = groundersOnRadar; break; } default: //Invalid radar type. return new ComputedVariable(false); } final int radarNumber = Integer.parseInt(parsedVariable[2]) - 1; switch (parsedVariable[3]) { case ("distance"): return new ComputedVariable(this, variable, partialTicks -> { if (radarNumber < radarList.size()) { AEntityB_Existing contact = radarList.get(radarNumber); return contact.position.distanceTo(position); } else { return 0; } }, false); case ("direction"): return new ComputedVariable(this, variable, partialTicks -> { if (radarNumber < radarList.size()) { AEntityB_Existing contact = radarList.get(radarNumber); double delta = Math.toDegrees(Math.atan2(-contact.position.z + position.z, -contact.position.x + position.x)) + 90 + orientation.angles.y; while (delta < -180) delta += 360; while (delta > 180) delta -= 360; return delta; } else { return 0; } }, false); case ("speed"): return new ComputedVariable(this, variable, partialTicks -> { if (radarNumber < radarList.size()) { AEntityB_Existing contact = radarList.get(radarNumber); return contact.velocity; } else { return 0; } }, false); case ("altitude"): return new ComputedVariable(this, variable, partialTicks -> { if (radarNumber < radarList.size()) { AEntityB_Existing contact = radarList.get(radarNumber); return contact.position.y; } else { return 0; } }, false); case ("angle"): return new ComputedVariable(this, variable, partialTicks -> { if (radarNumber < radarList.size()) { AEntityB_Existing contact = radarList.get(radarNumber); return -Math.toDegrees(Math.atan2(-contact.position.y + position.y, Math.hypot(-contact.position.z + position.z, -contact.position.x + position.x))) + orientation.angles.x; } else { return 0; } }, false); } } //Down here means bad variable format. return new ComputedVariable(false); }else { return super.createComputedVariable(variable, createDefaultIfNotPresent); } } } } @Override public void renderBoundingBoxes(TransformationMatrix transform) { super.renderBoundingBoxes(transform); if (towedByConnection == null || !towedByConnection.hitchConnection.mounted) { for (BoundingBox box : groundDeviceCollective.getGroundBounds()) { box.renderWireframe(this, transform, null, ColorRGB.BLUE); } } } }
1
0.908042
1
0.908042
game-dev
MEDIA
0.473208
game-dev
0.931657
1
0.931657
Fluorohydride/ygopro-scripts
2,766
c62022479.lua
--烙印の絆 function c62022479.initial_effect(c) aux.AddCodeList(c,68468459) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(62022479,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,62022479) e1:SetTarget(c62022479.target) e1:SetOperation(c62022479.activate) c:RegisterEffect(e1) --to grave local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(c62022479.regcon) e2:SetOperation(c62022479.regop) c:RegisterEffect(e2) --set local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(62022479,1)) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,62022480) e3:SetCondition(c62022479.setcon) e3:SetTarget(c62022479.settg) e3:SetOperation(c62022479.setop) c:RegisterEffect(e3) end function c62022479.spfilter(c,e,tp) return (c:IsFaceup() or c:IsLocation(LOCATION_HAND+LOCATION_GRAVE)) and c:IsCode(68468459) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c62022479.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c62022479.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED) end function c62022479.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c62022479.spfilter),tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function c62022479.regcon(e,tp,eg,ep,ev,re,r,rp) local code1,code2=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_CODE,CHAININFO_TRIGGERING_CODE2) return e:GetHandler():IsReason(REASON_COST) and re and re:IsActivated() and (code1==68468459 or code2==68468459) end function c62022479.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() c:RegisterFlagEffect(62022479,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1) end function c62022479.setcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(62022479)>0 end function c62022479.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsSSetable() end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) end function c62022479.setop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SSet(tp,c) end end
1
0.851738
1
0.851738
game-dev
MEDIA
0.962147
game-dev
0.910995
1
0.910995
CollapseLauncher/Collapse
8,479
CollapseLauncher/Classes/Plugins/PluginManager.cs
using CollapseLauncher.Helper.Metadata; using Hi3Helper; using Hi3Helper.Plugin.Core.Update; using Hi3Helper.Shared.Region; using System; using System.Buffers; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; // ReSharper disable StringLiteralTypo namespace CollapseLauncher.Plugins; #nullable enable internal static partial class PluginManager { internal const string PluginDirPrefix = "Hi3Helper.Plugin.*"; internal const string ManifestPrefix = "manifest.json"; public static readonly Dictionary<string, PluginInfo> PluginInstances = new(StringComparer.OrdinalIgnoreCase); internal static async Task LoadPlugins( Dictionary<string, Dictionary<string, PresetConfig>?> launcherMetadataConfig, Dictionary<string, List<string>?> launcherGameNameRegionCollection, Dictionary<string, Stamp> launcherMetadataStampDictionary) { DirectoryInfo directoryInfo = new DirectoryInfo(LauncherConfig.AppPluginFolder); if (!directoryInfo.Exists) { directoryInfo.Create(); } ApplyPendingRoutines(directoryInfo); foreach (DirectoryInfo pluginDirInfo in directoryInfo.EnumerateDirectories(PluginDirPrefix, SearchOption.TopDirectoryOnly)) { PluginInfo? pluginInfo = null; FileInfo? pluginFile = null; FileInfo? manifestFile = pluginDirInfo .EnumerateFiles(ManifestPrefix, SearchOption.TopDirectoryOnly) .FirstOrDefault(); FileInfo? markDisabled = pluginDirInfo .EnumerateFiles(PluginInfo.MarkDisabledFileName, SearchOption.TopDirectoryOnly) .FirstOrDefault(); try { if (manifestFile == null) { continue; } await using FileStream manifestFileStream = manifestFile.OpenRead(); PluginManifest? pluginManifest = await manifestFileStream.DeserializeAsync(PluginManifestContext.Default.PluginManifest); if (pluginManifest == null) { continue; } pluginFile = new FileInfo(Path.Combine(pluginDirInfo.FullName, pluginManifest.MainLibraryName)); if (!pluginFile.Exists) { Logger.LogWriteLine($"The {pluginManifest.MainLibraryName} doesn't exist in this plugin directory: {pluginDirInfo.FullName}. Skipping!", LogType.Warning, true); continue; } AssertIfUpxPacked(pluginFile); string pluginDirName = pluginDirInfo.Name; if (PluginInstances.TryGetValue(pluginDirName, out pluginInfo)) { // Plugin already loaded, skip it. continue; } string pluginRelName = Path.Combine(pluginDirInfo.Name, pluginFile.Name); pluginInfo = new PluginInfo(pluginFile.FullName, pluginRelName, pluginManifest, markDisabled is not { Exists: true }); await pluginInfo.Initialize(CancellationToken.None); _ = PluginInstances.TryAdd(pluginDirName, pluginInfo); } catch (Exception ex) { Logger.LogWriteLine($"[PluginManager] Failed to load plugin from file: {pluginFile?.FullName} due to error: {ex}", LogType.Error, true); pluginInfo?.Dispose(); } finally { if (pluginInfo is { IsLoaded: true }) { foreach (PluginPresetConfigWrapper currentConfig in pluginInfo.PresetConfigs) { string gameName = currentConfig.GameName; string gameRegion = currentConfig.ZoneName; ref Dictionary<string, PresetConfig>? dict = ref CollectionsMarshal.GetValueRefOrAddDefault(launcherMetadataConfig, gameName, out _); if (Unsafe.IsNullRef(ref dict) || dict == null) { dict = new Dictionary<string, PresetConfig>(StringComparer.OrdinalIgnoreCase); } dict.TryAdd(gameRegion, currentConfig); ref List<string>? gameRegions = ref CollectionsMarshal.GetValueRefOrAddDefault(launcherGameNameRegionCollection, gameName, out _); if (Unsafe.IsNullRef(ref gameRegions) || gameRegions == null) { gameRegions = []; } gameRegions.Add(gameRegion); long stampTimestamp = long.Parse(pluginInfo.CreationDate?.ToString("yyyyMMddHHmmss") ?? "0"); _ = launcherMetadataStampDictionary.TryAdd($"{gameName} - {gameRegion}", new Stamp { GameName = gameName, GameRegion = gameRegion, LastModifiedTimeUtc = pluginInfo.CreationDate ?? DateTime.MinValue, LastUpdated = stampTimestamp, MetadataType = MetadataType.PresetConfigPlugin, PresetConfigVersion = pluginInfo.StandardVersion.ToString() }); } } } } } internal static void UnloadPlugins() { // Dispose all plugin instances before freeing the plugin handles. foreach (PluginInfo pluginInfo in PluginInstances.Values) { pluginInfo.Dispose(); } // Clear the plugin instances. PluginInstances.Clear(); } internal static void ApplyPendingRoutines(DirectoryInfo pluginRootDir) { foreach (DirectoryInfo pluginDir in pluginRootDir .EnumerateDirectories(PluginDirPrefix, SearchOption.TopDirectoryOnly)) { FileInfo markPendingUninstall = new FileInfo(Path.Combine(pluginDir.FullName, PluginInfo.MarkPendingDeletionFileName)); FileInfo markPendingApplyUpdate = new FileInfo(Path.Combine(pluginDir.FullName, PluginInfo.MarkPendingUpdateFileName, PluginInfo.MarkPendingUpdateApplyFileName)); if (markPendingUninstall.Exists) { ApplyPendingUninstallRoutine(pluginDir, markPendingUninstall); } markPendingApplyUpdate.Refresh(); if (!markPendingApplyUpdate.Exists) { continue; } ApplyPendingUpdateRoutine(pluginDir); } } internal static void SetPluginLocaleId(string localeId) { foreach (PluginInfo pluginInfo in PluginInstances.Values) { pluginInfo.SetPluginLocaleId(localeId); } } private static void AssertIfUpxPacked(FileInfo fileInfo) { ReadOnlySpan<byte> searchValuesPattern1 = "UPX0\0\0\0\0"u8; ReadOnlySpan<byte> searchValuesPattern2 = "UPX1\0\0\0\0"u8; byte[] readHeader = ArrayPool<byte>.Shared.Rent(2048); try { using FileStream stream = fileInfo.OpenRead(); stream.ReadAtLeast(readHeader, readHeader.Length, false); int indexOfPattern1 = readHeader.AsSpan().IndexOf(searchValuesPattern1); int indexOfPattern2 = readHeader.AsSpan().IndexOf(searchValuesPattern2); if (indexOfPattern1 >= 0 && indexOfPattern2 >= 0) { Logger.LogWriteLine($"[PluginManager] Plugin: {fileInfo.Name} is UPX packed! The plugin might be unstable.", LogType.Warning, true); } } finally { ArrayPool<byte>.Shared.Return(readHeader); } } }
1
0.884712
1
0.884712
game-dev
MEDIA
0.438861
game-dev
0.969731
1
0.969731
castle-engine/castle-engine
2,304
src/scene/x3d/auto_generated_node_helpers/x3dnodes_x3dnurbscontrolcurvenode.inc
{ -*- buffer-read-only: t -*- Copyright 2015-2025 Michalis Kamburelis. This file is part of "Castle Game Engine". "Castle Game Engine" is free software; see the file COPYING.txt, included in this distribution, for details about the copyright. "Castle Game Engine" 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. ---------------------------------------------------------------------------- } { Automatically generated node properties. Do not edit this file manually! To add new properties: - add them to the text files in tools/internal/x3d-nodes-to-pascal/nodes-specification/ , - and regenerate include files by running x3d-nodes-to-pascal } {$ifdef read_interface} public { Create node fields and events. } procedure CreateNode; override; class function ClassX3DType: String; override; strict private FFdControlPoint: TMFVec2d; { Internal wrapper for property @code(ControlPoint). This wrapper API may change, we advise to access simpler @code(ControlPoint) instead, if it is defined (TODO: for now, some field types do not have a simpler counterpart). } public property FdControlPoint: TMFVec2d read FFdControlPoint; { } procedure SetControlPoint(const Value: array of TVector2Double); overload; { } procedure SetControlPoint(const Value: TVector2DoubleList); overload; {$endif read_interface} {$ifdef read_implementation} { TAbstractNurbsControlCurveNode ----------------------------------------------- } procedure TAbstractNurbsControlCurveNode.SetControlPoint(const Value: array of TVector2Double); begin FdControlPoint.Send(Value); end; procedure TAbstractNurbsControlCurveNode.SetControlPoint(const Value: TVector2DoubleList); begin FdControlPoint.Send(Value); end; class function TAbstractNurbsControlCurveNode.ClassX3DType: String; begin Result := 'X3DNurbsControlCurveNode'; end; procedure TAbstractNurbsControlCurveNode.CreateNode; begin inherited; FFdControlPoint := TMFVec2d.Create(Self, True, 'controlPoint', []); FdControlPoint.ChangeAlways := chVisibleNonGeometry; AddField(FFdControlPoint); DefaultContainerField := 'children'; end; {$endif read_implementation}
1
0.882548
1
0.882548
game-dev
MEDIA
0.325551
game-dev
0.932865
1
0.932865
Dreaming381/Latios-Framework
3,894
Kinemation/Authoring/BakingSystems/GatherMeshBindingPathsFromShadowHierarchySystem.cs
using System.Collections.Generic; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; using Unity.Entities; namespace Latios.Kinemation.Authoring.Systems { [RequireMatchingQueriesForUpdate] [DisableAutoCreation] public partial class GatherMeshBindingPathsFromShadowHierarchySystem : SystemBase { List<UnityEngine.SkinnedMeshRenderer> m_smrCache; protected unsafe override void OnUpdate() { if (m_smrCache == null) m_smrCache = new List<UnityEngine.SkinnedMeshRenderer>(); var textCache = new NativeText(Allocator.Temp); Entities.ForEach((ref DynamicBuffer<MeshPathByte> meshPathBytes, ref DynamicBuffer<MeshPathByteOffsetForPath> offsets, in SkinnedMeshRenderererReferenceForMeshPaths smrRef, in ShadowHierarchyReference shadowRef) => { m_smrCache.Clear(); shadowRef.shadowHierarchyRoot.Value.GetComponentsInChildren(true, m_smrCache); UnityEngine.SkinnedMeshRenderer shadowSmr = null; var sourceSmr = smrRef.skinnedMeshRenderer.Value.gameObject; foreach (var smr in m_smrCache) { var link = smr.GetComponent<HideThis.ShadowCloneSkinnedMeshTracker>(); if (link == null) continue; if (link.source == sourceSmr) { shadowSmr = smr; break; } } if (shadowSmr == null) { UnityEngine.Debug.LogError( $"Kinemation failed to bake mesh binding paths for {sourceSmr.gameObject.name}. The SkinnedMeshRenderer could not be found in the shadow hierarchy. This is an internal Kinemation bug. Please report!"); return; } var bones = shadowSmr.bones; if (bones == null) { UnityEngine.Debug.LogWarning( $"Kinemation failed to bake mesh binding paths for {sourceSmr.gameObject.name}. The bones array could not be extracted. Please ensure your avatar is configured correctly."); return; } foreach (var bone in bones) { if (bone == null) { UnityEngine.Debug.LogWarning( $"Kinemation failed to bake mesh binding paths for {sourceSmr.gameObject.name}. One of the bones was null. Please ensure your avatar is configured correctly."); return; } } offsets.ResizeUninitialized(bones.Length); textCache.Clear(); int i = 0; foreach (var bone in bones) { offsets[i] = new MeshPathByteOffsetForPath { offset = textCache.Length }; var tf = bone; while (tf.parent != null) { textCache.Append(tf.gameObject.name); textCache.Append('/'); tf = tf.parent; } i++; } meshPathBytes.ResizeUninitialized(textCache.Length); UnsafeUtility.MemCpy(meshPathBytes.GetUnsafePtr(), textCache.GetUnsafePtr(), textCache.Length); textCache.Clear(); }).WithEntityQueryOptions(EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabledEntities).WithoutBurst().Run(); m_smrCache.Clear(); } } }
1
0.873881
1
0.873881
game-dev
MEDIA
0.953498
game-dev
0.91199
1
0.91199
ja2-stracciatella/ja2-stracciatella
5,142
src/game/Utils/Timer_Control.cc
#include "Timer_Control.h" #include "ContentManager.h" #include "GameInstance.h" #include "GamePolicy.h" #include <array> #include <utility> static bool gfPauseClock{false}; static std::array<milliseconds, NUMTIMERS> const giTimerIntervals { 5ms, // Tactical Overhead 20ms, // NEXTSCROLL 200ms, // Start Scroll 200ms, // Animate tiles 80ms, // PATH FIND COUNTER 150ms, // CURSOR TIMER 300ms, // RIGHT CLICK FOR MENU 300ms, // LEFT 300ms, // MIDDLE 200ms, // TARGET REFINE TIMER 150ms, // CURSOR/AP FLASH 20ms, // PHYSICS UPDATE 100ms, // FADE ENEMYS 20ms, // STRATEGIC OVERHEAD 40ms, // CYCLE TIME RENDER ITEM COLOR 500ms, // NON GUN TARGET REFINE TIMER 250ms, // IMPROVED CURSOR FLASH 500ms, // 2nd CURSOR FLASH 400ms, // RADARMAP BLINK AND OVERHEAD MAP BLINK SHOUDL BE THE SAME 10ms, // Music Overhead 100ms // Team turn }; static std::array<TIMECOUNTER, NUMTIMERS> giTimerCounters; static TIMECOUNTER giTimerCustomizable; static double g_durations_multiplier; // These should probably use Timer.h's GetClock() instead, // which would also make ResetJA2ClockGlobalTimers unnecessary. extern std::uint32_t guiCompressionStringBaseTime; extern std::uint32_t guiFlashHighlightedItemBaseTime; extern std::uint32_t guiCompatibleItemBaseTime; extern std::uint32_t guiAnimateRouteBaseTime; extern std::uint32_t guiPotHeliPathBaseTime; extern std::uint32_t guiSectorLocatorBaseTime; extern std::uint32_t guiCommonGlowBaseTime; extern std::uint32_t guiFlashAssignBaseTime; extern std::uint32_t guiFlashContractBaseTime; extern std::uint32_t guiFlashCursorBaseTime; extern std::uint32_t guiPotCharPathBaseTime; // This is the time_point when guiBaseJA2Clock was updated last, // unless the game time is paused, then this holds the time point // then the game time was unfrozen. static ReferenceClock::time_point gLastUpdate; void UpdateJA2Clock() { if (gfPauseClock) return; auto const now{ ReferenceClock::now() }; guiBaseJA2Clock += static_cast<UINT32>( std::chrono::duration_cast<milliseconds>(now - gLastUpdate).count()); gLastUpdate = now; } void InitializeJA2Clock(void) { // Init timer delays for (int i = 0; i != NUMTIMERS; ++i) { RESETCOUNTER(static_cast<PredefinedCounters>(i)); } gLastUpdate = ReferenceClock::now(); guiBaseJA2Clock = 0; g_durations_multiplier = GCM->getGamePolicy()->game_durations_multiplier; } void PauseTime(bool const fPaused) { if (!fPaused && gfPauseClock) { // Remember when game time was unfrozen so that // UpdateJA2Clock() can add the number of ms between // this call and its own call. gLastUpdate = ReferenceClock::now(); } gfPauseClock = fPaused; } void SetCustomizableTimerCallbackAndDelay(ReferenceClock::duration const delay, CUSTOMIZABLE_TIMER_CALLBACK const callback, bool const replace) { if (!replace && gpCustomizableTimerCallback) { // Replace callback but call the current callback first gpCustomizableTimerCallback(); } RESETTIMECOUNTER(giTimerCustomizable, delay); gpCustomizableTimerCallback = callback; } void CheckCustomizableTimer(void) { if (!gpCustomizableTimerCallback) return; if (!TIMECOUNTERDONE(giTimerCustomizable, 0)) return; /* Set the callback to a temp variable so we can reset the global variable * before calling the callback, so that if the callback sets up another * instance of the timer, we don't reset it afterwards. */ std::exchange(gpCustomizableTimerCallback, nullptr)(); } void ResetJA2ClockGlobalTimers(void) { auto const now{ GetJA2Clock() }; guiCompressionStringBaseTime = now; guiFlashHighlightedItemBaseTime = now; guiCompatibleItemBaseTime = now; guiAnimateRouteBaseTime = now; guiPotHeliPathBaseTime = now; guiSectorLocatorBaseTime = now; guiCommonGlowBaseTime = now; guiFlashAssignBaseTime = now; guiFlashContractBaseTime = now; guiFlashCursorBaseTime = now; guiPotCharPathBaseTime = now; } void RESETCOUNTER(PredefinedCounters const pc) { RESETTIMECOUNTER(giTimerCounters[pc], giTimerIntervals[pc]); } bool COUNTERDONE(PredefinedCounters const pc, bool const autoReset) { // Timers never expire while time is paused. if (gfPauseClock) return false; bool const result{ ReferenceClock::now() >= giTimerCounters[pc] }; if (result && autoReset) RESETCOUNTER(pc); return result; } void RESETTIMECOUNTER(TIMECOUNTER & tc, ReferenceClock::duration const duration) { tc = ReferenceClock::now() + std::chrono::duration_cast <ReferenceClock::duration>(duration * g_durations_multiplier); } bool TIMECOUNTERDONE(TIMECOUNTER & tc, ReferenceClock::duration const duration) { // Timers never expire while time is paused. if (gfPauseClock) return false; bool const result{ ReferenceClock::now() >= tc}; if (result) RESETTIMECOUNTER(tc, duration); return result; } bool TIMECOUNTERDONE(TIMECOUNTER & tc, unsigned int const duration) { // Timers never expire while time is paused. if (gfPauseClock) return false; bool const result{ ReferenceClock::now() >= tc}; if (result && duration != 0) RESETTIMECOUNTER(tc, milliseconds{duration}); return result; }
1
0.852375
1
0.852375
game-dev
MEDIA
0.644689
game-dev,desktop-app
0.891931
1
0.891931
OGSR/OGSR-Engine
3,261
ogsr_engine/xr_3da/xr_area.h
#pragma once #include "xr_collide_form.h" #include "../xrCDB/xr_collide_defs.h" // refs class ENGINE_API ISpatial; class ENGINE_API ICollisionForm; class ENGINE_API CObject; //----------------------------------------------------------------------------------------------------------- // Space Area //----------------------------------------------------------------------------------------------------------- class ENGINE_API CObjectSpace { private: // Debug CDB::MODEL Static; Fbox m_BoundingVolume; public: #ifdef DEBUG ref_shader sh_debug; clQueryCollision q_debug; // MT: dangerous xr_vector<std::pair<Fsphere, u32>> dbg_S; // MT: dangerous #endif private: BOOL _RayTest(const Fvector& start, const Fvector& dir, float range, collide::rq_target tgt, collide::ray_cache* cache, const CObject* ignore_object); BOOL _RayPick(const Fvector& start, const Fvector& dir, float range, collide::rq_target tgt, collide::rq_result& R, const CObject* ignore_object) const; BOOL _RayQuery(collide::rq_results& dest, const collide::ray_defs& rq, collide::rq_callback* cb, LPVOID user_data, collide::test_callback* tb, const CObject* ignore_object) const; public: CObjectSpace(); ~CObjectSpace(); void Load(); // Occluded/No BOOL RayTest(const Fvector& start, const Fvector& dir, float range, collide::rq_target tgt, collide::ray_cache* cache, const CObject* ignore_object); // Game raypick (nearest) - returns object and addititional params BOOL RayPick(const Fvector& start, const Fvector& dir, float range, collide::rq_target tgt, collide::rq_result& R, const CObject* ignore_object) const; // General collision query BOOL RayQuery(collide::rq_results& dest, const collide::ray_defs& rq, collide::rq_callback* cb, LPVOID user_data, collide::test_callback* tb, const CObject* ignore_object) const; bool BoxQuery(Fvector const& box_center, Fvector const& box_z_axis, Fvector const& box_y_axis, Fvector const& box_sizes, xr_vector<Fvector>* out_tris) const; int GetNearest(xr_vector<CObject*>& q_nearest, ICollisionForm* obj, float range); int GetNearest(xr_vector<CObject*>& q_nearest, const Fvector& point, float range, CObject* ignore_object); int GetNearest(xr_vector<ISpatial*>& q_spatial, xr_vector<CObject*>& q_nearest, const Fvector& point, float range, CObject* ignore_object); CDB::TRI* GetStaticTris() { return Static.get_tris(); } Fvector* GetStaticVerts() { return Static.get_verts(); } CDB::MODEL* GetStaticModel() { return &Static; } const Fbox& GetBoundingVolume() const { return m_BoundingVolume; } // Debugging #ifdef DEBUG void dbgRender(); ref_shader dbgGetShader() { return sh_debug; } #endif }; class ENGINE_API RayPickAsync { private: bool future_ready{false}; collide::rq_result result{}; Fvector start{}; Fvector dir{}; float range{}; collide::rq_target tgt{}; const CObject* ignore_object{}; public: RayPickAsync(){}; ~RayPickAsync() { Discard(); }; public: void RayPickSubmit(Fvector start, Fvector dir, float range, collide::rq_target tgt, const CObject* ignore_object); bool Ready(collide::rq_result& R); void Discard(); private: void do_work_async(); };
1
0.860925
1
0.860925
game-dev
MEDIA
0.8578
game-dev
0.874672
1
0.874672
SideQuestVR/BanterSDK
2,172
Editor/Components/BanterAudioSourceEditor.cs
using UnityEditor; using UnityEngine; using UnityEngine.UIElements; using Banter.SDK; namespace Banter.SDKEditor { [CustomEditor(typeof(BanterAudioSource))] public class BanterAudioSourceEditor : Editor { void OnEnable() { if (target is BanterAudioSource) { var script = (BanterAudioSource)target; // script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector; var path = AssetDatabase.GetAssetPath(script); } } public override bool UseDefaultMargins() => false; public override VisualElement CreateInspectorGUI() { var script = (BanterAudioSource)target; Editor editor = Editor.CreateEditor(script); // script.gameObject.GetComponent<MeshFilter>().hideFlags = HideFlags.HideInInspector; VisualElement myInspector = new VisualElement(); var _mainWindowStyleSheet = Resources.Load<StyleSheet>("BanterCustomInspector"); myInspector.styleSheets.Add(_mainWindowStyleSheet); var title = new Label("PROPERTIES SEEN BY JS"); title.style.fontSize = 14; myInspector.Add(title); var seeFields = new Label("volume, pitch, mute, loop, bypassEffects, bypassListenerEffects, bypassReverbZones, playOnAwake, spatialBlend, "); seeFields.style.unityFontStyleAndWeight = FontStyle.Bold; seeFields.style.flexWrap = Wrap.Wrap; seeFields.style.whiteSpace = WhiteSpace.Normal; seeFields.style.marginBottom = 10; seeFields.style.marginTop = 10; seeFields.style.color = Color.gray; myInspector.Add(seeFields); //#if BANTER_EDITOR var foldout = new Foldout(); foldout.text = "Available Properties"; IMGUIContainer inspectorIMGUI = new IMGUIContainer(() => { editor.OnInspectorGUI(); }); foldout.value = false; foldout.Add(inspectorIMGUI); myInspector.Add(foldout); //#endif return myInspector; } } }
1
0.720168
1
0.720168
game-dev
MEDIA
0.597267
game-dev,web-frontend
0.961998
1
0.961998
natcap/invest
27,312
src/natcap/invest/managed_raster/ManagedRaster.h
#ifndef NATCAP_INVEST_MANAGEDRASTER_H_ #define NATCAP_INVEST_MANAGEDRASTER_H_ #include "gdal.h" #include "gdal_priv.h" #include <Python.h> #include <iostream> #include <string> #include "LRUCache.h" int MANAGED_RASTER_N_BLOCKS = static_cast<int>(pow(2, 6)); // given the pixel neighbor numbering system // 3 2 1 // 4 x 0 // 5 6 7 // These offsets are for the neighbor rows and columns int ROW_OFFSETS[8] = {0, -1, -1, -1, 0, 1, 1, 1}; int COL_OFFSETS[8] = {1, 1, 0, -1, -1, -1, 0, 1}; int FLOW_DIR_REVERSE_DIRECTION[8] = {4, 5, 6, 7, 0, 1, 2, 3}; // if a pixel `x` has a neighbor `n` in position `i`, // then `n`'s neighbor in position `inflow_offsets[i]` // is the original pixel `x` int INFLOW_OFFSETS[8] = {4, 5, 6, 7, 0, 1, 2, 3}; typedef std::pair<int, double*> BlockBufferPair; class D8 {}; class MFD {}; enum class LogLevel {debug, info, warning, error}; // Largely copied from: // https://gist.github.com/hensing/0db3f8e3a99590006368 static void log_msg(LogLevel level, string msg) { static PyObject *logging = NULL; static PyObject *pyString = NULL; // import logging module on demand if (logging == NULL) { logging = PyImport_ImportModuleNoBlock("logging"); if (logging == NULL) { PyErr_SetString(PyExc_ImportError, "Could not import module 'logging'"); } } // build msg-string pyString = Py_BuildValue("s", msg.c_str()); // call function depending on log level switch (level) { case LogLevel::debug: PyObject_CallMethod(logging, "debug", "O", pyString); break; case LogLevel::info: PyObject_CallMethod(logging, "info", "O", pyString); break; case LogLevel::warning: PyObject_CallMethod(logging, "warn", "O", pyString); break; case LogLevel::error: PyObject_CallMethod(logging, "error", "O", pyString); break; } Py_DECREF(pyString); } class NeighborTuple { public: int direction, x, y; float flow_proportion; NeighborTuple () {} NeighborTuple (int direction, int x, int y, float flow_proportion) { this->direction = direction; this->x = x; this->y = y; this->flow_proportion = flow_proportion; } }; class ManagedRaster { public: LRUCache<int, double*>* lru_cache; std::set<int> dirty_blocks; int* actualBlockWidths; int block_xsize; int block_ysize; int block_xmod; int block_ymod; int block_xbits; int block_ybits; long raster_x_size; long raster_y_size; int block_nx; int block_ny; char* raster_path; int band_id; GDALDataset* dataset; GDALRasterBand* band; int write_mode; int closed; double nodata; double* geotransform; int hasNodata; ManagedRaster() { } // Creates new instance of ManagedRaster. Opens the raster with GDAL, // stores important information about the dataset, and creates a cache // that will be used to efficiently read blocks from the raster. // Args: // raster_path: path to raster that has block sizes that are // powers of 2. If not, an exception is raised. // band_id: which band in `raster_path` to index. Uses GDAL // notation that starts at 1. // write_mode: if true, this raster is writable and dirty // memory blocks will be written back to the raster as blocks // are swapped out of the cache or when the object deconstructs. ManagedRaster(char* raster_path, int band_id, bool write_mode) : raster_path { raster_path } , band_id { band_id } , write_mode { write_mode } { GDALAllRegister(); dataset = (GDALDataset *) GDALOpen( raster_path, GA_Update ); raster_x_size = dataset->GetRasterXSize(); raster_y_size = dataset->GetRasterYSize(); if (band_id < 1 or band_id > dataset->GetRasterCount()) { throw std::invalid_argument( "Error: band ID is not a valid band number. " "This error is happening in the ManagedRaster.h extension."); } band = dataset->GetRasterBand(band_id); band->GetBlockSize( &block_xsize, &block_ysize ); block_xmod = block_xsize - 1; block_ymod = block_ysize - 1; nodata = band->GetNoDataValue( &hasNodata ); geotransform = (double *) CPLMalloc(sizeof(double) * 6); dataset->GetGeoTransform(geotransform); if (((block_xsize & (block_xsize - 1)) != 0) or ( (block_ysize & (block_ysize - 1)) != 0)) { throw std::invalid_argument( "Error: Block size is not a power of two. " "This error is happening in the ManagedRaster.h extension."); } block_xbits = static_cast<int>(log2(block_xsize)); block_ybits = static_cast<int>(log2(block_ysize)); // integer floor division block_nx = (raster_x_size + block_xsize - 1) / block_xsize; block_ny = (raster_y_size + block_ysize - 1) / block_ysize; int actual_x = 0; int actual_y = 0; actualBlockWidths = (int *) CPLMalloc(sizeof(int) * block_nx * block_ny); for (int block_yi = 0; block_yi < block_ny; block_yi++) { for (int block_xi = 0; block_xi < block_nx; block_xi++) { band->GetActualBlockSize(block_xi, block_yi, &actual_x, &actual_y); actualBlockWidths[block_yi * block_nx + block_xi] = actual_x; } } lru_cache = new LRUCache<int, double*>(MANAGED_RASTER_N_BLOCKS); closed = 0; } // Sets the pixel at `xi,yi` to `value` void inline set(long xi, long yi, double value) { int block_xi = xi / block_xsize; int block_yi = yi / block_ysize; // this is the flat index for the block int block_index = block_yi * block_nx + block_xi; if (not lru_cache->exist(block_index)) { _load_block(block_index); } int idx = ((yi & block_ymod) * actualBlockWidths[block_index]) + (xi & block_xmod); lru_cache->get(block_index)[idx] = value; if (write_mode) { std::set<int>::iterator dirty_itr = dirty_blocks.find(block_index); if (dirty_itr == dirty_blocks.end()) { dirty_blocks.insert(block_index); } } } // Returns the value of the pixel at `xi,yi`. double inline get(long xi, long yi) { int block_xi = xi / block_xsize; int block_yi = yi / block_ysize; // this is the flat index for the block int block_index = block_yi * block_nx + block_xi; if (not lru_cache->exist(block_index)) { _load_block(block_index); } double* block = lru_cache->get(block_index); // Using the property n % 2^i = n & (2^i - 1) // to efficienty compute the modulo: yi % block_xsize int idx = ((yi & block_ymod) * actualBlockWidths[block_index]) + (xi & block_xmod); double value = block[idx]; return value; } // Reads a block from the raster and saves it to the cache. // Args: // block_index: Index of the block to read, counted from the top-left void _load_block(int block_index) { int block_xi = block_index % block_nx; int block_yi = block_index / block_nx; // we need the offsets to subtract from global indexes for cached array int xoff = block_xi << block_xbits; int yoff = block_yi << block_ybits; double *double_buffer; list<BlockBufferPair> removed_value_list; // determine the block aligned xoffset for read as array // initially the win size is the same as the block size unless // we're at the edge of a raster int win_xsize = block_xsize; int win_ysize = block_ysize; // load a new block if ((xoff + win_xsize) > raster_x_size) { win_xsize = win_xsize - (xoff + win_xsize - raster_x_size); } if ((yoff + win_ysize) > raster_y_size) { win_ysize = win_ysize - (yoff + win_ysize - raster_y_size); } double *pafScanline = (double *) CPLMalloc(sizeof(double) * win_xsize * win_ysize); CPLErr err = band->RasterIO(GF_Read, xoff, yoff, win_xsize, win_ysize, pafScanline, win_xsize, win_ysize, GDT_Float64, 0, 0 ); if (err != CE_None) { std::cerr << "Error reading block\n"; } lru_cache->put(block_index, pafScanline, removed_value_list); while (not removed_value_list.empty()) { // write the changed value back if desired double_buffer = removed_value_list.front().second; if (write_mode) { block_index = removed_value_list.front().first; // write back the block if it's dirty std::set<int>::iterator dirty_itr = dirty_blocks.find(block_index); if (dirty_itr != dirty_blocks.end()) { dirty_blocks.erase(dirty_itr); block_xi = block_index % block_nx; block_yi = block_index / block_nx; xoff = block_xi << block_xbits; yoff = block_yi << block_ybits; win_xsize = block_xsize; win_ysize = block_ysize; if (xoff + win_xsize > raster_x_size) { win_xsize = win_xsize - (xoff + win_xsize - raster_x_size); } if (yoff + win_ysize > raster_y_size) { win_ysize = win_ysize - (yoff + win_ysize - raster_y_size); } err = band->RasterIO( GF_Write, xoff, yoff, win_xsize, win_ysize, double_buffer, win_xsize, win_ysize, GDT_Float64, 0, 0 ); if (err != CE_None) { std::cerr << "Error writing block\n"; } } } CPLFree(double_buffer); removed_value_list.pop_front(); } } // Closes the ManagedRaster and frees up resources. // This call writes any dirty blocks to disk, frees up the memory // allocated as part of the cache, and frees all GDAL references. // Any subsequent calls to any other functions in _ManagedRaster will // have undefined behavior. void close() { if (closed) { return; } closed = 1; double *double_buffer; int block_xi; int block_yi; int block_index; // initially the win size is the same as the block size unless // we're at the edge of a raster int win_xsize; int win_ysize; // we need the offsets to subtract from global indexes for cached array int xoff; int yoff; if (not write_mode) { for (auto it = lru_cache->begin(); it != lru_cache->end(); it++) { // write the changed value back if desired CPLFree(it->second); } GDALClose( (GDALDatasetH) dataset ); return; } // if we get here, we're in write_mode std::set<int>::iterator dirty_itr; for (auto it = lru_cache->begin(); it != lru_cache->end(); it++) { double_buffer = it->second; block_index = it->first; // write to disk if block is dirty dirty_itr = dirty_blocks.find(block_index); if (dirty_itr != dirty_blocks.end()) { dirty_blocks.erase(dirty_itr); block_xi = block_index % block_nx; block_yi = block_index / block_nx; // we need the offsets to subtract from global indexes for // cached array xoff = block_xi << block_xbits; yoff = block_yi << block_ybits; win_xsize = block_xsize; win_ysize = block_ysize; // clip window sizes if necessary if (xoff + win_xsize > raster_x_size) { win_xsize = win_xsize - (xoff + win_xsize - raster_x_size); } if (yoff + win_ysize > raster_y_size) { win_ysize = win_ysize - (yoff + win_ysize - raster_y_size); } CPLErr err = band->RasterIO( GF_Write, xoff, yoff, win_xsize, win_ysize, double_buffer, win_xsize, win_ysize, GDT_Float64, 0, 0 ); if (err != CE_None) { std::cerr << "Error writing block\n"; } } CPLFree(double_buffer); } GDALClose( (GDALDatasetH) dataset ); delete lru_cache; free(actualBlockWidths); } }; // Represents a flow direction raster, which may be of type MFD or D8 template<class T> class ManagedFlowDirRaster: public ManagedRaster { public: ManagedFlowDirRaster() {} ManagedFlowDirRaster(char* raster_path, int band_id, bool write_mode) : ManagedRaster(raster_path, band_id, write_mode) {} // Checks if a given pixel is a local high point. (MFD implementation) // Args: // xi: x coord in pixel space of the pixel to consider // yi: y coord in pixel space of the pixel to consider // Returns: // true if the pixel is a local high point, i.e. it has no // upslope neighbors; false otherwise. template<typename T_ = T, std::enable_if_t<std::is_same<T_, MFD>::value>* = nullptr> bool is_local_high_point(int xi, int yi) { int flow_dir_j, flow_ji; long xj, yj; for (int n_dir = 0; n_dir < 8; n_dir++) { xj = xi + COL_OFFSETS[n_dir]; yj = yi + ROW_OFFSETS[n_dir]; if (xj < 0 or xj >= raster_x_size or yj < 0 or yj >= raster_y_size) { continue; } flow_dir_j = static_cast<int>(get(xj, yj)); flow_ji = (0xF & (flow_dir_j >> (4 * FLOW_DIR_REVERSE_DIRECTION[n_dir]))); if (flow_ji) { return false; } } return true; } // Checks if a given pixel is a local high point. (D8 implementation) // Args: // xi: x coord in pixel space of the pixel to consider // yi: y coord in pixel space of the pixel to consider // Returns: // true if the pixel is a local high point, i.e. it has no // upslope neighbors; false otherwise. template<typename T_ = T, std::enable_if_t<std::is_same<T_, D8>::value>* = nullptr> bool is_local_high_point(int xi, int yi) { int flow_dir_j; long xj, yj; for (int n_dir = 0; n_dir < 8; n_dir++) { xj = xi + COL_OFFSETS[n_dir]; yj = yi + ROW_OFFSETS[n_dir]; if (xj < 0 or xj >= raster_x_size or yj < 0 or yj >= raster_y_size) { continue; } flow_dir_j = static_cast<int>(get(xj, yj)); if (flow_dir_j == FLOW_DIR_REVERSE_DIRECTION[n_dir]) { return false; } } return true; } }; // Represents a pixel in a ManagedFlowDirectionRaster template<class T> class Pixel { public: ManagedFlowDirRaster<T> raster; int x; int y; int val; Pixel() {} Pixel(ManagedFlowDirRaster<T> raster, int x, int y) : raster(raster), x(x), y(y) { double v = raster.get(x, y); val = static_cast<int>(v); } }; // Returned by the `.end()` method of Neighbor iterable classes static inline NeighborTuple endVal = NeighborTuple(8, -1, -1, -1); // Iterates over all eight neighboring pixels of a given pixel // This and subsequent iterator classes were written with a lot of help from // https://internalpointers.com/post/writing-custom-iterators-modern-cpp template<class T> class NeighborIterator { public: using iterator_category = std::forward_iterator_tag; using difference_type = std::ptrdiff_t; using value_type = NeighborTuple; using pointer = NeighborTuple*; using reference = NeighborTuple&; Pixel<T> pixel; pointer m_ptr = nullptr; int i = 0; NeighborIterator() {} NeighborIterator(NeighborTuple* n) { m_ptr = n; } NeighborIterator(const Pixel<T> pixel) : pixel(pixel) { next(); } reference operator*() const { return *m_ptr; } pointer operator->() { return m_ptr; } // Prefix increment NeighborIterator<T>& operator++() { next(); return *this; } // Postfix increment NeighborIterator<T> operator++(int) { NeighborIterator<T> tmp = *this; ++(*this); return tmp; } friend bool operator== (const NeighborIterator& a, const NeighborIterator& b) { return a.m_ptr == b.m_ptr; }; friend bool operator!= (const NeighborIterator& a, const NeighborIterator& b) { return a.m_ptr != b.m_ptr; }; // Increments the pointer to the next neighbor virtual void next() { long xj, yj, flow; if (i == 8) { m_ptr = &endVal; return; } xj = pixel.x + COL_OFFSETS[i]; yj = pixel.y + ROW_OFFSETS[i]; flow = (pixel.val >> (i * 4)) & 0xF; m_ptr = new NeighborTuple(i, xj, yj, static_cast<float>(flow)); i++; } }; // Iterates over neighbor pixels that are downslope of a given pixel, // in either MFD or D8 mode template<class T> class DownslopeNeighborIterator: public NeighborIterator<T> { public: DownslopeNeighborIterator(): NeighborIterator<T>() {} DownslopeNeighborIterator(NeighborTuple* n): NeighborIterator<T>(n) {} DownslopeNeighborIterator(const Pixel<T> p) { this->pixel = p; next(); } DownslopeNeighborIterator<T>& operator++() { next(); return *this; } DownslopeNeighborIterator<T> operator++(int) { DownslopeNeighborIterator<T> tmp = *this; ++(*this); return tmp; } // Increments the pointer to the next downslope neighbor (MFD) template<typename T_ = T, std::enable_if_t<std::is_same<T_, MFD>::value>* = nullptr> void next() { long xj, yj, flow; delete this->m_ptr; this->m_ptr = nullptr; if (this->i == 8) { this->m_ptr = &endVal; return; } xj = this->pixel.x + COL_OFFSETS[this->i]; yj = this->pixel.y + ROW_OFFSETS[this->i]; if (xj < 0 or xj >= this->pixel.raster.raster_x_size or yj < 0 or yj >= this->pixel.raster.raster_y_size) { this->i++; next(); return; } flow = (this->pixel.val >> (this->i * 4)) & 0xF; if (flow) { this->m_ptr = new NeighborTuple(this->i, xj, yj, static_cast<float>(flow)); this->i++; return; } else { this->i++; next(); } } // Increments the pointer to the next downslope neighbor (D8) template<typename T_ = T, std::enable_if_t<std::is_same<T_, D8>::value>* = nullptr> void next() { long xj, yj; delete this->m_ptr; this->m_ptr = nullptr; if (this->i == 8) { this->m_ptr = &endVal; return; } xj = this->pixel.x + COL_OFFSETS[this->pixel.val]; yj = this->pixel.y + ROW_OFFSETS[this->pixel.val]; if (xj < 0 or xj >= this->pixel.raster.raster_x_size or yj < 0 or yj >= this->pixel.raster.raster_y_size) { this->m_ptr = &endVal; return; } this->i = 8; this->m_ptr = new NeighborTuple(this->pixel.val, xj, yj, 1); return; } }; // Iterates over neighbor pixels that are downslope of a given pixel, // without skipping pixels that are out-of-bounds of the raster, // in either MFD or D8 mode template<class T> class DownslopeNeighborNoSkipIterator: public NeighborIterator<T> { public: DownslopeNeighborNoSkipIterator(): NeighborIterator<T>() {} DownslopeNeighborNoSkipIterator(NeighborTuple* n): NeighborIterator<T>(n) {} DownslopeNeighborNoSkipIterator(const Pixel<T> p) { this->pixel = p; next(); } DownslopeNeighborNoSkipIterator<T>& operator++() { next(); return *this; } DownslopeNeighborNoSkipIterator<T> operator++(int) { DownslopeNeighborNoSkipIterator<T> tmp = *this; ++(*this); return tmp; } // Increments the pointer to the next downslope neighbor (MFD) template<typename T_ = T, std::enable_if_t<std::is_same<T_, MFD>::value>* = nullptr> void next() { long xj, yj, flow; delete this->m_ptr; this->m_ptr = nullptr; if (this->i == 8) { this->m_ptr = &endVal; return; } xj = this->pixel.x + COL_OFFSETS[this->i]; yj = this->pixel.y + ROW_OFFSETS[this->i]; flow = (this->pixel.val >> (this->i * 4)) & 0xF; if (flow) { this->m_ptr = new NeighborTuple(this->i, xj, yj, static_cast<float>(flow)); this->i++; return; } else { this->i++; next(); } } // Increments the pointer to the next downslope neighbor (D8) template<typename T_ = T, std::enable_if_t<std::is_same<T_, D8>::value>* = nullptr> void next() { long xj, yj; delete this->m_ptr; this->m_ptr = nullptr; if (this->i == 8) { this->m_ptr = &endVal; return; } xj = this->pixel.x + COL_OFFSETS[this->pixel.val]; yj = this->pixel.y + ROW_OFFSETS[this->pixel.val]; this->i = 8; this->m_ptr = new NeighborTuple(this->pixel.val, xj, yj, 1); return; } }; // Iterates over neighbor pixels that are upslope of a given pixel, // in either MFD or D8 mode template<class T> class UpslopeNeighborIterator: public NeighborIterator<T> { public: UpslopeNeighborIterator(): NeighborIterator<T>() {} UpslopeNeighborIterator(NeighborTuple* n): NeighborIterator<T>(n) {} UpslopeNeighborIterator(const Pixel<T> p) { this->pixel = p; next(); } UpslopeNeighborIterator<T>& operator++() { next(); return *this; } UpslopeNeighborIterator<T> operator++(int) { UpslopeNeighborIterator<T> tmp = *this; ++(*this); return tmp; } // Increments the pointer to the next upslope neighbor (MFD) template<typename T_ = T, std::enable_if_t<std::is_same<T_, MFD>::value>* = nullptr> void next() { long xj, yj; int flow_dir_j; int flow_ji; long flow_dir_j_sum; delete this->m_ptr; this->m_ptr = nullptr; if (this->i == 8) { this->m_ptr = &endVal; return; } xj = this->pixel.x + COL_OFFSETS[this->i]; yj = this->pixel.y + ROW_OFFSETS[this->i]; if (xj < 0 or xj >= this->pixel.raster.raster_x_size or yj < 0 or yj >= this->pixel.raster.raster_y_size) { this->i++; next(); return; } flow_dir_j = static_cast<int>(this->pixel.raster.get(xj, yj)); flow_ji = (0xF & (flow_dir_j >> (4 * FLOW_DIR_REVERSE_DIRECTION[this->i]))); if (flow_ji) { flow_dir_j_sum = 0; for (int idx = 0; idx < 8; idx++) { flow_dir_j_sum += (flow_dir_j >> (idx * 4)) & 0xF; } this->m_ptr = new NeighborTuple( this->i, xj, yj, static_cast<float>(flow_ji) / static_cast<float>(flow_dir_j_sum)); this->i++; return; } else { this->i++; next(); } } // Increments the pointer to the next upslope neighbor (D8) template<typename T_ = T, std::enable_if_t<std::is_same<T_, D8>::value>* = nullptr> void next() { long xj, yj; int flow_dir_j; delete this->m_ptr; this->m_ptr = nullptr; if (this->i == 8) { this->m_ptr = &endVal; return; } xj = this->pixel.x + COL_OFFSETS[this->i]; yj = this->pixel.y + ROW_OFFSETS[this->i]; if (xj < 0 or xj >= this->pixel.raster.raster_x_size or yj < 0 or yj >= this->pixel.raster.raster_y_size) { this->i++; next(); return; } flow_dir_j = static_cast<int>(this->pixel.raster.get(xj, yj)); if (flow_dir_j == FLOW_DIR_REVERSE_DIRECTION[this->i]) { this->m_ptr = new NeighborTuple(this->i, xj, yj, 1); this->i++; return; } else { this->i++; next(); } } }; // Iterates over neighbor pixels that are upslope of a given pixel, // without dividing the flow_proportion, in either MFD or D8 mode template<class T> class UpslopeNeighborNoDivideIterator: public NeighborIterator<T> { public: UpslopeNeighborNoDivideIterator(): NeighborIterator<T>() {} UpslopeNeighborNoDivideIterator(NeighborTuple* n): NeighborIterator<T>(n) {} UpslopeNeighborNoDivideIterator(const Pixel<T> p) { this->pixel = p; next(); } UpslopeNeighborNoDivideIterator<T>& operator++() { next(); return *this; } UpslopeNeighborNoDivideIterator<T> operator++(int) { UpslopeNeighborNoDivideIterator<T> tmp = *this; ++(*this); return tmp; } // Increments the pointer to the next upslope neighbor (MFD) template<typename T_ = T, std::enable_if_t<std::is_same<T_, MFD>::value>* = nullptr> void next() { long xj, yj; int flow_dir_j; int flow_ji; delete this->m_ptr; this->m_ptr = nullptr; if (this->i == 8) { this->m_ptr = &endVal; return; } xj = this->pixel.x + COL_OFFSETS[this->i]; yj = this->pixel.y + ROW_OFFSETS[this->i]; if (xj < 0 or xj >= this->pixel.raster.raster_x_size or yj < 0 or yj >= this->pixel.raster.raster_y_size) { this->i++; next(); return; } flow_dir_j = static_cast<int>(this->pixel.raster.get(xj, yj)); flow_ji = (0xF & (flow_dir_j >> (4 * FLOW_DIR_REVERSE_DIRECTION[this->i]))); if (flow_ji) { this->m_ptr = new NeighborTuple(this->i, xj, yj, static_cast<float>(flow_ji)); this->i++; return; } else { this->i++; next(); } } // Increments the pointer to the next upslope neighbor (D8) template<typename T_ = T, std::enable_if_t<std::is_same<T_, D8>::value>* = nullptr> void next() { long xj, yj; int flow_dir_j; delete this->m_ptr; this->m_ptr = nullptr; if (this->i == 8) { this->m_ptr = &endVal; return; } xj = this->pixel.x + COL_OFFSETS[this->i]; yj = this->pixel.y + ROW_OFFSETS[this->i]; if (xj < 0 or xj >= this->pixel.raster.raster_x_size or yj < 0 or yj >= this->pixel.raster.raster_y_size) { this->i++; next(); return; } flow_dir_j = static_cast<int>(this->pixel.raster.get(xj, yj)); if (flow_dir_j == FLOW_DIR_REVERSE_DIRECTION[this->i]) { this->m_ptr = new NeighborTuple(this->i, xj, yj, 1); this->i++; return; } else { this->i++; next(); } } }; template<class T> class Neighbors { public: Pixel<T> pixel; Neighbors() {} Neighbors(const Pixel<T> pixel): pixel(pixel) {} NeighborIterator<T> begin() { return NeighborIterator<T>(pixel); } NeighborIterator<T> end() { return NeighborIterator<T>(&endVal); } }; template<class T> class DownslopeNeighbors: public Neighbors<T> { public: using Neighbors<T>::Neighbors; DownslopeNeighborIterator<T> begin() { return DownslopeNeighborIterator<T>(this->pixel); } DownslopeNeighborIterator<T> end() { return DownslopeNeighborIterator<T>(&endVal); } }; template<class T> class DownslopeNeighborsNoSkip: public Neighbors<T> { public: using Neighbors<T>::Neighbors; DownslopeNeighborNoSkipIterator<T> begin() { return DownslopeNeighborNoSkipIterator<T>(this->pixel); } DownslopeNeighborNoSkipIterator<T> end() { return DownslopeNeighborNoSkipIterator<T>(&endVal); } }; template<class T> class UpslopeNeighbors: public Neighbors<T> { public: using Neighbors<T>::Neighbors; UpslopeNeighborIterator<T> begin() { return UpslopeNeighborIterator<T>(this->pixel); } UpslopeNeighborIterator<T> end() { return UpslopeNeighborIterator<T>(&endVal); } }; template<class T> class UpslopeNeighborsNoDivide: public Neighbors<T> { public: using Neighbors<T>::Neighbors; UpslopeNeighborNoDivideIterator<T> begin() { return UpslopeNeighborNoDivideIterator<T>(this->pixel); } UpslopeNeighborNoDivideIterator<T> end() { return UpslopeNeighborNoDivideIterator<T>(&endVal); } }; // Note: I was concerned that checking each value for nan would be too slow, but // I compared its performance against another implementation where we first reclassify // nans to a regular float, and then skip the nan check, and that was much slower: // https://github.com/natcap/invest/issues/1714#issuecomment-2762134419 inline bool is_close(double x, double y) { if (isnan(x) and isnan(y)) { return true; } return abs(x - y) <= (pow(10, -8) + pow(10, -05) * abs(y)); } #endif // NATCAP_INVEST_MANAGEDRASTER_H_
1
0.992678
1
0.992678
game-dev
MEDIA
0.557606
game-dev
0.983475
1
0.983475
Goob-Station/Goob-Station-MRP
9,664
Content.Server/_EE/Supermatter/Systems/SupermatterSystem.cs
using Content.Server.AlertLevel; using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.Piping.Components; using Content.Server.Chat.Systems; using Content.Server.Decals; using Content.Server.DoAfter; using Content.Server.Explosion.EntitySystems; using Content.Server.Kitchen.Components; using Content.Server.Lightning; using Content.Server.Lightning.Components; using Content.Server.Popups; using Content.Server.Radio.EntitySystems; using Content.Server.Speech; using Content.Server.Station.Systems; using Content.Shared._EE.CCVars; using Content.Shared._EE.Supermatter.Components; using Content.Shared._EE.Supermatter.Monitor; using Content.Shared.Atmos; using Content.Shared.Audio; using Content.Shared.Body.Components; using Content.Shared.CCVar; using Content.Shared.DoAfter; using Content.Shared.Examine; using Content.Shared.Interaction; using Content.Shared.Mobs.Components; using Content.Shared.Popups; using Content.Shared.Projectiles; using Robust.Server.GameObjects; using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Containers; using Robust.Shared.Physics; using Robust.Shared.Physics.Events; using Robust.Shared.Random; using Robust.Shared.Timing; namespace Content.Server._EE.Supermatter.Systems; public sealed partial class SupermatterSystem : EntitySystem { [Dependency] private readonly AtmosphereSystem _atmosphere = default!; [Dependency] private readonly ChatSystem _chat = default!; [Dependency] private readonly RadioSystem _radio = default!; [Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly ExplosionSystem _explosion = default!; [Dependency] private readonly TransformSystem _xform = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambient = default!; [Dependency] private readonly LightningSystem _lightning = default!; [Dependency] private readonly AlertLevelSystem _alert = default!; [Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly MapSystem _map = default!; [Dependency] private readonly DoAfterSystem _doAfter = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly IConfigurationManager _config = default!; [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IRobustRandom _random = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent<SupermatterComponent, MapInitEvent>(OnMapInit); SubscribeLocalEvent<SupermatterComponent, AtmosDeviceUpdateEvent>(OnSupermatterUpdated); SubscribeLocalEvent<SupermatterComponent, StartCollideEvent>(OnCollideEvent); SubscribeLocalEvent<SupermatterComponent, InteractHandEvent>(OnHandInteract); SubscribeLocalEvent<SupermatterComponent, InteractUsingEvent>(OnItemInteract); SubscribeLocalEvent<SupermatterComponent, ExaminedEvent>(OnExamine); SubscribeLocalEvent<SupermatterComponent, SupermatterDoAfterEvent>(OnGetSliver); } public override void Update(float frameTime) { base.Update(frameTime); foreach (var sm in EntityManager.EntityQuery<SupermatterComponent>()) { if (!sm.Activated) continue; var uid = sm.Owner; AnnounceCoreDamage(uid, sm); } } private void OnMapInit(EntityUid uid, SupermatterComponent sm, MapInitEvent args) { // Set the yell timer sm.YellTimer = TimeSpan.FromSeconds(_config.GetCVar(ECCVars.SupermatterYellTimer)); // Set the Sound _ambient.SetAmbience(uid, true); // Add Air to the initialized SM in the Map so it doesn't delam on its' own var mix = _atmosphere.GetContainingMixture(uid, true, true); mix?.AdjustMoles(Gas.Oxygen, Atmospherics.OxygenMolesStandard); mix?.AdjustMoles(Gas.Nitrogen, Atmospherics.NitrogenMolesStandard); } public void OnSupermatterUpdated(EntityUid uid, SupermatterComponent sm, AtmosDeviceUpdateEvent args) { ProcessAtmos(uid, sm, args.dt); // This prevents SM from delamming due to spacing without activating the SM. if (sm.Activated) HandleDamage(uid, sm); if (sm.Damage >= sm.DamageDelaminationPoint || sm.Delamming) HandleDelamination(uid, sm); HandleStatus(uid, sm); HandleSoundLoop(uid, sm); HandleAccent(uid, sm); if (sm.Damage >= sm.DamagePenaltyPoint) SupermatterZap(uid, sm); } private void OnCollideEvent(EntityUid uid, SupermatterComponent sm, ref StartCollideEvent args) { if (!sm.Activated) sm.Activated = true; var target = args.OtherEntity; if (args.OtherBody.BodyType == BodyType.Static || HasComp<SupermatterImmuneComponent>(target) || _container.IsEntityInContainer(uid)) return; if (!HasComp<ProjectileComponent>(target)) { var popup = "supermatter-collide"; if (HasComp<MobStateComponent>(target)) { popup = "supermatter-collide-mob"; EntityManager.SpawnEntity(sm.CollisionResultPrototype, Transform(target).Coordinates); } var targetProto = MetaData(target).EntityPrototype; if (targetProto != null && targetProto.ID != sm.CollisionResultPrototype) { _popup.PopupEntity(Loc.GetString(popup, ("sm", uid), ("target", target)), uid, PopupType.LargeCaution); _audio.PlayPvs(sm.DustSound, uid); } sm.Power += args.OtherBody.Mass; } EntityManager.QueueDeleteEntity(target); AddComp<SupermatterImmuneComponent>(target); // prevent spam or excess power production if (TryComp<SupermatterFoodComponent>(target, out var food)) sm.Power += food.Energy; else if (TryComp<ProjectileComponent>(target, out var projectile)) sm.Power += (float) projectile.Damage.GetTotal(); else sm.Power++; sm.MatterPower += HasComp<MobStateComponent>(target) ? 200 : 0; } private void OnHandInteract(EntityUid uid, SupermatterComponent sm, ref InteractHandEvent args) { if (!sm.Activated) sm.Activated = true; var target = args.User; if (HasComp<SupermatterImmuneComponent>(target)) return; sm.MatterPower += 200; EntityManager.SpawnEntity(sm.CollisionResultPrototype, Transform(target).Coordinates); _popup.PopupEntity(Loc.GetString("supermatter-collide-mob", ("sm", uid), ("target", target)), uid, PopupType.LargeCaution); _audio.PlayPvs(sm.DustSound, uid); EntityManager.QueueDeleteEntity(target); } private void OnItemInteract(EntityUid uid, SupermatterComponent sm, ref InteractUsingEvent args) { if (!sm.Activated) sm.Activated = true; if (sm.SliverRemoved) return; if (!HasComp<SharpComponent>(args.Used)) return; var dae = new DoAfterArgs(EntityManager, args.User, 30f, new SupermatterDoAfterEvent(), args.Target) { BreakOnDamage = true, BreakOnHandChange = false, BreakOnWeightlessMove = false, NeedHand = true, RequireCanInteract = true, }; _doAfter.TryStartDoAfter(dae); _popup.PopupClient(Loc.GetString("supermatter-tamper-begin"), uid, args.User); } private void OnGetSliver(EntityUid uid, SupermatterComponent sm, ref SupermatterDoAfterEvent args) { if (args.Cancelled) return; // Your criminal actions will not go unnoticed sm.Damage += sm.DamageDelaminationPoint / 10; var integrity = GetIntegrity(sm).ToString("0.00"); SendSupermatterAnnouncement(uid, sm, Loc.GetString("supermatter-announcement-cc-tamper", ("integrity", integrity))); Spawn(sm.SliverPrototype, _transform.GetMapCoordinates(args.User)); _popup.PopupClient(Loc.GetString("supermatter-tamper-end"), uid, args.User); sm.DelamTimer /= 2; } private void OnExamine(EntityUid uid, SupermatterComponent sm, ref ExaminedEvent args) { if (args.IsInDetailsRange) args.PushMarkup(Loc.GetString("supermatter-examine-integrity", ("integrity", GetIntegrity(sm).ToString("0.00")))); } private SupermatterStatusType GetStatus(EntityUid uid, SupermatterComponent sm) { var mix = _atmosphere.GetContainingMixture(uid, true, true); if (mix is not { }) return SupermatterStatusType.Error; if (sm.Delamming || sm.Damage >= sm.DamageDelaminationPoint) return SupermatterStatusType.Delaminating; if (sm.Damage >= sm.DamagePenaltyPoint) return SupermatterStatusType.Emergency; if (sm.Damage >= sm.DamageDelamAlertPoint) return SupermatterStatusType.Danger; if (sm.Damage >= sm.DamageWarningThreshold) return SupermatterStatusType.Warning; if (mix.Temperature > Atmospherics.T0C + (sm.HeatPenaltyThreshold * 0.8)) return SupermatterStatusType.Caution; if (sm.Power > 5) return SupermatterStatusType.Normal; return SupermatterStatusType.Inactive; } }
1
0.825501
1
0.825501
game-dev
MEDIA
0.952096
game-dev
0.949195
1
0.949195
klebs6/aloe-rs
1,834
aloe-box2d/src/spherestack.rs
crate::ix!(); //-------------------------------------------[.cpp/Aloe/examples/Assets/Box2DTests/SphereStack.h] pub const SPHERE_STACK_E_COUNT: usize = 10; pub struct SphereStack { base: Test, bodies: *mut [b2Body; SPHERE_STACK_E_COUNT], } impl Default for SphereStack { fn default() -> Self { todo!(); /* { b2BodyDef bd; b2Body* ground = m_world->CreateBody(&bd); b2EdgeShape shape; shape.Set(b2Vec2(-40.0f, 0.0f), b2Vec2(40.0f, 0.0f)); ground->CreateFixture(&shape, 0.0f); } { b2CircleShape shape; shape.m_radius = 1.0f; for (int32 i = 0; i < SPHERE_STACK_E_COUNT; ++i) { b2BodyDef bd; bd.type = b2_dynamicBody; bd.position.Set(0.0, 4.0f + 3.0f * i); m_bodies[i] = m_world->CreateBody(&bd); m_bodies[i]->CreateFixture(&shape, 1.0f); m_bodies[i]->SetLinearVelocity(b2Vec2(0.0f, -50.0f)); } */ } } impl SphereStack { pub fn step(&mut self, settings: *mut Settings) { todo!(); /* Test::Step(settings); //for (int32 i = 0; i < SPHERE_STACK_E_COUNT; ++i) //{ // printf("%g ", m_bodies[i]->GetWorldCenter().y); //} //for (int32 i = 0; i < SPHERE_STACK_E_COUNT; ++i) //{ // printf("%g ", m_bodies[i]->GetLinearVelocity().y); //} //printf("\n"); */ } pub fn create() -> *mut Test { todo!(); /* return new SphereStack; */ } }
1
0.728387
1
0.728387
game-dev
MEDIA
0.892244
game-dev,testing-qa
0.603595
1
0.603595
fortressforever/fortressforever
43,205
game_shared/baseplayer_shared.cpp
//========= Copyright 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: Implements shared baseplayer class functionality // // $NoKeywords: $ //=============================================================================// #include "cbase.h" #include "movevars_shared.h" #include "util_shared.h" #include "datacache/imdlcache.h" #if defined( CLIENT_DLL ) #include "iclientvehicle.h" #include "prediction.h" #include "c_basedoor.h" #include "c_world.h" #include "view.h" #define CRecipientFilter C_RecipientFilter #else #include "iservervehicle.h" #include "trains.h" #include "world.h" #include "doors.h" #include "ai_basenpc.h" extern int TrainSpeed(int iSpeed, int iMax); #endif #include "in_buttons.h" #include "engine/IEngineSound.h" #include "tier0/vprof.h" #include "SoundEmitterSystem/isoundemittersystembase.h" #include "decals.h" #include "obstacle_pushaway.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" #if defined(GAME_DLL) && !defined(_XBOX) extern ConVar sv_pushaway_max_force; extern ConVar sv_pushaway_force; extern ConVar sv_turbophysics; class CUsePushFilter : public CTraceFilterEntitiesOnly { public: bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) { CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); // Static prop case... if ( !pEntity ) return false; // Only impact on physics objects if ( !pEntity->VPhysicsGetObject() ) return false; return g_pGameRules->CanEntityBeUsePushed( pEntity ); } }; #endif //----------------------------------------------------------------------------- // Purpose: // Output : float //----------------------------------------------------------------------------- float CBasePlayer::GetTimeBase( void ) const { return m_nTickBase * TICK_INTERVAL; } //----------------------------------------------------------------------------- // Purpose: Called every usercmd by the player PreThink //----------------------------------------------------------------------------- void CBasePlayer::ItemPreFrame() { // Handle use events PlayerUse(); if ( gpGlobals->curtime < m_flNextAttack ) { return; } if (!GetActiveWeapon()) return; #if defined( CLIENT_DLL ) // Not predicting this weapon if ( !GetActiveWeapon()->IsPredicted() ) return; #endif GetActiveWeapon()->ItemPreFrame(); CBaseCombatWeapon *pWeapon; // Allow all the holstered weapons to update for ( int i = 0; i < WeaponCount(); i++ ) { pWeapon = GetWeapon( i ); if ( pWeapon == NULL ) continue; if ( GetActiveWeapon() == pWeapon ) continue; pWeapon->ItemHolsterFrame(); } } //----------------------------------------------------------------------------- // Purpose: // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CBasePlayer::UsingStandardWeaponsInVehicle( void ) { Assert( IsInAVehicle() ); #if !defined( CLIENT_DLL ) IServerVehicle *pVehicle = GetVehicle(); #else IClientVehicle *pVehicle = GetVehicle(); #endif Assert( pVehicle ); if ( !pVehicle ) return true; // NOTE: We *have* to do this before ItemPostFrame because ItemPostFrame // may dump us out of the vehicle int nRole = pVehicle->GetPassengerRole( this ); bool bUsingStandardWeapons = pVehicle->IsPassengerUsingStandardWeapons( nRole ); // Fall through and check weapons, etc. if we're using them if (!bUsingStandardWeapons ) return false; return true; } //----------------------------------------------------------------------------- // Purpose: Called every usercmd by the player PostThink //----------------------------------------------------------------------------- void CBasePlayer::ItemPostFrame() { VPROF( "CBasePlayer::ItemPostFrame" ); // Put viewmodels into basically correct place based on new player origin CalcViewModelView( EyePosition(), EyeAngles() ); // Don't process items while in a vehicle. if ( GetVehicle() ) { #if defined( CLIENT_DLL ) IClientVehicle *pVehicle = GetVehicle(); #else IServerVehicle *pVehicle = GetVehicle(); #endif bool bUsingStandardWeapons = UsingStandardWeaponsInVehicle(); #if defined( CLIENT_DLL ) if ( pVehicle->IsPredicted() ) #endif { pVehicle->ItemPostFrame( this ); } if (!bUsingStandardWeapons || !GetVehicle()) return; } // check if the player is using something if ( m_hUseEntity != NULL ) { #if !defined( CLIENT_DLL ) Assert( !IsInAVehicle() ); ImpulseCommands();// this will call playerUse #endif return; } if ( gpGlobals->curtime < m_flNextAttack ) { if ( GetActiveWeapon() ) { GetActiveWeapon()->ItemBusyFrame(); } } else { if ( GetActiveWeapon() && (!IsInAVehicle() || UsingStandardWeaponsInVehicle()) ) { #if defined( CLIENT_DLL ) // Not predicting this weapon if ( GetActiveWeapon()->IsPredicted() ) #endif { GetActiveWeapon()->ItemPostFrame( ); } } } #if !defined( CLIENT_DLL ) ImpulseCommands(); #else // NOTE: If we ever support full impulse commands on the client, // remove this line and call ImpulseCommands instead. m_nImpulse = 0; #endif // Mirv: Totally disable weapons in spectator mode if (GetTeamNumber() >= TEAM_BLUE && GetTeamNumber() <= TEAM_GREEN) if(GetActiveWeapon()) //voogru: crash fix 08/14/2006 GetActiveWeapon()->ItemPostFrame( ); } //----------------------------------------------------------------------------- // Eye angles //----------------------------------------------------------------------------- const QAngle &CBasePlayer::EyeAngles( ) { // NOTE: Viewangles are measured *relative* to the parent's coordinate system CBaseEntity *pMoveParent = const_cast<CBasePlayer*>(this)->GetMoveParent(); if ( !pMoveParent ) { return pl.v_angle; } // FIXME: Cache off the angles? matrix3x4_t eyesToParent, eyesToWorld; AngleMatrix( pl.v_angle, eyesToParent ); ConcatTransforms( pMoveParent->EntityToWorldTransform(), eyesToParent, eyesToWorld ); static QAngle angEyeWorld; MatrixAngles( eyesToWorld, angEyeWorld ); return angEyeWorld; } const QAngle &CBasePlayer::LocalEyeAngles() { return pl.v_angle; } //----------------------------------------------------------------------------- // Actual Eye position + angles //----------------------------------------------------------------------------- Vector CBasePlayer::EyePosition( ) { #ifdef CLIENT_DLL IClientVehicle *pVehicle = GetVehicle(); #else IServerVehicle *pVehicle = GetVehicle(); #endif if ( pVehicle ) { Assert( pVehicle ); int nRole = pVehicle->GetPassengerRole( this ); Vector vecEyeOrigin; QAngle angEyeAngles; pVehicle->GetVehicleViewPosition( nRole, &vecEyeOrigin, &angEyeAngles ); return vecEyeOrigin; } else { #ifdef CLIENT_DLL if ( IsObserver() ) { if ( GetObserverMode() == OBS_MODE_CHASE ) { if ( IsLocalPlayer() ) { return MainViewOrigin(); } } } #endif return BaseClass::EyePosition(); } } //----------------------------------------------------------------------------- // Purpose: // Input : // Output : const Vector //----------------------------------------------------------------------------- const Vector CBasePlayer::GetPlayerMins( void ) const { if ( IsObserver() ) { return VEC_OBS_HULL_MIN; } else { if ( GetFlags() & FL_DUCKING ) { return VEC_DUCK_HULL_MIN; } else { return VEC_HULL_MIN; } } } //----------------------------------------------------------------------------- // Purpose: // Input : // Output : const Vector //----------------------------------------------------------------------------- const Vector CBasePlayer::GetPlayerMaxs( void ) const { if ( IsObserver() ) { return VEC_OBS_HULL_MAX; } else { if ( GetFlags() & FL_DUCKING ) { return VEC_DUCK_HULL_MAX; } else { return VEC_HULL_MAX; } } } //----------------------------------------------------------------------------- // Returns eye vectors //----------------------------------------------------------------------------- void CBasePlayer::EyeVectors( Vector *pForward, Vector *pRight, Vector *pUp ) { #ifdef CLIENT_DLL IClientVehicle *pVehicle = GetVehicle(); #else IServerVehicle *pVehicle = GetVehicle(); #endif if ( pVehicle ) { Assert( pVehicle ); int nRole = pVehicle->GetPassengerRole( this ); Vector vecEyeOrigin; QAngle angEyeAngles; pVehicle->GetVehicleViewPosition( nRole, &vecEyeOrigin, &angEyeAngles ); AngleVectors( angEyeAngles, pForward, pRight, pUp ); } else { AngleVectors( EyeAngles(), pForward, pRight, pUp ); } } //----------------------------------------------------------------------------- // Purpose: Returns the eye position and angle vectors. //----------------------------------------------------------------------------- void CBasePlayer::EyePositionAndVectors( Vector *pPosition, Vector *pForward, Vector *pRight, Vector *pUp ) { #ifdef CLIENT_DLL IClientVehicle *pVehicle = GetVehicle(); #else IServerVehicle *pVehicle = GetVehicle(); #endif if ( pVehicle ) { Assert( pVehicle ); int nRole = pVehicle->GetPassengerRole( this ); Vector vecEyeOrigin; QAngle angEyeAngles; pVehicle->GetVehicleViewPosition( nRole, pPosition, &angEyeAngles ); AngleVectors( angEyeAngles, pForward, pRight, pUp ); } else { VectorCopy( BaseClass::EyePosition(), *pPosition ); AngleVectors( EyeAngles(), pForward, pRight, pUp ); } } #ifdef CLIENT_DLL surfacedata_t * CBasePlayer::GetFootstepSurface( const Vector &origin, const char *surfaceName ) { return physprops->GetSurfaceData( physprops->GetSurfaceIndex( surfaceName ) ); } #endif void CBasePlayer::UpdateStepSound( surfacedata_t *psurface, const Vector &vecOrigin, const Vector &vecVelocity ) { int fWalking; float fvol; Vector knee; Vector feet; float height; float speed; float velrun; float velwalk; float flduck; int fLadder; // --> Mirv: Replaced to fix footsteps if (m_flStepSoundTime > gpGlobals->curtime) return; // <-- Mirv if ( GetFlags() & (FL_FROZEN|FL_ATCONTROLS)) return; if ( GetMoveType() == MOVETYPE_NOCLIP || GetMoveType() == MOVETYPE_OBSERVER ) return; if ( !sv_footsteps.GetFloat() ) return; speed = VectorLength( vecVelocity ); float groundspeed = Vector2DLength( vecVelocity.AsVector2D() ); // determine if we are on a ladder fLadder = ( GetMoveType() == MOVETYPE_LADDER ); // UNDONE: need defined numbers for run, walk, crouch, crouch run velocities!!!! if ( ( GetFlags() & FL_DUCKING) || fLadder ) { velwalk = 60; // These constants should be based on cl_movespeedkey * cl_forwardspeed somehow velrun = 80; flduck = 100; } else { velwalk = 90; velrun = 220; flduck = 0; } bool onground = ( GetFlags() & FL_ONGROUND ); bool movingalongground = ( groundspeed > 0.0f ); bool moving_fast_enough = ( speed >= velwalk ); // To hear step sounds you must be either on a ladder or moving along the ground AND // You must be moving fast enough if ( !moving_fast_enough || !(fLadder || ( onground && movingalongground )) ) return; // MoveHelper()->PlayerSetAnimation( PLAYER_WALK ); fWalking = speed < velrun; VectorCopy( vecOrigin, knee ); VectorCopy( vecOrigin, feet ); height = GetPlayerMaxs()[ 2 ] - GetPlayerMins()[ 2 ]; knee[2] = vecOrigin[2] + 0.2 * height; // find out what we're stepping in or on... if ( fLadder ) { #ifdef CLIENT_DLL psurface = GetFootstepSurface( vecOrigin, "ladder" ); #else psurface = physprops->GetSurfaceData( physprops->GetSurfaceIndex( "ladder" ) ); #endif fvol = 0.5; m_flStepSoundTime = gpGlobals->curtime +0.350f; // |-- Mirv: Added gpGlobals->curtime } else if ( enginetrace->GetPointContents( knee ) & MASK_WATER ) { static int iSkipStep = 0; if ( iSkipStep == 0 ) { iSkipStep++; return; } if ( iSkipStep++ == 3 ) { iSkipStep = 0; } psurface = physprops->GetSurfaceData( physprops->GetSurfaceIndex( "wade" ) ); fvol = 0.65; m_flStepSoundTime = gpGlobals->curtime +0.600f; // |-- Mirv: Added gpGlobals->curtime } else if ( enginetrace->GetPointContents( feet ) & MASK_WATER ) { psurface = physprops->GetSurfaceData( physprops->GetSurfaceIndex( "water" ) ); fvol = fWalking ? 0.2 : 0.5; m_flStepSoundTime = fWalking ? gpGlobals->curtime +0.400f : gpGlobals->curtime +0.300f; // |-- Mirv: Added gpGlobals->curtime } else { if ( !psurface ) return; m_flStepSoundTime = fWalking ? gpGlobals->curtime +0.400f : gpGlobals->curtime +0.300f; // |-- Mirv: Added gpGlobals->curtime switch ( psurface->game.material ) { default: case CHAR_TEX_CONCRETE: fvol = fWalking ? 0.2 : 0.5; break; case CHAR_TEX_METAL: fvol = fWalking ? 0.2 : 0.5; break; case CHAR_TEX_DIRT: fvol = fWalking ? 0.25 : 0.55; break; case CHAR_TEX_VENT: fvol = fWalking ? 0.4 : 0.7; break; case CHAR_TEX_GRATE: fvol = fWalking ? 0.2 : 0.5; break; case CHAR_TEX_TILE: fvol = fWalking ? 0.2 : 0.5; break; case CHAR_TEX_SLOSH: fvol = fWalking ? 0.2 : 0.5; break; } } m_flStepSoundTime += 0.001f * flduck; // slower step time if ducking // |-- Mirv: Added gpGlobals->curtime // play the sound // 65% volume if ducking if ( GetFlags() & FL_DUCKING ) { fvol *= 0.65; } // --> Mirv: Redone sound stuff // If we are walking or ducking, silence if (GetFlags() & (FL_DUCKING) || m_nButtons & IN_SPEED) { fvol = 0; } else { fvol = 1.0f; } PlayStepSound( feet, psurface, fvol, false ); } //----------------------------------------------------------------------------- // Purpose: // Input : step - // fvol - // force - force sound to play //----------------------------------------------------------------------------- void CBasePlayer::PlayStepSound( Vector &vecOrigin, surfacedata_t *psurface, float fvol, bool force ) { if ( gpGlobals->maxClients > 1 && !sv_footsteps.GetFloat() ) return; #if defined( CLIENT_DLL ) // during prediction play footstep sounds only once if ( prediction->InPrediction() && !prediction->IsFirstTimePredicted() ) return; #endif if ( !psurface ) return; unsigned short stepSoundName = m_Local.m_nStepside ? psurface->sounds.stepleft : psurface->sounds.stepright; m_Local.m_nStepside = !m_Local.m_nStepside; if ( !stepSoundName ) return; IPhysicsSurfaceProps *physprops = MoveHelper( )->GetSurfaceProps(); const char *pSoundName = physprops->GetString( stepSoundName ); CSoundParameters params; if ( !CBaseEntity::GetParametersForSound( pSoundName, params, NULL ) ) return; CRecipientFilter filter; filter.AddRecipientsByPAS( vecOrigin ); #ifndef CLIENT_DLL // im MP, server removed all players in origins PVS, these players // generate the footsteps clientside if ( gpGlobals->maxClients > 1 ) filter.RemoveRecipientsByPVS( vecOrigin ); #endif EmitSound_t ep; ep.m_nChannel = CHAN_BODY; ep.m_pSoundName = params.soundname; ep.m_flVolume = fvol; ep.m_SoundLevel = params.soundlevel; ep.m_nFlags = 0; ep.m_nPitch = params.pitch; ep.m_pOrigin = &vecOrigin; EmitSound( filter, entindex(), ep ); } void CBasePlayer::UpdateButtonState( int nUserCmdButtonMask ) { // Track button info so we can detect 'pressed' and 'released' buttons next frame m_afButtonLast = m_nButtons; // Get button states m_nButtons = nUserCmdButtonMask; int buttonsChanged = m_afButtonLast ^ m_nButtons; // Debounced button codes for pressed/released // UNDONE: Do we need auto-repeat? m_afButtonPressed = buttonsChanged & m_nButtons; // The changed ones still down are "pressed" m_afButtonReleased = buttonsChanged & (~m_nButtons); // The ones not down are "released" } Vector CBasePlayer::Weapon_ShootPosition( ) { return EyePosition(); } void CBasePlayer::SetAnimationExtension( const char *pExtension ) { Q_strncpy( m_szAnimExtension, pExtension, sizeof(m_szAnimExtension) ); } //----------------------------------------------------------------------------- // Purpose: Set the weapon to switch to when the player uses the 'lastinv' command //----------------------------------------------------------------------------- void CBasePlayer::Weapon_SetLast( CBaseCombatWeapon *pWeapon ) { m_hLastWeapon = pWeapon; } //----------------------------------------------------------------------------- // Purpose: Override base class so player can reset autoaim // Input : // Output : //----------------------------------------------------------------------------- bool CBasePlayer::Weapon_Switch( CBaseCombatWeapon *pWeapon, int viewmodelindex /*=0*/ ) { CBaseCombatWeapon *pLastWeapon = GetActiveWeapon(); if ( BaseClass::Weapon_Switch( pWeapon, viewmodelindex )) { if ( pLastWeapon && Weapon_ShouldSetLast( pLastWeapon, GetActiveWeapon() ) ) { Weapon_SetLast( pLastWeapon->GetLastWeapon() ); } CBaseViewModel *pViewModel = GetViewModel( viewmodelindex ); Assert( pViewModel ); if ( pViewModel ) pViewModel->RemoveEffects( EF_NODRAW ); ResetAutoaim( ); return true; } return false; } void CBasePlayer::SelectLastItem(void) { if ( m_hLastWeapon.Get() == NULL ) return; if ( GetActiveWeapon() && !GetActiveWeapon()->CanHolster() ) return; SelectItem( m_hLastWeapon.Get()->GetClassname(), m_hLastWeapon.Get()->GetSubType() ); } //----------------------------------------------------------------------------- // Purpose: Abort any reloads we're in //----------------------------------------------------------------------------- void CBasePlayer::AbortReload( void ) { if ( GetActiveWeapon() ) { GetActiveWeapon()->AbortReload(); } } #if !defined( NO_ENTITY_PREDICTION ) void CBasePlayer::AddToPlayerSimulationList( CBaseEntity *other ) { CHandle< CBaseEntity > h; h = other; // Already in list if ( m_SimulatedByThisPlayer.Find( h ) != m_SimulatedByThisPlayer.InvalidIndex() ) return; Assert( other->IsPlayerSimulated() ); m_SimulatedByThisPlayer.AddToTail( h ); } //----------------------------------------------------------------------------- // Purpose: Fixme, this should occur if the player fails to drive simulation // often enough!!! // Input : *other - //----------------------------------------------------------------------------- void CBasePlayer::RemoveFromPlayerSimulationList( CBaseEntity *other ) { if ( !other ) return; Assert( other->IsPlayerSimulated() ); Assert( other->GetSimulatingPlayer() == this ); CHandle< CBaseEntity > h; h = other; m_SimulatedByThisPlayer.FindAndRemove( h ); } void CBasePlayer::SimulatePlayerSimulatedEntities( void ) { int c = m_SimulatedByThisPlayer.Count(); int i; for ( i = c - 1; i >= 0; i-- ) { CHandle< CBaseEntity > h; h = m_SimulatedByThisPlayer[ i ]; CBaseEntity *e = h; if ( !e || !e->IsPlayerSimulated() ) { m_SimulatedByThisPlayer.Remove( i ); continue; } #if defined( CLIENT_DLL ) if ( e->IsClientCreated() && prediction->InPrediction() && !prediction->IsFirstTimePredicted() ) { continue; } #endif Assert( e->IsPlayerSimulated() ); Assert( e->GetSimulatingPlayer() == this ); e->PhysicsSimulate(); } // Loop through all entities again, checking their untouch if flagged to do so c = m_SimulatedByThisPlayer.Count(); for ( i = c - 1; i >= 0; i-- ) { CHandle< CBaseEntity > h; h = m_SimulatedByThisPlayer[ i ]; CBaseEntity *e = h; if ( !e || !e->IsPlayerSimulated() ) { m_SimulatedByThisPlayer.Remove( i ); continue; } #if defined( CLIENT_DLL ) if ( e->IsClientCreated() && prediction->InPrediction() && !prediction->IsFirstTimePredicted() ) { continue; } #endif Assert( e->IsPlayerSimulated() ); Assert( e->GetSimulatingPlayer() == this ); if ( !e->GetCheckUntouch() ) continue; e->PhysicsCheckForEntityUntouch(); } } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CBasePlayer::ClearPlayerSimulationList( void ) { int c = m_SimulatedByThisPlayer.Size(); int i; for ( i = c - 1; i >= 0; i-- ) { CHandle< CBaseEntity > h; h = m_SimulatedByThisPlayer[ i ]; CBaseEntity *e = h; if ( e ) { e->UnsetPlayerSimulated(); } } m_SimulatedByThisPlayer.RemoveAll(); } #endif //----------------------------------------------------------------------------- // Purpose: Return true if we should allow selection of the specified item //----------------------------------------------------------------------------- bool CBasePlayer::Weapon_ShouldSelectItem( CBaseCombatWeapon *pWeapon ) { return ( pWeapon != GetActiveWeapon() ); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CBasePlayer::SelectItem( const char *pstr, int iSubType ) { if (!pstr) return; CBaseCombatWeapon *pItem = Weapon_OwnsThisType( pstr, iSubType ); if (!pItem) return; if( GetObserverMode() != OBS_MODE_NONE ) return;// Observers can't select things. if ( !Weapon_ShouldSelectItem( pItem ) ) return; // FIX, this needs to queue them up and delay // Make sure the current weapon can be holstered if ( GetActiveWeapon() ) { if ( !GetActiveWeapon()->CanHolster() ) return; ResetAutoaim( ); } Weapon_Switch( pItem ); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- ConVar sv_debug_player_use( "sv_debug_player_use", "0", FCVAR_REPLICATED, "Visualizes +use logic. Green cross=trace success, Red cross=trace too far, Green box=radius success" ); float IntervalDistance( float x, float x0, float x1 ) { // swap so x0 < x1 if ( x0 > x1 ) { float tmp = x0; x0 = x1; x1 = tmp; } if ( x < x0 ) return x0-x; else if ( x > x1 ) return x - x1; return 0; } CBaseEntity *CBasePlayer::FindUseEntity() { Vector forward, up; EyeVectors( &forward, NULL, &up ); trace_t tr; // Search for objects in a sphere (tests for entities that are not solid, yet still useable) Vector searchCenter = EyePosition(); // NOTE: Some debris objects are useable too, so hit those as well // A button, etc. can be made out of clip brushes, make sure it's +useable via a traceline, too. int useableContents = MASK_SOLID | CONTENTS_DEBRIS | CONTENTS_PLAYERCLIP; #ifdef CSTRIKE_DLL useableContents = MASK_NPCSOLID_BRUSHONLY | MASK_OPAQUE_AND_NPCS; #endif #ifdef HL1_DLL useableContents = MASK_SOLID; #endif UTIL_TraceLine( searchCenter, searchCenter + forward * 1024, useableContents, this, COLLISION_GROUP_NONE, &tr ); // try the hit entity if there is one, or the ground entity if there isn't. CBaseEntity *pNearest = NULL; CBaseEntity *pObject = tr.m_pEnt; int count = 0; // UNDONE: Might be faster to just fold this range into the sphere query const int NUM_TANGENTS = 7; while ( !IsUseableEntity(pObject, 0) && count < NUM_TANGENTS) { // trace a box at successive angles down // 45 deg, 30 deg, 20 deg, 15 deg, 10 deg, -10, -15 const float tangents[NUM_TANGENTS] = { 1, 0.57735026919f, 0.3639702342f, 0.267949192431f, 0.1763269807f, -0.1763269807f, -0.267949192431f }; Vector down = forward - tangents[count]*up; VectorNormalize(down); UTIL_TraceHull( searchCenter, searchCenter + down * 72, -Vector(16,16,16), Vector(16,16,16), useableContents, this, COLLISION_GROUP_NONE, &tr ); pObject = tr.m_pEnt; count++; } float nearestDot = CONE_90_DEGREES; if ( IsUseableEntity(pObject, 0) ) { Vector delta = tr.endpos - tr.startpos; float centerZ = CollisionProp()->WorldSpaceCenter().z; delta.z = IntervalDistance( tr.endpos.z, centerZ + CollisionProp()->OBBMins().z, centerZ + CollisionProp()->OBBMaxs().z ); float dist = delta.Length(); if ( dist < PLAYER_USE_RADIUS ) { #ifndef CLIENT_DLL if ( sv_debug_player_use.GetBool() ) { NDebugOverlay::Line( searchCenter, tr.endpos, 0, 255, 0, true, 30 ); NDebugOverlay::Cross3D( tr.endpos, 16, 0, 255, 0, true, 30 ); } if ( pObject->MyNPCPointer() && pObject->MyNPCPointer()->IsPlayerAlly( this ) ) { // If about to select an NPC, do a more thorough check to ensure // that we're selecting the right one from a group. pObject = DoubleCheckUseNPC( pObject, searchCenter, forward ); } #endif return pObject; } } #ifndef CLIENT_DLL CBaseEntity *pFoundByTrace = pObject; #endif // check ground entity first // if you've got a useable ground entity, then shrink the cone of this search to 45 degrees // otherwise, search out in a 90 degree cone (hemisphere) if ( GetGroundEntity() && IsUseableEntity(GetGroundEntity(), FCAP_USE_ONGROUND) ) { pNearest = GetGroundEntity(); nearestDot = CONE_45_DEGREES; } for ( CEntitySphereQuery sphere( searchCenter, PLAYER_USE_RADIUS ); ( pObject = sphere.GetCurrentEntity() ) != NULL; sphere.NextEntity() ) { if ( !pObject ) continue; if ( !IsUseableEntity( pObject, FCAP_USE_IN_RADIUS ) ) continue; // see if it's more roughly in front of the player than previous guess Vector point; pObject->CollisionProp()->CalcNearestPoint( searchCenter, &point ); Vector dir = point - searchCenter; VectorNormalize(dir); float dot = DotProduct( dir, forward ); // Need to be looking at the object more or less if ( dot < 0.8 ) continue; if ( dot > nearestDot ) { // Since this has purely been a radius search to this point, we now // make sure the object isn't behind glass or a grate. trace_t trCheckOccluded; UTIL_TraceLine( searchCenter, point, useableContents, this, COLLISION_GROUP_NONE, &trCheckOccluded ); if ( trCheckOccluded.fraction == 1.0 || trCheckOccluded.m_pEnt == pObject ) { pNearest = pObject; nearestDot = dot; } } } #ifndef CLIENT_DLL if ( !pNearest ) { // Haven't found anything near the player to use, nor any NPC's at distance. // Check to see if the player is trying to select an NPC through a rail, fence, or other 'see-though' volume. trace_t trAllies; UTIL_TraceLine( searchCenter, searchCenter + forward * PLAYER_USE_RADIUS, MASK_OPAQUE_AND_NPCS, this, COLLISION_GROUP_NONE, &trAllies ); if ( trAllies.m_pEnt && IsUseableEntity( trAllies.m_pEnt, 0 ) && trAllies.m_pEnt->MyNPCPointer() && trAllies.m_pEnt->MyNPCPointer()->IsPlayerAlly( this ) ) { // This is an NPC, take it! pNearest = trAllies.m_pEnt; } } if ( pNearest && pNearest->MyNPCPointer() && pNearest->MyNPCPointer()->IsPlayerAlly( this ) ) { pNearest = DoubleCheckUseNPC( pNearest, searchCenter, forward ); } if ( sv_debug_player_use.GetBool() ) { if ( !pNearest ) { NDebugOverlay::Line( searchCenter, tr.endpos, 255, 0, 0, true, 30 ); NDebugOverlay::Cross3D( tr.endpos, 16, 255, 0, 0, true, 30 ); } else if ( pNearest == pFoundByTrace ) { NDebugOverlay::Line( searchCenter, tr.endpos, 0, 255, 0, true, 30 ); NDebugOverlay::Cross3D( tr.endpos, 16, 0, 255, 0, true, 30 ); } else { NDebugOverlay::Box( pNearest->WorldSpaceCenter(), Vector(-8, -8, -8), Vector(8, 8, 8), 0, 255, 0, true, 30 ); } } #endif return pNearest; } //----------------------------------------------------------------------------- // Purpose: Handles USE keypress //----------------------------------------------------------------------------- void CBasePlayer::PlayerUse ( void ) { #ifdef GAME_DLL // Was use pressed or released? if ( ! ((m_nButtons | m_afButtonPressed | m_afButtonReleased) & IN_USE) ) return; if ( IsObserver() ) { // do special use operation in oberserver mode if ( m_afButtonPressed & IN_USE ) ObserverUse( true ); else if ( m_afButtonReleased & IN_USE ) ObserverUse( false ); return; } #if !defined(_XBOX) // push objects in turbo physics mode if ( (m_nButtons & IN_USE) && sv_turbophysics.GetBool() ) { Vector forward, up; EyeVectors( &forward, NULL, &up ); trace_t tr; // Search for objects in a sphere (tests for entities that are not solid, yet still useable) Vector searchCenter = EyePosition(); CUsePushFilter filter; UTIL_TraceLine( searchCenter, searchCenter + forward * 96.0f, MASK_SOLID, &filter, &tr ); // try the hit entity if there is one, or the ground entity if there isn't. CBaseEntity *entity = tr.m_pEnt; if ( entity ) { IPhysicsObject *pObj = entity->VPhysicsGetObject(); Vector vPushAway = (entity->WorldSpaceCenter() - WorldSpaceCenter()); vPushAway.z = 0; float flDist = VectorNormalize( vPushAway ); flDist = max( flDist, 1 ); float flForce = sv_pushaway_force.GetFloat() / flDist; flForce = min( flForce, sv_pushaway_max_force.GetFloat() ); pObj->ApplyForceOffset( vPushAway * flForce, WorldSpaceCenter() ); } } #endif if ( m_afButtonPressed & IN_USE ) { // Controlling some latched entity? if ( ClearUseEntity() ) { return; } else { if ( m_afPhysicsFlags & PFLAG_DIROVERRIDE ) { m_afPhysicsFlags &= ~PFLAG_DIROVERRIDE; m_iTrain = TRAIN_NEW|TRAIN_OFF; return; } else { // Start controlling the train! CBaseEntity *pTrain = GetGroundEntity(); if ( pTrain && !(m_nButtons & IN_JUMP) && (GetFlags() & FL_ONGROUND) && (pTrain->ObjectCaps() & FCAP_DIRECTIONAL_USE) && pTrain->OnControls(this) ) { m_afPhysicsFlags |= PFLAG_DIROVERRIDE; m_iTrain = TrainSpeed(pTrain->m_flSpeed, ((CFuncTrackTrain*)pTrain)->GetMaxSpeed()); m_iTrain |= TRAIN_NEW; EmitSound( "Player.UseTrain" ); return; } } } } CBaseEntity *pUseEntity = FindUseEntity(); // Found an object if ( pUseEntity ) { //!!!UNDONE: traceline here to prevent +USEing buttons through walls bool bUsed = false; int caps = pUseEntity->ObjectCaps(); variant_t emptyVariant; if ( ( (m_nButtons & IN_USE) && (caps & FCAP_CONTINUOUS_USE) ) || ( (m_afButtonPressed & IN_USE) && (caps & (FCAP_IMPULSE_USE|FCAP_ONOFF_USE)) ) ) { if ( caps & FCAP_CONTINUOUS_USE ) { m_afPhysicsFlags |= PFLAG_USING; } if ( pUseEntity->ObjectCaps() & FCAP_ONOFF_USE ) { pUseEntity->AcceptInput( "Use", this, this, emptyVariant, USE_ON ); bUsed = true; } else { pUseEntity->AcceptInput( "Use", this, this, emptyVariant, USE_TOGGLE ); bUsed = true; } } // UNDONE: Send different USE codes for ON/OFF. Cache last ONOFF_USE object to send 'off' if you turn away else if ( (m_afButtonReleased & IN_USE) && (pUseEntity->ObjectCaps() & FCAP_ONOFF_USE) ) // BUGBUG This is an "off" use { pUseEntity->AcceptInput( "Use", this, this, emptyVariant, USE_OFF ); bUsed = true; } if(bUsed) { IGameEvent *pEvent = gameeventmanager->CreateEvent("player_use"); if(pEvent) { pEvent->SetInt("userid", GetUserID()); pEvent->SetInt("entity", pUseEntity->entindex()); gameeventmanager->FireEvent(pEvent, true); } } } else if ( m_afButtonPressed & IN_USE ) { EmitSound( "Player.UseDeny" ); } #endif } ConVar sv_suppress_viewpunch( "sv_suppress_viewpunch", "0", FCVAR_REPLICATED ); //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CBasePlayer::ViewPunch( const QAngle &angleOffset ) { //See if we're suppressing the view punching //FIXME: Multiplayer shouldn't allow this if ( sv_suppress_viewpunch.GetBool() ) return; // We don't allow view kicks in the vehicle if ( IsInAVehicle() ) return; m_Local.m_vecPunchAngleVel += angleOffset * 20; } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CBasePlayer::ViewPunchReset( float tolerance ) { if ( tolerance != 0 ) { tolerance *= tolerance; // square float check = m_Local.m_vecPunchAngleVel->LengthSqr() + m_Local.m_vecPunchAngle->LengthSqr(); if ( check > tolerance ) return; } m_Local.m_vecPunchAngle = vec3_angle; m_Local.m_vecPunchAngleVel = vec3_angle; } #if defined( CLIENT_DLL ) #include "iviewrender.h" #include "ivieweffects.h" #endif static ConVar smoothstairs( "smoothstairs", "1", FCVAR_REPLICATED, "Smooth player eye z coordinate when traversing stairs." ); //----------------------------------------------------------------------------- // Handle view smoothing when going up or down stairs //----------------------------------------------------------------------------- void CBasePlayer::SmoothViewOnStairs( Vector& eyeOrigin ) { CBaseEntity *pGroundEntity = GetGroundEntity(); float flCurrentPlayerZ = GetLocalOrigin().z; float flCurrentPlayerViewOffsetZ = GetViewOffset().z; // --> Mirv: // We're now only smoothing stairs if we've recently stepped up or down // far enough (currently >= 8.0 units). This way the stair smoothing isn't // affecting ramps if (!m_bSmoothStair) { m_flOldPlayerZ = flCurrentPlayerZ; } else { // Once we've got close enough to our actual position then stop stair // smoothing float flDistance = flCurrentPlayerZ - m_flOldPlayerZ; if (flDistance < 0.1f && flDistance > -0.1f) { m_flOldPlayerZ = flCurrentPlayerZ; m_bSmoothStair = false; } } // <-- Mirv // Smooth out stair step ups // NOTE: Don't want to do this when the ground entity is moving the player if ( ( pGroundEntity != NULL && pGroundEntity->GetMoveType() == MOVETYPE_NONE ) && ( flCurrentPlayerZ != m_flOldPlayerZ ) && smoothstairs.GetBool() && m_flOldPlayerViewOffsetZ == flCurrentPlayerViewOffsetZ ) { int dir = ( flCurrentPlayerZ > m_flOldPlayerZ ) ? 1 : -1; float steptime = gpGlobals->frametime; if (steptime < 0) { steptime = 0; } m_flOldPlayerZ += steptime * 150 * dir; const float stepSize = 18.0f; if ( dir > 0 ) { if (m_flOldPlayerZ > flCurrentPlayerZ) { m_flOldPlayerZ = flCurrentPlayerZ; } if (flCurrentPlayerZ - m_flOldPlayerZ > stepSize) { m_flOldPlayerZ = flCurrentPlayerZ - stepSize; } } else { if (m_flOldPlayerZ < flCurrentPlayerZ) { m_flOldPlayerZ = flCurrentPlayerZ; } if (flCurrentPlayerZ - m_flOldPlayerZ < -stepSize) { m_flOldPlayerZ = flCurrentPlayerZ + stepSize; } } eyeOrigin[2] += m_flOldPlayerZ - flCurrentPlayerZ; } else { m_flOldPlayerZ = flCurrentPlayerZ; m_flOldPlayerViewOffsetZ = flCurrentPlayerViewOffsetZ; } } static bool IsWaterContents( int contents ) { if ( contents & MASK_WATER ) return true; // if ( contents & CONTENTS_TESTFOGVOLUME ) // return true; return false; } void CBasePlayer::ResetObserverMode() { m_hObserverTarget.Set( 0 ); m_iObserverMode = (int)OBS_MODE_NONE; #ifndef CLIENT_DLL m_iObserverLastMode = OBS_MODE_ROAMING; m_bForcedObserverMode = false; m_afPhysicsFlags &= ~PFLAG_OBSERVER; #endif } //----------------------------------------------------------------------------- // Purpose: // Input : eyeOrigin - // eyeAngles - // zNear - // zFar - // fov - //----------------------------------------------------------------------------- void CBasePlayer::CalcView( Vector &eyeOrigin, QAngle &eyeAngles, float &zNear, float &zFar, float &fov ) { #if defined( CLIENT_DLL ) IClientVehicle *pVehicle; #else IServerVehicle *pVehicle; #endif pVehicle = GetVehicle(); if ( !pVehicle ) { if ( IsObserver() ) { CalcObserverView( eyeOrigin, eyeAngles, fov ); } else { CalcPlayerView( eyeOrigin, eyeAngles, fov ); } } else { CalcVehicleView( pVehicle, eyeOrigin, eyeAngles, zNear, zFar, fov ); } } void CBasePlayer::CalcViewModelView( const Vector& eyeOrigin, const QAngle& eyeAngles) { for ( int i = 0; i < MAX_VIEWMODELS; i++ ) { CBaseViewModel *vm = GetViewModel( i ); if ( !vm ) continue; vm->CalcViewModelView( this, eyeOrigin, eyeAngles ); } } void CBasePlayer::CalcPlayerView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov ) { #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) { // FIXME: Move into prediction view->DriftPitch(); } #endif VectorCopy( EyePosition(), eyeOrigin ); VectorCopy( EyeAngles(), eyeAngles ); #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) #endif { SmoothViewOnStairs( eyeOrigin ); } // Snack off the origin before bob + water offset are applied Vector vecBaseEyePosition = eyeOrigin; CalcViewRoll( eyeAngles ); // Apply punch angle VectorAdd( eyeAngles, m_Local.m_vecPunchAngle, eyeAngles ); #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) { // Shake it up baby! vieweffects->CalcShake(); vieweffects->ApplyShake( eyeOrigin, eyeAngles, 1.0 ); } #endif #if defined( CLIENT_DLL ) // Apply a smoothing offset to smooth out prediction errors. Vector vSmoothOffset; GetPredictionErrorSmoothingVector( vSmoothOffset ); eyeOrigin += vSmoothOffset; m_flObserverChaseDistance = 0.0; #endif // calc current FOV fov = GetFOV(); } //----------------------------------------------------------------------------- // Purpose: The main view setup function for vehicles //----------------------------------------------------------------------------- void CBasePlayer::CalcVehicleView( #if defined( CLIENT_DLL ) IClientVehicle *pVehicle, #else IServerVehicle *pVehicle, #endif Vector& eyeOrigin, QAngle& eyeAngles, float& zNear, float& zFar, float& fov ) { Assert( pVehicle ); // Initialize with default origin + angles int nRole = pVehicle->GetPassengerRole( this ); pVehicle->GetVehicleViewPosition( nRole, &eyeOrigin, &eyeAngles ); #if defined( CLIENT_DLL ) fov = GetFOV(); // Allows the vehicle to change the clip planes pVehicle->GetVehicleClipPlanes( zNear, zFar ); #endif // Snack off the origin before bob + water offset are applied Vector vecBaseEyePosition = eyeOrigin; CalcViewRoll( eyeAngles ); // Apply punch angle VectorAdd( eyeAngles, m_Local.m_vecPunchAngle, eyeAngles ); #if defined( CLIENT_DLL ) if ( !prediction->InPrediction() ) { // Shake it up baby! vieweffects->CalcShake(); vieweffects->ApplyShake( eyeOrigin, eyeAngles, 1.0 ); } #endif } void CBasePlayer::CalcObserverView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov ) { #if defined( CLIENT_DLL ) switch ( GetObserverMode() ) { case OBS_MODE_DEATHCAM : CalcDeathCamView( eyeOrigin, eyeAngles, fov ); break; case OBS_MODE_ROAMING : // just copy current position without view offset case OBS_MODE_FIXED : CalcRoamingView( eyeOrigin, eyeAngles, fov ); break; case OBS_MODE_IN_EYE : CalcInEyeCamView( eyeOrigin, eyeAngles, fov ); break; case OBS_MODE_CHASE : CalcChaseCamView( eyeOrigin, eyeAngles, fov ); break; } #else // on server just copy target postions, final view positions will be calculated on client VectorCopy( EyePosition(), eyeOrigin ); VectorCopy( EyeAngles(), eyeAngles ); #endif } //----------------------------------------------------------------------------- // Purpose: Compute roll angle for a particular lateral velocity // Input : angles - // velocity - // rollangle - // rollspeed - // Output : float CViewRender::CalcRoll //----------------------------------------------------------------------------- float CBasePlayer::CalcRoll (const QAngle& angles, const Vector& velocity, float rollangle, float rollspeed) { float sign; float side; float value; Vector forward, right, up; AngleVectors (angles, &forward, &right, &up); // Get amount of lateral movement side = DotProduct( velocity, right ); // Right or left side? sign = side < 0 ? -1 : 1; side = fabs(side); value = rollangle; // Hit 100% of rollangle at rollspeed. Below that get linear approx. if ( side < rollspeed ) { side = side * value / rollspeed; } else { side = value; } // Scale by right/left sign return side*sign; } //----------------------------------------------------------------------------- // Purpose: Determine view roll, including data kick //----------------------------------------------------------------------------- void CBasePlayer::CalcViewRoll( QAngle& eyeAngles ) { if ( GetMoveType() == MOVETYPE_NOCLIP ) return; float side = CalcRoll( GetAbsAngles(), GetAbsVelocity(), sv_rollangle.GetFloat(), sv_rollspeed.GetFloat() ); eyeAngles[ROLL] += side; } void CBasePlayer::DoMuzzleFlash() { for ( int i = 0; i < MAX_VIEWMODELS; i++ ) { CBaseViewModel *vm = GetViewModel( i ); if ( !vm ) continue; vm->DoMuzzleFlash(); } BaseClass::DoMuzzleFlash(); } float CBasePlayer::GetFOVDistanceAdjustFactor() { float defaultFOV = (float)GetDefaultFOV(); float localFOV = (float)GetFOV(); if ( localFOV == defaultFOV || defaultFOV < 0.001f ) { return 1.0f; } // If FOV is lower, then we're "zoomed" in and this will give a factor < 1 so apparent LOD distances can be // shorted accordingly return localFOV / defaultFOV; } //----------------------------------------------------------------------------- // Purpose: // Input : &vecTracerSrc - // &tr - // iTracerType - //----------------------------------------------------------------------------- void CBasePlayer::MakeTracer( const Vector &vecTracerSrc, const trace_t &tr, int iTracerType ) { if ( GetActiveWeapon() ) { GetActiveWeapon()->MakeTracer( vecTracerSrc, tr, iTracerType ); return; } BaseClass::MakeTracer( vecTracerSrc, tr, iTracerType ); } void CBasePlayer::SharedSpawn() { SetMoveType( MOVETYPE_WALK ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetFriction( 1.0f ); pl.deadflag = false; m_lifeState = LIFE_ALIVE; m_iHealth = 100; m_takedamage = DAMAGE_YES; m_Local.m_bDrawViewmodel = true; m_Local.m_flStepSize = sv_stepsize.GetFloat(); m_Local.m_bAllowAutoMovement = true; m_nRenderFX = kRenderFxNone; m_flNextAttack = gpGlobals->curtime; m_flMaxspeed = 0.0f; MDLCACHE_CRITICAL_SECTION(); SetSequence( SelectWeightedSequence( ACT_IDLE ) ); if ( GetFlags() & FL_DUCKING ) SetCollisionBounds( VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX ); else SetCollisionBounds( VEC_HULL_MIN, VEC_HULL_MAX ); // dont let uninitialized value here hurt the player m_Local.m_flFallVelocity = 0; SetBloodColor( BLOOD_COLOR_RED ); } //----------------------------------------------------------------------------- // Purpose: // Output : int //----------------------------------------------------------------------------- int CBasePlayer::GetDefaultFOV( void ) const { #if defined( CLIENT_DLL ) if ( GetObserverMode() == OBS_MODE_IN_EYE ) { C_BasePlayer *pTargetPlayer = dynamic_cast<C_BasePlayer*>( GetObserverTarget() ); if ( pTargetPlayer ) { return pTargetPlayer->GetDefaultFOV(); } } #endif int iFOV = ( m_iDefaultFOV == 0 ) ? g_pGameRules->DefaultFOV() : m_iDefaultFOV; return iFOV; } void CBasePlayer::AvoidPhysicsProps( CUserCmd *pCmd ) { #ifndef _XBOX // Don't avoid if noclipping or in movetype none switch ( GetMoveType() ) { case MOVETYPE_NOCLIP: case MOVETYPE_NONE: case MOVETYPE_OBSERVER: return; default: break; } if ( GetObserverMode() != OBS_MODE_NONE || !IsAlive() ) return; AvoidPushawayProps( this, pCmd ); #endif }
1
0.961493
1
0.961493
game-dev
MEDIA
0.949086
game-dev
0.882582
1
0.882582
GameTechDev/OcclusionCulling
2,976
CPUT/CPUTLight.cpp
//////////////////////////////////////////////////////////////////////////////// // Copyright 2017 Intel Corporation // // 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. //////////////////////////////////////////////////////////////////////////////// #include "CPUT.h" #include "CPUTLight.h" // Read light properties from .set file //----------------------------------------------------------------------------- CPUTResult CPUTLight::LoadLight(CPUTConfigBlock *pBlock, int *pParentID) { ASSERT( (NULL!=pBlock), _L("Invalid NULL parameter.") ); CPUTResult result = CPUT_SUCCESS; // set the null/group node name mName = pBlock->GetValueByName(_L("name"))->ValueAsString(); // get the parent ID *pParentID = pBlock->GetValueByName(_L("parent"))->ValueAsInt(); LoadParentMatrixFromParameterBlock( pBlock ); cString lightType = pBlock->GetValueByName(_L("lighttype"))->ValueAsString(); if(lightType.compare(_L("spot")) == 0) { mLightParams.nLightType = CPUT_LIGHT_SPOT; } else if(lightType.compare(_L("directional")) == 0) { mLightParams.nLightType = CPUT_LIGHT_DIRECTIONAL; } else if(lightType.compare(_L("point")) == 0) { mLightParams.nLightType = CPUT_LIGHT_POINT; } else { // ASSERT(0,_L("")); // TODO: why doesn't assert work here? } pBlock->GetValueByName(_L("Color"))->ValueAsFloatArray(mLightParams.pColor, 3); mLightParams.fIntensity = pBlock->GetValueByName(_L("Intensity"))->ValueAsFloat(); mLightParams.fHotSpot = pBlock->GetValueByName(_L("HotSpot"))->ValueAsFloat(); mLightParams.fConeAngle = pBlock->GetValueByName(_L("ConeAngle"))->ValueAsFloat(); mLightParams.fDecayStart = pBlock->GetValueByName(_L("DecayStart"))->ValueAsFloat(); mLightParams.bEnableFarAttenuation = pBlock->GetValueByName(_L("EnableNearAttenuation"))->ValueAsBool(); mLightParams.bEnableFarAttenuation = pBlock->GetValueByName(_L("EnableFarAttenuation"))->ValueAsBool(); mLightParams.fNearAttenuationStart = pBlock->GetValueByName(_L("NearAttenuationStart"))->ValueAsFloat(); mLightParams.fNearAttenuationEnd = pBlock->GetValueByName(_L("NearAttenuationEnd"))->ValueAsFloat(); mLightParams.fFarAttenuationStart = pBlock->GetValueByName(_L("FarAttenuationStart"))->ValueAsFloat(); mLightParams.fFarAttenuationEnd = pBlock->GetValueByName(_L("FarAttenuationEnd"))->ValueAsFloat(); return result; }
1
0.965353
1
0.965353
game-dev
MEDIA
0.535954
game-dev,graphics-rendering
0.978932
1
0.978932
Kharchii/NinjaTrader-bot
1,086
NinjaTrader/Custom/AddOns/OrderFlowBot/Events/StrategiesEvents.cs
using NinjaTrader.Custom.AddOns.OrderFlowBot.Models.Strategies; using System; using System.Collections.Generic; namespace NinjaTrader.Custom.AddOns.OrderFlowBot.Events { public class StrategiesEvents { private readonly EventManager _eventManager; public event Func<List<StrategyBase>> OnGetStrategies; public event Action OnResetStrategyData; public StrategiesEvents(EventManager eventManager) { _eventManager = eventManager; } /// <summary> /// Event triggered for getting the strategies. /// This is used to get the strategies. /// </summary> public List<StrategyBase> GetStrategies() { return _eventManager.InvokeEvent(() => OnGetStrategies?.Invoke()); } /// <summary> /// Event triggered for resetting the strategy data. /// This is used to reset the strategy data. /// </summary> public void ResetStrategyData() { _eventManager.InvokeEvent(OnResetStrategyData); } } }
1
0.74696
1
0.74696
game-dev
MEDIA
0.683001
game-dev,web-backend
0.813802
1
0.813802
cmangos/mangos-cata
6,031
src/game/AI/ScriptDevAI/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp
/* This file is part of the ScriptDev2 Project. See AUTHORS file for Copyright information * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* ScriptData SDName: Boss_Void_Reaver SD%Complete: 95 SDComment: Small adjustments may be required SDCategory: Tempest Keep, The Eye EndScriptData */ #include "AI/ScriptDevAI/include/precompiled.h" #include "the_eye.h" enum { SAY_AGGRO = -1550000, SAY_SLAY1 = -1550001, SAY_SLAY2 = -1550002, SAY_SLAY3 = -1550003, SAY_DEATH = -1550004, SAY_POUNDING1 = -1550005, SAY_POUNDING2 = -1550006, SPELL_POUNDING = 34162, SPELL_ARCANE_ORB_MISSILE = 34172, SPELL_KNOCK_AWAY = 25778, SPELL_BERSERK = 26662, NPC_ARCANE_ORB_TARGET = 19577, }; struct boss_void_reaverAI : public ScriptedAI { boss_void_reaverAI(Creature* pCreature) : ScriptedAI(pCreature) { m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData(); Reset(); } ScriptedInstance* m_pInstance; uint32 m_uiPoundingTimer; uint32 m_uiArcaneOrbTimer; uint32 m_uiKnockAwayTimer; uint32 m_uiBerserkTimer; void Reset() override { m_uiPoundingTimer = 13000; m_uiArcaneOrbTimer = 3000; m_uiKnockAwayTimer = 30000; m_uiBerserkTimer = 10 * MINUTE * IN_MILLISECONDS; } void KilledUnit(Unit* pVictim) override { if (pVictim->GetTypeId() != TYPEID_PLAYER) return; switch (urand(0, 2)) { case 0: DoScriptText(SAY_SLAY1, m_creature); break; case 1: DoScriptText(SAY_SLAY2, m_creature); break; case 2: DoScriptText(SAY_SLAY3, m_creature); break; } } void JustDied(Unit* /*pKiller*/) override { DoScriptText(SAY_DEATH, m_creature); if (m_pInstance) m_pInstance->SetData(TYPE_VOIDREAVER, DONE); } void Aggro(Unit* /*pWho*/) override { DoScriptText(SAY_AGGRO, m_creature); if (m_pInstance) m_pInstance->SetData(TYPE_VOIDREAVER, IN_PROGRESS); } void JustReachedHome() override { if (m_pInstance) m_pInstance->SetData(TYPE_VOIDREAVER, NOT_STARTED); } void JustSummoned(Creature* pSummoned) override { // Cast the Arcane Orb missile on the npc, not on player DoCastSpellIfCan(pSummoned, SPELL_ARCANE_ORB_MISSILE, CAST_TRIGGERED); } void UpdateAI(const uint32 uiDiff) override { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; // Pounding if (m_uiPoundingTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_POUNDING) == CAST_OK) { DoScriptText(urand(0, 1) ? SAY_POUNDING1 : SAY_POUNDING2, m_creature); m_uiPoundingTimer = 14000; } } else m_uiPoundingTimer -= uiDiff; // Arcane Orb if (m_uiArcaneOrbTimer < uiDiff) { // Search only for players which are not within 18 yards of the boss std::vector<Unit*> suitableTargets; ThreatList const& threatList = m_creature->getThreatManager().getThreatList(); for (ThreatList::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) { if (Unit* pTarget = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid())) { if (pTarget->GetTypeId() == TYPEID_PLAYER && !pTarget->IsWithinDist(m_creature, 18.0f)) suitableTargets.push_back(pTarget); } } if (suitableTargets.empty()) m_uiArcaneOrbTimer = 3000; else { Unit* pTarget = suitableTargets[urand(0, suitableTargets.size() - 1)]; if (pTarget) m_creature->SummonCreature(NPC_ARCANE_ORB_TARGET, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSPAWN_TIMED_DESPAWN, 0); m_uiArcaneOrbTimer = 3000; } } else m_uiArcaneOrbTimer -= uiDiff; // Single Target knock back, reduces aggro if (m_uiKnockAwayTimer < uiDiff) { if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK_AWAY) == CAST_OK) m_uiKnockAwayTimer = 30000; } else m_uiKnockAwayTimer -= uiDiff; // Berserk if (m_uiBerserkTimer) { if (m_uiBerserkTimer <= uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK) m_uiBerserkTimer = 0; } else m_uiBerserkTimer -= uiDiff; } DoMeleeAttackIfReady(); EnterEvadeIfOutOfCombatArea(uiDiff); } }; CreatureAI* GetAI_boss_void_reaver(Creature* pCreature) { return new boss_void_reaverAI(pCreature); } void AddSC_boss_void_reaver() { Script* pNewScript; pNewScript = new Script; pNewScript->Name = "boss_void_reaver"; pNewScript->GetAI = &GetAI_boss_void_reaver; pNewScript->RegisterSelf(); }
1
0.900235
1
0.900235
game-dev
MEDIA
0.984181
game-dev
0.983033
1
0.983033
Aelto/tw3-random-encounters-reworked
1,791
src/bounty/bounty_master/states/waiting.wss
state Waiting in RER_BountyMasterManager { event OnEnterState(previous_state_name: name) { super.OnEnterState(previous_state_name); NLOG("RER_BountyMasterManager - Waiting"); } } class RER_StartBountyMasterConversationOnInteraction extends SU_InteractionEventListener { default tag = "RER_StartBountyMasterConversationOnInteraction"; public function run(actionName : string, activator : CEntity, receptor: CPeristentEntity): bool { var rer: CRandomEncounters; if (!getRandomEncounters(rer)) { NDEBUG("An error occured, could not find the RER entity in the world"); return false; } if (rer.bounty_manager.bounty_master_manager.GetCurrentStateName() == 'Waiting') { rer.bounty_manager.bounty_master_manager.GotoState('DialogChoice'); this.doMovementAdjustment(receptor); } /** * We still want the dialogue to play after the interaction, so we'll return * true no matter what. */ return true; } function doMovementAdjustment(receptor: CPeristentEntity) { var movement_adjustor: CMovementAdjustor; var slide_ticket: SMovementAdjustmentRequestTicket; var target: CActor; target = thePlayer; movement_adjustor = (receptor as CActor) .GetMovingAgentComponent() .GetMovementAdjustor(); slide_ticket = movement_adjustor.GetRequest( 'RotateTowardsPlayer' ); // cancel any adjustement made with the same name movement_adjustor.CancelByName( 'RotateTowardsPlayer' ); // and now we create a new request slide_ticket = movement_adjustor.CreateNewRequest( 'RotateTowardsPlayer' ); movement_adjustor.AdjustmentDuration( slide_ticket, 0.25 // 500ms ); movement_adjustor.RotateTowards( slide_ticket, target ); } }
1
0.895782
1
0.895782
game-dev
MEDIA
0.783474
game-dev
0.759068
1
0.759068
ros2/rviz
8,766
rviz_common/src/rviz_common/frame_manager.cpp
// Copyright (c) 2009, Willow Garage, Inc. // Copyright (c) 2017, Open Source Robotics Foundation, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // * 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. // // * Neither the name of the copyright holder 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. #include "frame_manager.hpp" #include <algorithm> #include <chrono> #include <memory> #include <string> #include <utility> #include <vector> #include "geometry_msgs/msg/pose.hpp" #include "geometry_msgs/msg/pose_stamped.hpp" #include "geometry_msgs/msg/transform_stamped.hpp" #include "rclcpp/clock.hpp" #include "std_msgs/msg/float32.hpp" #include "rviz_common/display.hpp" #include "rviz_common/logging.hpp" #include "rviz_common/msg_conversions.hpp" #include "rviz_common/properties/property.hpp" #include "rviz_common/transformation/tf2_helpers/tf2_conversion_helpers.hpp" namespace rviz_common { FrameManager::FrameManager( rclcpp::Clock::SharedPtr clock, std::shared_ptr<transformation::FrameTransformer> transformer) : transformer_(transformer), sync_time_(0), clock_(clock) { setSyncMode(SyncOff); setPause(false); } void FrameManager::update() { std::lock_guard<std::mutex> lock(cache_mutex_); if (!pause_) { cache_.clear(); } if (!pause_) { switch (sync_mode_) { case SyncOff: sync_time_ = clock_->now(); break; case SyncExact: break; case SyncApprox: // adjust current time offset to sync source current_delta_ = static_cast<uint64_t>(0.7 * current_delta_ + 0.3 * sync_delta_); sync_time_ = rclcpp::Time( clock_->now().nanoseconds() - current_delta_, clock_->get_clock_type()); break; } } } void FrameManager::setFixedFrame(const std::string & frame) { bool should_emit = false; { std::lock_guard<std::mutex> lock(cache_mutex_); if (fixed_frame_ != frame) { fixed_frame_ = frame; cache_.clear(); should_emit = true; } } if (should_emit) { // This emission must be kept outside of the mutex lock to avoid deadlocks. emit fixedFrameChanged(); } } void FrameManager::setPause(bool pause) { pause_ = pause; } bool FrameManager::getPause() { return pause_; } FrameManager::SyncMode FrameManager::getSyncMode() { return sync_mode_; } void FrameManager::setSyncMode(SyncMode mode) { sync_mode_ = mode; sync_time_ = rclcpp::Time(0, 0, clock_->get_clock_type()); current_delta_ = 0; sync_delta_ = 0; } void FrameManager::syncTime(rclcpp::Time time) { switch (sync_mode_) { case SyncOff: break; case SyncExact: sync_time_ = time; break; case SyncApprox: if (time == rclcpp::Time(0, 0, clock_->get_clock_type())) { sync_delta_ = 0; return; } // avoid exception due to negative time if (clock_->now() >= time) { sync_delta_ = (clock_->now() - time).nanoseconds(); } else { setSyncMode(SyncApprox); } break; } } rclcpp::Time FrameManager::getTime() { return sync_time_; } bool FrameManager::adjustTime(const std::string & frame, rclcpp::Time & time) { // we only need to act if we get a zero timestamp, which means "latest" if (time != rclcpp::Time(0, 0, clock_->get_clock_type())) { return true; } switch (sync_mode_) { case SyncOff: break; case SyncExact: time = sync_time_; break; case SyncApprox: { std::string error_message; // try to get the time from the latest available transformation if (transformer_->canTransform( fixed_frame_, frame, tf2::TimePointZero, &error_message)) { time = sync_time_; } } break; } return true; } bool FrameManager::getTransform( const std::string & frame, rclcpp::Time time, Ogre::Vector3 & position, Ogre::Quaternion & orientation) { if (!adjustTime(frame, time)) { return false; } std::lock_guard<std::mutex> lock(cache_mutex_); position = Ogre::Vector3(9999999, 9999999, 9999999); orientation = Ogre::Quaternion::IDENTITY; if (fixed_frame_.empty()) { return false; } auto it = cache_.find(CacheKey(frame, time)); if (it != cache_.end()) { position = it->second.position; orientation = it->second.orientation; return true; } geometry_msgs::msg::Pose pose; pose.position.x = 0; pose.position.y = 0; pose.position.z = 0; pose.orientation.w = 1.0f; pose.orientation.x = 0; pose.orientation.y = 0; pose.orientation.z = 0; if (!transform(frame, time, pose, position, orientation)) { return false; } cache_.insert(std::make_pair(CacheKey(frame, time), CacheEntry(position, orientation))); return true; } bool FrameManager::transform( const std::string & frame, rclcpp::Time time, const geometry_msgs::msg::Pose & pose_msg, Ogre::Vector3 & position, Ogre::Quaternion & orientation) { if (!adjustTime(frame, time)) { return false; } position = Ogre::Vector3::ZERO; orientation = Ogre::Quaternion::IDENTITY; geometry_msgs::msg::PoseStamped pose_in; pose_in.header.stamp = time; pose_in.header.frame_id = frame; // TODO(wjwwood): figure out where the `/` is coming from and remove it // also consider warning the user in the GUI about this... if (pose_in.header.frame_id[0] == '/') { pose_in.header.frame_id = pose_in.header.frame_id.substr(1); } pose_in.pose = pose_msg; // TODO(wjwwood): figure out where the `/` is coming from and remove it // also consider warning the user in the GUI about this... std::string stripped_fixed_frame = fixed_frame_; if (stripped_fixed_frame[0] == '/') { stripped_fixed_frame = stripped_fixed_frame.substr(1); } geometry_msgs::msg::PoseStamped pose_out; try { pose_out = transformer_->transform(pose_in, stripped_fixed_frame); } catch (const transformation::FrameTransformerException & exception) { (void) exception; return false; } position = rviz_common::pointMsgToOgre(pose_out.pose.position); orientation = rviz_common::quaternionMsgToOgre(pose_out.pose.orientation); return true; } bool FrameManager::frameHasProblems(const std::string & frame, std::string & error) { return transformer_->frameHasProblems(frame, error); } bool FrameManager::transformHasProblems( const std::string & frame, rclcpp::Time time, std::string & error) { if (!adjustTime(frame, time)) { return false; } return !transformer_->canTransform( fixed_frame_, frame, transformation::tf2_helpers::toTf2TimePoint(time), &error); } const std::string & FrameManager::getFixedFrame() { return fixed_frame_; } transformation::TransformationLibraryConnector::WeakPtr FrameManager::getConnector() { return transformer_->getConnector(); } std::shared_ptr<transformation::FrameTransformer> FrameManager::getTransformer() { return transformer_; } std::vector<std::string> FrameManager::getAllFrameNames() { return transformer_->getAllFrameNames(); } void FrameManager::clear() { transformer_->clear(); } bool FrameManager::anyTransformationDataAvailable() { auto frames = transformer_->getAllFrameNames(); return !frames.empty(); } void FrameManager::setTransformerPlugin( std::shared_ptr<transformation::FrameTransformer> transformer) { transformer_ = transformer; } } // namespace rviz_common
1
0.941091
1
0.941091
game-dev
MEDIA
0.523844
game-dev
0.953052
1
0.953052
AlexAltea/nucleus
3,216
nucleus/cpu/frontend/spu/spu_decoder.h
/** * (c) 2014-2016 Alexandro Sanchez Bach. All rights reserved. * Released under GPL v2 license. Read LICENSE for more details. */ #pragma once #include "nucleus/common.h" #include "nucleus/format.h" #include "nucleus/cpu/cpu.h" #include "nucleus/cpu/hir/module.h" #include "nucleus/cpu/hir/type.h" #include "nucleus/cpu/hir/value.h" #include "nucleus/cpu/frontend/frontend_block.h" #include "nucleus/cpu/frontend/frontend_function.h" #include "nucleus/cpu/frontend/frontend_module.h" //#include "nucleus/cpu/frontend/spu/analyzer/spu_analyzer.h" #include <map> #include <string> #include <vector> namespace cpu { namespace frontend { namespace spu { // Forward declarations class Block; class Function; class Module; // Function type enum FunctionTypeIn { FUNCTION_IN_UNKNOWN = 0, FUNCTION_IN_INTEGER, // The U64 argument is passed on r3 to r10 FUNCTION_IN_FLOAT, // The F64 argument is passed on f1 to f13 FUNCTION_IN_VECTOR, // The U128 arguement is passed on v2 to v13 }; enum FunctionTypeOut { FUNCTION_OUT_UNKNOWN = 0, FUNCTION_OUT_INTEGER, // The U64 argument is returned on r3 FUNCTION_OUT_FLOAT, // The F64 argument is returned on f1 FUNCTION_OUT_FLOAT_X2, // The F64 argument is returned on f1:f2 FUNCTION_OUT_FLOAT_X3, // The F64 argument is returned on f1:f3 FUNCTION_OUT_FLOAT_X4, // The F64 argument is returned on f1:f4 FUNCTION_OUT_VECTOR, // The U128 arguement is returned on v2 FUNCTION_OUT_VOID, // Nothing is returned }; class Block : public frontend::Block { public: bool initial; // Is this a function entry block? bool jump_destination = false; // Is this a target of a bx/bcx instruction? bool call_destination = false; // Is this a target of a bl instruction // Constructors Block() {} Block(frontend::Block& block) : frontend::Block(block) {} // Determines whether an extra branch is required to connect this with the immediate block after bool is_split() const; }; class Function : public frontend::Function { // Analyzer auxiliary method: Determine register read/writes void do_register_analysis(/*Analyzer* status*/); public: // Return/Arguments type FunctionTypeOut type_out; std::vector<FunctionTypeIn> type_in; Function(Module* seg) { parent = reinterpret_cast<frontend::Module*>(seg); } // Analysis bool analyze_cfg(); // Generate CFG (and return if branching addresses stay inside the parent segment) void analyze_type(); // Determine function arguments/return types // Create placeholder void createPlaceholder(); // Declare function inside the parent segment void declare(); // Recompile function void recompile(); }; class Module : public frontend::Module { public: Function* addFunction(U32 addr); // Constructor Module(CPU* parent); // Generate a list of functions and analyze them void analyze(); // Recompile each of the functions void recompile(); // Replace a function with a HLE hook void hook(U32 funcAddr, U32 fnid); }; } // namespace spu } // namespace frontend } // namespace cpu
1
0.773756
1
0.773756
game-dev
MEDIA
0.257341
game-dev
0.642902
1
0.642902
duckdb/duckdb-java
1,180
src/duckdb/src/include/duckdb/execution/operator/helper/physical_set_variable.hpp
//===----------------------------------------------------------------------===// // DuckDB // // duckdb/execution/operator/helper/physical_set_variable.hpp // // //===----------------------------------------------------------------------===// #pragma once #include "duckdb/execution/physical_operator.hpp" namespace duckdb { //! PhysicalSet represents a SET of a variable (e.g. SET $a = 42) class PhysicalSetVariable : public PhysicalOperator { public: static constexpr const PhysicalOperatorType TYPE = PhysicalOperatorType::SET_VARIABLE; public: PhysicalSetVariable(PhysicalPlan &physical_plan, string name, idx_t estimated_cardinality); public: // Source interface SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override; bool IsSource() const override { return true; } public: unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override; SinkResultType Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const override; bool IsSink() const override { return true; } public: const string name; }; } // namespace duckdb
1
0.828554
1
0.828554
game-dev
MEDIA
0.407796
game-dev
0.732044
1
0.732044
Synthlight/RE-Editor
2,442
RE-Editor/Mods/MHWS/TalismansMaxSkills.cs
using System.Collections.Generic; using System.IO; using JetBrains.Annotations; using RE_Editor.Common; using RE_Editor.Common.Models; using RE_Editor.Models; using RE_Editor.Models.Structs; using RE_Editor.Util; using RE_Editor.Windows; namespace RE_Editor.Mods; [UsedImplicitly] public class TalismansMaxSkills : IMod { [UsedImplicitly] public static void Make(MainWindow mainWindow) { const string name = "Talismans - Max Skills"; const string description = "Talismans - Max Skills."; const string version = "1.9"; var baseMod = new NexusMod { Version = version, NameAsBundle = name, Desc = description }; var baseLuaMod = new VariousDataTweak { Version = version, NameAsBundle = name, Desc = description }; var mods = new List<INexusMod> { baseMod .SetName("Talismans - Max Skills (PAK)") .SetFiles([PathHelper.TALISMAN_DATA_PATH]) .SetAction(MaxSkills), baseLuaMod .SetName("Talismans - Max Skills (REF)") .SetDefaultLuaName() .SetChanges([ new() { Target = VariousDataTweak.Target.TALISMAN_DATA, Action = MaxSkillsRef } ]) .SetSkipPak(true) }; ModMaker.WriteMods(mainWindow, mods, name, copyLooseToFluffy: true); } public static void MaxSkills(List<RszObject> rszObjectData) { foreach (var obj in rszObjectData) { switch (obj) { case App_user_data_AmuletData_cData armor: foreach (var skillLevel in armor.SkillLevel) { if (skillLevel.Value > 0) { skillLevel.Value = 10; } } break; } } } public static void MaxSkillsRef(StreamWriter writer) { writer.WriteLine(" for skillIndex = 0, entry._SkillLevel:get_size() - 1 do"); writer.WriteLine(" if (entry._SkillLevel[skillIndex].m_value >= 1) then"); writer.WriteLine(" entry._SkillLevel[skillIndex] = 10"); writer.WriteLine(" end"); writer.WriteLine(" end"); } }
1
0.855428
1
0.855428
game-dev
MEDIA
0.902771
game-dev
0.916696
1
0.916696
GURPREETKAURJETHRA/Generative-AI-LLM-Projects
1,758
Medical_Chatbot_Llama2_Pinecone/Scripts/activate.ps1
$script:THIS_PATH = $myinvocation.mycommand.path $script:BASE_DIR = Split-Path (Resolve-Path "$THIS_PATH/..") -Parent function global:deactivate([switch] $NonDestructive) { if (Test-Path variable:_OLD_VIRTUAL_PATH) { $env:PATH = $variable:_OLD_VIRTUAL_PATH Remove-Variable "_OLD_VIRTUAL_PATH" -Scope global } if (Test-Path function:_old_virtual_prompt) { $function:prompt = $function:_old_virtual_prompt Remove-Item function:\_old_virtual_prompt } if ($env:VIRTUAL_ENV) { Remove-Item env:VIRTUAL_ENV -ErrorAction SilentlyContinue } if (!$NonDestructive) { # Self destruct! Remove-Item function:deactivate Remove-Item function:pydoc } } function global:pydoc { python -m pydoc $args } # unset irrelevant variables deactivate -nondestructive $VIRTUAL_ENV = $BASE_DIR $env:VIRTUAL_ENV = $VIRTUAL_ENV New-Variable -Scope global -Name _OLD_VIRTUAL_PATH -Value $env:PATH $env:PATH = "$env:VIRTUAL_ENV/Scripts;" + $env:PATH if (!$env:VIRTUAL_ENV_DISABLE_PROMPT) { function global:_old_virtual_prompt { "" } $function:_old_virtual_prompt = $function:prompt if ("" -ne "") { function global:prompt { # Add the custom prefix to the existing prompt $previous_prompt_value = & $function:_old_virtual_prompt ("() " + $previous_prompt_value) } } else { function global:prompt { # Add a prefix to the current prompt, but don't discard it. $previous_prompt_value = & $function:_old_virtual_prompt $new_prompt_value = "($( Split-Path $env:VIRTUAL_ENV -Leaf )) " ($new_prompt_value + $previous_prompt_value) } } }
1
0.816848
1
0.816848
game-dev
MEDIA
0.250505
game-dev
0.835275
1
0.835275
terraforming-mars/terraforming-mars
3,958
src/server/cards/pathfinders/SpecializedSettlement.ts
import {IProjectCard} from '../IProjectCard'; import {Tag} from '../../../common/cards/Tag'; import {Card} from '../Card'; import {CardType} from '../../../common/cards/CardType'; import {CardName} from '../../../common/cards/CardName'; import {IPlayer} from '../../IPlayer'; import {SelectSpace} from '../../inputs/SelectSpace'; import {Space} from '../../boards/Space'; import {Resource} from '../../../common/Resource'; import {CardRenderer} from '../render/CardRenderer'; import {SpaceBonus} from '../../../common/boards/SpaceBonus'; import {SelectResourceTypeDeferred} from '../../deferredActions/SelectResourceTypeDeferred'; import {Units} from '../../../common/Units'; export class SpecializedSettlement extends Card implements IProjectCard { constructor() { super({ type: CardType.AUTOMATED, name: CardName.SPECIALIZED_SETTLEMENT, tags: [Tag.CITY, Tag.BUILDING, Tag.MARS], cost: 20, metadata: { cardNumber: 'PF57', description: 'Decrease your energy production 1 step and increase your M€ production 3 steps. ' + 'Place a city tile on Mars. Increase your production by 1 of a resource on the map gained by placement bonus.', renderData: CardRenderer.builder((b) => { b.production((pb) => { pb.minus().energy(1).br; pb.plus().megacredits(3); pb.plus().wild(1); }).nbsp.city(); }), }, }); } public bonusResource?: Array<Resource>; public override bespokeCanPlay(player: IPlayer): boolean { return player.production.energy >= 1 && player.game.board.getAvailableSpacesForCity(player).length > 0; } private bonusResources(space: Space) { const resources: Set<Resource> = new Set(); space.bonus.forEach((bonus) => { switch (bonus) { case SpaceBonus.STEEL: resources.add(Resource.STEEL); break; case SpaceBonus.TITANIUM: resources.add(Resource.TITANIUM); break; case SpaceBonus.PLANT: resources.add(Resource.PLANTS); break; case SpaceBonus.ENERGY: resources.add(Resource.ENERGY); break; case SpaceBonus.HEAT: resources.add(Resource.HEAT); break; } }); return Array.from(resources); } public override bespokePlay(player: IPlayer) { player.production.adjust(SpecializedSettlement.defaultProductionBox); return new SelectSpace( 'Select space for city tile', player.game.board.getAvailableSpacesForCity(player)) .andThen((space) => { const coveringExistingTile = space.tile !== undefined; player.game.addCity(player, space); if (coveringExistingTile) return; const bonusResources = this.bonusResources(space); if (bonusResources.length === 0) return; player.game.defer(new SelectResourceTypeDeferred( player, bonusResources, 'Select a resource to gain 1 unit of production')) .andThen( (resource) => { player.production.add(resource, 1, {log: true}); this.bonusResource = [resource]; }, ); return undefined; }, ); } private static defaultProductionBox = Units.of({energy: -1, megacredits: 3}); public productionBox() { const units = {...SpecializedSettlement.defaultProductionBox}; if (this.bonusResource && this.bonusResource.length === 1) { units[this.bonusResource[0]] += 1; } return units; } public produceForTile(player: IPlayer, bonusResources: Array<Resource>) { if (bonusResources.length === 0) return; player.game.defer(new SelectResourceTypeDeferred( player, bonusResources, 'Select a resource to gain 1 unit of production')) .andThen( (resource) => { player.production.add(resource, 1, {log: true}); this.bonusResource = [resource]; }, ); } }
1
0.777739
1
0.777739
game-dev
MEDIA
0.691112
game-dev
0.86311
1
0.86311
Dimbreath/AzurLaneData
2,948
ko-KR/framework/puremvc/patterns/facade/facade.lua
slot0 = import("...core.Controller") slot1 = import("...core.Model") slot2 = import("...core.View") slot3 = import("..observer.Notification") slot4 = class("Facade") function slot4.Ctor(slot0, slot1) if uv0.instanceMap[slot1] ~= nil then error(uv0.MULTITON_MSG) end slot0:initializeNotifier(slot1) uv0.instanceMap[slot1] = slot0 slot0:initializeFacade() end function slot4.initializeFacade(slot0) slot0:initializeModel() slot0:initializeController() slot0:initializeView() end function slot4.getInstance(slot0) if slot0 == nil then return nil end if uv0.instanceMap[slot0] == nil then uv0.instanceMap[slot0] = uv0.New(slot0) end return uv0.instanceMap[slot0] end function slot4.initializeController(slot0) if slot0.controller ~= nil then return end slot0.controller = uv0.getInstance(slot0.multitonKey) end function slot4.initializeModel(slot0) if slot0.model ~= nil then return end slot0.model = uv0.getInstance(slot0.multitonKey) end function slot4.initializeView(slot0) if slot0.view ~= nil then return end slot0.view = uv0.getInstance(slot0.multitonKey) end function slot4.registerCommand(slot0, slot1, slot2) slot0.controller:registerCommand(slot1, slot2) end function slot4.removeCommand(slot0, slot1) slot0.controller:removeCommand(slot1) end function slot4.hasCommand(slot0, slot1) return slot0.controller:hasCommand(slot1) end function slot4.registerProxy(slot0, slot1) slot0.model:registerProxy(slot1) end function slot4.retrieveProxy(slot0, slot1) return slot0.model:retrieveProxy(slot1) end function slot4.removeProxy(slot0, slot1) slot2 = nil if slot0.model ~= nil then slot2 = slot0.model:removeProxy(slot1) end return slot2 end function slot4.hasProxy(slot0, slot1) return slot0.model:hasProxy(slot1) end function slot4.registerMediator(slot0, slot1) if slot0.view ~= nil then slot0.view:registerMediator(slot1) end end function slot4.retrieveMediator(slot0, slot1) return slot0.view:retrieveMediator(slot1) end function slot4.removeMediator(slot0, slot1) slot2 = nil if slot0.view ~= nil then slot2 = slot0.view:removeMediator(slot1) end return slot2 end function slot4.hasMediator(slot0, slot1) return slot0.view:hasMediator(slot1) end function slot4.sendNotification(slot0, slot1, slot2, slot3) slot0:notifyObservers(uv0.New(slot1, slot2, slot3)) end function slot4.notifyObservers(slot0, slot1) if slot0.view ~= nil then slot0.view:notifyObservers(slot1) end end function slot4.initializeNotifier(slot0, slot1) slot0.multitonKey = slot1 end function slot4.hasCore(slot0) return uv0.instanceMap[slot0] ~= nil end function slot4.removeCore(slot0) if uv0.instanceMap[slot0] == nil then return end uv1.removeModel(slot0) uv2.removeView(slot0) uv3.removeController(slot0) uv0.instanceMap[slot0] = nil end slot4.instanceMap = {} slot4.MULTITON_MSG = "Facade instance for this Multiton key already constructed!" return slot4
1
0.510172
1
0.510172
game-dev
MEDIA
0.898875
game-dev
0.78589
1
0.78589
lordofduct/spacepuppy-unity-framework-4.0
8,031
Framework/com.spacepuppy.audio/Runtime/src/Audio/AudioGroup.cs
using UnityEngine; using System.Collections.Generic; using com.spacepuppy.Utils; namespace com.spacepuppy.Audio { [DisallowMultipleComponent()] public class AudioGroup : SPComponent, IAudioGroup, ICollection<AudioSource> { #region Multiton Interface private static AudioGroupPool _pool = new AudioGroupPool(); public static AudioGroupPool Pool { get { return _pool; } } #endregion #region Fields [ReorderableArray()] [SerializeField()] private List<AudioSource> _managedAudioSources = new List<AudioSource>(); [SerializeField()] private bool _ignoreGlobalPause = true; [SerializeField()] private bool _ignoreGlobalVolume = true; [Range(0, 1f)] [SerializeField()] private float _volume = 1.0f; [SerializeField()] private bool _paused; [System.NonSerialized()] private bool _globallyPaused; [System.NonSerialized()] private List<AudioSource> _pausedPool; #endregion #region CONSTRUCTOR protected override void Awake() { base.Awake(); _pool.AddReference(this); _volume = Mathf.Clamp01(_volume); } protected override void Start() { base.Start(); foreach (var src in this.transform.GetChildComponents<AudioSource>(true)) { this.Add(src); } } protected override void OnDestroy() { base.OnDestroy(); for (int i = 0; i < _managedAudioSources.Count; i++) { if (_managedAudioSources[i] != null) Object.Destroy(_managedAudioSources[i]); } _managedAudioSources.Clear(); _pool.RemoveReference(this); } #endregion #region Properties public bool IgnoreGlobalPause { get { return _ignoreGlobalPause; } set { if (_ignoreGlobalPause == value) return; _ignoreGlobalPause = value; for (int i = 0; i < _managedAudioSources.Count; i++) { _managedAudioSources[i].ignoreListenerPause = _ignoreGlobalPause; } } } public bool IgnoreGlobalVolume { get { return _ignoreGlobalVolume; } set { if (_ignoreGlobalVolume == value) return; _ignoreGlobalVolume = value; for (int i = 0; i < _managedAudioSources.Count; i++) { _managedAudioSources[i].ignoreListenerVolume = _ignoreGlobalVolume; } } } #endregion #region Methods internal void SetGloballyPaused(bool paused) { if (_globallyPaused == paused) return; _globallyPaused = paused; } public bool TryAdd(AudioSource item) { if (_pool.IsManaged(item)) { //Debug.LogWarning("AudioSource is already managed by another group. An AudioSource can only be a member of one group at a time.", item); return false; } this.Add_Imp(item); return true; } private void Add_Imp(AudioSource item) { item.ignoreListenerPause = _ignoreGlobalPause; item.ignoreListenerVolume = _ignoreGlobalVolume; item.volume = _volume; _managedAudioSources.Add(item); if (_paused && item.isPlaying) { if (_pausedPool == null) _pausedPool = new List<AudioSource>(); item.Pause(); _pausedPool.Add(item); } } #endregion #region IAudioGroup Interface public float Volume { get { return _volume; } set { _volume = Mathf.Clamp01(value); for (int i = 0; i < _managedAudioSources.Count; i++) { _managedAudioSources[i].volume = _volume; } } } public bool Paused { get { return _paused; } } public void Pause() { _paused = true; if (_pausedPool == null) _pausedPool = new List<AudioSource>(); for (int i = 0; i < _managedAudioSources.Count; i++) { var src = _managedAudioSources[i]; if (src.isPlaying) { src.Pause(); _pausedPool.Add(src); } } } public void UnPause() { _paused = false; if (_pausedPool == null) return; for (int i = 0; i < _pausedPool.Count; i++) { _pausedPool[i].Play(); } _pausedPool.Clear(); } public void PlayAll() { for (int i = 0; i < _managedAudioSources.Count; i++) { _managedAudioSources[i].Play(); } } #endregion #region ICollection Interface public int Count { get { return _managedAudioSources.Count; } } bool ICollection<AudioSource>.IsReadOnly { get { throw new System.NotImplementedException(); } } public void Add(AudioSource item) { if (_pool.IsManaged(item)) { throw new System.ArgumentException("AudioSource is already managed by another group. An AudioSource can only be a member of one group at a time.", "item"); //Debug.LogWarning("AudioSource is already managed by another group. An AudioSource can only be a member of one group at a time.", item); //return; } this.Add_Imp(item); } public void Clear() { for (int i = 0; i < _managedAudioSources.Count; i++) { _managedAudioSources[i].ignoreListenerPause = false; _managedAudioSources[i].ignoreListenerVolume = false; } _managedAudioSources.Clear(); } public bool Contains(AudioSource item) { return _managedAudioSources.Contains(item); } public void CopyTo(AudioSource[] array, int arrayIndex) { _managedAudioSources.CopyTo(array, arrayIndex); } public bool Remove(AudioSource item) { if (_managedAudioSources.Remove(item)) { if (item != null) { //because the AudioSource may have been destroyed item.ignoreListenerPause = false; item.ignoreListenerVolume = false; } return true; } return false; } #endregion #region IEnumerable Interface System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return this.GetEnumerator(); } public IEnumerator<AudioSource> GetEnumerator() { return _managedAudioSources.GetEnumerator(); } #endregion #region Special Types public class AudioGroupPool : com.spacepuppy.Collections.MultitonPool<AudioGroup> { public bool IsManaged(AudioSource src) { if (src == null) return false; var e = this.GetEnumerator(); while (e.MoveNext()) { if (e.Current.Contains(src)) return true; } return false; } } #endregion } }
1
0.796522
1
0.796522
game-dev
MEDIA
0.819182
game-dev,audio-video-media
0.97631
1
0.97631
IJEMIN/Unity-Programming-Essence-2021
1,683
19/Done/Zombie Multiplayer/Assets/Photon/PhotonChat/Demos/DemoChat/NamePickGui.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright company="Exit Games GmbH"/> // <summary>Demo code for Photon Chat in Unity.</summary> // <author>developer@exitgames.com</author> // -------------------------------------------------------------------------------------------------------------------- using UnityEngine; using UnityEngine.UI; namespace Photon.Chat.Demo { [RequireComponent(typeof(ChatGui))] public class NamePickGui : MonoBehaviour { private const string UserNamePlayerPref = "NamePickUserName"; public ChatGui chatNewComponent; public InputField idInput; public void Start() { this.chatNewComponent = FindObjectOfType<ChatGui>(); string prefsName = PlayerPrefs.GetString(UserNamePlayerPref); if (!string.IsNullOrEmpty(prefsName)) { this.idInput.text = prefsName; } } // new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then StartChat. public void EndEditOnEnter() { if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter)) { this.StartChat(); } } public void StartChat() { ChatGui chatNewComponent = FindObjectOfType<ChatGui>(); chatNewComponent.UserName = this.idInput.text.Trim(); chatNewComponent.Connect(); this.enabled = false; PlayerPrefs.SetString(UserNamePlayerPref, chatNewComponent.UserName); } } }
1
0.836964
1
0.836964
game-dev
MEDIA
0.721774
game-dev
0.802233
1
0.802233
mastercomfig/tf2-patches-old
7,783
src/game/client/tf/tf_hud_training.cpp
//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // //=============================================================================// #include "cbase.h" #include "tf_hud_escort.h" #include <vgui/IVGui.h> #include "tf_hud_freezepanel.h" #include "teamplayroundbased_gamerules.h" #include "iclientmode.h" #include "tf_gamerules.h" #include "tf_hud_training.h" #include <vgui/ILocalize.h> using namespace vgui; //----------------------------------------------------------------------------- // Purpose: Localize text for training messages. Used in annotations and in the training hud. Assumes the output string size is greater than or equal to MAX_TRAINING_MSG_LENGTH //----------------------------------------------------------------------------- bool CTFHudTraining::FormatTrainingText(const char* inputString, wchar_t* outputString) { static wchar_t szBuf[MAX_TRAINING_MSG_LENGTH]; static wchar_t *pszBuf; if ( !inputString || !inputString[0] ) { return false; } // init buffers & pointers outputString[0] = 0; szBuf[0] = 0; pszBuf = szBuf; // try to localize pszBuf = g_pVGuiLocalize->Find( inputString ); if ( !pszBuf ) { // use plain ASCII string g_pVGuiLocalize->ConvertANSIToUnicode( inputString, szBuf, sizeof(szBuf) ); pszBuf = szBuf; } // Replace bindings with the keys // parse out the text into a label set wchar_t *ws = pszBuf; while ( *ws ) { wchar_t token[MAX_TRAINING_MSG_LENGTH]; bool isVar = false; // check for variables if ( *ws == '%' ) { isVar = true; ++ws; } // parse out the string wchar_t *end = wcschr( ws, '%' ); if ( end ) { wcsncpy( token, ws, end - ws ); token[end - ws] = 0; } else { V_wcscpy_safe( token, ws ); } ws += wcslen( token ); if ( isVar ) { // move over the end of the variable ++ws; } // modify the label if necessary if ( isVar ) { // lookup key names char binding[64]; g_pVGuiLocalize->ConvertUnicodeToANSI( token, binding, sizeof(binding) ); //!! change some key names into better names char friendlyName[64]; const char *key = engine->Key_LookupBinding( *binding == '+' ? binding + 1 : binding ); if ( !key ) { key = "< not bound >"; } Q_snprintf( friendlyName, sizeof(friendlyName), "#%s", key ); Q_strupr( friendlyName ); // set the variable text - key may need to be localized (button images for example) wchar_t *locName = g_pVGuiLocalize->Find( friendlyName ); if ( !locName || wcslen(locName) <= 0) { wchar_t wszFriendly[64]; g_pVGuiLocalize->ConvertANSIToUnicode( friendlyName+1, wszFriendly, sizeof( wszFriendly ) ); V_wcsncat( outputString, wszFriendly, MAX_TRAINING_MSG_LENGTH ); } else { V_wcsncat( outputString, locName, MAX_TRAINING_MSG_LENGTH ); } } else { V_wcsncat( outputString, token, MAX_TRAINING_MSG_LENGTH ); } } return true; } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- CTFHudTraining::CTFHudTraining( Panel *parent, const char *name ) : EditablePanel( parent, name ) { m_pMsgLabel = NULL; m_pPressSpacebarToContinueLabel = NULL; ivgui()->AddTickSignal( GetVPanel(), 10 ); ListenForGameEvent( "teamplay_round_start" ); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- CTFHudTraining::~CTFHudTraining() { ivgui()->RemoveTickSignal( GetVPanel() ); } //----------------------------------------------------------------------------- // Purpose: Hide when we take a freeze cam shot //----------------------------------------------------------------------------- bool CTFHudTraining::IsVisible( void ) { if( IsTakingAFreezecamScreenshot() ) return false; if ( IsInFreezeCam() ) return false; return BaseClass::IsVisible(); } void CTFHudTraining::Reset( void ) { const char *emptyText = ""; SetDialogVariable( "goal", emptyText ); if (m_pMsgLabel) m_pMsgLabel->SetText(emptyText); if (m_pPressSpacebarToContinueLabel) m_pPressSpacebarToContinueLabel->SetVisible( false ); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFHudTraining::ApplySchemeSettings( IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); // load control settings... LoadControlSettings( "resource/UI/HudTraining.res" ); m_pMsgLabel = dynamic_cast<CExRichText *>( FindChildByName("MsgLabel") ); m_pPressSpacebarToContinueLabel = dynamic_cast<CExLabel *>( FindChildByName("PressSpacebarToContinue") ); } void CTFHudTraining::SetTrainingObjective(char *szRawString) { wchar_t wszText[MAX_TRAINING_MSG_LENGTH]; if (!FormatTrainingText(szRawString, wszText)) { SetDialogVariable( "goal", "" ); return; } SetDialogVariable( "goal", wszText ); C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer(); if ( pLocalPlayer ) { pLocalPlayer->EmitSound( "Hud.TrainingMsgUpdate" ); } } void CTFHudTraining::SetTrainingText(char *szRawString) { static wchar_t wszText[MAX_TRAINING_MSG_LENGTH]; InvalidateLayout( false, true ); if ( !m_pMsgLabel ) return; if (!FormatTrainingText(szRawString, wszText)) { m_pMsgLabel->SetText( "" ); return; } // clear the text first m_pMsgLabel->SetText(""); enum { COLOR_NORMAL = 1, COLOR_HINT = 2, }; static wchar_t wszInsertedText[MAX_TRAINING_MSG_LENGTH]; Color color = m_pMsgLabel->GetFgColor(); Color newColor = color; int startIdx = 0; int endIdx = 0; bool bContinue = true; while ( bContinue ) { bool bSetText = false; switch ( wszText[endIdx] ) { case 0: bContinue = false; bSetText = true; break; case COLOR_NORMAL: newColor = m_pMsgLabel->GetFgColor(); bSetText = true; break; case COLOR_HINT: newColor = m_pMsgLabel->GetSchemeColor( "HudTrainingHint", Color(255, 255, 255, 255), scheme()->GetIScheme( m_pMsgLabel->GetScheme() ) ); bSetText = true; break; } if ( bSetText ) { if ( startIdx != endIdx ) { int len = endIdx - startIdx + 1; wcsncpy( wszInsertedText, wszText + startIdx, len ); wszInsertedText[len-1] = 0; m_pMsgLabel->InsertColorChange( color ); m_pMsgLabel->InsertString( wszInsertedText ); // skip past the color change character startIdx = endIdx + 1; } color = newColor; } ++endIdx; } //m_pMessageFlashEndTime = gpGlobals->curtime + MESSAGE_FLASH_TIME; g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "TrainingHudBounce"); C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer(); if ( pLocalPlayer ) { pLocalPlayer->EmitSound( "Hud.TrainingMsgUpdate" ); } } //----------------------------------------------------------------------------- // Purpose: Receive messages about changes in state //----------------------------------------------------------------------------- void CTFHudTraining::FireGameEvent( IGameEvent *event ) { const char *eventName = event->GetName(); if ( FStrEq( "teamplay_round_start", eventName ) ) { InvalidateLayout( false, true ); } } void CTFHudTraining::OnTick( ) { bool bShouldBeVisible = TFGameRules() && TFGameRules()->IsWaitingForTrainingContinue(); if ( m_pPressSpacebarToContinueLabel && bShouldBeVisible != m_pPressSpacebarToContinueLabel->IsVisible() ) { m_pPressSpacebarToContinueLabel->SetVisible( bShouldBeVisible ); g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( bShouldBeVisible ? "TrainingPressSpacebarBlink" : "TrainingPressSpacebarBlinkStop" ); } }
1
0.959031
1
0.959031
game-dev
MEDIA
0.822723
game-dev,desktop-app
0.942737
1
0.942737
skyjake/Doomsday-Engine
3,122
doomsday/libs/gui/src/widgets/variabletogglewidget.cpp
/** @file variabletogglewidget.cpp Toggles the value of a variable. * * @authors Copyright (c) 2013-2017 Jaakko Keränen <jaakko.keranen@iki.fi> * * @par License * LGPL: http://www.gnu.org/licenses/lgpl.html * * <small>This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at your * option) any later version. This 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 Lesser * General Public License for more details. You should have received a copy of * the GNU Lesser General Public License along with this program; if not, see: * http://www.gnu.org/licenses</small> */ #include "de/variabletogglewidget.h" #include <de/numbervalue.h> namespace de { DE_PIMPL(VariableToggleWidget), DE_OBSERVES(Variable, Deletion), DE_OBSERVES(Variable, Change ), DE_OBSERVES(ToggleWidget, Toggle ) { Variable *var; NumberValue activeValue; NumberValue inactiveValue; Impl(Public *i, Variable &variable) : Base(i) , var(&variable) , activeValue(1) , inactiveValue(0) { updateFromVariable(); self().audienceForToggle() += this; var->audienceForDeletion() += this; var->audienceForChange() += this; } void updateFromVariable() { if (!var) return; self().setToggleState(!var->value().compare(activeValue)? Active : Inactive, false /*don't notify*/); } void setVariableFromWidget() { if (!var) return; var->audienceForChange() -= this; var->set(self().isActive()? activeValue : inactiveValue); var->audienceForChange() += this; } void toggleStateChanged(ToggleWidget &) { setVariableFromWidget(); } void variableValueChanged(Variable &, const Value &) { updateFromVariable(); } void variableBeingDeleted(Variable &) { var = nullptr; self().disable(); } }; VariableToggleWidget::VariableToggleWidget(Variable &variable, const String &name) : ToggleWidget(DefaultFlags, name) , d(new Impl(this, variable)) {} VariableToggleWidget::VariableToggleWidget(const String &label, Variable &variable, const String &name) : ToggleWidget(DefaultFlags, name) , d(new Impl(this, variable)) { setText(label); } Variable &VariableToggleWidget::variable() const { if (!d->var) { throw VariableMissingError("VariableToggleWidget::variable", "Widget is not associated with a variable"); } return *d->var; } void VariableToggleWidget::setActiveValue(double val) { d->activeValue = NumberValue(val); d->updateFromVariable(); } void VariableToggleWidget::setInactiveValue(double val) { d->inactiveValue = NumberValue(val); d->updateFromVariable(); } } // namespace de
1
0.792557
1
0.792557
game-dev
MEDIA
0.748434
game-dev
0.866173
1
0.866173
pain1929/cs2cheatlogs
2,715
sdk/include/source2sdk/server/CEntityFlame.hpp
#pragma once #include "source2sdk/source2gen/source2gen.hpp" #include <cstddef> #include <cstdint> #include "source2sdk/entity2/GameTime_t.hpp" #include "source2sdk/server/CBaseEntity.hpp" namespace source2sdk { namespace server { struct CBaseEntity; }; }; // ///////////////////////////////////////////////////////////// // Module: server // Created using source2gen - github.com/neverlosecc/source2gen // ///////////////////////////////////////////////////////////// namespace source2sdk { namespace server { // Registered alignment: 0x8 // Alignment: 0x8 // Standard-layout class: false // Size: 0x518 // Has VTable // Construct allowed // MNetworkAssumeNotNetworkable // // static metadata: MNetworkVarNames "CHandle< CBaseEntity> m_hEntAttached" // static metadata: MNetworkVarNames "bool m_bCheapEffect" #pragma pack(push, 1) class CEntityFlame : public source2sdk::server::CBaseEntity { public: // metadata: MNetworkEnable // m_hEntAttached has a template type with potentially unknown template parameters. You can try uncommenting the field below. // CHandle<source2sdk::server::CBaseEntity> m_hEntAttached; char m_hEntAttached[0x4]; // 0x4e0 // metadata: MNetworkEnable bool m_bCheapEffect; // 0x4e4 uint8_t _pad04e5[0x3]; // 0x4e5 float m_flSize; // 0x4e8 bool m_bUseHitboxes; // 0x4ec uint8_t _pad04ed[0x3]; // 0x4ed std::int32_t m_iNumHitboxFires; // 0x4f0 float m_flHitboxFireScale; // 0x4f4 source2sdk::entity2::GameTime_t m_flLifetime; // 0x4f8 // m_hAttacker has a template type with potentially unknown template parameters. You can try uncommenting the field below. // CHandle<source2sdk::server::CBaseEntity> m_hAttacker; char m_hAttacker[0x4]; // 0x4fc std::int32_t m_iDangerSound; // 0x500 float m_flDirectDamagePerSecond; // 0x504 std::int32_t m_iCustomDamageType; // 0x508 uint8_t _pad050c[0xc]; // Datamap fields: // void m_hPlayingSound; // 0x50c // void CEntityFlameFlameThink; // 0x0 }; #pragma pack(pop) // Cannot assert offsets of fields in CEntityFlame because it is not a standard-layout class static_assert(sizeof(source2sdk::server::CEntityFlame) == 0x518); }; };
1
0.782285
1
0.782285
game-dev
MEDIA
0.875857
game-dev
0.528061
1
0.528061
PaperMC/Paper
1,625
paper-server/src/main/java/io/papermc/paper/command/subcommands/HeapDumpCommand.java
package io.papermc.paper.command.subcommands; import io.papermc.paper.command.PaperSubcommand; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.craftbukkit.CraftServer; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.framework.qual.DefaultQualifier; import static net.kyori.adventure.text.Component.text; import static net.kyori.adventure.text.format.NamedTextColor.GREEN; import static net.kyori.adventure.text.format.NamedTextColor.RED; import static net.kyori.adventure.text.format.NamedTextColor.YELLOW; @DefaultQualifier(NonNull.class) public final class HeapDumpCommand implements PaperSubcommand { @Override public boolean execute(final CommandSender sender, final String subCommand, final String[] args) { this.dumpHeap(sender); return true; } private void dumpHeap(final CommandSender sender) { java.nio.file.Path dir = java.nio.file.Paths.get("./dumps"); String name = "heap-dump-" + DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss").format(LocalDateTime.now()); Command.broadcastCommandMessage(sender, text("Writing JVM heap data...", YELLOW)); java.nio.file.Path file = CraftServer.dumpHeap(dir, name); if (file != null) { Command.broadcastCommandMessage(sender, text("Heap dump saved to " + file, GREEN)); } else { Command.broadcastCommandMessage(sender, text("Failed to write heap dump, see server log for details", RED)); } } }
1
0.841091
1
0.841091
game-dev
MEDIA
0.369225
game-dev,networking
0.869258
1
0.869258
ProjectIgnis/CardScripts
3,699
official/c4997565.lua
--No.3 地獄蝉王ローカスト・キング --Number 3: Cicada King --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Xyz.AddProcedure(c,nil,3,2) --Special Summon an Insect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_CHANGE_POS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Negate effects local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,{id,1}) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.discon) e2:SetCost(Cost.DetachFromSelf(1,1,nil)) e2:SetTarget(s.distg) e2:SetOperation(s.disop) c:RegisterEffect(e2) end s.xyz_number=3 function s.spfilter(c,e,tp) return c:IsRace(RACE_INSECT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end function s.discon(e,tp,eg,ep,ev,re,r,rp) local loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION) local rc=re:GetHandler() return (loc&LOCATION_ONFIELD)~=0 and re:IsMonsterEffect() and re:GetHandler():IsNegatableMonster() and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and re:GetHandler():IsRelateToEffect(re) and rc:IsCanBeEffectTarget(e) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetCard(re:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) end function s.filter(c) return c:IsFaceup() and c:IsRace(RACE_INSECT) and (not c:IsType(TYPE_LINK) or c:IsCanChangePosition()) end function s.disop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if ((tc:IsFaceup() and not tc:IsDisabled()) or tc:IsType(TYPE_TRAPMONSTER)) and tc:IsRelateToEffect(e) then Duel.NegateRelatedChain(tc,RESET_TURN_SET) --Negate effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.Clone(e1) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) tc:RegisterEffect(e2) if tc:IsImmuneToEffect(e1) or tc:IsImmuneToEffect(e2) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local sc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil):GetFirst() if not sc then return end Duel.HintSelection(Group.FromCards(sc),true) Duel.BreakEffect() if sc:IsCanChangePosition() and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.ChangePosition(sc,POS_FACEUP_DEFENSE,0,POS_FACEUP_ATTACK,0) else --Gain 500 DEF local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_UPDATE_DEFENSE) e3:SetValue(500) e3:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e3) end end end
1
0.941287
1
0.941287
game-dev
MEDIA
0.986887
game-dev
0.951111
1
0.951111
dcs-retribution/dcs-retribution
23,323
resources/plugins/MooseMarkerOps/MooseMarkerOps.lua
SoundFilePath = "" BlueDebug = false ------------------------------------------------------------------------------------------------- -- MARKEROPS BOOM ------------------------------------------------------------------------------------------------- function Boom() local MarkerOpsBoom = MARKEROPS_BASE:New("Boom", nil, false) if BlueDebug then BASE:I("--------BOOM LOADING-----") end if BlueDebug then local m = MESSAGE:New("Explosion on Coordinate Mode Enabled", 30, "Player"):ToBlue() end -- Handler function local function Handler(Text, Coord) local n = tonumber(Text:match("(%d+)$")) BASE:I(n) Coord:Explosion(n) end -- Event functions function MarkerOpsBoom:OnAfterMarkAdded(From, Event, To, Text, Keywords, Coord) if BlueDebug then local ms = MESSAGE:New("Sending Boom", 30, "Player"):ToBlue() end Handler(Text, Coord) end function MarkerOpsBoom:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord) if BlueDebug then local m = MESSAGE:New(string.format("%s coordinates recieved", self.Tag), 10, "Info", true):ToAll() end Handler(Text, Coord) end function MarkerOpsBoom:OnAfterMarkDeleted(From, Event, To) if BlueDebug then local m = MESSAGE:New(string.format("%s Mark Deleted.", self.Tag), 10, "Info", true):ToAll() end end if BlueDebug then BASE:I("-------BOOM LOADED------") end end Boom() ------------------------------------------------------------------------------------------------- -- MARKEROPS ILLUMINATION ------------------------------------------------------------------------------------------------- function Illumination() if BlueDebug then BASE:I("----ILLUMINATION LOADING---------") end local MarkerOpsIlluminationBomb = MARKEROPS_BASE:New("Light", { "Zone", "zone" }, false) if BlueDebug then local m = MESSAGE:New("IlluminationBomb on Coordinate Mode Enabled", 30, "Player"):ToBlue() end -- Handler function local function LightHandler(Coord, Keywords, Text) env.info("----Simple Light-----") Coord:SetAltitude(350) Coord:IlluminationBomb(nil, 3) for _index, _word in pairs(Keywords) do if string.lower(_word) == "zone" then -- User says "Light zone" or "Light Zone 5", not just "Light" env.info("----Light 'zone' found-----") local coord = Coord -- See if a Radius is Defined local n = tonumber(Text:match("(%d+)$")) or 5 BASE:I(n) -- Make X Mile Zone Around Coord local ZoneAroundCoord = ZONE_RADIUS:New("Zone " .. math.random(100000), coord:GetVec2(), n * 1609) -- Draw the Zone ZoneAroundCoord:DrawZone(-1, { 1, 0, 0 }, 1, { 1, 0, 0 }) ZoneAroundCoord:UndrawZone(10) -- Make a set of all Groups in Zone local GroupsInZoneSet = SET_GROUP:New():FilterZones({ ZoneAroundCoord }, true):FilterOnce() -- If Groups In Zone, Drop an Illumination Bomb on Each if GroupsInZoneSet:Count() > 0 then GroupsInZoneSet:ForEachGroup(function(grp) env.info(grp:GetName() .. " Is In Zone-----") grpFirstCoord = grp:GetCoordinate() grpFirstCoord:SetAltitude(350) grpFirstCoord:IlluminationBomb(nil, 3) env.info("-----Illuminating " .. grp:GetName() .. " In Zone-----") if BlueDebug then trigger.action.outText("---Illuminating " .. grp:GetName() .. " In Zone-----", 5) end end) end end end end -- Event functions function MarkerOpsIlluminationBomb:OnAfterMarkAdded(From, Event, To, Text, Keywords, Coord) if BlueDebug then local ms = MESSAGE:New("Sending Illumination", 30, "Player"):ToBlue() end LightHandler(Coord, Keywords, Text) end function MarkerOpsIlluminationBomb:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord) if BlueDebug then local m = MESSAGE:New(string.format("%s coordinates recieved", self.Tag), 10, "Info", true):ToAll() end LightHandler(Coord, Keywords, Text) end function MarkerOpsIlluminationBomb:OnAfterMarkDeleted(From, Event, To) if BlueDebug then local m = MESSAGE:New(string.format("%s Mark Deleted.", self.Tag), 10, "Info", true):ToAll() end end if BlueDebug then BASE:I("----ILLUMINATION LOADED---------") end end Illumination() ------------------------------------------------------------------------------------------------- -- MARKEROPS SMOKE POINT ------------------------------------------------------------------------------------------------- function Smoke() if BlueDebug then BASE:I("------SMOKE LOADING------") end local MarkerOpsSmoke = MARKEROPS_BASE:New("Smoke", { "Red", "Blue", "Green", "Orange", "White" }, false) if BlueDebug then local m = MESSAGE:New("Smoke Mode Enabled (Lasts 5 min)", 30, "Player"):ToBlue() end -- Handler function function SmokeHandler(Keywords, Coord) for _, _word in pairs(Keywords) do if string.lower(_word) == "red" then Coord:SmokeRed() env.info("------Red Smoke on Coord-------") elseif string.lower(_word) == "blue" then Coord:SmokeBlue() env.info("------Blue Smoke on Coord-------") elseif string.lower(_word) == "green" then Coord:SmokeGreen() env.info("------Green Smoke on Coord-------") elseif string.lower(_word) == "orange" then Coord:SmokeOrange() env.info("------Orange Smoke on Coord-------") elseif string.lower(_word) == "white" then Coord:SmokeWhite() env.info("------White Smoke on Coord-------") end end end -- Event functions function MarkerOpsSmoke:OnAfterMarkAdded(From, Event, To, Text, Keywords, Coord) if BlueDebug then local ms = MESSAGE:New("Marking Smoke", 30, "Player"):ToBlue() end SmokeHandler(Keywords, Coord) end function MarkerOpsSmoke:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord) if BlueDebug then local m = MESSAGE:New(string.format("%s coordinates recieved", self.Tag), 10, "Info", true):ToAll() end SmokeHandler(Keywords, Coord) end function MarkerOpsSmoke:OnAfterMarkDeleted(From, Event, To) if BlueDebug then local m = MESSAGE:New(string.format("%s Mark Deleted.", self.Tag), 10, "Info", true):ToAll() end end if BlueDebug then BASE:I("-----SMOKE LOADED------") end end Smoke() ------------------------------------------------------------------------------------------------- -- MARKEROPS SMOKE ZONE ------------------------------------------------------------------------------------------------- function SmokeZone() if BlueDebug then BASE:I("------SMOKE ZONE LOADING------") end local MarkerOpsSmokeZone = MARKEROPS_BASE:New("SmokeZone", nil, false) if BlueDebug then local m = MESSAGE:New("Smoke Zone Mode Enabled (Lasts 5 min)", 30, "Player"):ToBlue() end -- Handler function function SmokeZoneHandler(Text, Coord) local coord = Coord local n = 5 if Text then local n = tonumber(Text:match("(%d+)$")) end BASE:I(n) -- Make X Mile Zone Around Coord local ZoneAroundCoord = ZONE_RADIUS:New("Zone " .. math.random(100000), coord:GetVec2(), n * 1609) -- Draw the Zone ZoneAroundCoord:DrawZone(-1, { 1, 0, 0 }, 1, { 1, 0, 0 }) ZoneAroundCoord:UndrawZone(10) -- Make a set of all Groups in Zone local GroupsInZoneSet = SET_GROUP:New():FilterZones({ ZoneAroundCoord }, true):FilterOnce() -- If Groups In Zone, Attack if GroupsInZoneSet:Count() > 0 then GroupsInZoneSet:ForEachGroup(function(grp) local grpCoalition = grp:GetCoalition() local grpCoordinate = grp:GetCoordinate() if grpCoalition == coalition.side.RED then grpCoordinate:SmokeRed() env.info("----SMOKING " .. grp:GetName() .. " RED----") end if grpCoalition == coalition.side.BLUE then grpCoordinate:SmokeBlue() env.info("----SMOKING " .. grp:GetName() .. " BLUE----") end if grpCoalition == coalition.side.NEUTRAL then grpCoordinate:SmokeWhite() env.info("----SMOKING " .. grp:GetName() .. " WHITE----") end end) else env.info("-----NO GROUPS IN ZONE------") end end -- Event functions function MarkerOpsSmokeZone:OnAfterMarkAdded(From, Event, To, Text, Keywords, Coord) if BlueDebug then local ms = MESSAGE:New("Marking SmokeZone", 30, "Player"):ToBlue() end SmokeZoneHandler(Text, Coord) end function MarkerOpsSmokeZone:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord) if BlueDebug then local m = MESSAGE:New(string.format("%s coordinates recieved", self.Tag), 10, "Info", true):ToAll() end SmokeZoneHandler(Text, Coord) end function MarkerOpsSmokeZone:OnAfterMarkDeleted(From, Event, To) if BlueDebug then local m = MESSAGE:New(string.format("%s Mark Deleted.", self.Tag), 10, "Info", true):ToAll() end end if BlueDebug then BASE:I("-----SMOKE ZONE LOADED------") end end SmokeZone() ------------------------------------------------------------------------------------------------- -- MARKEROPS DESTROY ------------------------------------------------------------------------------------------------- function DestroyThem() if BlueDebug then BASE:I("------DESTROY LOADING------") end local MarkerOpsDestroy = MARKEROPS_BASE:New("Destroy", nil, false) if BlueDebug then local m = MESSAGE:New("Destroy Mode Enabled", 30, "Player"):ToBlue() end -- Handler function local function DestroyHandler(Text, Coord) local n = tonumber(Text:match("(%d+)$")) or 5 BASE:I(n) local coord = Coord -- Make X Mile Zone Around Coord local ZoneAroundCoord = ZONE_RADIUS:New("Zone " .. math.random(100000), coord:GetVec2(), n * 1609) -- Draw the Zone ZoneAroundCoord:DrawZone(-1, { 1, 0, 0 }, 1, { 1, 0, 0 }) ZoneAroundCoord:UndrawZone(10) -- Make a set of all Groups in Zone local GroupsInZoneSet = SET_GROUP:New():FilterZones({ ZoneAroundCoord }, true):FilterOnce() -- If Groups In Zone, Attack if GroupsInZoneSet:Count() > 0 then GroupsInZoneSet:ForEachGroup(function(grp) grp:Destroy(true) env.info("-----Destroying " .. grp:GetName() .. " In Zone") if BlueDebug then trigger.action.outText("---Destroying " .. grp:GetName() .. " In Zone-----", 5) end end) else env.info("-----NO GROUPS IN ZONE------") end end -- Event functions function MarkerOpsDestroy:OnAfterMarkAdded(From, Event, To, Text, Keywords, Coord) if BlueDebug then local ms = MESSAGE:New("Destroying All Groups In Radius", 30, "Player"):ToBlue() end DestroyHandler(Text, Coord) end function MarkerOpsDestroy:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord) if BlueDebug then local m = MESSAGE:New(string.format("%s coordinates recieved", self.Tag), 10, "Info", true):ToAll() end DestroyHandler(Text, Coord) end function MarkerOpsDestroy:OnAfterMarkDeleted(From, Event, To) if BlueDebug then local m = MESSAGE:New(string.format("%s Mark Deleted.", self.Tag), 10, "Info", true):ToAll() end end if BlueDebug then BASE:I("------DESTROY LOADED-----------") end end DestroyThem() ------------------------------------------------------------------------------------------------- -- RTB ZONE ------------------------------------------------------------------------------------------------- function RTBZone() if BlueDebug then BASE:I("------RTB ZONE LOADING------") end local MarkerOpsRTBZone = MARKEROPS_BASE:New("RTB", nil, false) if BlueDebug then local m = MESSAGE:New("RTB Zone Mode Enabled", 30, "Player"):ToBlue() end -- Handler function function RTBZoneHandler(Text, Coord) local coord = Coord local n = 5 if Text then local n = tonumber(Text:match("(%d+)$")) end BASE:I(n) -- Make X Mile Zone Around Coord local ZoneAroundCoord = ZONE_RADIUS:New("Zone " .. math.random(100000), coord:GetVec2(), n * 1609) -- Draw the Zone ZoneAroundCoord:DrawZone(-1, { 1, 0, 0 }, 1, { 1, 0, 0 }) ZoneAroundCoord:UndrawZone(10) -- Make a set of all Groups in Zone local GroupsInZoneSet = SET_GROUP:New():FilterZones({ ZoneAroundCoord }, true):FilterOnce() -- If Groups In Zone, Attack if GroupsInZoneSet:Count() > 0 then env.info("----THERE ARE " .. GroupsInZoneSet:Count() .. " GROUPS IN ZONE-----") GroupsInZoneSet:ForEachGroup(function(grp) local opsGroup = _DATABASE:FindOpsGroup(grp:GetName()) if opsGroup then if opsGroup:IsFlightgroup() then env.info("-----Flightgroup RTB-----") opsGroup:CancelAllMissions() end end end) else env.info("-----NO GROUPS IN ZONE------") end end -- Event functions function MarkerOpsRTBZone:OnAfterMarkAdded(From, Event, To, Text, Keywords, Coord) if BlueDebug then local ms = MESSAGE:New("RTB for all groups in Zone", 30, "Player"):ToBlue() end RTBZoneHandler(Text, Coord) end function MarkerOpsRTBZone:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord) if BlueDebug then local m = MESSAGE:New(string.format("%s coordinates recieved", self.Tag), 10, "Info", true):ToAll() end RTBZoneHandler(Text, Coord) end function MarkerOpsRTBZone:OnAfterMarkDeleted(From, Event, To) if BlueDebug then local m = MESSAGE:New(string.format("%s Mark Deleted.", self.Tag), 10, "Info", true):ToAll() end end if BlueDebug then BASE:I("-----RTB ZONE LOADED------") end end RTBZone() ------------------------------------------------------------------------------------------------- -- IMMORTAL ON ZONE ------------------------------------------------------------------------------------------------- function ImmortalZone() if BlueDebug then BASE:I("------Immortal ZONE LOADING------") end local MarkerOpsImmortalZone = MARKEROPS_BASE:New("Immortal", nil, false) if BlueDebug then local m = MESSAGE:New("Immortal Zone Mode Enabled", 30, "Player"):ToBlue() end -- Handler function function ImmortalZoneHandler(Text, Coord) local coord = Coord local n = 5 if Text then local n = tonumber(Text:match("(%d+)$")) end BASE:I(n) -- Make X Mile Zone Around Coord local ZoneAroundCoord = ZONE_RADIUS:New("Zone " .. math.random(100000), coord:GetVec2(), n * 1609) -- Draw the Zone ZoneAroundCoord:DrawZone(-1, { 1, 0, 0 }, 1, { 1, 0, 0 }) ZoneAroundCoord:UndrawZone(10) -- Make a set of all Groups in Zone local GroupsInZoneSet = SET_GROUP:New():FilterZones({ ZoneAroundCoord }, true):FilterOnce() -- If Groups In Zone, Attack if GroupsInZoneSet:Count() > 0 then env.info("----THERE ARE " .. GroupsInZoneSet:Count() .. " GROUPS IN ZONE-----") GroupsInZoneSet:ForEachGroup(function(grp) env.info(grp:GetName() .. " IS NOW IMMORTAL-----") grp:CommandSetImmortal(true) end) else env.info("-----NO GROUPS IN ZONE------") end end -- Event functions function MarkerOpsImmortalZone:OnAfterMarkAdded(From, Event, To, Text, Keywords, Coord) if BlueDebug then local ms = MESSAGE:New("GROUPS IN ZONE NOW IMMORTAL", 30, "Player"):ToBlue() end ImmortalZoneHandler(Text, Coord) end function MarkerOpsImmortalZone:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord) if BlueDebug then local m = MESSAGE:New(string.format("%s coordinates recieved", self.Tag), 10, "Info", true):ToAll() end ImmortalZoneHandler(Text, Coord) end function MarkerOpsImmortalZone:OnAfterMarkDeleted(From, Event, To) if BlueDebug then local m = MESSAGE:New(string.format("%s Mark Deleted.", self.Tag), 10, "Info", true):ToAll() end end if BlueDebug then BASE:I("-----IMMORTAL ZONE LOADED------") end end ImmortalZone() ------------------------------------------------------------------------------------------------- -- MORTAL ON ZONE ------------------------------------------------------------------------------------------------- function MortalZone() if BlueDebug then BASE:I("------MORTAL ZONE LOADING------") end local MarkerOpsMortalZone = MARKEROPS_BASE:New("Mortal", nil, false) if BlueDebug then local m = MESSAGE:New("Mortal Zone Mode Enabled", 30, "Player"):ToBlue() end -- Handler function function MortalZoneHandler(Text, Coord) local coord = Coord local n = 5 if Text then local n = tonumber(Text:match("(%d+)$")) end BASE:I(n) -- Make X Mile Zone Around Coord local ZoneAroundCoord = ZONE_RADIUS:New("Zone " .. math.random(100000), coord:GetVec2(), n * 1609) -- Draw the Zone ZoneAroundCoord:DrawZone(-1, { 1, 0, 0 }, 1, { 1, 0, 0 }) ZoneAroundCoord:UndrawZone(10) -- Make a set of all Groups in Zone local GroupsInZoneSet = SET_GROUP:New():FilterZones({ ZoneAroundCoord }, true):FilterOnce() -- If Groups In Zone, Attack if GroupsInZoneSet:Count() > 0 then env.info("----THERE ARE " .. GroupsInZoneSet:Count() .. " GROUPS IN ZONE-----") GroupsInZoneSet:ForEachGroup(function(grp) env.info(grp:GetName() .. " IS NOW MORTAL-----") grp:CommandSetImmortal(false) end) else env.info("-----NO GROUPS IN ZONE------") end end -- Event functions function MarkerOpsMortalZone:OnAfterMarkAdded(From, Event, To, Text, Keywords, Coord) if BlueDebug then local ms = MESSAGE:New("GROUPS IN ZONE NOW MORTAL", 30, "Player"):ToBlue() end MortalZoneHandler(Text, Coord) end function MarkerOpsMortalZone:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord) if BlueDebug then local m = MESSAGE:New(string.format("%s coordinates recieved", self.Tag), 10, "Info", true):ToAll() end MortalZoneHandler(Text, Coord) end function MarkerOpsMortalZone:OnAfterMarkDeleted(From, Event, To) if BlueDebug then local m = MESSAGE:New(string.format("%s Mark Deleted.", self.Tag), 10, "Info", true):ToAll() end end if BlueDebug then BASE:I("-----MORTAL ZONE LOADED------") end end MortalZone() ------------------------------------------------------------------------------------------------- -- REFUEL ZONE ------------------------------------------------------------------------------------------------- function RefuelZone() if BlueDebug then BASE:I("------REFUEL ZONE LOADING------") end local MarkerOpsRefuelZone = MARKEROPS_BASE:New("Refuel", nil, false) if BlueDebug then local m = MESSAGE:New("Refuel Zone Mode Enabled", 30, "Player"):ToBlue() end -- Handler function function RefuelZoneHandler(Text, Coord) local coord = Coord local n = 5 if Text then local n = tonumber(Text:match("(%d+)$")) end BASE:I(n) -- Make X Mile Zone Around Coord local ZoneAroundCoord = ZONE_RADIUS:New("Zone " .. math.random(100000), coord:GetVec2(), n * 1609) -- Draw the Zone ZoneAroundCoord:DrawZone(-1, { 1, 0, 0 }, 1, { 1, 0, 0 }) ZoneAroundCoord:UndrawZone(10) -- Make a set of all Groups in Zone local GroupsInZoneSet = SET_GROUP:New():FilterZones({ ZoneAroundCoord }, true) :FilterFunction( -- The function needs to take a GROUP object as first - and in this case, only - argument. function(grp) local isinclude = true if grp:GetAttribute() == GROUP.Attribute.AIR_TANKER then isinclude = false end return isinclude end):FilterOnce() -- If Groups In Zone, Attack if GroupsInZoneSet:Count() > 0 then env.info("----THERE ARE " .. GroupsInZoneSet:Count() .. " GROUPS IN ZONE-----") GroupsInZoneSet:ForEachGroup(function(grp) if opsGroup and opsGroup:IsFlightgroup() then opsGroup:Refuel() env.info(grp:GetName() .. "Sent to Refuel-----") end end) else env.info("-----NO GROUPS IN ZONE------") end end -- Event functions function MarkerOpsRefuelZone:OnAfterMarkAdded(From, Event, To, Text, Keywords, Coord) if BlueDebug then local ms = MESSAGE:New("Refuel for all groups in Zone", 30, "Player"):ToBlue() end RefuelZoneHandler(Text, Coord) end function MarkerOpsRefuelZone:OnAfterMarkChanged(From, Event, To, Text, Keywords, Coord) if BlueDebug then local m = MESSAGE:New(string.format("%s coordinates recieved", self.Tag), 10, "Info", true):ToAll() end RefuelZoneHandler(Text, Coord) end function MarkerOpsRefuelZone:OnAfterMarkDeleted(From, Event, To) if BlueDebug then local m = MESSAGE:New(string.format("%s Mark Deleted.", self.Tag), 10, "Info", true):ToAll() end end if BlueDebug then BASE:I("-----Refuel ZONE LOADED------") end end RefuelZone() MESSAGE:New("*MARKEROPS LOADED*", 5, "MISSION", false):ToAll():ToLog()
1
0.849449
1
0.849449
game-dev
MEDIA
0.644843
game-dev
0.888678
1
0.888678
Open-RSC/Core-Framework
3,517
server/plugins/com/openrsc/server/plugins/authentic/npcs/brimhaven/BrimHavenBartender.java
package com.openrsc.server.plugins.authentic.npcs.brimhaven; import com.openrsc.server.constants.ItemId; import com.openrsc.server.constants.NpcId; import com.openrsc.server.constants.Skill; import com.openrsc.server.model.container.Item; import com.openrsc.server.model.entity.npc.Npc; import com.openrsc.server.model.entity.player.Player; import com.openrsc.server.plugins.triggers.TalkNpcTrigger; import java.util.Optional; import static com.openrsc.server.plugins.Functions.*; public final class BrimHavenBartender implements TalkNpcTrigger { @Override public boolean blockTalkNpc(Player player, Npc n) { return n.getID() == NpcId.BARTENDER_BRIMHAVEN.id(); } @Override public void onTalkNpc(Player player, Npc n) { npcsay(player, n, "Yohoho me hearty what would you like to drink?"); String[] options; if (player.getCache().hasKey("barcrawl") && !player.getCache().hasKey("barfour") && player.getCarriedItems().hasCatalogID(ItemId.BARCRAWL_CARD.id(), Optional.of(false))) { options = new String[]{"Nothing thankyou", "A pint of Grog please", "A bottle of rum please", "I'm doing Alfred Grimhand's barcrawl"}; } else { options = new String[]{"Nothing thankyou", "A pint of Grog please", "A bottle of rum please"}; } int firstMenu = multi(player, n, options); if (firstMenu == 0) {// NOTHING } else if (firstMenu == 1) { npcsay(player, n, "One grog coming right up", "That'll be 3 gold"); if (ifheld(player, ItemId.COINS.id(), 3)) { player.message("You buy a pint of Grog"); player.getCarriedItems().remove(new Item(ItemId.COINS.id(), 3)); give(player, ItemId.GROG.id(), 1); } else { say(player, n, "Oh dear. I don't seem to have enough money"); } } else if (firstMenu == 2) { npcsay(player, n, "That'll be 27 gold"); if (ifheld(player, ItemId.COINS.id(), 27)) { player.message("You buy a bottle of rum"); player.getCarriedItems().remove(new Item(ItemId.COINS.id(), 27)); give(player, ItemId.KARAMJA_RUM.id(), 1); } else { say(player, n, "Oh dear. I don't seem to have enough money"); } } else if (firstMenu == 3) { npcsay(player, n, "Haha time to be breaking out the old supergrog", "That'll be 15 coins please"); if (ifheld(player, ItemId.COINS.id(), 15)) { player.getCarriedItems().remove(new Item(ItemId.COINS.id(), 15)); mes("The bartender serves you a glass of strange thick dark liquid"); delay(3); mes("You wince and drink it"); delay(3); mes("You stagger backwards"); delay(3); drinkAle(player); mes("You think you see 2 bartenders signing 2 barcrawl cards"); delay(3); player.getCache().store("barfour", true); } else { say(player, n, "Sorry I don't have 15 coins"); } } } private void drinkAle(Player player) { int[] skillIDs = {Skill.ATTACK.id(), Skill.DEFENSE.id(), Skill.PRAYER.id(), Skill.COOKING.id(), Skill.HERBLAW.id()}; for (int i = 0; i < skillIDs.length; i++) { setAleEffect(player, skillIDs[i]); } } private void setAleEffect(Player player, int skillId) { int reduction, currentStat, maxStat; maxStat = player.getSkills().getMaxStat(skillId); //estimated reduction = maxStat < 20 ? 5 : maxStat < 40 ? 6 : maxStat < 70 ? 7 : 8; currentStat = player.getSkills().getLevel(skillId); if (currentStat <= 8) { player.getSkills().setLevel(skillId, Math.max(currentStat - reduction, 0)); } else { player.getSkills().setLevel(skillId, currentStat - reduction); } } }
1
0.896964
1
0.896964
game-dev
MEDIA
0.789522
game-dev,web-backend
0.980822
1
0.980822
google/liquidfun
6,362
liquidfun/Box2D/Box2D/Dynamics/Joints/b2RopeJoint.cpp
/* * Copyright (c) 2007-2011 Erin Catto http://www.box2d.org * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ #include <Box2D/Dynamics/Joints/b2RopeJoint.h> #include <Box2D/Dynamics/b2Body.h> #include <Box2D/Dynamics/b2TimeStep.h> // Limit: // C = norm(pB - pA) - L // u = (pB - pA) / norm(pB - pA) // Cdot = dot(u, vB + cross(wB, rB) - vA - cross(wA, rA)) // J = [-u -cross(rA, u) u cross(rB, u)] // K = J * invM * JT // = invMassA + invIA * cross(rA, u)^2 + invMassB + invIB * cross(rB, u)^2 b2RopeJoint::b2RopeJoint(const b2RopeJointDef* def) : b2Joint(def) { m_localAnchorA = def->localAnchorA; m_localAnchorB = def->localAnchorB; m_maxLength = def->maxLength; m_mass = 0.0f; m_impulse = 0.0f; m_state = e_inactiveLimit; m_length = 0.0f; } void b2RopeJoint::InitVelocityConstraints(const b2SolverData& data) { m_indexA = m_bodyA->m_islandIndex; m_indexB = m_bodyB->m_islandIndex; m_localCenterA = m_bodyA->m_sweep.localCenter; m_localCenterB = m_bodyB->m_sweep.localCenter; m_invMassA = m_bodyA->m_invMass; m_invMassB = m_bodyB->m_invMass; m_invIA = m_bodyA->m_invI; m_invIB = m_bodyB->m_invI; b2Vec2 cA = data.positions[m_indexA].c; float32 aA = data.positions[m_indexA].a; b2Vec2 vA = data.velocities[m_indexA].v; float32 wA = data.velocities[m_indexA].w; b2Vec2 cB = data.positions[m_indexB].c; float32 aB = data.positions[m_indexB].a; b2Vec2 vB = data.velocities[m_indexB].v; float32 wB = data.velocities[m_indexB].w; b2Rot qA(aA), qB(aB); m_rA = b2Mul(qA, m_localAnchorA - m_localCenterA); m_rB = b2Mul(qB, m_localAnchorB - m_localCenterB); m_u = cB + m_rB - cA - m_rA; m_length = m_u.Length(); float32 C = m_length - m_maxLength; if (C > 0.0f) { m_state = e_atUpperLimit; } else { m_state = e_inactiveLimit; } if (m_length > b2_linearSlop) { m_u *= 1.0f / m_length; } else { m_u.SetZero(); m_mass = 0.0f; m_impulse = 0.0f; return; } // Compute effective mass. float32 crA = b2Cross(m_rA, m_u); float32 crB = b2Cross(m_rB, m_u); float32 invMass = m_invMassA + m_invIA * crA * crA + m_invMassB + m_invIB * crB * crB; m_mass = invMass != 0.0f ? 1.0f / invMass : 0.0f; if (data.step.warmStarting) { // Scale the impulse to support a variable time step. m_impulse *= data.step.dtRatio; b2Vec2 P = m_impulse * m_u; vA -= m_invMassA * P; wA -= m_invIA * b2Cross(m_rA, P); vB += m_invMassB * P; wB += m_invIB * b2Cross(m_rB, P); } else { m_impulse = 0.0f; } data.velocities[m_indexA].v = vA; data.velocities[m_indexA].w = wA; data.velocities[m_indexB].v = vB; data.velocities[m_indexB].w = wB; } void b2RopeJoint::SolveVelocityConstraints(const b2SolverData& data) { b2Vec2 vA = data.velocities[m_indexA].v; float32 wA = data.velocities[m_indexA].w; b2Vec2 vB = data.velocities[m_indexB].v; float32 wB = data.velocities[m_indexB].w; // Cdot = dot(u, v + cross(w, r)) b2Vec2 vpA = vA + b2Cross(wA, m_rA); b2Vec2 vpB = vB + b2Cross(wB, m_rB); float32 C = m_length - m_maxLength; float32 Cdot = b2Dot(m_u, vpB - vpA); // Predictive constraint. if (C < 0.0f) { Cdot += data.step.inv_dt * C; } float32 impulse = -m_mass * Cdot; float32 oldImpulse = m_impulse; m_impulse = b2Min(0.0f, m_impulse + impulse); impulse = m_impulse - oldImpulse; b2Vec2 P = impulse * m_u; vA -= m_invMassA * P; wA -= m_invIA * b2Cross(m_rA, P); vB += m_invMassB * P; wB += m_invIB * b2Cross(m_rB, P); data.velocities[m_indexA].v = vA; data.velocities[m_indexA].w = wA; data.velocities[m_indexB].v = vB; data.velocities[m_indexB].w = wB; } bool b2RopeJoint::SolvePositionConstraints(const b2SolverData& data) { b2Vec2 cA = data.positions[m_indexA].c; float32 aA = data.positions[m_indexA].a; b2Vec2 cB = data.positions[m_indexB].c; float32 aB = data.positions[m_indexB].a; b2Rot qA(aA), qB(aB); b2Vec2 rA = b2Mul(qA, m_localAnchorA - m_localCenterA); b2Vec2 rB = b2Mul(qB, m_localAnchorB - m_localCenterB); b2Vec2 u = cB + rB - cA - rA; float32 length = u.Normalize(); float32 C = length - m_maxLength; C = b2Clamp(C, 0.0f, b2_maxLinearCorrection); float32 impulse = -m_mass * C; b2Vec2 P = impulse * u; cA -= m_invMassA * P; aA -= m_invIA * b2Cross(rA, P); cB += m_invMassB * P; aB += m_invIB * b2Cross(rB, P); data.positions[m_indexA].c = cA; data.positions[m_indexA].a = aA; data.positions[m_indexB].c = cB; data.positions[m_indexB].a = aB; return length - m_maxLength < b2_linearSlop; } b2Vec2 b2RopeJoint::GetAnchorA() const { return m_bodyA->GetWorldPoint(m_localAnchorA); } b2Vec2 b2RopeJoint::GetAnchorB() const { return m_bodyB->GetWorldPoint(m_localAnchorB); } b2Vec2 b2RopeJoint::GetReactionForce(float32 inv_dt) const { b2Vec2 F = (inv_dt * m_impulse) * m_u; return F; } float32 b2RopeJoint::GetReactionTorque(float32 inv_dt) const { B2_NOT_USED(inv_dt); return 0.0f; } float32 b2RopeJoint::GetMaxLength() const { return m_maxLength; } b2LimitState b2RopeJoint::GetLimitState() const { return m_state; } void b2RopeJoint::Dump() { int32 indexA = m_bodyA->m_islandIndex; int32 indexB = m_bodyB->m_islandIndex; b2Log(" b2RopeJointDef jd;\n"); b2Log(" jd.bodyA = bodies[%d];\n", indexA); b2Log(" jd.bodyB = bodies[%d];\n", indexB); b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected); b2Log(" jd.localAnchorA.Set(%.15lef, %.15lef);\n", m_localAnchorA.x, m_localAnchorA.y); b2Log(" jd.localAnchorB.Set(%.15lef, %.15lef);\n", m_localAnchorB.x, m_localAnchorB.y); b2Log(" jd.maxLength = %.15lef;\n", m_maxLength); b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index); }
1
0.9203
1
0.9203
game-dev
MEDIA
0.90364
game-dev
0.947504
1
0.947504
Whales/Cataclysm2
3,945
dice.cpp
#include "dice.h" #include "rng.h" #include "window.h" #include <sstream> Dice::Dice(int N, int S, int B, bool G) { number = N; sides = S; bonus = B; negative = G; } int Dice::roll() { if (number == 0 || sides == 0) { return bonus; } int ret = dice(number, sides) + bonus; for (int i = 0; i < others.size(); i++) { ret += others[i].roll(); } if (negative) { ret = 0 - ret; } return ret; } Dice Dice::base() const { Dice ret(number, sides, bonus, negative); return ret; } Dice& Dice::operator=(const Dice& rhs) { if (this == &rhs) { return (*this); } number = rhs.number; sides = rhs.sides; bonus = rhs.bonus; negative = rhs.negative; others.clear(); for (int i = 0; i < rhs.others.size(); i++) { others.push_back( rhs.others[i] ); } return (*this); } Dice& Dice::operator+=(const Dice& rhs) { if ((rhs.sides > 0 && rhs.number > 0) || rhs.bonus > 0) { others.push_back(rhs.base()); } for (int i = 0; i < rhs.others.size(); i++) { (*this) += rhs.others[i].base(); } return *this; } Dice& Dice::operator-=(const Dice& rhs) { if ((rhs.sides > 0 && rhs.number > 0) || rhs.bonus > 0) { Dice tmp = rhs; tmp.negative = true; others.push_back(tmp.base()); } for (int i = 0; i < rhs.others.size(); i++) { (*this) += rhs.others[i].base(); } return *this; } Dice& Dice::operator+=(const int& rhs) { bonus += rhs; return *this; } Dice& Dice::operator-=(const int& rhs) { bonus -= rhs; return *this; } std::string Dice::str() { std::stringstream ret; ret << number << "d" << sides; if (bonus < 0) { ret << " - " << int(0 - bonus); } else if (bonus > 0) { ret << " + " << bonus; } for (int i = 0; i < others.size(); i++) { if (others[i].negative) { ret << " - "; } else { ret << " + "; } ret << others[i].str(); } return ret.str(); } bool Dice::load_data(std::istream &data, std::string owner) { if (!data.good()) { return false; } // Set all values to 0, in case they're not loaded here. number = 0; sides = 0; bonus = 0; int current_number = 0; bool set_number = false, set_sides = false, negative_bonus = false; bool done = false; while (!done && data.good()) { char ch = data.get(); if (data.good()) { if (ch >= '0' && ch <= '9') { current_number = current_number * 10 + (ch - '0'); } else if (ch == 'd' || ch == 'D') { if (set_number) { debugmsg("Two 'd' characters in dice spec (%s)", owner.c_str()); return false; } set_number = true; number = current_number; current_number = 0; } else if (ch == '+' || ch == '-') { if (set_sides) { debugmsg("More than one bonus in dice spec (%s)", owner.c_str()); return false; } if (!set_number) { debugmsg("Encountered + before d in dice spec (%s)", owner.c_str()); return false; } set_sides = true; sides = current_number; current_number = 0; if (ch == '-') { negative_bonus = true; } } else if (ch == '\n' || ch == ';') { done = true; } else if (ch != ' ') { debugmsg("Extraneous character '%c' in dice spec (%s)", ch, owner.c_str()); return false; } } // if (data.good()) } // while (!done && data.good()) /* If we've set our sides, then anything left is the bonus * If we haven't set our sides OR our number of dice, then it's just a number, * i.e., it's our bonus - just a flat value. */ if (set_sides || !set_number) { if (negative_bonus) { bonus = 0 - current_number; } else { bonus = current_number; } } else if (!set_sides) { // If we haven't set our sides, then it's the number of sides our dice have sides = current_number; } return true; }
1
0.776476
1
0.776476
game-dev
MEDIA
0.45709
game-dev
0.888236
1
0.888236
atsb/RZDoom
64,981
src/g_game.cpp
// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // $Id:$ // // Copyright (C) 1993-1996 by id Software, Inc. // // This source is available for distribution and/or modification // only under the terms of the DOOM Source Code License as // published by id Software. All rights reserved. // // The source is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License // for more details. // // $Log:$ // // DESCRIPTION: none // //----------------------------------------------------------------------------- #include <string.h> #include <stdlib.h> #include <stdio.h> #include <stddef.h> #include <time.h> #ifdef __APPLE__ #include <CoreServices/CoreServices.h> #endif #include "templates.h" #include "version.h" #include "doomdef.h" #include "doomstat.h" #include "d_protocol.h" #include "d_netinf.h" #include "intermission/intermission.h" #include "m_argv.h" #include "m_misc.h" #include "menu/menu.h" #include "m_random.h" #include "m_crc32.h" #include "i_system.h" #include "i_input.h" #include "p_saveg.h" #include "p_tick.h" #include "d_main.h" #include "wi_stuff.h" #include "hu_stuff.h" #include "st_stuff.h" #include "am_map.h" #include "c_console.h" #include "c_cvars.h" #include "c_bind.h" #include "c_dispatch.h" #include "v_video.h" #include "w_wad.h" #include "p_local.h" #include "s_sound.h" #include "gstrings.h" #include "r_sky.h" #include "g_game.h" #include "g_level.h" #include "b_bot.h" //Added by MC: #include "sbar.h" #include "m_swap.h" #include "m_png.h" #include "gi.h" #include "a_keys.h" #include "a_artifacts.h" #include "r_data/r_translate.h" #include "cmdlib.h" #include "d_net.h" #include "d_event.h" #include "p_acs.h" #include "p_effect.h" #include "m_joy.h" #include "farchive.h" #include "r_renderer.h" #include "r_data/colormaps.h" #include <zlib.h> #include "g_hub.h" static FRandom pr_dmspawn ("DMSpawn"); static FRandom pr_pspawn ("PlayerSpawn"); const int SAVEPICWIDTH = 216; const int SAVEPICHEIGHT = 162; bool G_CheckDemoStatus (void); void G_ReadDemoTiccmd (ticcmd_t *cmd, int player); void G_WriteDemoTiccmd (ticcmd_t *cmd, int player, int buf); void G_PlayerReborn (int player); void G_DoNewGame (void); void G_DoLoadGame (void); void G_DoPlayDemo (void); void G_DoCompleted (void); void G_DoVictory (void); void G_DoWorldDone (void); void G_DoSaveGame (bool okForQuicksave, FString filename, const char *description); void G_DoAutoSave (); void STAT_Write(FILE *file); void STAT_Read(PNGHandle *png); FIntCVar gameskill ("skill", 2, CVAR_SERVERINFO|CVAR_LATCH); CVAR (Int, deathmatch, 0, CVAR_SERVERINFO|CVAR_LATCH); CVAR (Bool, chasedemo, false, 0); CVAR (Bool, storesavepic, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, longsavemessages, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (String, save_dir, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG); CVAR (Bool, cl_waitforsave, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); EXTERN_CVAR (Float, con_midtime); //========================================================================== // // CVAR displaynametags // // Selects whether to display name tags or not when changing weapons/items // //========================================================================== CUSTOM_CVAR (Int, displaynametags, 0, CVAR_ARCHIVE) { if (self < 0 || self > 3) { self = 0; } } CVAR(Int, nametagcolor, CR_GOLD, CVAR_ARCHIVE) gameaction_t gameaction; gamestate_t gamestate = GS_STARTUP; int paused; bool pauseext; bool sendpause; // send a pause event next tic bool sendsave; // send a save event next tic bool sendturn180; // [RH] send a 180 degree turn next tic bool usergame; // ok to save / end game bool insave; // Game is saving - used to block exit commands bool timingdemo; // if true, exit with report on completion bool nodrawers; // for comparative timing purposes bool noblit; // for comparative timing purposes bool viewactive; bool netgame; // only true if packets are broadcast bool multiplayer; player_t players[MAXPLAYERS]; bool playeringame[MAXPLAYERS]; int consoleplayer; // player taking events int gametic; CVAR(Bool, demo_compress, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); FString newdemoname; FString newdemomap; FString demoname; bool demorecording; bool demoplayback; bool demonew; // [RH] Only used around G_InitNew for demos int demover; BYTE* demobuffer; BYTE* demo_p; BYTE* democompspot; BYTE* demobodyspot; size_t maxdemosize; BYTE* zdemformend; // end of FORM ZDEM chunk BYTE* zdembodyend; // end of ZDEM BODY chunk bool singledemo; // quit after playing a demo from cmdline bool precache = true; // if true, load all graphics at start wbstartstruct_t wminfo; // parms for world map / intermission short consistancy[MAXPLAYERS][BACKUPTICS]; #define MAXPLMOVE (forwardmove[1]) #define TURBOTHRESHOLD 12800 float normforwardmove[2] = {0x19, 0x32}; // [RH] For setting turbo from console float normsidemove[2] = {0x18, 0x28}; // [RH] Ditto fixed_t forwardmove[2], sidemove[2]; fixed_t angleturn[4] = {640, 1280, 320, 320}; // + slow turn fixed_t flyspeed[2] = {1*256, 3*256}; int lookspeed[2] = {450, 512}; #define SLOWTURNTICS 6 CVAR (Bool, cl_run, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Always run? CVAR (Bool, invertmouse, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Invert mouse look down/up? CVAR (Bool, freelook, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Always mlook? CVAR (Bool, lookstrafe, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Always strafe with mouse? CVAR (Float, m_pitch, 1.f, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) // Mouse speeds CVAR (Float, m_yaw, 1.f, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) CVAR (Float, m_forward, 1.f, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) CVAR (Float, m_side, 2.f, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) int turnheld; // for accelerative turning // mouse values are used once int mousex; int mousey; FString savegamefile; char savedescription[SAVESTRINGSIZE]; // [RH] Name of screenshot file to generate (usually NULL) FString shotfile; AActor* bodyque[BODYQUESIZE]; int bodyqueslot; void R_ExecuteSetViewSize (void); FString savename; FString BackupSaveName; bool SendLand; const AInventory *SendItemUse, *SendItemDrop; EXTERN_CVAR (Int, team) CVAR (Bool, teamplay, false, CVAR_SERVERINFO) // [RH] Allow turbo setting anytime during game CUSTOM_CVAR (Float, turbo, 100.f, 0) { if (self < 10.f) { self = 10.f; } else if (self > 255.f) { self = 255.f; } else { double scale = self * 0.01; forwardmove[0] = (int)(normforwardmove[0]*scale); forwardmove[1] = (int)(normforwardmove[1]*scale); sidemove[0] = (int)(normsidemove[0]*scale); sidemove[1] = (int)(normsidemove[1]*scale); } } CCMD (turnspeeds) { if (argv.argc() == 1) { Printf ("Current turn speeds: %d %d %d %d\n", angleturn[0], angleturn[1], angleturn[2], angleturn[3]); } else { int i; for (i = 1; i <= 4 && i < argv.argc(); ++i) { angleturn[i-1] = atoi (argv[i]); } if (i <= 2) { angleturn[1] = angleturn[0] * 2; } if (i <= 3) { angleturn[2] = angleturn[0] / 2; } if (i <= 4) { angleturn[3] = angleturn[2]; } } } CCMD (slot) { if (argv.argc() > 1) { int slot = atoi (argv[1]); if (slot < NUM_WEAPON_SLOTS) { SendItemUse = players[consoleplayer].weapons.Slots[slot].PickWeapon (&players[consoleplayer], !(compatflags & COMPATF_DONTCHECKAMMO)); } } } CCMD (centerview) { Net_WriteByte (DEM_CENTERVIEW); } CCMD(crouch) { Net_WriteByte(DEM_CROUCH); } CCMD (land) { SendLand = true; } CCMD (pause) { sendpause = true; } CCMD (turn180) { sendturn180 = true; } CCMD (weapnext) { SendItemUse = players[consoleplayer].weapons.PickNextWeapon (&players[consoleplayer]); // [BC] Option to display the name of the weapon being cycled to. if ((displaynametags & 2) && StatusBar && SmallFont && SendItemUse) { StatusBar->AttachMessage(new DHUDMessageFadeOut(SmallFont, SendItemUse->GetTag(), 1.5f, 0.90f, 0, 0, (EColorRange)*nametagcolor, 2.f, 0.35f), MAKE_ID( 'W', 'E', 'P', 'N' )); } } CCMD (weapprev) { SendItemUse = players[consoleplayer].weapons.PickPrevWeapon (&players[consoleplayer]); // [BC] Option to display the name of the weapon being cycled to. if ((displaynametags & 2) && StatusBar && SmallFont && SendItemUse) { StatusBar->AttachMessage(new DHUDMessageFadeOut(SmallFont, SendItemUse->GetTag(), 1.5f, 0.90f, 0, 0, (EColorRange)*nametagcolor, 2.f, 0.35f), MAKE_ID( 'W', 'E', 'P', 'N' )); } } CCMD (invnext) { AInventory *next; if (who == NULL) return; if (who->InvSel != NULL) { if ((next = who->InvSel->NextInv()) != NULL) { who->InvSel = next; } else { // Select the first item in the inventory if (!(who->Inventory->ItemFlags & IF_INVBAR)) { who->InvSel = who->Inventory->NextInv(); } else { who->InvSel = who->Inventory; } } if ((displaynametags & 1) && StatusBar && SmallFont && who->InvSel) StatusBar->AttachMessage (new DHUDMessageFadeOut (SmallFont, who->InvSel->GetTag(), 1.5f, 0.80f, 0, 0, (EColorRange)*nametagcolor, 2.f, 0.35f), MAKE_ID('S','I','N','V')); } who->player->inventorytics = 5*TICRATE; } CCMD (invprev) { AInventory *item, *newitem; if (who == NULL) return; if (who->InvSel != NULL) { if ((item = who->InvSel->PrevInv()) != NULL) { who->InvSel = item; } else { // Select the last item in the inventory item = who->InvSel; while ((newitem = item->NextInv()) != NULL) { item = newitem; } who->InvSel = item; } if ((displaynametags & 1) && StatusBar && SmallFont && who->InvSel) StatusBar->AttachMessage (new DHUDMessageFadeOut (SmallFont, who->InvSel->GetTag(), 1.5f, 0.80f, 0, 0, (EColorRange)*nametagcolor, 2.f, 0.35f), MAKE_ID('S','I','N','V')); } who->player->inventorytics = 5*TICRATE; } CCMD (invuseall) { SendItemUse = (const AInventory *)1; } CCMD (invuse) { if (players[consoleplayer].inventorytics == 0) { if (players[consoleplayer].mo) SendItemUse = players[consoleplayer].mo->InvSel; } players[consoleplayer].inventorytics = 0; } CCMD(invquery) { AInventory *inv = players[consoleplayer].mo->InvSel; if (inv != NULL) { Printf(PRINT_HIGH, "%s (%dx)\n", inv->GetTag(), inv->Amount); } } CCMD (use) { if (argv.argc() > 1 && who != NULL) { SendItemUse = who->FindInventory (PClass::FindClass (argv[1])); } } CCMD (invdrop) { if (players[consoleplayer].mo) SendItemDrop = players[consoleplayer].mo->InvSel; } CCMD (weapdrop) { SendItemDrop = players[consoleplayer].ReadyWeapon; } CCMD (drop) { if (argv.argc() > 1 && who != NULL) { SendItemDrop = who->FindInventory (PClass::FindClass (argv[1])); } } const PClass *GetFlechetteType(AActor *other); CCMD (useflechette) { // Select from one of arti_poisonbag1-3, whichever the player has static const ENamedName bagnames[3] = { NAME_ArtiPoisonBag1, NAME_ArtiPoisonBag2, NAME_ArtiPoisonBag3 }; if (who == NULL) return; const PClass *type = GetFlechetteType(who); if (type != NULL) { AInventory *item; if ( (item = who->FindInventory (type) )) { SendItemUse = item; return; } } // The default flechette could not be found. Try all 3 types then. for (int j = 0; j < 3; ++j) { AInventory *item; if ( (item = who->FindInventory (bagnames[j])) ) { SendItemUse = item; break; } } } CCMD (select) { if (argv.argc() > 1) { AInventory *item = who->FindInventory (PClass::FindClass (argv[1])); if (item != NULL) { who->InvSel = item; } } who->player->inventorytics = 5*TICRATE; } static inline int joyint(double val) { if (val >= 0) { return int(ceil(val)); } else { return int(floor(val)); } } // // G_BuildTiccmd // Builds a ticcmd from all of the available inputs // or reads it from the demo buffer. // If recording a demo, write it out // void G_BuildTiccmd (ticcmd_t *cmd) { int strafe; int speed; int forward; int side; int fly; ticcmd_t *base; base = I_BaseTiccmd (); // empty, or external driver *cmd = *base; cmd->consistancy = consistancy[consoleplayer][(maketic/ticdup)%BACKUPTICS]; strafe = Button_Strafe.bDown; speed = Button_Speed.bDown ^ (int)cl_run; forward = side = fly = 0; // [RH] only use two stage accelerative turning on the keyboard // and not the joystick, since we treat the joystick as // the analog device it is. if (Button_Left.bDown || Button_Right.bDown) turnheld += ticdup; else turnheld = 0; // let movement keys cancel each other out if (strafe) { if (Button_Right.bDown) side += sidemove[speed]; if (Button_Left.bDown) side -= sidemove[speed]; } else { int tspeed = speed; if (turnheld < SLOWTURNTICS) tspeed += 2; // slow turn if (Button_Right.bDown) { G_AddViewAngle (angleturn[tspeed]); LocalKeyboardTurner = true; } if (Button_Left.bDown) { G_AddViewAngle (-angleturn[tspeed]); LocalKeyboardTurner = true; } } if (Button_LookUp.bDown) { G_AddViewPitch (lookspeed[speed]); LocalKeyboardTurner = true; } if (Button_LookDown.bDown) { G_AddViewPitch (-lookspeed[speed]); LocalKeyboardTurner = true; } if (Button_MoveUp.bDown) fly += flyspeed[speed]; if (Button_MoveDown.bDown) fly -= flyspeed[speed]; if (Button_Klook.bDown) { if (Button_Forward.bDown) G_AddViewPitch (lookspeed[speed]); if (Button_Back.bDown) G_AddViewPitch (-lookspeed[speed]); } else { if (Button_Forward.bDown) forward += forwardmove[speed]; if (Button_Back.bDown) forward -= forwardmove[speed]; } if (Button_MoveRight.bDown) side += sidemove[speed]; if (Button_MoveLeft.bDown) side -= sidemove[speed]; // buttons if (Button_Attack.bDown) cmd->ucmd.buttons |= BT_ATTACK; if (Button_AltAttack.bDown) cmd->ucmd.buttons |= BT_ALTATTACK; if (Button_Use.bDown) cmd->ucmd.buttons |= BT_USE; if (Button_Jump.bDown) cmd->ucmd.buttons |= BT_JUMP; if (Button_Crouch.bDown) cmd->ucmd.buttons |= BT_CROUCH; if (Button_Zoom.bDown) cmd->ucmd.buttons |= BT_ZOOM; if (Button_Reload.bDown) cmd->ucmd.buttons |= BT_RELOAD; if (Button_User1.bDown) cmd->ucmd.buttons |= BT_USER1; if (Button_User2.bDown) cmd->ucmd.buttons |= BT_USER2; if (Button_User3.bDown) cmd->ucmd.buttons |= BT_USER3; if (Button_User4.bDown) cmd->ucmd.buttons |= BT_USER4; if (Button_Speed.bDown) cmd->ucmd.buttons |= BT_SPEED; if (Button_Strafe.bDown) cmd->ucmd.buttons |= BT_STRAFE; if (Button_MoveRight.bDown) cmd->ucmd.buttons |= BT_MOVERIGHT; if (Button_MoveLeft.bDown) cmd->ucmd.buttons |= BT_MOVELEFT; if (Button_LookDown.bDown) cmd->ucmd.buttons |= BT_LOOKDOWN; if (Button_LookUp.bDown) cmd->ucmd.buttons |= BT_LOOKUP; if (Button_Back.bDown) cmd->ucmd.buttons |= BT_BACK; if (Button_Forward.bDown) cmd->ucmd.buttons |= BT_FORWARD; if (Button_Right.bDown) cmd->ucmd.buttons |= BT_RIGHT; if (Button_Left.bDown) cmd->ucmd.buttons |= BT_LEFT; if (Button_MoveDown.bDown) cmd->ucmd.buttons |= BT_MOVEDOWN; if (Button_MoveUp.bDown) cmd->ucmd.buttons |= BT_MOVEUP; if (Button_ShowScores.bDown) cmd->ucmd.buttons |= BT_SHOWSCORES; // Handle joysticks/game controllers. float joyaxes[NUM_JOYAXIS]; I_GetAxes(joyaxes); // Remap some axes depending on button state. if (Button_Strafe.bDown || (Button_Mlook.bDown && lookstrafe)) { joyaxes[JOYAXIS_Side] = joyaxes[JOYAXIS_Yaw]; joyaxes[JOYAXIS_Yaw] = 0; } if (Button_Mlook.bDown) { joyaxes[JOYAXIS_Pitch] = joyaxes[JOYAXIS_Forward]; joyaxes[JOYAXIS_Forward] = 0; } if (joyaxes[JOYAXIS_Pitch] != 0) { G_AddViewPitch(joyint(joyaxes[JOYAXIS_Pitch] * 2048)); LocalKeyboardTurner = true; } if (joyaxes[JOYAXIS_Yaw] != 0) { G_AddViewAngle(joyint(-1280 * joyaxes[JOYAXIS_Yaw])); LocalKeyboardTurner = true; } side -= joyint(sidemove[speed] * joyaxes[JOYAXIS_Side]); forward += joyint(joyaxes[JOYAXIS_Forward] * forwardmove[speed]); fly += joyint(joyaxes[JOYAXIS_Up] * 2048); // Handle mice. if (!Button_Mlook.bDown && !freelook) { forward += (int)((float)mousey * m_forward); } cmd->ucmd.pitch = LocalViewPitch >> 16; if (SendLand) { SendLand = false; fly = -32768; } if (strafe || lookstrafe) side += (int)((float)mousex * m_side); mousex = mousey = 0; // Build command. if (forward > MAXPLMOVE) forward = MAXPLMOVE; else if (forward < -MAXPLMOVE) forward = -MAXPLMOVE; if (side > MAXPLMOVE) side = MAXPLMOVE; else if (side < -MAXPLMOVE) side = -MAXPLMOVE; cmd->ucmd.forwardmove += forward; cmd->ucmd.sidemove += side; cmd->ucmd.yaw = LocalViewAngle >> 16; cmd->ucmd.upmove = fly; LocalViewAngle = 0; LocalViewPitch = 0; // special buttons if (sendturn180) { sendturn180 = false; cmd->ucmd.buttons |= BT_TURN180; } if (sendpause) { sendpause = false; Net_WriteByte (DEM_PAUSE); } if (sendsave) { sendsave = false; Net_WriteByte (DEM_SAVEGAME); Net_WriteString (savegamefile); Net_WriteString (savedescription); savegamefile = ""; } if (SendItemUse == (const AInventory *)1) { Net_WriteByte (DEM_INVUSEALL); SendItemUse = NULL; } else if (SendItemUse != NULL) { Net_WriteByte (DEM_INVUSE); Net_WriteLong (SendItemUse->InventoryID); SendItemUse = NULL; } if (SendItemDrop != NULL) { Net_WriteByte (DEM_INVDROP); Net_WriteLong (SendItemDrop->InventoryID); SendItemDrop = NULL; } cmd->ucmd.forwardmove <<= 8; cmd->ucmd.sidemove <<= 8; } //[Graf Zahl] This really helps if the mouse update rate can't be increased! CVAR (Bool, smooth_mouse, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) void G_AddViewPitch (int look) { if (gamestate == GS_TITLELEVEL) { return; } look <<= 16; if (players[consoleplayer].playerstate != PST_DEAD && // No adjustment while dead. players[consoleplayer].ReadyWeapon != NULL && // No adjustment if no weapon. players[consoleplayer].ReadyWeapon->FOVScale > 0) // No adjustment if it is non-positive. { look = int(look * players[consoleplayer].ReadyWeapon->FOVScale); } if (!level.IsFreelookAllowed()) { LocalViewPitch = 0; } else if (look > 0) { // Avoid overflowing if (LocalViewPitch > INT_MAX - look) { LocalViewPitch = 0x78000000; } else { LocalViewPitch = MIN(LocalViewPitch + look, 0x78000000); } } else if (look < 0) { // Avoid overflowing if (LocalViewPitch < INT_MIN - look) { LocalViewPitch = -0x78000000; } else { LocalViewPitch = MAX(LocalViewPitch + look, -0x78000000); } } if (look != 0) { LocalKeyboardTurner = smooth_mouse; } } void G_AddViewAngle (int yaw) { if (gamestate == GS_TITLELEVEL) { return; } yaw <<= 16; if (players[consoleplayer].playerstate != PST_DEAD && // No adjustment while dead. players[consoleplayer].ReadyWeapon != NULL && // No adjustment if no weapon. players[consoleplayer].ReadyWeapon->FOVScale > 0) // No adjustment if it is non-positive. { yaw = int(yaw * players[consoleplayer].ReadyWeapon->FOVScale); } LocalViewAngle -= yaw; if (yaw != 0) { LocalKeyboardTurner = smooth_mouse; } } CVAR (Bool, bot_allowspy, false, 0) enum { SPY_CANCEL = 0, SPY_NEXT, SPY_PREV, }; // [RH] Spy mode has been separated into two console commands. // One goes forward; the other goes backward. static void ChangeSpy (int changespy) { // If you're not in a level, then you can't spy. if (gamestate != GS_LEVEL) { return; } // If not viewing through a player, return your eyes to your own head. if (players[consoleplayer].camera->player == NULL) { // When watching demos, you will just have to wait until your player // has done this for you, since it could desync otherwise. if (!demoplayback) { Net_WriteByte(DEM_REVERTCAMERA); } return; } // We may not be allowed to spy on anyone. if (dmflags2 & DF2_DISALLOW_SPYING) return; // Otherwise, cycle to the next player. bool checkTeam = !demoplayback && deathmatch; int pnum = consoleplayer; if (changespy != SPY_CANCEL) { player_t *player = players[consoleplayer].camera->player; // only use the camera as starting index if it's a valid player. if (player != NULL) pnum = int(players[consoleplayer].camera->player - players); int step = (changespy == SPY_NEXT) ? 1 : -1; do { pnum += step; pnum &= MAXPLAYERS-1; if (playeringame[pnum] && (!checkTeam || players[pnum].mo->IsTeammate (players[consoleplayer].mo) || (bot_allowspy && players[pnum].Bot != NULL))) { break; } } while (pnum != consoleplayer); } players[consoleplayer].camera = players[pnum].mo; S_UpdateSounds(players[consoleplayer].camera); StatusBar->AttachToPlayer (&players[pnum]); if (demoplayback || multiplayer) { StatusBar->ShowPlayerName (); } } CCMD (spynext) { // allow spy mode changes even during the demo ChangeSpy (SPY_NEXT); } CCMD (spyprev) { // allow spy mode changes even during the demo ChangeSpy (SPY_PREV); } CCMD (spycancel) { // allow spy mode changes even during the demo ChangeSpy (SPY_CANCEL); } // // G_Responder // Get info needed to make ticcmd_ts for the players. // bool G_Responder (event_t *ev) { // any other key pops up menu if in demos // [RH] But only if the key isn't bound to a "special" command if (gameaction == ga_nothing && (demoplayback || gamestate == GS_DEMOSCREEN || gamestate == GS_TITLELEVEL)) { const char *cmd = Bindings.GetBind (ev->data1); if (ev->type == EV_KeyDown) { if (!cmd || ( strnicmp (cmd, "menu_", 5) && stricmp (cmd, "toggleconsole") && stricmp (cmd, "sizeup") && stricmp (cmd, "sizedown") && stricmp (cmd, "togglemap") && stricmp (cmd, "spynext") && stricmp (cmd, "spyprev") && stricmp (cmd, "chase") && stricmp (cmd, "+showscores") && stricmp (cmd, "bumpgamma") && stricmp (cmd, "screenshot"))) { M_StartControlPanel(true); M_SetMenu(NAME_Mainmenu, -1); return true; } else { return C_DoKey (ev, &Bindings, &DoubleBindings); } } if (cmd && cmd[0] == '+') return C_DoKey (ev, &Bindings, &DoubleBindings); return false; } if (CT_Responder (ev)) return true; // chat ate the event if (gamestate == GS_LEVEL) { if (ST_Responder (ev)) return true; // status window ate it if (!viewactive && AM_Responder (ev, false)) return true; // automap ate it } else if (gamestate == GS_FINALE) { if (F_Responder (ev)) return true; // finale ate the event } switch (ev->type) { case EV_KeyDown: if (C_DoKey (ev, &Bindings, &DoubleBindings)) return true; break; case EV_KeyUp: C_DoKey (ev, &Bindings, &DoubleBindings); break; // [RH] mouse buttons are sent as key up/down events case EV_Mouse: mousex = (int)(ev->x * mouse_sensitivity); mousey = (int)(ev->y * mouse_sensitivity); break; } // [RH] If the view is active, give the automap a chance at // the events *last* so that any bound keys get precedence. if (gamestate == GS_LEVEL && viewactive) return AM_Responder (ev, true); return (ev->type == EV_KeyDown || ev->type == EV_Mouse); } // // G_Ticker // Make ticcmd_ts for the players. // extern FTexture *Page; void G_Ticker () { int i; gamestate_t oldgamestate; // do player reborns if needed for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i]) { if (players[i].playerstate == PST_GONE) { G_DoPlayerPop(i); } if (players[i].playerstate == PST_REBORN || players[i].playerstate == PST_ENTER) { G_DoReborn(i, false); } } } if (ToggleFullscreen) { static char toggle_fullscreen[] = "toggle fullscreen"; ToggleFullscreen = false; AddCommandString (toggle_fullscreen); } // do things to change the game state oldgamestate = gamestate; while (gameaction != ga_nothing) { if (gameaction == ga_newgame2) { gameaction = ga_newgame; break; } switch (gameaction) { case ga_loadlevel: G_DoLoadLevel (-1, false); break; case ga_recordgame: G_CheckDemoStatus(); G_RecordDemo(newdemoname); G_BeginRecording(newdemomap); case ga_newgame2: // Silence GCC (see above) case ga_newgame: G_DoNewGame (); break; case ga_loadgame: case ga_loadgamehidecon: case ga_autoloadgame: G_DoLoadGame (); break; case ga_savegame: G_DoSaveGame (true, savegamefile, savedescription); gameaction = ga_nothing; savegamefile = ""; savedescription[0] = '\0'; break; case ga_autosave: G_DoAutoSave (); gameaction = ga_nothing; break; case ga_loadgameplaydemo: G_DoLoadGame (); // fallthrough case ga_playdemo: G_DoPlayDemo (); break; case ga_completed: G_DoCompleted (); break; case ga_slideshow: if (gamestate == GS_LEVEL) F_StartIntermission(level.info->slideshow, FSTATE_InLevel); break; case ga_worlddone: G_DoWorldDone (); break; case ga_screenshot: M_ScreenShot (shotfile); shotfile = ""; gameaction = ga_nothing; break; case ga_fullconsole: C_FullConsole (); gameaction = ga_nothing; break; case ga_togglemap: AM_ToggleMap (); gameaction = ga_nothing; break; case ga_nothing: break; } C_AdjustBottom (); } if (oldgamestate != gamestate) { if (oldgamestate == GS_DEMOSCREEN && Page != NULL) { Page->Unload(); Page = NULL; } else if (oldgamestate == GS_FINALE) { F_EndFinale (); } } // get commands, check consistancy, and build new consistancy check int buf = (gametic/ticdup)%BACKUPTICS; // [RH] Include some random seeds and player stuff in the consistancy // check, not just the player's x position like BOOM. DWORD rngsum = FRandom::StaticSumSeeds (); //Added by MC: For some of that bot stuff. The main bot function. bglobal.Main (); for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i]) { ticcmd_t *cmd = &players[i].cmd; ticcmd_t *newcmd = &netcmds[i][buf]; if ((gametic % ticdup) == 0) { RunNetSpecs (i, buf); } if (demorecording) { G_WriteDemoTiccmd (newcmd, i, buf); } players[i].oldbuttons = cmd->ucmd.buttons; // If the user alt-tabbed away, paused gets set to -1. In this case, // we do not want to read more demo commands until paused is no // longer negative. if (demoplayback) { G_ReadDemoTiccmd (cmd, i); } else { memcpy(cmd, newcmd, sizeof(ticcmd_t)); } // check for turbo cheats if (cmd->ucmd.forwardmove > TURBOTHRESHOLD && !(gametic&31) && ((gametic>>5)&(MAXPLAYERS-1)) == i ) { Printf ("%s is turbo!\n", players[i].userinfo.GetName()); } if (netgame && players[i].Bot == NULL && !demoplayback && (gametic%ticdup) == 0) { //players[i].inconsistant = 0; if (gametic > BACKUPTICS*ticdup && consistancy[i][buf] != cmd->consistancy) { players[i].inconsistant = gametic - BACKUPTICS*ticdup; } if (players[i].mo) { DWORD sum = rngsum + players[i].mo->X() + players[i].mo->Y() + players[i].mo->Z() + players[i].mo->angle + players[i].mo->pitch; sum ^= players[i].health; consistancy[i][buf] = sum; } else { consistancy[i][buf] = rngsum; } } } } // do main actions switch (gamestate) { case GS_LEVEL: P_Ticker (); AM_Ticker (); break; case GS_TITLELEVEL: P_Ticker (); break; case GS_INTERMISSION: WI_Ticker (); break; case GS_FINALE: F_Ticker (); break; case GS_DEMOSCREEN: D_PageTicker (); break; case GS_STARTUP: if (gameaction == ga_nothing) { gamestate = GS_FULLCONSOLE; gameaction = ga_fullconsole; } break; default: break; } } // // PLAYER STRUCTURE FUNCTIONS // also see P_SpawnPlayer in P_Mobj // // // G_PlayerFinishLevel // Called when a player completes a level. // // flags is checked for RESETINVENTORY and RESETHEALTH only. void G_PlayerFinishLevel (int player, EFinishLevelType mode, int flags) { AInventory *item, *next; player_t *p; p = &players[player]; if (p->morphTics != 0) { // Undo morph P_UndoPlayerMorph (p, p, 0, true); } // Strip all current powers, unless moving in a hub and the power is okay to keep. item = p->mo->Inventory; while (item != NULL) { next = item->Inventory; if (item->IsKindOf (RUNTIME_CLASS(APowerup))) { if (deathmatch || ((mode != FINISH_SameHub || !(item->ItemFlags & IF_HUBPOWER)) && !(item->ItemFlags & IF_PERSISTENTPOWER))) // Keep persistent powers in non-deathmatch games { item->Destroy (); } } item = next; } if (p->ReadyWeapon != NULL && p->ReadyWeapon->WeaponFlags&WIF_POWERED_UP && p->PendingWeapon == p->ReadyWeapon->SisterWeapon) { // Unselect powered up weapons if the unpowered counterpart is pending p->ReadyWeapon=p->PendingWeapon; } // reset invisibility to default if (p->mo->GetDefault()->flags & MF_SHADOW) { p->mo->flags |= MF_SHADOW; } else { p->mo->flags &= ~MF_SHADOW; } p->mo->RenderStyle = p->mo->GetDefault()->RenderStyle; p->mo->alpha = p->mo->GetDefault()->alpha; p->extralight = 0; // cancel gun flashes p->fixedcolormap = NOFIXEDCOLORMAP; // cancel ir goggles p->fixedlightlevel = -1; p->damagecount = 0; // no palette changes p->bonuscount = 0; p->poisoncount = 0; p->inventorytics = 0; if (mode != FINISH_SameHub) { // Take away flight and keys (and anything else with IF_INTERHUBSTRIP set) item = p->mo->Inventory; while (item != NULL) { next = item->Inventory; if (item->InterHubAmount < 1) { item->Destroy (); } item = next; } } if (mode == FINISH_NoHub && !(level.flags2 & LEVEL2_KEEPFULLINVENTORY)) { // Reduce all owned (visible) inventory to defined maximum interhub amount for (item = p->mo->Inventory; item != NULL; item = item->Inventory) { // If the player is carrying more samples of an item than allowed, reduce amount accordingly if (item->ItemFlags & IF_INVBAR && item->Amount > item->InterHubAmount) { item->Amount = item->InterHubAmount; } } } // Resets player health to default if not dead. if ((flags & CHANGELEVEL_RESETHEALTH) && p->playerstate != PST_DEAD) { p->health = p->mo->health = p->mo->SpawnHealth(); } // Clears the entire inventory and gives back the defaults for starting a game if ((flags & CHANGELEVEL_RESETINVENTORY) && p->playerstate != PST_DEAD) { p->mo->ClearInventory(); p->mo->GiveDefaultInventory(); } } // // G_PlayerReborn // Called after a player dies // almost everything is cleared and initialized // void G_PlayerReborn (int player) { player_t* p; int frags[MAXPLAYERS]; int fragcount; // [RH] Cumulative frags int killcount; int itemcount; int secretcount; int chasecam; BYTE currclass; userinfo_t userinfo; // [RH] Save userinfo APlayerPawn *actor; const PClass *cls; FString log; DBot *Bot; //Added by MC: p = &players[player]; memcpy (frags, p->frags, sizeof(frags)); fragcount = p->fragcount; killcount = p->killcount; itemcount = p->itemcount; secretcount = p->secretcount; currclass = p->CurrentPlayerClass; userinfo.TransferFrom(p->userinfo); actor = p->mo; cls = p->cls; log = p->LogText; chasecam = p->cheats & CF_CHASECAM; Bot = p->Bot; //Added by MC: // Reset player structure to its defaults p->~player_t(); ::new(p) player_t; memcpy (p->frags, frags, sizeof(p->frags)); p->health = actor->health; p->fragcount = fragcount; p->killcount = killcount; p->itemcount = itemcount; p->secretcount = secretcount; p->CurrentPlayerClass = currclass; p->userinfo.TransferFrom(userinfo); p->mo = actor; p->cls = cls; p->LogText = log; p->cheats |= chasecam; p->Bot = Bot; //Added by MC: p->oldbuttons = ~0, p->attackdown = true; p->usedown = true; // don't do anything immediately p->original_oldbuttons = ~0; p->playerstate = PST_LIVE; if (gamestate != GS_TITLELEVEL) { // [GRB] Give inventory specified in DECORATE actor->GiveDefaultInventory (); p->ReadyWeapon = p->PendingWeapon; } //Added by MC: Init bot structure. if (p->Bot != NULL) { botskill_t skill = p->Bot->skill; p->Bot->Clear (); p->Bot->player = p; p->Bot->skill = skill; } } // // G_CheckSpot // Returns false if the player cannot be respawned // at the given mapthing spot // because something is occupying it // bool G_CheckSpot (int playernum, FPlayerStart *mthing) { fixed_t x; fixed_t y; fixed_t z, oldz; int i; if (mthing->type == 0) return false; x = mthing->x; y = mthing->y; z = mthing->z; if (!(level.flags & LEVEL_USEPLAYERSTARTZ)) { z = 0; } z += P_PointInSector (x, y)->floorplane.ZatPoint (x, y); if (!players[playernum].mo) { // first spawn of level, before corpses for (i = 0; i < playernum; i++) if (players[i].mo && players[i].mo->X() == x && players[i].mo->Y() == y) return false; return true; } oldz = players[playernum].mo->Z(); // [RH] Need to save corpse's z-height players[playernum].mo->SetZ(z); // [RH] Checks are now full 3-D // killough 4/2/98: fix bug where P_CheckPosition() uses a non-solid // corpse to detect collisions with other players in DM starts // // Old code: // if (!P_CheckPosition (players[playernum].mo, x, y)) // return false; players[playernum].mo->flags |= MF_SOLID; i = P_CheckPosition(players[playernum].mo, x, y); players[playernum].mo->flags &= ~MF_SOLID; players[playernum].mo->SetZ(oldz); // [RH] Restore corpse's height if (!i) return false; return true; } // // G_DeathMatchSpawnPlayer // Spawns a player at one of the random death match spots // called at level load and each death // // [RH] Returns the distance of the closest player to the given mapthing static fixed_t PlayersRangeFromSpot (FPlayerStart *spot) { fixed_t closest = INT_MAX; fixed_t distance; int i; for (i = 0; i < MAXPLAYERS; i++) { if (!playeringame[i] || !players[i].mo || players[i].health <= 0) continue; distance = players[i].mo->AproxDistance (spot->x, spot->y); if (distance < closest) closest = distance; } return closest; } // [RH] Select the deathmatch spawn spot farthest from everyone. static FPlayerStart *SelectFarthestDeathmatchSpot (size_t selections) { fixed_t bestdistance = 0; FPlayerStart *bestspot = NULL; unsigned int i; for (i = 0; i < selections; i++) { fixed_t distance = PlayersRangeFromSpot (&deathmatchstarts[i]); if (distance > bestdistance) { bestdistance = distance; bestspot = &deathmatchstarts[i]; } } return bestspot; } // [RH] Select a deathmatch spawn spot at random (original mechanism) static FPlayerStart *SelectRandomDeathmatchSpot (int playernum, unsigned int selections) { unsigned int i, j; for (j = 0; j < 20; j++) { i = pr_dmspawn() % selections; if (G_CheckSpot (playernum, &deathmatchstarts[i]) ) { return &deathmatchstarts[i]; } } // [RH] return a spot anyway, since we allow telefragging when a player spawns return &deathmatchstarts[i]; } void G_DeathMatchSpawnPlayer (int playernum) { unsigned int selections; FPlayerStart *spot; selections = deathmatchstarts.Size (); // [RH] We can get by with just 1 deathmatch start if (selections < 1) I_Error ("No deathmatch starts"); // At level start, none of the players have mobjs attached to them, // so we always use the random deathmatch spawn. During the game, // though, we use whatever dmflags specifies. if ((dmflags & DF_SPAWN_FARTHEST) && players[playernum].mo) spot = SelectFarthestDeathmatchSpot (selections); else spot = SelectRandomDeathmatchSpot (playernum, selections); if (spot == NULL) { // No good spot, so the player will probably get stuck. // We were probably using select farthest above, and all // the spots were taken. spot = G_PickPlayerStart(playernum, PPS_FORCERANDOM); if (!G_CheckSpot(playernum, spot)) { // This map doesn't have enough coop spots for this player // to use one. spot = SelectRandomDeathmatchSpot(playernum, selections); if (spot == NULL) { // We have a player 1 start, right? spot = &playerstarts[0]; if (spot->type == 0) { // Fine, whatever. spot = &deathmatchstarts[0]; } } } } AActor *mo = P_SpawnPlayer(spot, playernum); if (mo != NULL) P_PlayerStartStomp(mo); } // // G_PickPlayerStart // FPlayerStart *G_PickPlayerStart(int playernum, int flags) { if (AllPlayerStarts.Size() == 0) // No starts to pick { return NULL; } if ((level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) || (flags & PPS_FORCERANDOM) || playerstarts[playernum].type == 0) { if (!(flags & PPS_NOBLOCKINGCHECK)) { TArray<FPlayerStart *> good_starts; unsigned int i; // Find all unblocked player starts. for (i = 0; i < AllPlayerStarts.Size(); ++i) { if (G_CheckSpot(playernum, &AllPlayerStarts[i])) { good_starts.Push(&AllPlayerStarts[i]); } } if (good_starts.Size() > 0) { // Pick an open spot at random. return good_starts[pr_pspawn(good_starts.Size())]; } } // Pick a spot at random, whether it's open or not. return &AllPlayerStarts[pr_pspawn(AllPlayerStarts.Size())]; } return &playerstarts[playernum]; } // // G_QueueBody // static void G_QueueBody (AActor *body) { // flush an old corpse if needed int modslot = bodyqueslot%BODYQUESIZE; if (bodyqueslot >= BODYQUESIZE && bodyque[modslot] != NULL) { bodyque[modslot]->Destroy (); } bodyque[modslot] = body; // Copy the player's translation, so that if they change their color later, only // their current body will change and not all their old corpses. if (GetTranslationType(body->Translation) == TRANSLATION_Players || GetTranslationType(body->Translation) == TRANSLATION_PlayersExtra) { *translationtables[TRANSLATION_PlayerCorpses][modslot] = *TranslationToTable(body->Translation); body->Translation = TRANSLATION(TRANSLATION_PlayerCorpses,modslot); translationtables[TRANSLATION_PlayerCorpses][modslot]->UpdateNative(); } const int skinidx = body->player->userinfo.GetSkin(); if (0 != skinidx && !(body->flags4 & MF4_NOSKIN)) { // Apply skin's scale to actor's scale, it will be lost otherwise const AActor *const defaultActor = body->GetDefault(); const FPlayerSkin &skin = skins[skinidx]; body->scaleX = Scale(body->scaleX, skin.ScaleX, defaultActor->scaleX); body->scaleY = Scale(body->scaleY, skin.ScaleY, defaultActor->scaleY); } bodyqueslot++; } // // G_DoReborn // CVAR (Bool, pistolstart, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) EXTERN_CVAR(Int, compatmode) void G_DoReborn (int playernum, bool freshbot) { cluster_info_t *cluster = FindClusterInfo (level.cluster); bool ishub = (cluster != nullptr && (cluster->flags & CLUSTER_HUB)); if (!multiplayer && !(level.flags2 & LEVEL2_ALLOWRESPAWN)) { if (BackupSaveName.Len() > 0 && FileExists (BackupSaveName.GetChars()) && (ishub || !pistolstart || !gameinfo.gametype == GAME_Doom)) { // Load game from the last point it was saved savename = BackupSaveName; gameaction = ga_autoloadgame; } else { // Reload the level from scratch bool indemo = demoplayback; BackupSaveName = ""; G_InitNew (level.MapName, false); demoplayback = indemo; // gameaction = ga_loadlevel; } } else { // respawn at the start // first disassociate the corpse if (players[playernum].mo) { G_QueueBody (players[playernum].mo); players[playernum].mo->player = NULL; } // spawn at random spot if in deathmatch if (deathmatch) { G_DeathMatchSpawnPlayer (playernum); return; } if (!(level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) && playerstarts[playernum].type != 0 && G_CheckSpot (playernum, &playerstarts[playernum])) { AActor *mo = P_SpawnPlayer(&playerstarts[playernum], playernum); if (mo != NULL) P_PlayerStartStomp(mo, true); } else { // try to spawn at any random player's spot FPlayerStart *start = G_PickPlayerStart(playernum, PPS_FORCERANDOM); AActor *mo = P_SpawnPlayer(start, playernum); if (mo != NULL) P_PlayerStartStomp(mo, true); } } } // // G_DoReborn // void G_DoPlayerPop(int playernum) { playeringame[playernum] = false; if (deathmatch) { Printf("%s left the game with %d frags\n", players[playernum].userinfo.GetName(), players[playernum].fragcount); } else { Printf("%s left the game\n", players[playernum].userinfo.GetName()); } // [RH] Revert each player to their own view if spying through the player who left for (int ii = 0; ii < MAXPLAYERS; ++ii) { if (playeringame[ii] && players[ii].camera == players[playernum].mo) { players[ii].camera = players[ii].mo; if (ii == consoleplayer && StatusBar != NULL) { StatusBar->AttachToPlayer(&players[ii]); } } } // [RH] Make the player disappear FBehavior::StaticStopMyScripts(players[playernum].mo); // [RH] Let the scripts know the player left FBehavior::StaticStartTypedScripts(SCRIPT_Disconnect, players[playernum].mo, true, playernum, true); if (players[playernum].mo != NULL) { P_DisconnectEffect(players[playernum].mo); players[playernum].mo->player = NULL; players[playernum].mo->Destroy(); if (!(players[playernum].mo->ObjectFlags & OF_EuthanizeMe)) { // We just destroyed a morphed player, so now the original player // has taken their place. Destroy that one too. players[playernum].mo->Destroy(); } players[playernum].mo = NULL; players[playernum].camera = NULL; } } void G_ScreenShot (char *filename) { shotfile = filename; gameaction = ga_screenshot; } // // G_InitFromSavegame // Can be called by the startup code or the menu task. // void G_LoadGame (const char* name, bool hidecon) { if (name != NULL) { savename = name; gameaction = !hidecon ? ga_loadgame : ga_loadgamehidecon; } } static bool CheckSingleWad (char *name, bool &printRequires, bool printwarn) { if (name == NULL) { return true; } if (Wads.CheckIfWadLoaded (name) < 0) { if (printwarn) { if (!printRequires) { Printf ("This savegame needs these wads:\n%s", name); } else { Printf (", %s", name); } } printRequires = true; delete[] name; return false; } delete[] name; return true; } // Return false if not all the needed wads have been loaded. bool G_CheckSaveGameWads (PNGHandle *png, bool printwarn) { char *text; bool printRequires = false; text = M_GetPNGText (png, "Game WAD"); CheckSingleWad (text, printRequires, printwarn); text = M_GetPNGText (png, "Map WAD"); CheckSingleWad (text, printRequires, printwarn); if (printRequires) { if (printwarn) { Printf ("\n"); } return false; } return true; } void G_DoLoadGame () { char sigcheck[20]; char *text = NULL; char *map; bool hidecon; if (gameaction != ga_autoloadgame) { demoplayback = false; } hidecon = gameaction == ga_loadgamehidecon; gameaction = ga_nothing; FILE *stdfile = fopen (savename.GetChars(), "rb"); if (stdfile == NULL) { Printf ("Could not read savegame '%s'\n", savename.GetChars()); return; } PNGHandle *png = M_VerifyPNG (stdfile); if (png == NULL) { fclose (stdfile); Printf ("'%s' is not a valid (PNG) savegame\n", savename.GetChars()); return; } SaveVersion = 0; // Check whether this savegame actually has been created by a compatible engine. // Since there are ZDoom derivates using the exact same savegame format but // with mutual incompatibilities this check simplifies things significantly. char *engine = M_GetPNGText (png, "Engine"); if (engine == NULL || 0 != strcmp (engine, GAMESIG)) { // Make a special case for the message printed for old savegames that don't // have this information. if (engine == NULL) { Printf ("Savegame is from an incompatible version\n"); } else { Printf ("Savegame is from another ZDoom-based engine: %s\n", engine); delete[] engine; } delete png; fclose (stdfile); return; } if (engine != NULL) { delete[] engine; } SaveVersion = 0; if (!M_GetPNGText (png, "ZDoom Save Version", sigcheck, 20) || 0 != strncmp (sigcheck, SAVESIG, 9) || // ZDOOMSAVE is the first 9 chars (SaveVersion = atoi (sigcheck+9)) < MINSAVEVER) { delete png; fclose (stdfile); Printf ("Savegame is from an incompatible version"); if (SaveVersion != 0) { Printf(": %d (%d is the oldest supported)", SaveVersion, MINSAVEVER); } Printf("\n"); return; } if (!G_CheckSaveGameWads (png, true)) { fclose (stdfile); return; } map = M_GetPNGText (png, "Current Map"); if (map == NULL) { Printf ("Savegame is missing the current map\n"); fclose (stdfile); return; } // Now that it looks like we can load this save, hide the fullscreen console if it was up // when the game was selected from the menu. if (hidecon && gamestate == GS_FULLCONSOLE) { gamestate = GS_HIDECONSOLE; } // Read intermission data for hubs G_ReadHubInfo(png); bglobal.RemoveAllBots (true); text = M_GetPNGText (png, "Important CVARs"); if (text != NULL) { BYTE *vars_p = (BYTE *)text; C_ReadCVars (&vars_p); delete[] text; if (SaveVersion <= 4509) { // account for the flag shuffling for making freelook a 3-state option INTBOOL flag = dmflags & DF_YES_FREELOOK; dmflags = dmflags & ~DF_YES_FREELOOK; if (flag) dmflags2 = dmflags2 | DF2_RESPAWN_SUPER; } } // dearchive all the modifications if (M_FindPNGChunk (png, MAKE_ID('p','t','I','c')) == 8) { DWORD time[2]; fread (&time, 8, 1, stdfile); time[0] = BigLong((unsigned int)time[0]); time[1] = BigLong((unsigned int)time[1]); level.time = Scale (time[1], TICRATE, time[0]); } else { // No ptIc chunk so we don't know how long the user was playing level.time = 0; } G_ReadSnapshots (png); // load a base level savegamerestore = true; // Use the player actors in the savegame bool demoplaybacksave = demoplayback; G_InitNew (map, false); demoplayback = demoplaybacksave; delete[] map; savegamerestore = false; STAT_Read(png); FRandom::StaticReadRNGState(png); P_ReadACSDefereds(png); P_ReadACSVars(png); NextSkill = -1; if (M_FindPNGChunk (png, MAKE_ID('s','n','X','t')) == 1) { BYTE next; fread (&next, 1, 1, stdfile); NextSkill = next; } if (level.info->snapshot != NULL) { delete level.info->snapshot; level.info->snapshot = NULL; } BackupSaveName = savename; delete png; fclose (stdfile); // At this point, the GC threshold is likely a lot higher than the // amount of memory in use, so bring it down now by starting a // collection. GC::StartCollection(); } // // G_SaveGame // Called by the menu task. // Description is a 24 byte text string // void G_SaveGame (const char *filename, const char *description) { if (sendsave || gameaction == ga_savegame) { Printf ("A game save is still pending.\n"); return; } else if (!usergame) { Printf ("not in a saveable game\n"); } else if (gamestate != GS_LEVEL) { Printf ("not in a level\n"); } else if (players[consoleplayer].health <= 0 && !multiplayer) { Printf ("player is dead in a single-player game\n"); } else { savegamefile = filename; strncpy (savedescription, description, sizeof(savedescription)-1); savedescription[sizeof(savedescription)-1] = '\0'; sendsave = true; } } FString G_BuildSaveName (const char *prefix, int slot) { FString name; FString leader; const char *slash = ""; leader = Args->CheckValue ("-savedir"); if (leader.IsEmpty()) { leader = save_dir; if (leader.IsEmpty()) { leader = M_GetSavegamesPath(); } } size_t len = leader.Len(); if (leader[0] != '\0' && leader[len-1] != '\\' && leader[len-1] != '/') { slash = "/"; } name << leader << slash; name = NicePath(name); CreatePath(name); name << prefix; if (slot >= 0) { name.AppendFormat("%d.zds", slot); } return name; } CVAR (Int, autosavenum, 0, CVAR_NOSET|CVAR_ARCHIVE|CVAR_GLOBALCONFIG) static int nextautosave = -1; CVAR (Int, disableautosave, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CUSTOM_CVAR (Int, autosavecount, 4, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) { if (self < 0) self = 0; if (self > 20) self = 20; } extern void P_CalcHeight (player_t *); void G_DoAutoSave () { char description[SAVESTRINGSIZE]; FString file; // Keep up to four autosaves at a time UCVarValue num; const char *readableTime; int count = autosavecount != 0 ? autosavecount : 1; if (nextautosave == -1) { nextautosave = (autosavenum + 1) % count; } num.Int = nextautosave; autosavenum.ForceSet (num, CVAR_Int); file = G_BuildSaveName ("auto", nextautosave); if (!(level.flags2 & LEVEL2_NOAUTOSAVEHINT)) { nextautosave = (nextautosave + 1) % count; } else { // This flag can only be used once per level level.flags2 &= ~LEVEL2_NOAUTOSAVEHINT; } readableTime = myasctime (); strcpy (description, "Autosave "); strncpy (description+9, readableTime+4, 12); description[9+12] = 0; G_DoSaveGame (false, file, description); } static void PutSaveWads (FILE *file) { const char *name; // Name of IWAD name = Wads.GetWadName (FWadCollection::IWAD_FILENUM); M_AppendPNGText (file, "Game WAD", name); // Name of wad the map resides in if (Wads.GetLumpFile (level.lumpnum) > 1) { name = Wads.GetWadName (Wads.GetLumpFile (level.lumpnum)); M_AppendPNGText (file, "Map WAD", name); } } static void PutSaveComment (FILE *file) { char comment[256]; const char *readableTime; WORD len; int levelTime; // Get the current date and time readableTime = myasctime (); strncpy (comment, readableTime, 10); strncpy (comment+10, readableTime+19, 5); strncpy (comment+15, readableTime+10, 9); comment[24] = 0; M_AppendPNGText (file, "Creation Time", comment); // Get level name //strcpy (comment, level.level_name); mysnprintf(comment, countof(comment), "%s - %s", level.MapName.GetChars(), level.LevelName.GetChars()); len = (WORD)strlen (comment); comment[len] = '\n'; // Append elapsed time levelTime = level.time / TICRATE; mysnprintf (comment + len + 1, countof(comment) - len - 1, "time: %02d:%02d:%02d", levelTime/3600, (levelTime%3600)/60, levelTime%60); comment[len+16] = 0; // Write out the comment M_AppendPNGText (file, "Comment", comment); } static void PutSavePic (FILE *file, int width, int height) { if (width <= 0 || height <= 0 || !storesavepic) { M_CreateDummyPNG (file); } else { Renderer->WriteSavePic(&players[consoleplayer], file, width, height); } } void G_DoSaveGame (bool okForQuicksave, FString filename, const char *description) { char buf[100]; // Do not even try, if we're not in a level. (Can happen after // a demo finishes playback.) if (lines == NULL || sectors == NULL || gamestate != GS_LEVEL) { return; } if (demoplayback) { filename = G_BuildSaveName ("demosave.zds", -1); } if (cl_waitforsave) I_FreezeTime(true); insave = true; G_SnapshotLevel (); FILE *stdfile = fopen (filename, "wb"); if (stdfile == NULL) { Printf ("Could not create savegame '%s'\n", filename.GetChars()); insave = false; I_FreezeTime(false); return; } SaveVersion = SAVEVER; PutSavePic (stdfile, SAVEPICWIDTH, SAVEPICHEIGHT); mysnprintf(buf, countof(buf), GAMENAME " %s", GetVersionString()); M_AppendPNGText (stdfile, "Software", buf); M_AppendPNGText (stdfile, "Engine", GAMESIG); M_AppendPNGText (stdfile, "ZDoom Save Version", SAVESIG); M_AppendPNGText (stdfile, "Title", description); M_AppendPNGText (stdfile, "Current Map", level.MapName); PutSaveWads (stdfile); PutSaveComment (stdfile); // Intermission stats for hubs G_WriteHubInfo(stdfile); { FString vars = C_GetMassCVarString(CVAR_SERVERINFO); M_AppendPNGText (stdfile, "Important CVARs", vars.GetChars()); } if (level.time != 0 || level.maptime != 0) { DWORD time[2] = { DWORD(BigLong(TICRATE)), DWORD(BigLong(level.time)) }; M_AppendPNGChunk (stdfile, MAKE_ID('p','t','I','c'), (BYTE *)&time, 8); } G_WriteSnapshots (stdfile); STAT_Write(stdfile); FRandom::StaticWriteRNGState (stdfile); P_WriteACSDefereds (stdfile); P_WriteACSVars(stdfile); if (NextSkill != -1) { BYTE next = NextSkill; M_AppendPNGChunk (stdfile, MAKE_ID('s','n','X','t'), &next, 1); } M_FinishPNG (stdfile); fclose (stdfile); M_NotifyNewSave (filename.GetChars(), description, okForQuicksave); // Check whether the file is ok. bool success = false; stdfile = fopen (filename.GetChars(), "rb"); if (stdfile != NULL) { PNGHandle *pngh = M_VerifyPNG(stdfile); if (pngh != NULL) { success = true; delete pngh; } fclose(stdfile); } if (success) { if (longsavemessages) Printf ("%s (%s)\n", GStrings("GGSAVED"), filename.GetChars()); else Printf ("%s\n", GStrings("GGSAVED")); } else Printf(PRINT_HIGH, "Save failed\n"); BackupSaveName = filename; // We don't need the snapshot any longer. if (level.info->snapshot != NULL) { delete level.info->snapshot; level.info->snapshot = NULL; } insave = false; I_FreezeTime(false); } // // DEMO RECORDING // void G_ReadDemoTiccmd (ticcmd_t *cmd, int player) { int id = DEM_BAD; while (id != DEM_USERCMD && id != DEM_EMPTYUSERCMD) { if (!demorecording && demo_p >= zdembodyend) { // nothing left in the BODY chunk, so end playback. G_CheckDemoStatus (); break; } id = ReadByte (&demo_p); switch (id) { case DEM_STOP: // end of demo stream G_CheckDemoStatus (); break; case DEM_USERCMD: UnpackUserCmd (&cmd->ucmd, &cmd->ucmd, &demo_p); break; case DEM_EMPTYUSERCMD: // leave cmd->ucmd unchanged break; case DEM_DROPPLAYER: { BYTE i = ReadByte (&demo_p); if (i < MAXPLAYERS) { playeringame[i] = false; } } break; default: Net_DoCommand (id, &demo_p, player); break; } } } bool stoprecording; CCMD (stop) { stoprecording = true; } extern BYTE *lenspot; void G_WriteDemoTiccmd (ticcmd_t *cmd, int player, int buf) { BYTE *specdata; int speclen; if (stoprecording) { // use "stop" console command to end demo recording G_CheckDemoStatus (); if (!netgame) { gameaction = ga_fullconsole; } return; } // [RH] Write any special "ticcmds" for this player to the demo if ((specdata = NetSpecs[player][buf].GetData (&speclen)) && gametic % ticdup == 0) { memcpy (demo_p, specdata, speclen); demo_p += speclen; NetSpecs[player][buf].SetData (NULL, 0); } // [RH] Now write out a "normal" ticcmd. WriteUserCmdMessage (&cmd->ucmd, &players[player].cmd.ucmd, &demo_p); // [RH] Bigger safety margin if (demo_p > demobuffer + maxdemosize - 64) { ptrdiff_t pos = demo_p - demobuffer; ptrdiff_t spot = lenspot - demobuffer; ptrdiff_t comp = democompspot - demobuffer; ptrdiff_t body = demobodyspot - demobuffer; // [RH] Allocate more space for the demo maxdemosize += 0x20000; demobuffer = (BYTE *)M_Realloc (demobuffer, maxdemosize); demo_p = demobuffer + pos; lenspot = demobuffer + spot; democompspot = demobuffer + comp; demobodyspot = demobuffer + body; } } // // G_RecordDemo // void G_RecordDemo (const char* name) { usergame = false; demoname = name; FixPathSeperator (demoname); DefaultExtension (demoname, ".lmp"); maxdemosize = 0x20000; demobuffer = (BYTE *)M_Malloc (maxdemosize); demorecording = true; } // [RH] Demos are now saved as IFF FORMs. I've also removed support // for earlier ZDEMs since I didn't want to bother supporting // something that probably wasn't used much (if at all). void G_BeginRecording (const char *startmap) { int i; if (startmap == NULL) { startmap = level.MapName; } demo_p = demobuffer; WriteLong (FORM_ID, &demo_p); // Write FORM ID demo_p += 4; // Leave space for len WriteLong (ZDEM_ID, &demo_p); // Write ZDEM ID // Write header chunk StartChunk (ZDHD_ID, &demo_p); WriteWord (DEMOGAMEVERSION, &demo_p); // Write ZDoom version *demo_p++ = 2; // Write minimum version needed to use this demo. *demo_p++ = 3; // (Useful?) strcpy((char*)demo_p, startmap); // Write name of map demo was recorded on. demo_p += strlen(startmap) + 1; WriteLong(rngseed, &demo_p); // Write RNG seed *demo_p++ = consoleplayer; FinishChunk (&demo_p); // Write player info chunks for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i]) { StartChunk (UINF_ID, &demo_p); WriteByte ((BYTE)i, &demo_p); D_WriteUserInfoStrings (i, &demo_p); FinishChunk (&demo_p); } } // It is possible to start a "multiplayer" game with only one player, // so checking the number of players when playing back the demo is not // enough. if (multiplayer) { StartChunk (NETD_ID, &demo_p); FinishChunk (&demo_p); } // Write cvars chunk StartChunk (VARS_ID, &demo_p); C_WriteCVars (&demo_p, CVAR_SERVERINFO|CVAR_DEMOSAVE); FinishChunk (&demo_p); // Write weapon ordering chunk StartChunk (WEAP_ID, &demo_p); P_WriteDemoWeaponsChunk(&demo_p); FinishChunk (&demo_p); // Indicate body is compressed StartChunk (COMP_ID, &demo_p); democompspot = demo_p; WriteLong (0, &demo_p); FinishChunk (&demo_p); // Begin BODY chunk StartChunk (BODY_ID, &demo_p); demobodyspot = demo_p; } // // G_PlayDemo // FString defdemoname; void G_DeferedPlayDemo (const char *name) { defdemoname = name; gameaction = (gameaction == ga_loadgame) ? ga_loadgameplaydemo : ga_playdemo; } CCMD (playdemo) { if (netgame) { Printf("End your current netgame first!"); return; } if (demorecording) { Printf("End your current demo first!"); return; } if (argv.argc() > 1) { G_DeferedPlayDemo (argv[1]); singledemo = true; } } CCMD (timedemo) { if (argv.argc() > 1) { G_TimeDemo (argv[1]); singledemo = true; } } // [RH] Process all the information in a FORM ZDEM // until a BODY chunk is entered. bool G_ProcessIFFDemo (FString &mapname) { bool headerHit = false; bool bodyHit = false; int numPlayers = 0; int id, len, i; uLong uncompSize = 0; BYTE *nextchunk; demoplayback = true; for (i = 0; i < MAXPLAYERS; i++) playeringame[i] = 0; len = ReadLong (&demo_p); zdemformend = demo_p + len + (len & 1); // Check to make sure this is a ZDEM chunk file. // TODO: Support multiple FORM ZDEMs in a CAT. Might be useful. id = ReadLong (&demo_p); if (id != ZDEM_ID) { Printf ("Not a " GAMENAME " demo file!\n"); return true; } // Process all chunks until a BODY chunk is encountered. while (demo_p < zdemformend && !bodyHit) { id = ReadLong (&demo_p); len = ReadLong (&demo_p); nextchunk = demo_p + len + (len & 1); if (nextchunk > zdemformend) { Printf ("Demo is mangled!\n"); return true; } switch (id) { case ZDHD_ID: headerHit = true; demover = ReadWord (&demo_p); // ZDoom version demo was created with if (demover < MINDEMOVERSION) { Printf ("Demo requires an older version of " GAMENAME "!\n"); //return true; } if (ReadWord (&demo_p) > DEMOGAMEVERSION) // Minimum ZDoom version { Printf ("Demo requires a newer version of " GAMENAME "!\n"); return true; } if (demover >= 0x21a) { mapname = (char*)demo_p; demo_p += mapname.Len() + 1; } else { mapname = FString((char*)demo_p, 8); demo_p += 8; } rngseed = ReadLong (&demo_p); // Only reset the RNG if this demo is not in conjunction with a savegame. if (mapname[0] != 0) { FRandom::StaticClearRandom (); } consoleplayer = *demo_p++; break; case VARS_ID: C_ReadCVars (&demo_p); break; case UINF_ID: i = ReadByte (&demo_p); if (!playeringame[i]) { playeringame[i] = 1; numPlayers++; } D_ReadUserInfoStrings (i, &demo_p, false); break; case NETD_ID: multiplayer = true; break; case WEAP_ID: P_ReadDemoWeaponsChunk(&demo_p); break; case BODY_ID: bodyHit = true; zdembodyend = demo_p + len; break; case COMP_ID: uncompSize = ReadLong (&demo_p); break; } if (!bodyHit) demo_p = nextchunk; } if (!headerHit) { Printf ("Demo has no header!\n"); return true; } if (!numPlayers) { Printf ("Demo has no players!\n"); return true; } if (!bodyHit) { zdembodyend = NULL; Printf ("Demo has no BODY chunk!\n"); return true; } if (numPlayers > 1) multiplayer = netgame = true; if (uncompSize > 0) { BYTE *uncompressed = (BYTE*)M_Malloc(uncompSize); int r = uncompress (uncompressed, &uncompSize, demo_p, uLong(zdembodyend - demo_p)); if (r != Z_OK) { Printf ("Could not decompress demo! %s\n", M_ZLibError(r).GetChars()); M_Free(uncompressed); return true; } M_Free (demobuffer); zdembodyend = uncompressed + uncompSize; demobuffer = demo_p = uncompressed; } return false; } void G_DoPlayDemo (void) { FString mapname; int demolump; gameaction = ga_nothing; // [RH] Allow for demos not loaded as lumps demolump = Wads.CheckNumForFullName (defdemoname, true); if (demolump >= 0) { int demolen = Wads.LumpLength (demolump); demobuffer = (BYTE *)M_Malloc(demolen); Wads.ReadLump (demolump, demobuffer); } else { FixPathSeperator (defdemoname); DefaultExtension (defdemoname, ".lmp"); M_ReadFileMalloc (defdemoname, &demobuffer); } demo_p = demobuffer; Printf ("Playing demo %s\n", defdemoname.GetChars()); C_BackupCVars (); // [RH] Save cvars that might be affected by demo if (ReadLong (&demo_p) != FORM_ID) { const char *eek = "Cannot play non-" GAMENAME " demos.\n"; C_ForgetCVars(); M_Free(demobuffer); demo_p = demobuffer = NULL; if (singledemo) { I_Error ("%s", eek); } else { Printf (PRINT_BOLD, "%s", eek); gameaction = ga_nothing; } } else if (G_ProcessIFFDemo (mapname)) { C_RestoreCVars(); gameaction = ga_nothing; demoplayback = false; } else { // don't spend a lot of time in loadlevel precache = false; demonew = true; if (mapname.Len() != 0) { G_InitNew (mapname, false); } else if (numsectors == 0) { I_Error("Cannot play demo without its savegame\n"); } C_HideConsole (); demonew = false; precache = true; usergame = false; demoplayback = true; } } // // G_TimeDemo // void G_TimeDemo (const char* name) { nodrawers = !!Args->CheckParm ("-nodraw"); noblit = !!Args->CheckParm ("-noblit"); timingdemo = true; singletics = true; defdemoname = name; gameaction = (gameaction == ga_loadgame) ? ga_loadgameplaydemo : ga_playdemo; } /* =================== = = G_CheckDemoStatus = = Called after a death or level completion to allow demos to be cleaned up = Returns true if a new demo loop action will take place =================== */ bool G_CheckDemoStatus (void) { if (!demorecording) { // [RH] Restore the player's userinfo settings. D_SetupUserInfo(); } if (demoplayback) { extern int starttime; int endtime = 0; if (timingdemo) endtime = I_GetTime (false) - starttime; C_RestoreCVars (); // [RH] Restore cvars demo might have changed M_Free (demobuffer); demobuffer = NULL; P_SetupWeapons_ntohton(); demoplayback = false; netgame = false; multiplayer = false; singletics = false; for (int i = 1; i < MAXPLAYERS; i++) playeringame[i] = 0; consoleplayer = 0; players[0].camera = NULL; if (StatusBar != NULL) { StatusBar->AttachToPlayer (&players[0]); } if (singledemo || timingdemo) { if (timingdemo) { // Trying to get back to a stable state after timing a demo // seems to cause problems. I don't feel like fixing that // right now. I_FatalError ("timed %i gametics in %i realtics (%.1f fps)\n" "(This is not really an error.)", gametic, endtime, (float)gametic/(float)endtime*(float)TICRATE); } else { Printf ("Demo ended.\n"); } gameaction = ga_fullconsole; timingdemo = false; return false; } else { D_AdvanceDemo (); } return true; } if (demorecording) { BYTE *formlen; WriteByte (DEM_STOP, &demo_p); if (demo_compress) { // Now that the entire BODY chunk has been created, replace it with // a compressed version. If the BODY successfully compresses, the // contents of the COMP chunk will be changed to indicate the // uncompressed size of the BODY. uLong len = uLong(demo_p - demobodyspot); uLong outlen = (len + len/100 + 12); Byte *compressed = new Byte[outlen]; int r = compress2 (compressed, &outlen, demobodyspot, len, 9); if (r == Z_OK && outlen < len) { formlen = democompspot; WriteLong (len, &democompspot); memcpy (demobodyspot, compressed, outlen); demo_p = demobodyspot + outlen; } delete[] compressed; } FinishChunk (&demo_p); formlen = demobuffer + 4; WriteLong (int(demo_p - demobuffer - 8), &formlen); bool saved = M_WriteFile (demoname, demobuffer, int(demo_p - demobuffer)); M_Free (demobuffer); demorecording = false; stoprecording = false; if (saved) { Printf ("Demo %s recorded\n", demoname.GetChars()); } else { Printf ("Demo %s could not be saved\n", demoname.GetChars()); } } return false; }
1
0.920826
1
0.920826
game-dev
MEDIA
0.965233
game-dev
0.52372
1
0.52372
Doraku/Ecs.CSharp.Benchmark
2,752
source/Ecs.CSharp.Benchmark/SystemWithTwoComponents/HypEcs.cs
using BenchmarkDotNet.Attributes; using Ecs.CSharp.Benchmark.Contexts; using HypEcs; namespace Ecs.CSharp.Benchmark { public partial class SystemWithTwoComponents { private sealed class HypEcsContext : HypEcsBaseContext { private sealed class MonoThreadRunSystem : ISystem { public void Run(World world) { Query<Component1, Component2> query = world.Query<Component1, Component2>().Build(); query.Run((count, s1, s2) => { for (int i = 0; i < count; i++) { s1[i].Value += s2[i].Value; } }); } } private sealed class MultiThreadRunSystem : ISystem { public void Run(World world) { Query<Component1, Component2> query = world.Query<Component1, Component2>().Build(); query.RunParallel((count, s1, s2) => { for (int i = 0; i < count; i++) { s1[i].Value += s2[i].Value; } }); } } public ISystem MonoThreadSystem { get; } = new MonoThreadRunSystem(); public ISystem MultiThreadSystem { get; } = new MultiThreadRunSystem(); public HypEcsContext(int entityCount, int entityPadding) { for (int i = 0; i < entityCount; ++i) { for (int j = 0; j < entityPadding; ++j) { EntityBuilder padding = World.Spawn(); switch (j % 2) { case 0: padding.Add(new Component1()); break; case 1: padding.Add(new Component2()); break; } } World.Spawn() .Add(new Component1()) .Add(new Component2 { Value = 1 }); } } } [Context] private readonly HypEcsContext _hypEcs; [BenchmarkCategory(Categories.HypEcs)] [Benchmark] public void HypEcs_MonoThread() => _hypEcs.MonoThreadSystem.Run(_hypEcs.World); [BenchmarkCategory(Categories.HypEcs)] [Benchmark] public void HypEcs_MultiThread() => _hypEcs.MultiThreadSystem.Run(_hypEcs.World); } }
1
0.763604
1
0.763604
game-dev
MEDIA
0.722348
game-dev
0.668581
1
0.668581
aldenml/libtorrent4j
2,694
src/main/java/org/libtorrent4j/PiecesTracker.java
package org.libtorrent4j; import java.util.ArrayList; /** * @author gubatron * @author aldenml */ public final class PiecesTracker { private final int numFiles; private final int numPieces; private final int[][] files; private final long[][] sizes; private final boolean[] complete; public PiecesTracker(TorrentInfo ti) { this.numFiles = ti.numFiles(); this.numPieces = ti.numPieces(); this.files = new int[numFiles][]; this.sizes = new long[numFiles][]; this.complete = new boolean[numPieces]; FileStorage fs = ti.files(); for (int fileIndex = 0; fileIndex < numFiles; fileIndex++) { long size = fs.fileSize(fileIndex); int firstPiece = ti.mapFile(fileIndex, 0, 1).piece(); int lastPiece = ti.mapFile(fileIndex, size - 1, 1).piece(); int numSlices = lastPiece - firstPiece + 1; files[fileIndex] = new int[numSlices]; sizes[fileIndex] = new long[numSlices]; for (int pieceIndex = firstPiece; pieceIndex <= lastPiece; pieceIndex++) { int index = pieceIndex - firstPiece; files[fileIndex][index] = pieceIndex; ArrayList<FileSlice> slices = ti.mapBlock(pieceIndex, 0, ti.pieceSize(pieceIndex)); for (FileSlice slice : slices) { if (slice.fileIndex() == fileIndex) { sizes[fileIndex][index] = slice.size(); } } } } } public int numFiles() { return numFiles; } public int numPieces() { return numPieces; } public boolean isComplete(int pieceIndex) { return complete[pieceIndex]; } public void setComplete(int pieceIndex, boolean complete) { this.complete[pieceIndex] = complete; } public long getSequentialDownloadedBytes(int fileIndex) { int[] pieces = files[fileIndex]; long downloaded = 0; for (int i = 0; i < pieces.length; i++) { int pieceIndex = pieces[i]; if (complete[pieceIndex]) { downloaded += sizes[fileIndex][i]; } else { break; } } return downloaded; } public int getSequentialDownloadedPieces(int fileIndex) { int[] pieces = files[fileIndex]; int count = 0; for (int i = 0; i < pieces.length; i++) { int pieceIndex = pieces[i]; if (complete[pieceIndex]) { count++; } else { break; } } return count; } }
1
0.852336
1
0.852336
game-dev
MEDIA
0.461438
game-dev
0.978612
1
0.978612
stephank/surreal
7,765
Deps/SDL/src/joystick/beos/SDL_bejoystick.cc
/* Simple DirectMedia Layer Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "SDL_config.h" #ifdef SDL_JOYSTICK_BEOS /* This is the system specific header for the SDL joystick API */ #include <be/support/String.h> #include <be/device/Joystick.h> extern "C" { #include "SDL_joystick.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" /* The maximum number of joysticks we'll detect */ #define MAX_JOYSTICKS 16 /* A list of available joysticks */ static char *SDL_joyport[MAX_JOYSTICKS]; static char *SDL_joyname[MAX_JOYSTICKS]; /* The private structure used to keep track of a joystick */ struct joystick_hwdata { BJoystick *stick; uint8 *new_hats; int16 *new_axes; }; /* Function to scan the system for joysticks. * This function should set SDL_numjoysticks to the number of available * joysticks. Joystick 0 should be the system default joystick. * It should return 0, or -1 on an unrecoverable fatal error. */ int SDL_SYS_JoystickInit(void) { BJoystick joystick; int numjoysticks; int i; int32 nports; char name[B_OS_NAME_LENGTH]; /* Search for attached joysticks */ nports = joystick.CountDevices(); numjoysticks = 0; SDL_memset(SDL_joyport, 0, (sizeof SDL_joyport)); SDL_memset(SDL_joyname, 0, (sizeof SDL_joyname)); for (i = 0; (SDL_numjoysticks < MAX_JOYSTICKS) && (i < nports); ++i) { if (joystick.GetDeviceName(i, name) == B_OK) { if (joystick.Open(name) != B_ERROR) { BString stick_name; joystick.GetControllerName(&stick_name); SDL_joyport[numjoysticks] = strdup(name); SDL_joyname[numjoysticks] = strdup(stick_name.String()); numjoysticks++; joystick.Close(); } } } return (numjoysticks); } /* Function to get the device-dependent name of a joystick */ const char *SDL_SYS_JoystickName(int index) { return SDL_joyname[index]; } /* Function to open a joystick for use. The joystick to open is specified by the index field of the joystick. This should fill the nbuttons and naxes fields of the joystick structure. It returns 0, or -1 if there is an error. */ int SDL_SYS_JoystickOpen(SDL_Joystick * joystick) { BJoystick *stick; /* Create the joystick data structure */ joystick->hwdata = (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata)); if (joystick->hwdata == NULL) { SDL_OutOfMemory(); return (-1); } SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata)); stick = new BJoystick; joystick->hwdata->stick = stick; /* Open the requested joystick for use */ if (stick->Open(SDL_joyport[joystick->index]) == B_ERROR) { SDL_SetError("Unable to open joystick"); SDL_SYS_JoystickClose(joystick); return (-1); } /* Set the joystick to calibrated mode */ stick->EnableCalibration(); /* Get the number of buttons, hats, and axes on the joystick */ joystick->nbuttons = stick->CountButtons(); joystick->naxes = stick->CountAxes(); joystick->nhats = stick->CountHats(); joystick->hwdata->new_axes = (int16 *) SDL_malloc(joystick->naxes * sizeof(int16)); joystick->hwdata->new_hats = (uint8 *) SDL_malloc(joystick->nhats * sizeof(uint8)); if (!joystick->hwdata->new_hats || !joystick->hwdata->new_axes) { SDL_OutOfMemory(); SDL_SYS_JoystickClose(joystick); return (-1); } /* We're done! */ return (0); } /* Function to update the state of a joystick - called as a device poll. * This function shouldn't update the joystick structure directly, * but instead should call SDL_PrivateJoystick*() to deliver events * and update joystick device state. */ void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) { static const Uint8 hat_map[9] = { SDL_HAT_CENTERED, SDL_HAT_UP, SDL_HAT_RIGHTUP, SDL_HAT_RIGHT, SDL_HAT_RIGHTDOWN, SDL_HAT_DOWN, SDL_HAT_LEFTDOWN, SDL_HAT_LEFT, SDL_HAT_LEFTUP }; const int JITTER = (32768 / 10); /* 10% jitter threshold (ok?) */ BJoystick *stick; int i, change; int16 *axes; uint8 *hats; uint32 buttons; /* Set up data pointers */ stick = joystick->hwdata->stick; axes = joystick->hwdata->new_axes; hats = joystick->hwdata->new_hats; /* Get the new joystick state */ stick->Update(); stick->GetAxisValues(axes); stick->GetHatValues(hats); buttons = stick->ButtonValues(); /* Generate axis motion events */ for (i = 0; i < joystick->naxes; ++i) { change = ((int32) axes[i] - joystick->axes[i]); if ((change > JITTER) || (change < -JITTER)) { SDL_PrivateJoystickAxis(joystick, i, axes[i]); } } /* Generate hat change events */ for (i = 0; i < joystick->nhats; ++i) { if (hats[i] != joystick->hats[i]) { SDL_PrivateJoystickHat(joystick, i, hat_map[hats[i]]); } } /* Generate button events */ for (i = 0; i < joystick->nbuttons; ++i) { if ((buttons & 0x01) != joystick->buttons[i]) { SDL_PrivateJoystickButton(joystick, i, (buttons & 0x01)); } buttons >>= 1; } } /* Function to close a joystick after use */ void SDL_SYS_JoystickClose(SDL_Joystick * joystick) { if (joystick->hwdata) { joystick->hwdata->stick->Close(); delete joystick->hwdata->stick; if (joystick->hwdata->new_hats) { SDL_free(joystick->hwdata->new_hats); } if (joystick->hwdata->new_axes) { SDL_free(joystick->hwdata->new_axes); } SDL_free(joystick->hwdata); joystick->hwdata = NULL; } } /* Function to perform any system-specific joystick related cleanup */ void SDL_SYS_JoystickQuit(void) { int i; for (i = 0; SDL_joyport[i]; ++i) { SDL_free(SDL_joyport[i]); } SDL_joyport[0] = NULL; for (i = 0; SDL_joyname[i]; ++i) { SDL_free(SDL_joyname[i]); } SDL_joyname[0] = NULL; } }; // extern "C" #endif /* SDL_JOYSTICK_BEOS */ /* vi: set ts=4 sw=4 expandtab: */
1
0.689255
1
0.689255
game-dev
MEDIA
0.953071
game-dev
0.66317
1
0.66317
TheAssemblyArmada/Thyme
2,815
src/game/common/system/functionlexicon.h
/** * @file * * @author OmniBlade * * @brief Interface for UI function pointer manager. * * @copyright Thyme 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. * A full copy of the GNU General Public License can be found in * LICENSE */ #pragma once #include "always.h" #include "gamewindow.h" #include "namekeygenerator.h" #include "subsysteminterface.h" #include "windowlayout.h" class FunctionLexicon : public SubsystemInterface { ALLOW_HOOKING public: enum TableIndex { TABLE_ANY = -1, TABLE_GAME_WIN_SYSTEM, TABLE_GAME_WIN_INPUT, TABLE_GAME_WIN_TOOLTIP, TABLE_GAME_WIN_DEVICEDRAW, TABLE_GAME_WIN_DRAW, TABLE_LAYOUT_INIT, TABLE_WIN_LAYOUT_INIT, TABLE_WIN_LAYOUT_UPDATE, TABLE_WIN_LAYOUT_SHUTDOWN, MAX_FUNCTION_TABLES, }; struct TableEntry { NameKeyType key; const char *name; void *func; }; public: FunctionLexicon(); virtual ~FunctionLexicon() {} virtual void Init() override; virtual void Reset() override { Init(); } virtual void Update() override {} void *Find_Function(NameKeyType key, TableIndex index); WindowDrawFunc Game_Win_Draw_Func(NameKeyType key, TableIndex index); WindowLayoutCallbackFunc Win_Layout_Init_Func(NameKeyType key, TableIndex index); WindowCallbackFunc Game_Win_System_Func(NameKeyType key, TableIndex index) { return reinterpret_cast<WindowCallbackFunc>(Find_Function(key, index)); } WindowCallbackFunc Game_Win_Input_Func(NameKeyType key, TableIndex index) { return reinterpret_cast<WindowCallbackFunc>(Find_Function(key, index)); } WindowTooltipFunc Game_Win_Tooltip_Func(NameKeyType key, TableIndex index) { return reinterpret_cast<WindowTooltipFunc>(Find_Function(key, index)); } WindowLayoutCallbackFunc Win_Layout_Update_Func(NameKeyType key, TableIndex index) { return reinterpret_cast<WindowLayoutCallbackFunc>(Find_Function(key, index)); } WindowLayoutCallbackFunc Win_Layout_Shutdown_Func(NameKeyType key, TableIndex index) { return reinterpret_cast<WindowLayoutCallbackFunc>(Find_Function(key, index)); } protected: void Load_Table(TableEntry *table, TableIndex index); bool Validate(); void *Key_To_Func(NameKeyType key, TableEntry *table); private: TableEntry *m_tables[MAX_FUNCTION_TABLES]; }; #ifdef GAME_DLL extern FunctionLexicon *&g_theFunctionLexicon; #else extern FunctionLexicon *g_theFunctionLexicon; #endif
1
0.821706
1
0.821706
game-dev
MEDIA
0.429406
game-dev
0.555551
1
0.555551
Navigine/Indoor-Positioning-And-Navigation-Algorithms
2,856
src/position_postprocessor/position_smoother_ab.cpp
#include <navigine/navigation-core/navigation_settings.h> #include "position_smoother_ab.h" namespace navigine { namespace navigation_core { static const double MAX_ALPHA = 0.9; static const double MIN_ALPHA = 0.1; static const double TIME_THRESHOLD_SEC = 10; static const double MAX_OBJECT_VELOCITY_MPS = 4; PositionSmootherAB::PositionSmootherAB(const NavigationSettings& navProps) : mUseBarriers(navProps.commonSettings.useBarriers) , mUseSpeedConstraint(navProps.commonSettings.useSpeedConstraint) , mUseAccuracyForSmoothing(navProps.commonSettings.useAccuracyForSmoothing) , mWasCalled(false) , mSpeedX(0.0) , mSpeedY(0.0) { double smoothing = navProps.commonSettings.smoothing; smoothing = std::min(1.0, std::max(0.0, smoothing)); mAlpha = MIN_ALPHA * smoothing + MAX_ALPHA * (1.0 - smoothing); } Position PositionSmootherAB::smoothPosition(Position pos, const Level& level) { // assert(pos.ts > mPosition.ts); if (pos.ts > mPosition.ts) { double t = (pos.ts - mPosition.ts) / 1000.0; double a = mAlpha; if (mUseAccuracyForSmoothing) { double newAlpha = mPosition.deviationM / (pos.deviationM + mPosition.deviationM + 0.5); a = std::min(std::max(MIN_ALPHA, newAlpha), MAX_ALPHA); } /* temporary commented - it boost the filter to obtain the minimal speed */ // if (std::sqrt(mSpeedX * mSpeedX + mSpeedY * mSpeedY) < 0.5) // a = MAX_ALPHA / 2.0; double b = a * a / (2.0 - a); double xp = mPosition.x + mSpeedX * t; double vxp = mSpeedX + (b / t) * (pos.x - xp); double xs = xp + a * (pos.x - xp); double yp = mPosition.y + mSpeedY * t; double vyp = mSpeedY + (b / t) * (pos.y - yp); double ys = yp + a * (pos.y - yp); double velocity = std::sqrt(vxp * vxp + vyp * vyp); bool timeIsTooLong = t > TIME_THRESHOLD_SEC; bool velocityIsTooFast = (mUseSpeedConstraint && velocity > MAX_OBJECT_VELOCITY_MPS); bool isInsideBarrier = (mUseBarriers && !boost::geometry::covered_by(Point(xs, ys), level.geometry().allowedArea())); if (!mWasCalled || timeIsTooLong || velocityIsTooFast || isInsideBarrier) { mPosition = pos; mSpeedX = 0.0; mSpeedY = 0.0; mWasCalled = true; return pos; } mSpeedX = vxp; mSpeedY = vyp; if (std::isfinite(xs) && std::isfinite(ys)) { pos.x = xs; pos.y = ys; } mPosition = pos; if (mUseAccuracyForSmoothing) { //TODO more real accuracy update double predictedAccuracy = mPosition.deviationM + t * std::sqrt(mSpeedX * mSpeedX + mSpeedY * mSpeedY); mPosition.deviationM = (1.0 - a) * predictedAccuracy + a * pos.deviationM; } } return mPosition; } void PositionSmootherAB::reset(Position pos) { mPosition = pos; mSpeedX = 0.0; mSpeedY = 0.0; } } } // namespace navigine::navigation_core
1
0.615571
1
0.615571
game-dev
MEDIA
0.158157
game-dev
0.952344
1
0.952344
RCInet/LastEpoch_Mods
4,171
AssetBundleExport/Library/PackageCache/com.unity.timeline@c58b4ee65782/Runtime/Evaluation/ScheduleRuntimeClip.cs
using System; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Playables; namespace UnityEngine.Timeline { // Special runtime clip implementation that handles playables that use a scheduling system // such as Audio internal class ScheduleRuntimeClip : RuntimeClipBase { private TimelineClip m_Clip; private Playable m_Playable; private Playable m_ParentMixer; private double m_StartDelay; private double m_FinishTail; private bool m_Started = false; // represents the start point when we want to start getting updated public override double start { get { return Math.Max(0, m_Clip.start - m_StartDelay); } } public override double duration { get { return m_Clip.duration + m_FinishTail + m_Clip.start - start; } } public void SetTime(double time) { m_Playable.SetTime(time); } public TimelineClip clip { get { return m_Clip; } } public Playable mixer { get { return m_ParentMixer; } } public Playable playable { get { return m_Playable; } } public ScheduleRuntimeClip(TimelineClip clip, Playable clipPlayable, Playable parentMixer, double startDelay = 0.2, double finishTail = 0.1) { Create(clip, clipPlayable, parentMixer, startDelay, finishTail); } private void Create(TimelineClip clip, Playable clipPlayable, Playable parentMixer, double startDelay, double finishTail) { m_Clip = clip; m_Playable = clipPlayable; m_ParentMixer = parentMixer; m_StartDelay = startDelay; m_FinishTail = finishTail; clipPlayable.Pause(); } public override bool enable { set { if (value && m_Playable.GetPlayState() != PlayState.Playing) { m_Playable.Play(); } else if (!value && m_Playable.GetPlayState() != PlayState.Paused) { m_Playable.Pause(); if (m_ParentMixer.IsValid()) m_ParentMixer.SetInputWeight(m_Playable, 0.0f); } m_Started &= value; } } public override void EvaluateAt(double localTime, FrameData frameData) { if (frameData.timeHeld) { enable = false; return; } bool forceSeek = frameData.seekOccurred || frameData.timeLooped || frameData.evaluationType == FrameData.EvaluationType.Evaluate; // If we are in the tail region of the clip, then dont do anything if (localTime > start + duration - m_FinishTail) return; // this may set the weight to 1 in a delay, but it will avoid missing the start float weight = clip.EvaluateMixIn(localTime) * clip.EvaluateMixOut(localTime); if (mixer.IsValid()) mixer.SetInputWeight(playable, weight); // localTime of the sequence to localtime of the clip if (!m_Started || forceSeek) { // accounts for clip in and speed double clipTime = clip.ToLocalTime(Math.Max(localTime, clip.start)); // multiply by the time scale so the delay is local to the clip // Audio will rescale based on it's effective time scale (which includes the parent) double startDelay = Math.Max(clip.start - localTime, 0) * clip.timeScale; double durationLocal = m_Clip.duration * clip.timeScale; if (m_Playable.IsPlayableOfType<AudioClipPlayable>()) ((AudioClipPlayable)m_Playable).Seek(clipTime, startDelay, durationLocal); m_Started = true; } } public override void DisableAt(double localTime, double rootDuration, FrameData frameData) { enable = false; } } }
1
0.908602
1
0.908602
game-dev
MEDIA
0.65255
game-dev,audio-video-media
0.993341
1
0.993341
FTL13/FTL13
2,188
code/game/objects/items/weapons/implants/implantcase.dm
/obj/item/weapon/implantcase name = "implant case" desc = "A glass case containing an implant." icon = 'icons/obj/items.dmi' icon_state = "implantcase-0" item_state = "implantcase" lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi' throw_speed = 2 throw_range = 5 w_class = WEIGHT_CLASS_TINY origin_tech = "materials=1;biotech=2" materials = list(MAT_GLASS=500) var/obj/item/weapon/implant/imp = null var/imp_type /obj/item/weapon/implantcase/update_icon() if(imp) icon_state = "implantcase-[imp.item_color]" origin_tech = imp.origin_tech reagents = imp.reagents else icon_state = "implantcase-0" origin_tech = initial(origin_tech) reagents = null /obj/item/weapon/implantcase/attackby(obj/item/weapon/W, mob/user, params) if(istype(W, /obj/item/weapon/pen)) var/t = stripped_input(user, "What would you like the label to be?", name, null) if(user.get_active_held_item() != W) return if(!in_range(src, user) && loc != user) return if(t) name = "implant case - '[t]'" else name = "implant case" else if(istype(W, /obj/item/weapon/implanter)) var/obj/item/weapon/implanter/I = W if(I.imp) if(imp || I.imp.imp_in) return I.imp.loc = src imp = I.imp I.imp = null update_icon() I.update_icon() else if(imp) if(I.imp) return imp.loc = I I.imp = imp imp = null update_icon() I.update_icon() else return ..() /obj/item/weapon/implantcase/Initialize(mapload) ..() if(imp_type) imp = new imp_type(src) update_icon() /obj/item/weapon/implantcase/tracking name = "implant case - 'Tracking'" desc = "A glass case containing a tracking implant." imp_type = /obj/item/weapon/implant/tracking /obj/item/weapon/implantcase/weapons_auth name = "implant case - 'Firearms Authentication'" desc = "A glass case containing a firearms authentication implant." imp_type = /obj/item/weapon/implant/weapons_auth /obj/item/weapon/implantcase/adrenaline name = "implant case - 'Adrenaline'" desc = "A glass case containing an adrenaline implant." imp_type = /obj/item/weapon/implant/adrenalin
1
0.541095
1
0.541095
game-dev
MEDIA
0.872782
game-dev
0.544819
1
0.544819
uhbbang33/AltF2
1,187
Assets/02. Scripts/Player/PlayerSound.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerSound : MonoBehaviour { private Rigidbody _rigidbody; private float _time; private float _delay =0.5f; private PlayerController _playerController; private Animator _animator; private void Awake() { _animator = GetComponent<Animator>(); _rigidbody =GetComponent<Rigidbody>(); _playerController =GetComponent<PlayerController>(); } private void Update() { WalkSound(); } public void LandingSound() { GameManager.Sound.SFXPlay(("landing"), gameObject.transform.position, 0.1f); } public void WalkSound() { _time += Time.deltaTime; if (Mathf.Abs(_rigidbody.velocity.y)<0.1f&& Mathf.Abs(_rigidbody.velocity.magnitude)> 0.1f) { if (_playerController.IsGrounded()&& _animator.enabled) { if (_time > _delay) { GameManager.Sound.SFXPlay(("Footstep"), gameObject.transform.position, 0.1f); _time = 0; } } } } }
1
0.698873
1
0.698873
game-dev
MEDIA
0.979918
game-dev
0.780304
1
0.780304
Reinisch/Darkest-Dungeon-Unity
2,741
Assets/Scripts/UI/Controls/SkillTooltip.cs
using UnityEngine; using UnityEngine.UI; public class SkillTooltip : ToolTip { [SerializeField] private GameObject targetRanksObject; [SerializeField] private Image[] launchRanks; [SerializeField] private Image[] targetRanks; [SerializeField] private RectTransform connectorRect; private Color targetColor; private Color launchColor; private Color neutralColor; private int basicWidth = 14; private int startConnectorOffset = 8; public override void Initialize() { base.Initialize(); Color resultColor; targetColor = ColorUtility.TryParseHtmlString(DarkestDungeonManager.Data.HexColors["harmful"], out resultColor) ? resultColor : Color.red; launchColor = ColorUtility.TryParseHtmlString(DarkestDungeonManager.Data.HexColors["notable"], out resultColor) ? resultColor : Color.yellow; neutralColor = ColorUtility.TryParseHtmlString(DarkestDungeonManager.Data.HexColors["neutral"], out resultColor) ? resultColor : Color.gray; connectorRect.GetComponent<Image>().color = targetColor; } public void UpdateSkillRanks(CombatSkill skill) { for (int i = 0; i < launchRanks.Length; i++) launchRanks[i].color = skill.LaunchRanks.Ranks.Contains(i + 1) ? launchColor : neutralColor; if(skill.TargetRanks.IsSelfFormation || skill.TargetRanks.IsSelfTarget) targetRanksObject.SetActive(false); else { targetRanksObject.SetActive(true); int firstTargetIndex = -1; int lastTargetIndex = -1; for(int i = 0; i < targetRanks.Length; i++) { if (skill.TargetRanks.Ranks.Contains(i + 1)) { if(firstTargetIndex == -1) firstTargetIndex = i; targetRanks[i].color = targetColor; lastTargetIndex = i; } else targetRanks[i].color = neutralColor; } if(skill.TargetRanks.IsMultitarget) { if(firstTargetIndex == -1 || firstTargetIndex == lastTargetIndex) connectorRect.gameObject.SetActive(false); else { connectorRect.gameObject.SetActive(true); connectorRect.localPosition = new Vector3(startConnectorOffset + basicWidth * firstTargetIndex, 0, 0); connectorRect.sizeDelta = new Vector2(basicWidth * (skill.TargetRanks.Ranks.Count - 1), connectorRect.sizeDelta.y); } } else connectorRect.gameObject.SetActive(false); } } }
1
0.748539
1
0.748539
game-dev
MEDIA
0.374357
game-dev
0.866316
1
0.866316
ixray-team/ixray-1.6-stcop
15,596
gamedata/scripts/bind_anomaly_zone.script
--'****************************************************** --'* Биндер объекта зоны аномалии . --'****************************************************** artefact_ways_by_id = {} artefact_points_by_id = {} parent_zones_by_artefact_id = {} ANOMAL_ZONE_SECT = "anomal_zone" function bind(obj) obj:bind_object(anomaly_zone_binder(obj)) end class "anomaly_zone_binder" (object_binder) function anomaly_zone_binder:__init(obj) super(obj) self.ini = obj:spawn_ini() if not self.ini:section_exist(ANOMAL_ZONE_SECT) then printf( "[anomal_zone %s] no configuration!", obj:name() ) self.disabled = true return end local filename = utils.cfg_get_string(self.ini, ANOMAL_ZONE_SECT, "cfg", nil, false, "", nil) if filename then self.ini = ini_file(filename) end local ini = self.ini self.artefact_ways_by_id = {} self.artefact_points_by_id = {} self.disabled = false self.turned_off = false self.artefacts_table = {} self.start_artefacts_table = {} self.artefacts_coeff_table = {} self.path_table = {} self.fields_table = {} self.mines_table = {} self.respawn_tries_table = {} self.max_artefacts_table = {} self.forces_table = {} self.spawned_count = 0 self.respawn_artefacts = true self.forced_spawn = false self.forced_spawn_override = false self.forced_artefact = "" self.layers_count = utils.cfg_get_number(ini, ANOMAL_ZONE_SECT, "layers_count", nil, false, 1) self.cur_layer = "layer_"..math.random(1,self.layers_count) self.custom_placement = self.layers_count>1 local def_respawn_tries = utils.cfg_get_number(ini, ANOMAL_ZONE_SECT, "respawn_tries", nil, false, 2) local def_max_artefacts = utils.cfg_get_number(ini, ANOMAL_ZONE_SECT, "max_artefacts", nil, false, 3) local def_app_force_xz = utils.cfg_get_number(ini, ANOMAL_ZONE_SECT, "applying_force_xz", nil, false, 200) local def_app_force_y = utils.cfg_get_number(ini, ANOMAL_ZONE_SECT, "applying_force_y", nil, false, 400) local def_arts = utils.cfg_get_string(ini, ANOMAL_ZONE_SECT, "artefacts", nil, false, "", nil) local def_start_arts = utils.cfg_get_string(ini, ANOMAL_ZONE_SECT, "start_artefact",nil, false, "", nil) local def_ways = utils.cfg_get_string(ini, ANOMAL_ZONE_SECT, "artefact_ways", nil, false, "", nil) local def_field_name = utils.cfg_get_string(ini, ANOMAL_ZONE_SECT, "field_name", nil, false, "", nil) local def_coeff_sect_name= utils.cfg_get_string(ini, ANOMAL_ZONE_SECT, "coeffs_section",nil, false, "", "{+actor_was_in_many_bad_places} coeff2, coeff") local def_coeffs = utils.cfg_get_string(ini, ANOMAL_ZONE_SECT, "coeff", nil, false, "", nil) for i = 1, self.layers_count do local section = "layer_"..i self.respawn_tries_table[section] = utils.cfg_get_number(ini, section, "artefact_count", nil, false, def_respawn_tries) self.respawn_tries_table[section] = utils.cfg_get_number(ini, section, "respawn_tries", nil, false, self.respawn_tries_table[section]) self.max_artefacts_table[section] = utils.cfg_get_number(ini, section, "max_artefacts", nil, false, def_max_artefacts) self.forces_table[section] = {} self.forces_table[section].xz = utils.cfg_get_number(ini, section, "applying_force_xz", nil, false, def_app_force_xz) self.forces_table[section].y = utils.cfg_get_number(ini, section, "applying_force_y", nil, false, def_app_force_y) local arts = utils.cfg_get_string(ini, section, "artefacts", nil, false, "", def_arts) if arts == nil then abort("There is no field 'artefacts' in section [%s] in obj [%s]", section, obj:name()) end self.artefacts_table[section] = parse_names(arts) local start_arts = utils.cfg_get_string(ini, section, "start_artefact", nil, false, "", def_start_arts) if start_arts ~= nil then self.forced_spawn = true self.start_artefacts_table[section] = parse_names(start_arts) end local coeffs_section = utils.cfg_get_string(ini, section, "coeffs_section", nil, false, "", def_coeff_sect_name) local parsed_condlist = xr_logic.parse_condlist(nil, "anomal_zone_binder", "coeff_condlist", coeffs_section) local coeffs_sect_name = xr_logic.pick_section_from_condlist(get_story_object("actor"), nil, parsed_condlist) local coeffs = utils.cfg_get_string(ini, section, coeffs_sect_name, nil, false, "", def_coeffs) if coeffs ~= nil then self.artefacts_coeff_table[section] = parse_nums(coeffs) else self.artefacts_coeff_table[section] = {} end local path = utils.cfg_get_string(ini, section, "artefact_ways", nil, false, "", def_ways) if path == nil then abort("There is no field 'artefact_ways' in section [%s] in obj [%s]", section, obj:name()) end self.path_table[section] = parse_names(path) if #self.path_table[section] < self.max_artefacts_table[section] then --abort("Not enough ways for anomal zone [%s], in section [%s], must be at least [%s]", tostring(obj:name()), tostring(section), tostring(self.max_artefacts_table[section])) end if(self.custom_placement) then local field = utils.cfg_get_string(ini, section, "field_name", nil, false, "", def_field_name) if field == nil then --abort("There is no field 'field_name' in section [%s] in obj [%s]", section, obj:name()) self.fields_table[section] = {} else self.fields_table[section] = parse_names(field)--field end local mines_section = utils.cfg_get_string(ini, section, "mines_section", nil, true, "", nil) if mines_section == nil then abort("There is no field 'mines_section' in section [%s] in obj [%s]", section, obj:name()) end if ini:line_count(mines_section) == 0 then --abort("There is no 'mines_names' in section [%s] in obj [%s]", mines_section, obj:name()) end self.mines_table[section] = {} if ini:line_count(mines_section) > 0 then for i = 0, ini:line_count(mines_section)-1 do temp1, mine_name, temp2 = ini:r_line(mines_section, i, "", "") table.insert(self.mines_table[section],mine_name) end end end end self.respawn_tries = self.respawn_tries_table[self.cur_layer] self.max_artefacts = self.max_artefacts_table[self.cur_layer] self.applying_force_xz = self.forces_table[self.cur_layer].xz self.applying_force_y = self.forces_table[self.cur_layer].y end function anomaly_zone_binder:disable_anomaly_fields() if not(self.custom_placement) then self.disabled = true return end local layer = self.cur_layer local anom_fields = bind_anomaly_field.fields_by_names local counter = 0 for k,v in pairs(self.fields_table) do if(k~=layer) then for kk, vv in pairs(self.fields_table[k]) do if(anom_fields[vv]~=nil) then anom_fields[vv]:set_enable(false) else counter = counter + 1 end end end end for k,v in pairs(self.mines_table) do if(k~=layer) then for kk,vv in pairs(self.mines_table[k]) do if(anom_fields[vv]~=nil) then anom_fields[vv]:set_enable(false) else counter = counter + 1 end end end end if(counter==0) then self.disabled = true end if not self.turned_off then for kk, vv in pairs(self.fields_table[layer]) do if(anom_fields[vv]~=nil) then anom_fields[vv]:set_enable(true) end end for kk,vv in pairs(self.mines_table[layer]) do if(anom_fields[vv]~=nil) then anom_fields[vv]:set_enable(true) end end end end function anomaly_zone_binder:respawn_artefacts_and_replace_anomaly_zone() local anom_fields = bind_anomaly_field.fields_by_names self.respawn_artefacts = true if(self.custom_placement) then local layer = self.cur_layer for k,v in pairs(self.fields_table[layer]) do if(anom_fields[v]~=nil) then anom_fields[v]:set_enable(false) end end for k,v in pairs(self.mines_table[layer]) do if(anom_fields[v]~=nil) then anom_fields[v]:set_enable(false) end end layer = "layer_"..math.random(1,self.layers_count) for k,v in pairs(self.fields_table[layer]) do if(anom_fields[v]~=nil) then anom_fields[v]:set_enable(true) end end for k,v in pairs(self.mines_table[layer]) do if(anom_fields[v]~=nil) then anom_fields[v]:set_enable(true) end end self.cur_layer = layer self.respawn_tries = self.respawn_tries_table[self.cur_layer] self.max_artefacts = self.max_artefacts_table[self.cur_layer] self.applying_force_xz = self.forces_table[self.cur_layer].xz self.applying_force_y = self.forces_table[self.cur_layer].y end end function anomaly_zone_binder:spawn_artefact_randomly() local layer = self.cur_layer local rnd_artefact if self.forced_spawn_override then rnd_artefact = self.forced_artefact self.forced_spawn_override = false elseif self.forced_spawn then rnd_artefact = self.start_artefacts_table[layer][#self.start_artefacts_table[layer]] self.forced_spawn = false else if math.random(1,100) > 17 then return end local coeff_total = 0 for k, v in pairs(self.artefacts_coeff_table[layer]) do coeff_total = coeff_total + v end if coeff_total == 0 then for i = 1, #self.artefacts_table[layer] do self.artefacts_coeff_table[layer][i] = 1 coeff_total = coeff_total + 1 end end local rnd = math.random(1, coeff_total) for i = 1, #self.artefacts_table[layer] do local chance = self.artefacts_coeff_table[layer][i] if rnd <= chance then rnd_artefact = self.artefacts_table[layer][i] break end rnd = rnd - chance end end local rnd_path_name = self:get_artefact_path() local rnd_path = patrol(rnd_path_name) local rnd_path_point = math.random(0, rnd_path:count() - 1) local artefact_obj = alife():create( rnd_artefact, rnd_path:point(rnd_path_point), self.object:level_vertex_id(), self.object:game_vertex_id()) artefact_ways_by_id[artefact_obj.id] = rnd_path_name artefact_points_by_id[artefact_obj.id] = rnd_path_point self.artefact_ways_by_id[artefact_obj.id] = rnd_path_name self.artefact_points_by_id[artefact_obj.id] = rnd_path_point parent_zones_by_artefact_id[artefact_obj.id] = self self.spawned_count = self.spawned_count + 1 end function anomaly_zone_binder:get_artefact_path() local temp_table = {} for k,v in pairs(self.path_table[self.cur_layer]) do local f_spawned = false for kk,vv in pairs(self.artefact_ways_by_id) do if vv ~= nil and v == vv then f_spawned = true end end if not f_spawned then table.insert(temp_table, v) end end if #temp_table < 1 then --abort("No free way to spawn artefact in anomal zone [%s]", tostring(self.object:name())) return self.path_table[self.cur_layer][math.random(1, #self.path_table[self.cur_layer])] end local rnd_path_name = temp_table[math.random(1, #temp_table)] return rnd_path_name end function anomaly_zone_binder:set_forced_override(artefact_name) self.forced_artefact = artefact_name self.forced_spawn_override = true printf("set forced override for zone [%s], artefact [%s]", tostring(self.object:name()), tostring(artefact_name)) end function anomaly_zone_binder:reload(section) object_binder.reload(self, section) end function anomaly_zone_binder:reinit() object_binder.reinit(self) db.storage[self.object:id()] = {} self.st = db.storage[self.object:id()] end function anomaly_zone_binder:net_spawn(server_object) if not object_binder.net_spawn(self, server_object) then return false end db.add_anomaly(self) db.add_obj(self.object) return true end function anomaly_zone_binder:net_destroy() db.del_anomaly(self) db.del_obj(self.object) db.storage[self.object:id()] = nil object_binder.net_destroy(self) end function anomaly_zone_binder:update(delta) object_binder.update(self, delta) if (not self.turned_off) and (self.spawned_count < self.max_artefacts) and self.respawn_artefacts then local cnt = self.respawn_tries if cnt > self.max_artefacts - self.spawned_count then cnt = self.max_artefacts - self.spawned_count end if cnt ~= 0 then for i=1, cnt do self:spawn_artefact_randomly() end end self.respawn_artefacts = false elseif (not self.turned_off) and (self.spawned_count >= self.max_artefacts) and self.respawn_artefacts then self.respawn_artefacts = false end if not(self.disabled) then self:disable_anomaly_fields() end end function anomaly_zone_binder:turn_off() self.turned_off = true self:disable_anomaly_fields() for k,v in pairs(self.artefact_ways_by_id) do alife():release(alife():object(tonumber(k)), true) artefact_ways_by_id[k] = nil artefact_points_by_id[k] = nil parent_zones_by_artefact_id[k] = nil end self.spawned_count = 0 self.artefact_ways_by_id = {} self.artefact_points_by_id = {} end function anomaly_zone_binder:turn_on(f_af) self.turned_off = false self:disable_anomaly_fields() if f_af then self.respawn_artefacts = true else self.respawn_artefacts = false end end function anomaly_zone_binder:on_artefact_take(obj) local id if(type(obj.id)=="number") then id = obj.id else id = obj:id() end artefact_ways_by_id[id] = nil artefact_points_by_id[id] = nil self.artefact_ways_by_id[id] = nil self.artefact_points_by_id[id] = nil self.spawned_count = self.spawned_count - 1 pda.change_anomalies_names() end -- Standart function for save function anomaly_zone_binder:net_save_relevant() return true end -- Saving anomaly zone function anomaly_zone_binder:save(thread) set_save_marker(thread, "save", false, "anomaly_zone_binder") object_binder.save(self, thread) local count = 0 for k,v in pairs(self.artefact_ways_by_id) do count = count + 1 end thread:w_u16(count) for k,v in pairs(self.artefact_ways_by_id) do thread:w_u16(k) thread:w_stringZ(v) end ----------------optimize this--------------------------------------------------- local count = 0 for k,v in pairs(self.artefact_points_by_id) do count = count + 1 end thread:w_u16(count) for k,v in pairs(self.artefact_points_by_id) do thread:w_u16(k) thread:w_u8(v) end -------------------------------------------------------------------------------- thread:w_u8(self.spawned_count) thread:w_bool(self.respawn_artefacts) thread:w_bool(self.forced_spawn) thread:w_bool(self.forced_spawn_override) thread:w_stringZ(self.forced_artefact) local layer_num = tonumber(string.sub(self.cur_layer, string.find(self.cur_layer, "_")+1, string.len(self.cur_layer))) if(layer_num) then thread:w_u8(layer_num) else thread:w_u8(-1) end thread:w_bool(self.turned_off) set_save_marker(thread, "save", true, "anomaly_zone_binder") end -- Loading anomaly zone function anomaly_zone_binder:load(thread) set_save_marker(thread, "load", false, "anomaly_zone_binder") object_binder.load(self, thread) local count = thread:r_u16() for i=1,count do local art_id = thread:r_u16() local way_name = thread:r_stringZ() artefact_ways_by_id[art_id] = way_name self.artefact_ways_by_id[art_id] = way_name parent_zones_by_artefact_id[art_id] = self end ----------------optimize this--------------------------------------------------- local count = thread:r_u16() for i=1,count do local art_id = thread:r_u16() local point_name = thread:r_u8() artefact_points_by_id[art_id] = point_name self.artefact_points_by_id[art_id] = point_name end -------------------------------------------------------------------------------- self.spawned_count = thread:r_u8() self.respawn_artefacts = thread:r_bool() self.forced_spawn = thread:r_bool() self.forced_spawn_override = thread:r_bool() self.forced_artefact = thread:r_stringZ() local layer_num = thread:r_u8() if(layer_num~=255) then self.cur_layer = "layer_"..layer_num end self.turned_off = thread:r_bool() set_save_marker(thread, "load", true, "anomaly_zone_binder") end
1
0.966378
1
0.966378
game-dev
MEDIA
0.735045
game-dev
0.976491
1
0.976491
brandonmousseau/vhvr-mod
5,600
Unity/ValheimVR/Assets/SteamVR/Input/SteamVR_ActionSet_Manager.cs
//======= Copyright (c) Valve Corporation, All rights reserved. =============== using UnityEngine; using System.Collections; using System; using Valve.VR; using System.Runtime.InteropServices; using System.Collections.Generic; using System.Text; namespace Valve.VR { /// <summary> /// Action sets are logical groupings of actions. Multiple sets can be active at one time. /// </summary> public static class SteamVR_ActionSet_Manager { public static VRActiveActionSet_t[] rawActiveActionSetArray; [NonSerialized] private static uint activeActionSetSize; private static bool changed = false; public static void Initialize() { activeActionSetSize = (uint)(Marshal.SizeOf(typeof(VRActiveActionSet_t))); } /// <summary> /// Disable all known action sets. /// </summary> public static void DisableAllActionSets() { for (int actionSetIndex = 0; actionSetIndex < SteamVR_Input.actionSets.Length; actionSetIndex++) { SteamVR_Input.actionSets[actionSetIndex].Deactivate(SteamVR_Input_Sources.Any); SteamVR_Input.actionSets[actionSetIndex].Deactivate(SteamVR_Input_Sources.LeftHand); SteamVR_Input.actionSets[actionSetIndex].Deactivate(SteamVR_Input_Sources.RightHand); } } private static int lastFrameUpdated; public static void UpdateActionStates(bool force = false) { if (force || Time.frameCount != lastFrameUpdated) { lastFrameUpdated = Time.frameCount; if (changed) { UpdateActionSetsArray(); } if (rawActiveActionSetArray != null && rawActiveActionSetArray.Length > 0) { if (OpenVR.Input != null) { EVRInputError err = OpenVR.Input.UpdateActionState(rawActiveActionSetArray, activeActionSetSize); if (err != EVRInputError.None) Debug.LogError("<b>[SteamVR]</b> UpdateActionState error: " + err.ToString()); //else Debug.Log("Action sets activated: " + activeActionSets.Length); } } else { //Debug.LogWarning("No sets active"); } } } public static void SetChanged() { changed = true; } private static void UpdateActionSetsArray() { List<VRActiveActionSet_t> activeActionSetsList = new List<VRActiveActionSet_t>(); SteamVR_Input_Sources[] sources = SteamVR_Input_Source.GetAllSources(); for (int actionSetIndex = 0; actionSetIndex < SteamVR_Input.actionSets.Length; actionSetIndex++) { SteamVR_ActionSet set = SteamVR_Input.actionSets[actionSetIndex]; for (int sourceIndex = 0; sourceIndex < sources.Length; sourceIndex++) { SteamVR_Input_Sources source = sources[sourceIndex]; if (set.ReadRawSetActive(source)) { VRActiveActionSet_t activeSet = new VRActiveActionSet_t(); activeSet.ulActionSet = set.handle; activeSet.nPriority = set.ReadRawSetPriority(source); activeSet.ulRestrictedToDevice = SteamVR_Input_Source.GetHandle(source); int insertionIndex = 0; for (insertionIndex = 0; insertionIndex < activeActionSetsList.Count; insertionIndex++) { if (activeActionSetsList[insertionIndex].nPriority > activeSet.nPriority) break; } activeActionSetsList.Insert(insertionIndex, activeSet); } } } changed = false; rawActiveActionSetArray = activeActionSetsList.ToArray(); if (Application.isEditor || updateDebugTextInBuilds) UpdateDebugText(); } public static SteamVR_ActionSet GetSetFromHandle(ulong handle) { for (int actionSetIndex = 0; actionSetIndex < SteamVR_Input.actionSets.Length; actionSetIndex++) { SteamVR_ActionSet set = SteamVR_Input.actionSets[actionSetIndex]; if (set.handle == handle) return set; } return null; } public static string debugActiveSetListText; public static bool updateDebugTextInBuilds = false; private static void UpdateDebugText() { StringBuilder stringBuilder = new StringBuilder(); for (int activeIndex = 0; activeIndex < rawActiveActionSetArray.Length; activeIndex++) { VRActiveActionSet_t set = rawActiveActionSetArray[activeIndex]; stringBuilder.Append(set.nPriority); stringBuilder.Append("\t"); stringBuilder.Append(SteamVR_Input_Source.GetSource(set.ulRestrictedToDevice)); stringBuilder.Append("\t"); stringBuilder.Append(GetSetFromHandle(set.ulActionSet).GetShortName()); stringBuilder.Append("\n"); } debugActiveSetListText = stringBuilder.ToString(); } } }
1
0.707623
1
0.707623
game-dev
MEDIA
0.934896
game-dev
0.681974
1
0.681974
serpentiem/ddmk
3,118
Eva/Eva.cpp
import Core; import Core_Input; #include "../Core/Macros.h" import Windows; using namespace Windows; import Actor; import Arcade; import Config; import Event; import Global; import Graphics; import Hooks; import HUD; import Internal; import Training; import Vars; import Window; #define debug false uint32 DllMain ( HINSTANCE instance, uint32 reason, LPVOID reserved ) { if (reason == DLL_PROCESS_ATTACH) { InitLog("logs", "Eva.txt"); Log("Session started."); if (!Core_Memory_Init()) { Log("Core_Memory_Init failed."); return 0; } if (!memoryData.InitData(64 * 1024 * 1024)) { Log("memoryData.InitData failed."); return 0; } SetMemory ( memoryData.dataAddr, 0xCC, memoryData.dataSize ); if (!protectionHelper.Init(4096)) { Log("protectionHelper.Init failed."); return 0; } if ( !backupHelper.Init ( (8 * 1024 * 1024), (1 * 1024 * 1024) ) ) { Log("backupHelper.Init failed."); return 0; } InitConfig(); LoadConfig(); Internal_Init(); ToggleForceEdgeFixes(false); ToggleForceEdgeFixes(activeConfig.enableForceEdgeFixes); ToggleSpardaFixes(false); ToggleSpardaFixes(activeConfig.enableSpardaFixes); ToggleYamatoFixes(false); ToggleYamatoFixes(activeConfig.enableYamatoFixes); ToggleAirHikeCoreAbility(false); ToggleAirHikeCoreAbility(activeConfig.airHikeCoreAbility); ToggleInfiniteRoundTrip(false); ToggleInfiniteRoundTrip(activeConfig.infiniteRoundTrip); ToggleMeleeWeaponSwitchController(false); ToggleMeleeWeaponSwitchController(activeConfig.enableMeleeWeaponSwitchController); ToggleRangedWeaponSwitchController(false); ToggleRangedWeaponSwitchController(activeConfig.enableRangedWeaponSwitchController); ToggleChargeFixes(false); ToggleChargeFixes(activeConfig.enableChargeController); Arcade::Toggle(false); Arcade::Toggle(activeConfig.Arcade.enable); ToggleSkipIntro(false); ToggleSkipIntro(activeConfig.skipIntro); ToggleDisablePauseRestrictions(false); ToggleDisablePauseRestrictions(activeConfig.disablePauseRestrictions); ToggleForceWindowFocus(false); ToggleForceWindowFocus(activeConfig.forceWindowFocus); ToggleInfiniteHitPoints(false); ToggleInfiniteHitPoints(activeConfig.infiniteHitPoints); ToggleInfiniteMagicPoints(false); ToggleInfiniteMagicPoints(activeConfig.infiniteMagicPoints); ToggleDisableTimer(false); ToggleDisableTimer(activeConfig.disableTimer); Event::Toggle(false); Event::Toggle(true); ToggleAutoExamine(false); ToggleSkipText (false); ToggleDisablePlayerActorIdleTimer(false); ToggleDisablePlayerActorIdleTimer(activeConfig.disablePlayerActorIdleTimer); ToggleScreenEffectForceMaxTimer(false); ToggleScreenEffectForceMaxTimer(activeConfig.screenEffectForceMaxTimer); ToggleForceVisibleHUD(false); ToggleForceVisibleHUD(activeConfig.forceVisibleHUD); XI::new_Init("xinput9_1_0.dll"); Hooks::Init(); // Remove Labels SetMemory ( (appBaseAddr + 0x50CDE6), 0, 35, MemoryFlags_VirtualProtectDestination ); } return 1; }
1
0.887832
1
0.887832
game-dev
MEDIA
0.847641
game-dev
0.940129
1
0.940129
typesafehub/ReactiveMaps
2,969
test/assets/javascripts/map/MarkerSpec.coffee
# Mocks class MockPromise constructor: (value) -> @value = value done: (callback) -> callback(@value) class LatLng constructor: (lat, lng) -> @lat = lat @lng = lng class MockPopup constructor: (content) -> @content = content setContent: (content) -> @content = content @ update: -> class MockMarker constructor: (latLng, options) -> @latLng = latLng @options = options bindPopup: (content) -> @popup = new MockPopup(content) getPopup: -> @popup setLatLng: (latLng) -> @latLng = latLng setIcon: (icon) -> @options.icon = icon addTo: (map) -> @addedTo = map on: (type, callback) -> @onClick = callback class MockMarkerRenderer renderPopup: (userId) -> "Popup " + userId createClusterMarkerIcon: (count) -> "cluster of " + count resetTranstion: -> transition: -> class MockLeaflet Marker: MockMarker LatLng: LatLng class MockMap testMarker = (test) -> (done) -> # Create mocks leaflet = new MockLeaflet() renderer = new MockMarkerRenderer() # Mockout require js environment new Squire() .mock("markerRenderer", renderer) .mock("leaflet", leaflet) .require ["javascripts/map/marker"], (Marker) -> test({ leaflet: leaflet, renderer: renderer, }, Marker) done() cluster = { properties: { count: 10 timestamp: 0 } id: "somecluster" } single = { properties: { timestamp: 0 } id: "userid" } describe "Marker", -> it "should create a single marker", testMarker (deps, Marker) -> marker = new Marker(new MockMap(), single, new LatLng(10, 20)) assert.equal(single, marker.feature) assert.deepEqual(new LatLng(10, 20), marker.marker.latLng) assert.equal("Popup userid", marker.marker.popup.content) it "should create a cluster marker", testMarker (deps, Marker) -> marker = new Marker(new MockMap(), cluster, new LatLng(10, 20)) assert.equal(cluster, marker.feature) assert.deepEqual(new LatLng(10, 20), marker.marker.latLng) assert.equal("cluster of 10", marker.marker.options.icon) it "should add it to the map", testMarker (deps, Marker) -> map = new MockMap() marker = new Marker(map, single, new LatLng(10, 20)) assert.equal(map, marker.marker.addedTo) it "should update the position", testMarker (deps, Marker) -> marker = new Marker(new MockMap(), single, new LatLng(10, 20)) marker.update({ properties: { timestamp: 0 } id: "userid" }, new LatLng(20, 30)) assert.deepEqual(new LatLng(20, 30), marker.marker.latLng) it "should update the cluster count", testMarker (deps, Marker) -> marker = new Marker(new MockMap(), cluster, new LatLng(10, 20)) marker.update({ properties: { timestamp: 0 count: 20 } id: "somecluster" }, new LatLng(20, 30)) assert.equal("cluster of 20", marker.marker.options.icon)
1
0.858261
1
0.858261
game-dev
MEDIA
0.445071
game-dev,testing-qa
0.821854
1
0.821854
Simplifine-gamedev/orca-engine
3,903
core/debugger/engine_profiler.cpp
/**************************************************************************/ /* engine_profiler.cpp */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* 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. */ /**************************************************************************/ #include "engine_profiler.h" #include "core/debugger/engine_debugger.h" void EngineProfiler::_bind_methods() { GDVIRTUAL_BIND(_toggle, "enable", "options"); GDVIRTUAL_BIND(_add_frame, "data"); GDVIRTUAL_BIND(_tick, "frame_time", "process_time", "physics_time", "physics_frame_time"); } void EngineProfiler::toggle(bool p_enable, const Array &p_array) { GDVIRTUAL_CALL(_toggle, p_enable, p_array); } void EngineProfiler::add(const Array &p_data) { GDVIRTUAL_CALL(_add_frame, p_data); } void EngineProfiler::tick(double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) { GDVIRTUAL_CALL(_tick, p_frame_time, p_process_time, p_physics_time, p_physics_frame_time); } Error EngineProfiler::bind(const String &p_name) { ERR_FAIL_COND_V(is_bound(), ERR_ALREADY_IN_USE); EngineDebugger::Profiler prof( this, [](void *p_user, bool p_enable, const Array &p_opts) { static_cast<EngineProfiler *>(p_user)->toggle(p_enable, p_opts); }, [](void *p_user, const Array &p_data) { static_cast<EngineProfiler *>(p_user)->add(p_data); }, [](void *p_user, double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) { static_cast<EngineProfiler *>(p_user)->tick(p_frame_time, p_process_time, p_physics_time, p_physics_frame_time); }); registration = p_name; EngineDebugger::register_profiler(p_name, prof); return OK; } Error EngineProfiler::unbind() { ERR_FAIL_COND_V(!is_bound(), ERR_UNCONFIGURED); EngineDebugger::unregister_profiler(registration); registration.clear(); return OK; } EngineProfiler::~EngineProfiler() { if (is_bound()) { unbind(); } }
1
0.731831
1
0.731831
game-dev
MEDIA
0.368898
game-dev
0.747005
1
0.747005
fabiensanglard/libRealSpace
1,328
src/sc/AssetManager.cpp
// // AssetManager.cpp // libRealSpace // // Created by Fabien Sanglard on 1/25/2014. // Copyright (c) 2014 Fabien Sanglard. All rights reserved. // #include "precomp.h" typedef struct TreNameID{ AssetManager::TreID id ; const char* filename; } TreNameID; #define NUM_TRES 6 TreNameID nameIds[NUM_TRES] = { {AssetManager::TRE_GAMEFLOW,"GAMEFLOW.TRE"}, {AssetManager::TRE_OBJECTS,"OBJECTS.TRE"}, {AssetManager::TRE_MISC,"MISC.TRE"}, {AssetManager::TRE_SOUND,"SOUND.TRE"}, {AssetManager::TRE_MISSIONS,"MISSIONS.TRE"}, {AssetManager::TRE_TEXTURES,"TEXTURES.TRE"} }; void AssetManager::SetBase(const char* newBase){ ::SetBase(newBase); } void AssetManager::Init(void){ //Load all TRE in RAM and store them. for (size_t i =0 ; i < NUM_TRES; i++) { TreArchive* tre = new TreArchive(); tre->InitFromFile(nameIds[i].filename); if (tre->IsValid()) this->tres.push_back(tre); else{ Game.Terminate("Unable to load asset '%s' (Did you set the SC base folder ?).",nameIds[i].filename); } } } AssetManager::AssetManager(){ } AssetManager::~AssetManager(){ while(!tres.empty()){ TreArchive* tre = tres.back(); tres.pop_back(); delete tre; } }
1
0.986362
1
0.986362
game-dev
MEDIA
0.945157
game-dev
0.973411
1
0.973411
wormtql/genshin_artifact
2,662
src/composables/weapon.ts
import type {WeaponName, WeaponType} from "@/types/weapon" // @ts-ignore import {weaponByType, weaponData} from "@weapon" import {type Ref} from "vue" import {useI18n} from "@/i18n/i18n"; export function useWeapon(weaponType: null | Ref<WeaponType>) { const weaponName = ref<WeaponName>("PolarStar") const weaponLevel = ref("90") const weaponRefine = ref(1) const weaponConfig = ref<any>({ "PolarStar": { stack: 1 } }) const weaponLevelNumber = computed(() => { return parseInt(weaponLevel.value) }) const weaponAscend = computed(() => { return weaponLevel.value.includes("+") }) const weaponSplash = computed(() => { const data = weaponData[weaponName.value] return data.gacha ?? data.url ?? data.tn }) const weaponNeedConfig = computed(() => { return !!weaponData[weaponName.value].configs }) const weaponConfigConfig = computed(() => { return weaponData[weaponName.value].configs }) const weaponInterface = computed(() => { return { name: weaponName.value, level: weaponLevelNumber.value, ascend: weaponAscend.value, refine: weaponRefine.value, params: weaponConfig.value } }) // function changeWeapon(name: WeaponName) { // // } if (weaponType) { watch(() => weaponType.value, newWeaponType => { const defaultWeaponData = weaponByType[newWeaponType][0] weaponName.value = defaultWeaponData.name }, { flush: "sync" }) } watch(() => weaponName.value, name => { weaponName.value = name // change config const hasConfig = !!weaponData[name]?.configs if (hasConfig) { const configs = weaponData[name].configs let defaultConfig: any = {} for (let config of configs) { defaultConfig[config.name] = config.default } weaponConfig.value = { [name]: defaultConfig } } else { weaponConfig.value = "NoConfig" } }, { flush: "sync" }) const { ta } = useI18n() const weaponLocale = computed(() => { return ta(weaponData[weaponName.value].nameLocale) }) return { weaponName, weaponLevel, weaponRefine, weaponConfig, weaponLevelNumber, weaponAscend, weaponSplash, weaponNeedConfig, weaponConfigConfig, weaponInterface, weaponLocale // changeWeapon } }
1
0.765977
1
0.765977
game-dev
MEDIA
0.941936
game-dev
0.576924
1
0.576924
gavilanch/MinimalApisMoviesEFCore
1,334
ASP.NET Core 9/Module 8 - Advanced Scenarios/Start/MinimalAPIsMovies/Utilities/AutoMapperProfiles.cs
using AutoMapper; using MinimalAPIsMovies.DTOs; using MinimalAPIsMovies.Entities; namespace MinimalAPIsMovies.Utilities { public class AutoMapperProfiles: Profile { public AutoMapperProfiles() { CreateMap<Genre, GenreDTO>(); CreateMap<CreateGenreDTO, Genre>(); CreateMap<Actor, ActorDTO>(); CreateMap<CreateActorDTO, Actor>() .ForMember(p => p.Picture, options => options.Ignore()); CreateMap<Movie, MovieDTO>() .ForMember(x => x.Genres, entity => entity.MapFrom(p => p.GenresMovies .Select(gm => new GenreDTO { Id = gm.GenreId, Name = gm.Genre.Name }))) .ForMember(x => x.Actors, entity => entity.MapFrom(p => p.ActorsMovies.Select(am => new ActorMovieDTO { Id = am.ActorId, Name = am.Actor.Name, Character = am.Character }))); CreateMap<CreateMovieDTO, Movie>() .ForMember(p => p.Poster, options => options.Ignore()); CreateMap<Comment, CommentDTO>(); CreateMap<CreateCommentDTO, Comment>(); CreateMap<AssignActorMovieDTO, ActorMovie>(); } } }
1
0.754964
1
0.754964
game-dev
MEDIA
0.856142
game-dev
0.754185
1
0.754185
wled/WLED
6,453
usermods/TetrisAI_v2/tetrisai.h
/****************************************************************************** * @file : ai.h * @brief : contains the heuristic ****************************************************************************** * @attention * * Copyright (c) muebau 2023 * All rights reserved.</center></h2> * ****************************************************************************** */ #ifndef __AI_H__ #define __AI_H__ #include "gridbw.h" #include "rating.h" using namespace std; class TetrisAI { private: public: float aHeight; float fullLines; float holes; float bumpiness; bool findWorstMove = false; uint8_t countOnes(uint32_t vector) { uint8_t count = 0; while (vector) { vector &= (vector - 1); count++; } return count; } void updateRating(GridBW grid, Rating* rating) { rating->minHeight = 0; rating->maxHeight = 0; rating->holes = 0; rating->fullLines = 0; rating->bumpiness = 0; rating->aggregatedHeight = 0; fill(rating->lineHights.begin(), rating->lineHights.end(), 0); uint32_t columnvector = 0x0; uint32_t lastcolumnvector = 0x0; for (uint8_t row = 0; row < grid.height; row++) { columnvector |= grid.pixels[row]; //first (highest) column makes it if (rating->maxHeight == 0 && columnvector) { rating->maxHeight = grid.height - row; } //if column vector is full we found the minimal height (or it stays zero) if (rating->minHeight == 0 && (columnvector == (uint32_t)((1 << grid.width) - 1))) { rating->minHeight = grid.height - row; } //line full if all ones in mask :-) if (grid.isLineFull(row)) { rating->fullLines++; } //holes are basically a XOR with the "full" columns rating->holes += countOnes(columnvector ^ grid.pixels[row]); //calculate the difference (XOR) between the current column vector and the last one uint32_t columnDelta = columnvector ^ lastcolumnvector; //process every new column uint8_t index = 0; while (columnDelta) { //if this is a new column if (columnDelta & 0x1) { //update hight of this column rating->lineHights[(grid.width - 1) - index] = grid.height - row; // update aggregatedHeight rating->aggregatedHeight += grid.height - row; } index++; columnDelta >>= 1; } lastcolumnvector = columnvector; } //compare every two columns to get the difference and add them up for (uint8_t column = 1; column < grid.width; column++) { rating->bumpiness += abs(rating->lineHights[column - 1] - rating->lineHights[column]); } rating->score = (aHeight * (rating->aggregatedHeight)) + (fullLines * (rating->fullLines)) + (holes * (rating->holes)) + (bumpiness * (rating->bumpiness)); } TetrisAI(): TetrisAI(-0.510066f, 0.760666f, -0.35663f, -0.184483f) {} TetrisAI(float aHeight, float fullLines, float holes, float bumpiness): aHeight(aHeight), fullLines(fullLines), holes(holes), bumpiness(bumpiness) {} void findBestMove(GridBW grid, Piece *piece) { vector<Piece> pieces = {*piece}; findBestMove(grid, &pieces); *piece = pieces[0]; } void findBestMove(GridBW grid, std::vector<Piece> *pieces) { findBestMove(grid, pieces->begin(), pieces->end()); } void findBestMove(GridBW grid, std::vector<Piece>::iterator start, std::vector<Piece>::iterator end) { Rating bestRating(grid.width); findBestMove(grid, start, end, &bestRating); } void findBestMove(GridBW grid, std::vector<Piece>::iterator start, std::vector<Piece>::iterator end, Rating* bestRating) { grid.cleanupFullLines(); Rating curRating(grid.width); Rating deeperRating(grid.width); Piece piece = *start; // for every rotation of the piece for (piece.rotation = 0; piece.rotation < piece.pieceData->rotCount; piece.rotation++) { // put piece to top left corner piece.x = 0; piece.y = 0; //test for every column for (piece.x = 0; piece.x <= grid.width - piece.getRotation().width; piece.x++) { //todo optimise by the use of the previous grids height piece.landingY = 0; //will set landingY to final position grid.findLandingPosition(&piece); // draw piece grid.placePiece(&piece, piece.x, piece.landingY); if(start == end - 1) { //at the deepest level updateRating(grid, &curRating); } else { //go deeper to take another piece into account findBestMove(grid, start + 1, end, &deeperRating); curRating = deeperRating; } // eraese piece grid.erasePiece(&piece, piece.x, piece.landingY); if(findWorstMove) { //init rating for worst if(bestRating->score == -FLT_MAX) { bestRating->score = FLT_MAX; } // update if we found a worse one if (bestRating->score > curRating.score) { *bestRating = curRating; (*start) = piece; } } else { // update if we found a better one if (bestRating->score < curRating.score) { *bestRating = curRating; (*start) = piece; } } } } } }; #endif /* __AI_H__ */
1
0.936261
1
0.936261
game-dev
MEDIA
0.599833
game-dev
0.96714
1
0.96714
kimsama/Unity-RxSamples
7,053
Assets/Plugins/UniRx/Scripts/Operators/Catch.cs
using System; using System.Collections.Generic; namespace UniRx.Operators { internal class CatchObservable<T, TException> : OperatorObservableBase<T> where TException : Exception { readonly IObservable<T> source; readonly Func<TException, IObservable<T>> errorHandler; public CatchObservable(IObservable<T> source, Func<TException, IObservable<T>> errorHandler) : base(source.IsRequiredSubscribeOnCurrentThread()) { this.source = source; this.errorHandler = errorHandler; } protected override IDisposable SubscribeCore(IObserver<T> observer, IDisposable cancel) { return new Catch(this, observer, cancel).Run(); } class Catch : OperatorObserverBase<T, T> { readonly CatchObservable<T, TException> parent; SingleAssignmentDisposable sourceSubscription; SingleAssignmentDisposable exceptionSubscription; public Catch(CatchObservable<T, TException> parent, IObserver<T> observer, IDisposable cancel) : base(observer, cancel) { this.parent = parent; } public IDisposable Run() { this.sourceSubscription = new SingleAssignmentDisposable(); this.exceptionSubscription = new SingleAssignmentDisposable(); this.sourceSubscription.Disposable = parent.source.Subscribe(this); return StableCompositeDisposable.Create(sourceSubscription, exceptionSubscription); } public override void OnNext(T value) { base.observer.OnNext(value); } public override void OnError(Exception error) { var e = error as TException; if (e != null) { IObservable<T> next; try { if (parent.errorHandler == Stubs.CatchIgnore<T>) { next = Observable.Empty<T>(); // for avoid iOS AOT } else { next = parent.errorHandler(e); } } catch (Exception ex) { try { observer.OnError(ex); } finally { Dispose(); }; return; } exceptionSubscription.Disposable = next.Subscribe(observer); } else { try { observer.OnError(error); } finally { Dispose(); }; return; } } public override void OnCompleted() { try { observer.OnCompleted(); } finally { Dispose(); }; } } } internal class CatchObservable<T> : OperatorObservableBase<T> { readonly IEnumerable<IObservable<T>> sources; public CatchObservable(IEnumerable<IObservable<T>> sources) : base(true) { this.sources = sources; } protected override IDisposable SubscribeCore(IObserver<T> observer, IDisposable cancel) { return new Catch(this, observer, cancel).Run(); } class Catch : OperatorObserverBase<T, T> { readonly CatchObservable<T> parent; readonly object gate = new object(); bool isDisposed; IEnumerator<IObservable<T>> e; SerialDisposable subscription; Exception lastException; Action nextSelf; public Catch(CatchObservable<T> parent, IObserver<T> observer, IDisposable cancel) : base(observer, cancel) { this.parent = parent; } public IDisposable Run() { isDisposed = false; e = parent.sources.GetEnumerator(); subscription = new SerialDisposable(); var schedule = Scheduler.DefaultSchedulers.TailRecursion.Schedule(RecursiveRun); return StableCompositeDisposable.Create(schedule, subscription, Disposable.Create(() => { lock (gate) { this.isDisposed = true; this.e.Dispose(); } })); } void RecursiveRun(Action self) { lock (gate) { nextSelf = self; if (isDisposed) return; var current = default(IObservable<T>); var hasNext = false; var ex = default(Exception); try { hasNext = e.MoveNext(); if (hasNext) { current = e.Current; if (current == null) throw new InvalidOperationException("sequence is null."); } else { e.Dispose(); } } catch (Exception exception) { ex = exception; e.Dispose(); } if (ex != null) { try { observer.OnError(ex); } finally { Dispose(); } return; } if (!hasNext) { if (lastException != null) { try { observer.OnError(lastException); } finally { Dispose(); } } else { try { observer.OnCompleted(); } finally { Dispose(); } } return; } var source = current; var d = new SingleAssignmentDisposable(); subscription.Disposable = d; d.Disposable = source.Subscribe(this); } } public override void OnNext(T value) { base.observer.OnNext(value); } public override void OnError(Exception error) { lastException = error; nextSelf(); } public override void OnCompleted() { try { observer.OnCompleted(); } finally { Dispose(); } return; } } } }
1
0.920025
1
0.920025
game-dev
MEDIA
0.347543
game-dev
0.987293
1
0.987293
alexbatalov/fallout2-re
33,463
src/game/game.c
#include "game/game.h" #include <io.h> #include <stdio.h> #include <string.h> #include "int/window.h" #include "game/actions.h" #include "game/anim.h" #include "game/automap.h" #include "game/editor.h" #include "game/select.h" #include "plib/color/color.h" #include "game/combat.h" #include "game/combatai.h" #include "plib/gnw/input.h" #include "game/critter.h" #include "game/cycle.h" #include "plib/db/db.h" #include "game/bmpdlog.h" #include "plib/gnw/debug.h" #include "game/display.h" #include "plib/gnw/grbuf.h" #include "game/ereg.h" #include "game/endgame.h" #include "game/fontmgr.h" #include "game/gconfig.h" #include "game/gdialog.h" #include "game/gmemory.h" #include "game/gmouse.h" #include "game/gmovie.h" #include "game/gsound.h" #include "game/intface.h" #include "game/inventry.h" #include "game/item.h" #include "game/loadsave.h" #include "game/map.h" #include "plib/gnw/memory.h" #include "int/movie.h" #include "game/moviefx.h" #include "game/object.h" #include "game/options.h" #include "game/palette.h" #include "game/party.h" #include "game/perk.h" #include "game/pipboy.h" #include "game/proto.h" #include "game/queue.h" #include "game/roll.h" #include "game/scripts.h" #include "game/skill.h" #include "game/skilldex.h" #include "game/stat.h" #include "plib/gnw/text.h" #include "game/tile.h" #include "game/trait.h" #include "game/trap.h" #include "game/version.h" #include "plib/gnw/gnw.h" #include "plib/gnw/svga.h" #include "game/worldmap.h" #define HELP_SCREEN_WIDTH 640 #define HELP_SCREEN_HEIGHT 480 #define SPLASH_WIDTH 640 #define SPLASH_HEIGHT 480 #define SPLASH_COUNT 10 static void game_display_counter(double value); static int game_screendump(int width, int height, unsigned char* buffer, unsigned char* palette); static void game_unload_info(); static void game_help(); static int game_init_databases(); static void game_splash_screen(); // TODO: Remove. // 0x501C9C char _aGame_0[] = "game\\"; // TODO: Remove. // 0x5020B8 char _aDec11199816543[] = VERSION_BUILD_TIME; // 0x518688 static FontMgr alias_mgr = { 100, 110, FMtext_font, FMtext_to_buf, FMtext_height, FMtext_width, FMtext_char_width, FMtext_mono_width, FMtext_spacing, FMtext_size, FMtext_max, }; // 0x5186B4 static bool game_ui_disabled = false; // 0x5186B8 static int game_state_cur = GAME_STATE_0; // 0x5186BC static bool game_in_mapper = false; // 0x5186C0 int* game_global_vars = NULL; // 0x5186C4 int num_game_global_vars = 0; // 0x5186C8 const char* msg_path = _aGame_0; // 0x5186CC int game_user_wants_to_quit = 0; // misc.msg // // 0x58E940 MessageList misc_message_file; // master.dat loading result // // 0x58E948 int master_db_handle; // critter.dat loading result // // 0x58E94C int critter_db_handle; // 0x442580 int game_init(const char* windowTitle, bool isMapper, int font, int a4, int argc, char** argv) { char path[MAX_PATH]; if (gmemory_init() == -1) { return -1; } gconfig_init(isMapper, argc, argv); game_in_mapper = isMapper; if (game_init_databases() == -1) { gconfig_exit(false); return -1; } annoy_user(); win_set_minimized_title(windowTitle); initWindow(1, a4); palette_init(); char* language; if (config_get_string(&game_config, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_LANGUAGE_KEY, &language)) { if (stricmp(language, FRENCH) == 0) { kb_set_layout(KEYBOARD_LAYOUT_FRENCH); } else if (stricmp(language, GERMAN) == 0) { kb_set_layout(KEYBOARD_LAYOUT_GERMAN); } else if (stricmp(language, ITALIAN) == 0) { kb_set_layout(KEYBOARD_LAYOUT_ITALIAN); } else if (stricmp(language, SPANISH) == 0) { kb_set_layout(KEYBOARD_LAYOUT_SPANISH); } } if (!game_in_mapper) { game_splash_screen(); } trap_init(); FMInit(); text_add_manager(&alias_mgr); text_font(font); register_screendump(KEY_F12, game_screendump); register_pause(-1, NULL); tile_disable_refresh(); roll_init(); init_message(); skill_init(); stat_init(); if (partyMember_init() != 0) { debug_printf("Failed on partyMember_init\n"); return -1; } perk_init(); trait_init(); item_init(); queue_init(); critter_init(); combat_ai_init(); inven_reset_dude(); if (gsound_init() != 0) { debug_printf("Sound initialization failed.\n"); } debug_printf(">gsound_init\t"); initMovie(); debug_printf(">initMovie\t\t"); if (gmovie_init() != 0) { debug_printf("Failed on gmovie_init\n"); return -1; } debug_printf(">gmovie_init\t"); if (moviefx_init() != 0) { debug_printf("Failed on moviefx_init\n"); return -1; } debug_printf(">moviefx_init\t"); if (iso_init() != 0) { debug_printf("Failed on iso_init\n"); return -1; } debug_printf(">iso_init\t"); if (gmouse_init() != 0) { debug_printf("Failed on gmouse_init\n"); return -1; } debug_printf(">gmouse_init\t"); if (proto_init() != 0) { debug_printf("Failed on proto_init\n"); return -1; } debug_printf(">proto_init\t"); anim_init(); debug_printf(">anim_init\t"); if (scr_init() != 0) { debug_printf("Failed on scr_init\n"); return -1; } debug_printf(">scr_init\t"); if (game_load_info() != 0) { debug_printf("Failed on game_load_info\n"); return -1; } debug_printf(">game_load_info\t"); if (scr_game_init() != 0) { debug_printf("Failed on scr_game_init\n"); return -1; } debug_printf(">scr_game_init\t"); if (wmWorldMap_init() != 0) { debug_printf("Failed on wmWorldMap_init\n"); return -1; } debug_printf(">wmWorldMap_init\t"); CharEditInit(); debug_printf(">CharEditInit\t"); pip_init(); debug_printf(">pip_init\t\t"); InitLoadSave(); KillOldMaps(); debug_printf(">InitLoadSave\t"); if (gdialogInit() != 0) { debug_printf("Failed on gdialog_init\n"); return -1; } debug_printf(">gdialog_init\t"); if (combat_init() != 0) { debug_printf("Failed on combat_init\n"); return -1; } debug_printf(">combat_init\t"); if (automap_init() != 0) { debug_printf("Failed on automap_init\n"); return -1; } debug_printf(">automap_init\t"); if (!message_init(&misc_message_file)) { debug_printf("Failed on message_init\n"); return -1; } debug_printf(">message_init\t"); sprintf(path, "%s%s", msg_path, "misc.msg"); if (!message_load(&misc_message_file, path)) { debug_printf("Failed on message_load\n"); return -1; } debug_printf(">message_load\t"); if (scr_disable() != 0) { debug_printf("Failed on scr_disable\n"); return -1; } debug_printf(">scr_disable\t"); if (init_options_menu() != 0) { debug_printf("Failed on init_options_menu\n"); return -1; } debug_printf(">init_options_menu\n"); if (endgameDeathEndingInit() != 0) { debug_printf("Failed on endgameDeathEndingInit"); return -1; } debug_printf(">endgameDeathEndingInit\n"); return 0; } // 0x442B84 void game_reset() { tile_disable_refresh(); palette_reset(); roll_reset(); skill_reset(); stat_reset(); perk_reset(); trait_reset(); item_reset(); queue_reset(); anim_reset(); KillOldMaps(); critter_reset(); combat_ai_reset(); inven_reset_dude(); gsound_reset(); movieStop(); moviefx_reset(); gmovie_reset(); iso_reset(); gmouse_reset(); proto_reset(); scr_reset(); game_load_info(); scr_game_reset(); wmWorldMap_reset(); partyMember_reset(); CharEditInit(); pip_init(); ResetLoadSave(); gdialogReset(); combat_reset(); game_user_wants_to_quit = 0; automap_reset(); init_options_menu(); } // 0x442C34 void game_exit() { debug_printf("\nGame Exit\n"); tile_disable_refresh(); message_exit(&misc_message_file); combat_exit(); gdialogExit(); scr_game_exit(); // NOTE: Uninline. game_unload_info(); scr_exit(); anim_exit(); proto_exit(); gmouse_exit(); iso_exit(); moviefx_exit(); movieClose(); gsound_exit(); combat_ai_exit(); critter_exit(); item_exit(); queue_exit(); perk_exit(); stat_exit(); skill_exit(); trait_exit(); roll_exit(); exit_message(); automap_exit(); palette_exit(); wmWorldMap_exit(); partyMember_exit(); endgameDeathEndingExit(); FMExit(); trap_exit(); windowClose(); db_exit(); gconfig_exit(true); } // 0x442D44 int game_handle_input(int eventCode, bool isInCombatMode) { // NOTE: Uninline. if (game_state() == GAME_STATE_5) { gdialogSystemEnter(); } if (eventCode == -1) { return 0; } if (eventCode == -2) { int mouseState = mouse_get_buttons(); int mouseX; int mouseY; mouse_get_position(&mouseX, &mouseY); if ((mouseState & MOUSE_EVENT_LEFT_BUTTON_DOWN) != 0) { if ((mouseState & MOUSE_EVENT_LEFT_BUTTON_REPEAT) == 0) { if (mouseX == scr_size.ulx || mouseX == scr_size.lrx || mouseY == scr_size.uly || mouseY == scr_size.lry) { gmouse_clicked_on_edge = true; } else { gmouse_clicked_on_edge = false; } } } else { if ((mouseState & MOUSE_EVENT_LEFT_BUTTON_UP) != 0) { gmouse_clicked_on_edge = false; } } gmouse_handle_event(mouseX, mouseY, mouseState); return 0; } if (gmouse_is_scrolling()) { return 0; } switch (eventCode) { case -20: if (intface_is_enabled()) { intface_use_item(); } break; case -2: if (1) { int mouseEvent = mouse_get_buttons(); int mouseX; int mouseY; mouse_get_position(&mouseX, &mouseY); if ((mouseEvent & MOUSE_EVENT_LEFT_BUTTON_DOWN) != 0) { if ((mouseEvent & MOUSE_EVENT_LEFT_BUTTON_REPEAT) == 0) { if (mouseX == scr_size.ulx || mouseX == scr_size.lrx || mouseY == scr_size.uly || mouseY == scr_size.lry) { gmouse_clicked_on_edge = true; } else { gmouse_clicked_on_edge = false; } } } else { if ((mouseEvent & MOUSE_EVENT_LEFT_BUTTON_UP) != 0) { gmouse_clicked_on_edge = false; } } gmouse_handle_event(mouseX, mouseY, mouseEvent); } break; case KEY_CTRL_Q: case KEY_CTRL_X: case KEY_F10: gsound_play_sfx_file("ib1p1xx1"); game_quit_with_confirm(); break; case KEY_TAB: if (intface_is_enabled() && keys[DIK_LALT] == 0 && keys[DIK_RALT] == 0) { gsound_play_sfx_file("ib1p1xx1"); automap(true, false); } break; case KEY_CTRL_P: gsound_play_sfx_file("ib1p1xx1"); PauseWindow(false); break; case KEY_UPPERCASE_A: case KEY_LOWERCASE_A: if (intface_is_enabled()) { if (!isInCombatMode) { combat(NULL); } } break; case KEY_UPPERCASE_N: case KEY_LOWERCASE_N: if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); intface_toggle_item_state(); } break; case KEY_UPPERCASE_M: case KEY_LOWERCASE_M: gmouse_3d_toggle_mode(); break; case KEY_UPPERCASE_B: case KEY_LOWERCASE_B: // change active hand if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); intface_toggle_items(true); } break; case KEY_UPPERCASE_C: case KEY_LOWERCASE_C: if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); bool isoWasEnabled = map_disable_bk_processes(); editor_design(false); if (isoWasEnabled) { map_enable_bk_processes(); } } break; case KEY_UPPERCASE_I: case KEY_LOWERCASE_I: // open inventory if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); handle_inventory(); } break; case KEY_ESCAPE: case KEY_UPPERCASE_O: case KEY_LOWERCASE_O: // options if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); do_options(); } break; case KEY_UPPERCASE_P: case KEY_LOWERCASE_P: // pipboy if (intface_is_enabled()) { if (isInCombatMode) { gsound_play_sfx_file("iisxxxx1"); // Pipboy not available in combat! MessageListItem messageListItem; char title[128]; strcpy(title, getmsg(&misc_message_file, &messageListItem, 7)); dialog_out(title, NULL, 0, 192, 116, colorTable[32328], NULL, colorTable[32328], 0); } else { gsound_play_sfx_file("ib1p1xx1"); pipboy(false); } } break; case KEY_UPPERCASE_S: case KEY_LOWERCASE_S: // skilldex if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); int mode = -1; // NOTE: There is an `inc` for this value to build jump table which // is not needed. int rc = skilldex_select(); // Remap Skilldex result code to action. switch (rc) { case SKILLDEX_RC_ERROR: debug_printf("\n ** Error calling skilldex_select()! ** \n"); break; case SKILLDEX_RC_SNEAK: action_skill_use(SKILL_SNEAK); break; case SKILLDEX_RC_LOCKPICK: mode = GAME_MOUSE_MODE_USE_LOCKPICK; break; case SKILLDEX_RC_STEAL: mode = GAME_MOUSE_MODE_USE_STEAL; break; case SKILLDEX_RC_TRAPS: mode = GAME_MOUSE_MODE_USE_TRAPS; break; case SKILLDEX_RC_FIRST_AID: mode = GAME_MOUSE_MODE_USE_FIRST_AID; break; case SKILLDEX_RC_DOCTOR: mode = GAME_MOUSE_MODE_USE_DOCTOR; break; case SKILLDEX_RC_SCIENCE: mode = GAME_MOUSE_MODE_USE_SCIENCE; break; case SKILLDEX_RC_REPAIR: mode = GAME_MOUSE_MODE_USE_REPAIR; break; default: break; } if (mode != -1) { gmouse_set_cursor(MOUSE_CURSOR_USE_CROSSHAIR); gmouse_3d_set_mode(mode); } } break; case KEY_UPPERCASE_Z: case KEY_LOWERCASE_Z: if (intface_is_enabled()) { if (isInCombatMode) { gsound_play_sfx_file("iisxxxx1"); // Pipboy not available in combat! MessageListItem messageListItem; char title[128]; strcpy(title, getmsg(&misc_message_file, &messageListItem, 7)); dialog_out(title, NULL, 0, 192, 116, colorTable[32328], NULL, colorTable[32328], 0); } else { gsound_play_sfx_file("ib1p1xx1"); pipboy(true); } } break; case KEY_HOME: if (obj_dude->elevation != map_elevation) { map_set_elevation(obj_dude->elevation); } if (game_in_mapper) { tile_set_center(obj_dude->tile, TILE_SET_CENTER_REFRESH_WINDOW); } else { tile_scroll_to(obj_dude->tile, 2); } break; case KEY_1: case KEY_EXCLAMATION: if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); gmouse_set_cursor(MOUSE_CURSOR_USE_CROSSHAIR); action_skill_use(SKILL_SNEAK); } break; case KEY_2: case KEY_AT: if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); gmouse_set_cursor(MOUSE_CURSOR_USE_CROSSHAIR); gmouse_3d_set_mode(GAME_MOUSE_MODE_USE_LOCKPICK); } break; case KEY_3: case KEY_NUMBER_SIGN: if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); gmouse_set_cursor(MOUSE_CURSOR_USE_CROSSHAIR); gmouse_3d_set_mode(GAME_MOUSE_MODE_USE_STEAL); } break; case KEY_4: case KEY_DOLLAR: if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); gmouse_set_cursor(MOUSE_CURSOR_USE_CROSSHAIR); gmouse_3d_set_mode(GAME_MOUSE_MODE_USE_TRAPS); } break; case KEY_5: case KEY_PERCENT: if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); gmouse_set_cursor(MOUSE_CURSOR_USE_CROSSHAIR); gmouse_3d_set_mode(GAME_MOUSE_MODE_USE_FIRST_AID); } break; case KEY_6: case KEY_CARET: if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); gmouse_set_cursor(MOUSE_CURSOR_USE_CROSSHAIR); gmouse_3d_set_mode(GAME_MOUSE_MODE_USE_DOCTOR); } break; case KEY_7: case KEY_AMPERSAND: if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); gmouse_set_cursor(MOUSE_CURSOR_USE_CROSSHAIR); gmouse_3d_set_mode(GAME_MOUSE_MODE_USE_SCIENCE); } break; case KEY_8: case KEY_ASTERISK: if (intface_is_enabled()) { gsound_play_sfx_file("ib1p1xx1"); gmouse_set_cursor(MOUSE_CURSOR_USE_CROSSHAIR); gmouse_3d_set_mode(GAME_MOUSE_MODE_USE_REPAIR); } break; case KEY_MINUS: case KEY_UNDERSCORE: DecGamma(); break; case KEY_EQUAL: case KEY_PLUS: IncGamma(); break; case KEY_COMMA: case KEY_LESS: if (register_begin(ANIMATION_REQUEST_RESERVED) == 0) { register_object_dec_rotation(obj_dude); register_end(); } break; case KEY_DOT: case KEY_GREATER: if (register_begin(ANIMATION_REQUEST_RESERVED) == 0) { register_object_inc_rotation(obj_dude); register_end(); } break; case KEY_SLASH: case KEY_QUESTION: if (1) { gsound_play_sfx_file("ib1p1xx1"); int month; int day; int year; game_time_date(&month, &day, &year); MessageList messageList; if (message_init(&messageList)) { char path[FILENAME_MAX]; sprintf(path, "%s%s", msg_path, "editor.msg"); if (message_load(&messageList, path)) { MessageListItem messageListItem; messageListItem.num = 500 + month - 1; if (message_search(&messageList, &messageListItem)) { char* time = game_time_hour_str(); char date[128]; sprintf(date, "%s: %d/%d %s", messageListItem.text, day, year, time); display_print(date); } } message_exit(&messageList); } } break; case KEY_F1: gsound_play_sfx_file("ib1p1xx1"); game_help(); break; case KEY_F2: gsound_set_master_volume(gsound_get_master_volume() - 2047); break; case KEY_F3: gsound_set_master_volume(gsound_get_master_volume() + 2047); break; case KEY_CTRL_S: case KEY_F4: gsound_play_sfx_file("ib1p1xx1"); if (SaveGame(1) == -1) { debug_printf("\n ** Error calling SaveGame()! **\n"); } break; case KEY_CTRL_L: case KEY_F5: gsound_play_sfx_file("ib1p1xx1"); if (LoadGame(LOAD_SAVE_MODE_NORMAL) == -1) { debug_printf("\n ** Error calling LoadGame()! **\n"); } break; case KEY_F6: if (1) { gsound_play_sfx_file("ib1p1xx1"); int rc = SaveGame(LOAD_SAVE_MODE_QUICK); if (rc == -1) { debug_printf("\n ** Error calling SaveGame()! **\n"); } else if (rc == 1) { MessageListItem messageListItem; // Quick save game successfully saved. char* msg = getmsg(&misc_message_file, &messageListItem, 5); display_print(msg); } } break; case KEY_F7: if (1) { gsound_play_sfx_file("ib1p1xx1"); int rc = LoadGame(LOAD_SAVE_MODE_QUICK); if (rc == -1) { debug_printf("\n ** Error calling LoadGame()! **\n"); } else if (rc == 1) { MessageListItem messageListItem; // Quick load game successfully loaded. char* msg = getmsg(&misc_message_file, &messageListItem, 4); display_print(msg); } } break; case KEY_CTRL_V: if (1) { gsound_play_sfx_file("ib1p1xx1"); char version[VERSION_MAX]; getverstr(version); display_print(version); display_print(_aDec11199816543); } break; case KEY_ARROW_LEFT: map_scroll(-1, 0); break; case KEY_ARROW_RIGHT: map_scroll(1, 0); break; case KEY_ARROW_UP: map_scroll(0, -1); break; case KEY_ARROW_DOWN: map_scroll(0, 1); break; } return 0; } // game_ui_disable // 0x443BFC void game_ui_disable(int a1) { if (!game_ui_disabled) { gmouse_3d_off(); gmouse_disable(a1); kb_disable(); intface_disable(); game_ui_disabled = true; } } // game_ui_enable // 0x443C30 void game_ui_enable() { if (game_ui_disabled) { intface_enable(); kb_enable(); kb_clear(); gmouse_enable(); gmouse_3d_on(); game_ui_disabled = false; } } // game_ui_is_disabled // 0x443C60 bool game_ui_is_disabled() { return game_ui_disabled; } // 0x443C68 int game_get_global_var(int var) { if (var < 0 || var >= num_game_global_vars) { debug_printf("ERROR: attempt to reference global var out of range: %d", var); return 0; } return game_global_vars[var]; } // 0x443C98 int game_set_global_var(int var, int value) { if (var < 0 || var >= num_game_global_vars) { debug_printf("ERROR: attempt to reference global var out of range: %d", var); return -1; } game_global_vars[var] = value; return 0; } // game_load_info // 0x443CC8 int game_load_info() { return game_load_info_vars("data\\vault13.gam", "GAME_GLOBAL_VARS:", &num_game_global_vars, &game_global_vars); } // 0x443CE8 int game_load_info_vars(const char* path, const char* section, int* variablesListLengthPtr, int** variablesListPtr) { inven_reset_dude(); File* stream = db_fopen(path, "rt"); if (stream == NULL) { return -1; } if (*variablesListLengthPtr != 0) { mem_free(*variablesListPtr); *variablesListPtr = NULL; *variablesListLengthPtr = 0; } char string[260]; if (section != NULL) { while (db_fgets(string, 258, stream)) { if (strncmp(string, section, 16) == 0) { break; } } } while (db_fgets(string, 258, stream)) { if (string[0] == '\n') { continue; } if (string[0] == '/' && string[1] == '/') { continue; } char* semicolon = strchr(string, ';'); if (semicolon != NULL) { *semicolon = '\0'; } *variablesListLengthPtr = *variablesListLengthPtr + 1; *variablesListPtr = (int*)mem_realloc(*variablesListPtr, sizeof(int) * *variablesListLengthPtr); if (*variablesListPtr == NULL) { exit(1); } char* equals = strchr(string, '='); if (equals != NULL) { sscanf(equals + 1, "%d", *variablesListPtr + *variablesListLengthPtr - 1); } else { *variablesListPtr[*variablesListLengthPtr - 1] = 0; } } db_fclose(stream); return 0; } // 0x443E2C int game_state() { return game_state_cur; } // 0x443E34 int game_state_request(int a1) { if (a1 == GAME_STATE_0) { a1 = GAME_STATE_1; } else if (a1 == GAME_STATE_2) { a1 = GAME_STATE_3; } else if (a1 == GAME_STATE_4) { a1 = GAME_STATE_5; } if (game_state_cur != GAME_STATE_4 || a1 != GAME_STATE_5) { game_state_cur = a1; return 0; } return -1; } // 0x443E90 void game_state_update() { int v0; v0 = game_state_cur; switch (game_state_cur) { case GAME_STATE_1: v0 = GAME_STATE_0; break; case GAME_STATE_3: v0 = GAME_STATE_2; break; case GAME_STATE_5: v0 = GAME_STATE_4; } game_state_cur = v0; } // NOTE: Unused. // // 0x443EC0 static void game_display_counter(double value) { char stringBuffer[16]; sprintf(stringBuffer, "%f", value); display_print(stringBuffer); } // 0x443EF0 static int game_screendump(int width, int height, unsigned char* buffer, unsigned char* palette) { MessageListItem messageListItem; if (default_screendump(width, height, buffer, palette) != 0) { // Error saving screenshot. messageListItem.num = 8; if (message_search(&misc_message_file, &messageListItem)) { display_print(messageListItem.text); } return -1; } // Saved screenshot. messageListItem.num = 3; if (message_search(&misc_message_file, &messageListItem)) { display_print(messageListItem.text); } return 0; } // NOTE: Inlined. // // 0x443F50 static void game_unload_info() { num_game_global_vars = 0; if (game_global_vars != NULL) { mem_free(game_global_vars); game_global_vars = NULL; } } // 0x443F74 static void game_help() { bool isoWasEnabled = map_disable_bk_processes(); gmouse_3d_off(); gmouse_set_cursor(MOUSE_CURSOR_NONE); bool colorCycleWasEnabled = cycle_is_enabled(); cycle_disable(); int helpWindowX = 0; int helpWindowY = 0; int win = win_add(helpWindowX, helpWindowY, HELP_SCREEN_WIDTH, HELP_SCREEN_HEIGHT, 0, WINDOW_HIDDEN | WINDOW_FLAG_0x04); if (win != -1) { unsigned char* windowBuffer = win_get_buf(win); if (windowBuffer != NULL) { int backgroundFid = art_id(OBJ_TYPE_INTERFACE, 297, 0, 0, 0); CacheEntry* backgroundHandle; unsigned char* backgroundData = art_ptr_lock_data(backgroundFid, 0, 0, &backgroundHandle); if (backgroundData != NULL) { palette_set_to(black_palette); buf_to_buf(backgroundData, HELP_SCREEN_WIDTH, HELP_SCREEN_HEIGHT, HELP_SCREEN_WIDTH, windowBuffer, HELP_SCREEN_WIDTH); art_ptr_unlock(backgroundHandle); win_show(win); loadColorTable("art\\intrface\\helpscrn.pal"); palette_set_to(cmap); while (get_input() == -1 && game_user_wants_to_quit == 0) { } while (mouse_get_buttons() != 0) { get_input(); } palette_set_to(black_palette); } } win_delete(win); loadColorTable("color.pal"); palette_set_to(cmap); } if (colorCycleWasEnabled) { cycle_enable(); } gmouse_3d_on(); if (isoWasEnabled) { map_enable_bk_processes(); } } // 0x4440B8 int game_quit_with_confirm() { bool isoWasEnabled = map_disable_bk_processes(); bool gameMouseWasVisible; if (isoWasEnabled) { gameMouseWasVisible = gmouse_3d_is_on(); } else { gameMouseWasVisible = false; } if (gameMouseWasVisible) { gmouse_3d_off(); } bool cursorWasHidden = mouse_hidden(); if (cursorWasHidden) { mouse_show(); } int oldCursor = gmouse_get_cursor(); gmouse_set_cursor(MOUSE_CURSOR_ARROW); int rc; // Are you sure you want to quit? MessageListItem messageListItem; messageListItem.num = 0; if (message_search(&misc_message_file, &messageListItem)) { rc = dialog_out(messageListItem.text, 0, 0, 169, 117, colorTable[32328], NULL, colorTable[32328], DIALOG_BOX_YES_NO); if (rc != 0) { game_user_wants_to_quit = 2; } } else { rc = -1; } gmouse_set_cursor(oldCursor); if (cursorWasHidden) { mouse_hide(); } if (gameMouseWasVisible) { gmouse_3d_on(); } if (isoWasEnabled) { map_enable_bk_processes(); } return rc; } // 0x44418C static int game_init_databases() { int hashing; char* main_file_name; char* patch_file_name; int patch_index; char filename[MAX_PATH]; hashing = 0; main_file_name = NULL; patch_file_name = NULL; if (config_get_value(&game_config, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_HASHING_KEY, &hashing)) { db_enable_hash_table(); } config_get_string(&game_config, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_MASTER_DAT_KEY, &main_file_name); if (*main_file_name == '\0') { main_file_name = NULL; } config_get_string(&game_config, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_MASTER_PATCHES_KEY, &patch_file_name); if (*patch_file_name == '\0') { patch_file_name = NULL; } master_db_handle = db_init(main_file_name, 0, patch_file_name, 1); if (master_db_handle == -1) { GNWSystemError("Could not find the master datafile. Please make sure the FALLOUT CD is in the drive and that you are running FALLOUT from the directory you installed it to."); return -1; } config_get_string(&game_config, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_CRITTER_DAT_KEY, &main_file_name); if (*main_file_name == '\0') { main_file_name = NULL; } config_get_string(&game_config, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_CRITTER_PATCHES_KEY, &patch_file_name); if (*patch_file_name == '\0') { patch_file_name = NULL; } critter_db_handle = db_init(main_file_name, 0, patch_file_name, 1); if (critter_db_handle == -1) { db_select(master_db_handle); GNWSystemError("Could not find the critter datafile. Please make sure the FALLOUT CD is in the drive and that you are running FALLOUT from the directory you installed it to."); return -1; } for (patch_index = 0; patch_index < 1000; patch_index++) { sprintf(filename, "patch%03d.dat", patch_index); if (access(filename, 0) == 0) { db_init(filename, 0, NULL, 1); } } db_select(master_db_handle); return 0; } // 0x444384 static void game_splash_screen() { int splash; config_get_value(&game_config, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_SPLASH_KEY, &splash); char path[64]; char* language; if (config_get_string(&game_config, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_LANGUAGE_KEY, &language) && stricmp(language, ENGLISH) != 0) { sprintf(path, "art\\%s\\splash\\", language); } else { sprintf(path, "art\\splash\\"); } File* stream; for (int index = 0; index < SPLASH_COUNT; index++) { char filePath[64]; sprintf(filePath, "%ssplash%d.rix", path, splash); stream = db_fopen(filePath, "rb"); if (stream != NULL) { break; } splash++; if (splash >= SPLASH_COUNT) { splash = 0; } } if (stream == NULL) { return; } unsigned char* palette = (unsigned char*)mem_malloc(768); if (palette == NULL) { db_fclose(stream); return; } unsigned char* data = (unsigned char*)mem_malloc(SPLASH_WIDTH * SPLASH_HEIGHT); if (data == NULL) { mem_free(palette); db_fclose(stream); return; } palette_set_to(black_palette); db_fseek(stream, 10, SEEK_SET); db_fread(palette, 1, 768, stream); db_fread(data, 1, SPLASH_WIDTH * SPLASH_HEIGHT, stream); db_fclose(stream); int splashWindowX = 0; int splashWindowY = 0; scr_blit(data, SPLASH_WIDTH, SPLASH_HEIGHT, 0, 0, SPLASH_WIDTH, SPLASH_HEIGHT, splashWindowX, splashWindowY); palette_fade_to(palette); mem_free(data); mem_free(palette); config_set_value(&game_config, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_SPLASH_KEY, splash + 1); }
1
0.873243
1
0.873243
game-dev
MEDIA
0.646824
game-dev
0.706145
1
0.706145
mjtb49/LattiCG
2,807
src/main/java/com/seedfinding/latticg/reversal/calltype/java/NextFloatCall.java
package com.seedfinding.latticg.reversal.calltype.java; import com.seedfinding.latticg.reversal.calltype.CallType; import com.seedfinding.latticg.reversal.calltype.RangeCallType; import com.seedfinding.latticg.reversal.calltype.RangeableCallType; import com.seedfinding.latticg.util.Range; import org.jetbrains.annotations.ApiStatus; @ApiStatus.Experimental public class NextFloatCall extends RangeableCallType<Float> { @ApiStatus.Internal static final NextFloatCall INSTANCE = new NextFloatCall(); private static final Float ABS_MIN = 0f; private static final Float ABS_MAX = 1f; private NextFloatCall() { super(Float.class, 1); } @Override protected RangeCallType<Float> createRangeCallType(Float min, Float max, boolean minStrict, boolean maxStrict, boolean inverted) { return new FloatRange(min, max, minStrict, maxStrict, inverted); } @Override protected Float getAbsoluteMin() { return ABS_MIN; } @Override protected Float getAbsoluteMax() { return ABS_MAX; } @Override public CallType<Range<Float>> ranged() { return new Ranged(0.5f); } @Override public CallType<Range<Float>> ranged(Float expectedSize) { return new Ranged(expectedSize); } @ApiStatus.Internal public static class FloatRange extends RangeCallType<Float> { public FloatRange(Float min, Float max, boolean minStrict, boolean maxStrict, boolean inverted) { super(min, max, minStrict, maxStrict, inverted, 1); } @Override protected RangeCallType<Float> createNew(Float min, Float max, boolean lowerStrict, boolean upperStrict, boolean inverted) { return new FloatRange(min, max, lowerStrict, upperStrict, inverted); } } @ApiStatus.Internal public static final class Ranged extends CallType<Range<Float>> { private final float expectedSize; private Ranged(float expectedSize) { super(Range.type(), 1); this.expectedSize = expectedSize; } public float getExpectedSize() { return expectedSize; } @Override public CallType<Range<Float>> not() { return new RangedInverted(expectedSize); } } @ApiStatus.Internal public static final class RangedInverted extends CallType<Range<Float>> { private final float expectedSize; private RangedInverted(float expectedSize) { super(Range.type(), 1); this.expectedSize = expectedSize; } public float getExpectedSize() { return expectedSize; } @Override public CallType<Range<Float>> not() { return new Ranged(expectedSize); } } }
1
0.552029
1
0.552029
game-dev
MEDIA
0.548933
game-dev,graphics-rendering
0.748684
1
0.748684
The-Final-Nights/The-Final-Nights
1,352
code/datums/diseases/advance/symptoms/weight.dm
/* ////////////////////////////////////// Weight Loss Very Very Noticable. Decreases resistance. Decreases stage speed. Reduced Transmittable. High level. Bonus Decreases the weight of the mob, forcing it to be skinny. ////////////////////////////////////// */ /datum/symptom/weight_loss name = "Weight Loss" desc = "The virus mutates the host's metabolism, making it almost unable to gain nutrition from food." stealth = -2 resistance = 2 stage_speed = -2 transmittable = -2 level = 3 severity = 3 base_message_chance = 100 symptom_delay_min = 15 symptom_delay_max = 45 threshold_descs = list( "Stealth 4" = "The symptom is less noticeable." ) /datum/symptom/weight_loss/Start(datum/disease/advance/A) if(!..()) return if(A.properties["stealth"] >= 4) //warn less often base_message_chance = 25 /datum/symptom/weight_loss/Activate(datum/disease/advance/A) if(!..()) return var/mob/living/M = A.affected_mob switch(A.stage) if(1, 2, 3, 4) if(prob(base_message_chance)) to_chat(M, "<span class='warning'>[pick("You feel hungry.", "You crave for food.")]</span>") else to_chat(M, "<span class='warning'><i>[pick("So hungry...", "You'd kill someone for a bite of food...", "Hunger cramps seize you...")]</i></span>") M.overeatduration = max(M.overeatduration - 100, 0) M.adjust_nutrition(-100)
1
0.563999
1
0.563999
game-dev
MEDIA
0.913368
game-dev
0.759118
1
0.759118
mofumofumoffy/ticex
1,658
src/main/java/moffy/ticex/caps/mekanism/RadiationShieldingCapabilityProvider.java
package moffy.ticex.caps.mekanism; import java.util.function.Supplier; import mekanism.common.capabilities.Capabilities; import mekanism.common.capabilities.ItemCapabilityWrapper; import mekanism.common.capabilities.radiation.item.RadiationShieldingHandler; import mekanism.common.item.gear.ItemHazmatSuitArmor; import moffy.ticex.modules.general.TicEXRegistry; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import slimeknights.tconstruct.library.tools.capability.ToolCapabilityProvider.IToolCapabilityProvider; import slimeknights.tconstruct.library.tools.nbt.IToolStackView; public class RadiationShieldingCapabilityProvider implements IToolCapabilityProvider { private ItemCapabilityWrapper mekCapabilityWrapper; public RadiationShieldingCapabilityProvider(ItemStack stack, Supplier<? extends IToolStackView> toolSupplier) { this.mekCapabilityWrapper = new ItemCapabilityWrapper( stack, RadiationShieldingHandler.create(item -> ItemHazmatSuitArmor.getShieldingByArmor(((ArmorItem) item.getItem()).getType()) ) ); } @Override public <T> LazyOptional<T> getCapability(IToolStackView tool, Capability<T> capability) { if ( capability == Capabilities.RADIATION_SHIELDING && tool.getModifierLevel(TicEXRegistry.RADIATION_SHIELDING_MODIFIER.get()) > 0 ) { return mekCapabilityWrapper.getCapability(capability); } return LazyOptional.empty(); } }
1
0.760892
1
0.760892
game-dev
MEDIA
0.992302
game-dev
0.690953
1
0.690953
joschu/trajopt
8,904
ext/bullet/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp
/* Bullet Continuous Collision Detection and Physics Library Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "btConvex2dConvex2dAlgorithm.h" //#include <stdio.h> #include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h" #include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h" #include "BulletCollision/CollisionDispatch/btCollisionObject.h" #include "BulletCollision/CollisionShapes/btConvexShape.h" #include "BulletCollision/CollisionShapes/btCapsuleShape.h" #include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h" #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" #include "BulletCollision/CollisionShapes/btBoxShape.h" #include "BulletCollision/CollisionDispatch/btManifoldResult.h" #include "BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h" #include "BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h" #include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h" #include "BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h" #include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h" #include "BulletCollision/CollisionShapes/btSphereShape.h" #include "BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h" #include "BulletCollision/NarrowPhaseCollision/btGjkEpa2.h" #include "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h" #include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h" btConvex2dConvex2dAlgorithm::CreateFunc::CreateFunc(btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver) { m_numPerturbationIterations = 0; m_minimumPointsPerturbationThreshold = 3; m_simplexSolver = simplexSolver; m_pdSolver = pdSolver; } btConvex2dConvex2dAlgorithm::CreateFunc::~CreateFunc() { } btConvex2dConvex2dAlgorithm::btConvex2dConvex2dAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap,btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver,int numPerturbationIterations, int minimumPointsPerturbationThreshold) : btActivatingCollisionAlgorithm(ci,body0Wrap,body1Wrap), m_simplexSolver(simplexSolver), m_pdSolver(pdSolver), m_ownManifold (false), m_manifoldPtr(mf), m_lowLevelOfDetail(false), m_numPerturbationIterations(numPerturbationIterations), m_minimumPointsPerturbationThreshold(minimumPointsPerturbationThreshold) { (void)body0Wrap; (void)body1Wrap; } btConvex2dConvex2dAlgorithm::~btConvex2dConvex2dAlgorithm() { if (m_ownManifold) { if (m_manifoldPtr) m_dispatcher->releaseManifold(m_manifoldPtr); } } void btConvex2dConvex2dAlgorithm ::setLowLevelOfDetail(bool useLowLevel) { m_lowLevelOfDetail = useLowLevel; } extern btScalar gContactBreakingThreshold; // // Convex-Convex collision algorithm // void btConvex2dConvex2dAlgorithm ::processCollision (const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) { if (!m_manifoldPtr) { //swapped? m_manifoldPtr = m_dispatcher->getNewManifold(body0Wrap->getCollisionObject(),body1Wrap->getCollisionObject()); m_ownManifold = true; } resultOut->setPersistentManifold(m_manifoldPtr); //comment-out next line to test multi-contact generation //resultOut->getPersistentManifold()->clearManifold(); const btConvexShape* min0 = static_cast<const btConvexShape*>(body0Wrap->getCollisionShape()); const btConvexShape* min1 = static_cast<const btConvexShape*>(body1Wrap->getCollisionShape()); btVector3 normalOnB; btVector3 pointOnBWorld; { btGjkPairDetector::ClosestPointInput input; btGjkPairDetector gjkPairDetector(min0,min1,m_simplexSolver,m_pdSolver); //TODO: if (dispatchInfo.m_useContinuous) gjkPairDetector.setMinkowskiA(min0); gjkPairDetector.setMinkowskiB(min1); { input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactBreakingThreshold(); input.m_maximumDistanceSquared*= input.m_maximumDistanceSquared; } input.m_stackAlloc = dispatchInfo.m_stackAllocator; input.m_transformA = body0Wrap->getWorldTransform(); input.m_transformB = body1Wrap->getWorldTransform(); gjkPairDetector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw); btVector3 v0,v1; btVector3 sepNormalWorldSpace; } if (m_ownManifold) { resultOut->refreshContactPoints(); } } btScalar btConvex2dConvex2dAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,btCollisionObject* col1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut) { (void)resultOut; (void)dispatchInfo; ///Rather then checking ALL pairs, only calculate TOI when motion exceeds threshold ///Linear motion for one of objects needs to exceed m_ccdSquareMotionThreshold ///col0->m_worldTransform, btScalar resultFraction = btScalar(1.); btScalar squareMot0 = (col0->getInterpolationWorldTransform().getOrigin() - col0->getWorldTransform().getOrigin()).length2(); btScalar squareMot1 = (col1->getInterpolationWorldTransform().getOrigin() - col1->getWorldTransform().getOrigin()).length2(); if (squareMot0 < col0->getCcdSquareMotionThreshold() && squareMot1 < col1->getCcdSquareMotionThreshold()) return resultFraction; //An adhoc way of testing the Continuous Collision Detection algorithms //One object is approximated as a sphere, to simplify things //Starting in penetration should report no time of impact //For proper CCD, better accuracy and handling of 'allowed' penetration should be added //also the mainloop of the physics should have a kind of toi queue (something like Brian Mirtich's application of Timewarp for Rigidbodies) /// Convex0 against sphere for Convex1 { btConvexShape* convex0 = static_cast<btConvexShape*>(col0->getCollisionShape()); btSphereShape sphere1(col1->getCcdSweptSphereRadius()); //todo: allow non-zero sphere sizes, for better approximation btConvexCast::CastResult result; btVoronoiSimplexSolver voronoiSimplex; //SubsimplexConvexCast ccd0(&sphere,min0,&voronoiSimplex); ///Simplification, one object is simplified as a sphere btGjkConvexCast ccd1( convex0 ,&sphere1,&voronoiSimplex); //ContinuousConvexCollision ccd(min0,min1,&voronoiSimplex,0); if (ccd1.calcTimeOfImpact(col0->getWorldTransform(),col0->getInterpolationWorldTransform(), col1->getWorldTransform(),col1->getInterpolationWorldTransform(),result)) { //store result.m_fraction in both bodies if (col0->getHitFraction()> result.m_fraction) col0->setHitFraction( result.m_fraction ); if (col1->getHitFraction() > result.m_fraction) col1->setHitFraction( result.m_fraction); if (resultFraction > result.m_fraction) resultFraction = result.m_fraction; } } /// Sphere (for convex0) against Convex1 { btConvexShape* convex1 = static_cast<btConvexShape*>(col1->getCollisionShape()); btSphereShape sphere0(col0->getCcdSweptSphereRadius()); //todo: allow non-zero sphere sizes, for better approximation btConvexCast::CastResult result; btVoronoiSimplexSolver voronoiSimplex; //SubsimplexConvexCast ccd0(&sphere,min0,&voronoiSimplex); ///Simplification, one object is simplified as a sphere btGjkConvexCast ccd1(&sphere0,convex1,&voronoiSimplex); //ContinuousConvexCollision ccd(min0,min1,&voronoiSimplex,0); if (ccd1.calcTimeOfImpact(col0->getWorldTransform(),col0->getInterpolationWorldTransform(), col1->getWorldTransform(),col1->getInterpolationWorldTransform(),result)) { //store result.m_fraction in both bodies if (col0->getHitFraction() > result.m_fraction) col0->setHitFraction( result.m_fraction); if (col1->getHitFraction() > result.m_fraction) col1->setHitFraction( result.m_fraction); if (resultFraction > result.m_fraction) resultFraction = result.m_fraction; } } return resultFraction; }
1
0.969135
1
0.969135
game-dev
MEDIA
0.983343
game-dev
0.978832
1
0.978832
canhorn/EventHorizon.Blazor.TypeScript.Interop.Generator
27,283
Sample/_generated/EventHorizon.Blazor.BabylonJS.Server/ParticleSystem.cs
/// Generated - Do Not Edit using System; using System.Collections.Generic; using System.Text.Json.Serialization; using System.Threading.Tasks; using EventHorizon.Blazor.Server.Interop; using EventHorizon.Blazor.Server.Interop.Callbacks; using EventHorizon.Blazor.Server.Interop.ResultCallbacks; using Microsoft.JSInterop; [JsonConverter(typeof(CachedEntityConverter<ParticleSystem>))] public class ParticleSystem : BaseParticleSystem, _IDisposable, IAnimatable, IParticleSystem { #region Static Accessors #endregion #region Static Properties public static async ValueTask<decimal> get_BILLBOARDMODE_Y() { return await EventHorizonBlazorInterop.Get<decimal>("ParticleSystem", "BILLBOARDMODE_Y"); } public static async ValueTask<decimal> get_BILLBOARDMODE_ALL() { return await EventHorizonBlazorInterop.Get<decimal>("ParticleSystem", "BILLBOARDMODE_ALL"); } public static async ValueTask<decimal> get_BILLBOARDMODE_STRETCHED() { return await EventHorizonBlazorInterop.Get<decimal>( "ParticleSystem", "BILLBOARDMODE_STRETCHED" ); } #endregion #region Static Methods public static async ValueTask<ParticleSystem> Parse( object parsedParticleSystem, Scene sceneOrEngine, string rootUrl, System.Nullable<bool> doNotStart = null ) { return await EventHorizonBlazorInterop.FuncClass<ParticleSystem>( entity => new ParticleSystem() { ___guid = entity.___guid }, new object[] { new string[] { "ParticleSystem", "Parse" }, parsedParticleSystem, sceneOrEngine, rootUrl, doNotStart } ); } #endregion #region Accessors public async ValueTask<bool> get_useRampGradients() { return await EventHorizonBlazorInterop.Get<bool>(this.___guid, "useRampGradients"); } public ValueTask set_useRampGradients(bool value) { return EventHorizonBlazorInterop.Set(this.___guid, "useRampGradients", value); } public async ValueTask<Particle[]> get_particles() { return await EventHorizonBlazorInterop.GetArrayClass<Particle>( this.___guid, "particles", (entity) => { return new Particle() { ___guid = entity.___guid }; } ); } private Observable<Effect> __onBeforeDrawParticlesObservable; public async ValueTask<Observable<Effect>> get_onBeforeDrawParticlesObservable() { if (__onBeforeDrawParticlesObservable == null) { __onBeforeDrawParticlesObservable = await EventHorizonBlazorInterop.GetClass< Observable<Effect> >( this.___guid, "onBeforeDrawParticlesObservable", (entity) => { return new Observable<Effect>() { ___guid = entity.___guid }; } ); } return __onBeforeDrawParticlesObservable; } public async ValueTask<string> get_vertexShaderName() { return await EventHorizonBlazorInterop.Get<string>(this.___guid, "vertexShaderName"); } #endregion #region Properties private Observable<IParticleSystemCachedEntity> __onDisposeObservable; public async ValueTask<Observable<IParticleSystemCachedEntity>> get_onDisposeObservable() { if (__onDisposeObservable == null) { __onDisposeObservable = await EventHorizonBlazorInterop.GetClass< Observable<IParticleSystemCachedEntity> >( this.___guid, "onDisposeObservable", (entity) => { return new Observable<IParticleSystemCachedEntity>() { ___guid = entity.___guid }; } ); } return __onDisposeObservable; } public ValueTask set_onDisposeObservable(Observable<IParticleSystemCachedEntity> value) { __onDisposeObservable = null; return EventHorizonBlazorInterop.Set(this.___guid, "onDisposeObservable", value); } private Observable<IParticleSystemCachedEntity> __onStoppedObservable; public async ValueTask<Observable<IParticleSystemCachedEntity>> get_onStoppedObservable() { if (__onStoppedObservable == null) { __onStoppedObservable = await EventHorizonBlazorInterop.GetClass< Observable<IParticleSystemCachedEntity> >( this.___guid, "onStoppedObservable", (entity) => { return new Observable<IParticleSystemCachedEntity>() { ___guid = entity.___guid }; } ); } return __onStoppedObservable; } public ValueTask set_onStoppedObservable(Observable<IParticleSystemCachedEntity> value) { __onStoppedObservable = null; return EventHorizonBlazorInterop.Set(this.___guid, "onStoppedObservable", value); } private Matrix __defaultProjectionMatrix; public async ValueTask<Matrix> get_defaultProjectionMatrix() { if (__defaultProjectionMatrix == null) { __defaultProjectionMatrix = await EventHorizonBlazorInterop.GetClass<Matrix>( this.___guid, "defaultProjectionMatrix", (entity) => { return new Matrix() { ___guid = entity.___guid }; } ); } return __defaultProjectionMatrix; } public ValueTask set_defaultProjectionMatrix(Matrix value) { __defaultProjectionMatrix = null; return EventHorizonBlazorInterop.Set(this.___guid, "defaultProjectionMatrix", value); } private Matrix __defaultViewMatrix; public async ValueTask<Matrix> get_defaultViewMatrix() { if (__defaultViewMatrix == null) { __defaultViewMatrix = await EventHorizonBlazorInterop.GetClass<Matrix>( this.___guid, "defaultViewMatrix", (entity) => { return new Matrix() { ___guid = entity.___guid }; } ); } return __defaultViewMatrix; } public ValueTask set_defaultViewMatrix(Matrix value) { __defaultViewMatrix = null; return EventHorizonBlazorInterop.Set(this.___guid, "defaultViewMatrix", value); } public async ValueTask<ParticleSystem[]> get_subEmitters() { return await EventHorizonBlazorInterop.GetArrayClass<ParticleSystem>( this.___guid, "subEmitters", (entity) => { return new ParticleSystem() { ___guid = entity.___guid }; } ); } public ValueTask set_subEmitters(ParticleSystem[] value) { return EventHorizonBlazorInterop.Set(this.___guid, "subEmitters", value); } public async ValueTask<ParticleSystem[]> get_activeSubSystems() { return await EventHorizonBlazorInterop.GetArrayClass<ParticleSystem>( this.___guid, "activeSubSystems", (entity) => { return new ParticleSystem() { ___guid = entity.___guid }; } ); } public ValueTask set_activeSubSystems(ParticleSystem[] value) { return EventHorizonBlazorInterop.Set(this.___guid, "activeSubSystems", value); } public async ValueTask<bool> get_isLocal() { return await EventHorizonBlazorInterop.Get<bool>(this.___guid, "isLocal"); } public ValueTask set_isLocal(bool value) { return EventHorizonBlazorInterop.Set(this.___guid, "isLocal", value); } #endregion #region Constructor public ParticleSystem() : base() { } public ParticleSystem(ICachedEntity entity) : base(entity) { } public static async ValueTask<ParticleSystem> NewParticleSystem( string name, decimal capacity, Scene sceneOrEngine, Effect customEffect = null, System.Nullable<bool> isAnimationSheetEnabled = null, System.Nullable<decimal> epsilon = null ) { var entity = await EventHorizonBlazorInterop.New( new string[] { "ParticleSystem" }, name, capacity, sceneOrEngine, customEffect, isAnimationSheetEnabled, epsilon ); return new ParticleSystem(entity); } public static async ValueTask<ParticleSystem> NewParticleSystem(string name) { var entity = await EventHorizonBlazorInterop.New(new string[] { "ParticleSystem" }, name); return new ParticleSystem(entity); } #endregion #region Methods public async ValueTask updateFunction(Particle[] particles) { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "updateFunction" }, particles } ); } public async ValueTask startDirectionFunction( Matrix worldMatrix, Vector3 directionToUpdate, Particle particle, bool isLocal ) { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "startDirectionFunction" }, worldMatrix, directionToUpdate, particle, isLocal } ); } public async ValueTask startPositionFunction( Matrix worldMatrix, Vector3 positionToUpdate, Particle particle, bool isLocal ) { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "startPositionFunction" }, worldMatrix, positionToUpdate, particle, isLocal } ); } public async ValueTask<decimal> getActiveCount() { return await EventHorizonBlazorInterop.Func<decimal>( new object[] { new string[] { this.___guid, "getActiveCount" } } ); } public async ValueTask<string> getClassName() { return await EventHorizonBlazorInterop.Func<string>( new object[] { new string[] { this.___guid, "getClassName" } } ); } public async ValueTask<bool> isStopping() { return await EventHorizonBlazorInterop.Func<bool>( new object[] { new string[] { this.___guid, "isStopping" } } ); } public async ValueTask<Effect> getCustomEffect(System.Nullable<decimal> blendMode = null) { return await EventHorizonBlazorInterop.FuncClass<Effect>( entity => new Effect() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "getCustomEffect" }, blendMode } ); } public async ValueTask setCustomEffect(Effect effect, System.Nullable<decimal> blendMode = null) { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "setCustomEffect" }, effect, blendMode } ); } public async ValueTask<IParticleSystemCachedEntity> addLifeTimeGradient( decimal gradient, decimal factor, System.Nullable<decimal> factor2 = null ) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "addLifeTimeGradient" }, gradient, factor, factor2 } ); } public async ValueTask<IParticleSystemCachedEntity> removeLifeTimeGradient(decimal gradient) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "removeLifeTimeGradient" }, gradient } ); } public async ValueTask<IParticleSystemCachedEntity> addSizeGradient( decimal gradient, decimal factor, System.Nullable<decimal> factor2 = null ) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "addSizeGradient" }, gradient, factor, factor2 } ); } public async ValueTask<IParticleSystemCachedEntity> removeSizeGradient(decimal gradient) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "removeSizeGradient" }, gradient } ); } public async ValueTask<IParticleSystemCachedEntity> addColorRemapGradient( decimal gradient, decimal min, decimal max ) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "addColorRemapGradient" }, gradient, min, max } ); } public async ValueTask<IParticleSystemCachedEntity> removeColorRemapGradient(decimal gradient) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "removeColorRemapGradient" }, gradient } ); } public async ValueTask<IParticleSystemCachedEntity> addAlphaRemapGradient( decimal gradient, decimal min, decimal max ) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "addAlphaRemapGradient" }, gradient, min, max } ); } public async ValueTask<IParticleSystemCachedEntity> removeAlphaRemapGradient(decimal gradient) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "removeAlphaRemapGradient" }, gradient } ); } public async ValueTask<IParticleSystemCachedEntity> addAngularSpeedGradient( decimal gradient, decimal factor, System.Nullable<decimal> factor2 = null ) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "addAngularSpeedGradient" }, gradient, factor, factor2 } ); } public async ValueTask<IParticleSystemCachedEntity> removeAngularSpeedGradient(decimal gradient) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "removeAngularSpeedGradient" }, gradient } ); } public async ValueTask<IParticleSystemCachedEntity> addVelocityGradient( decimal gradient, decimal factor, System.Nullable<decimal> factor2 = null ) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "addVelocityGradient" }, gradient, factor, factor2 } ); } public async ValueTask<IParticleSystemCachedEntity> removeVelocityGradient(decimal gradient) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "removeVelocityGradient" }, gradient } ); } public async ValueTask<IParticleSystemCachedEntity> addLimitVelocityGradient( decimal gradient, decimal factor, System.Nullable<decimal> factor2 = null ) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "addLimitVelocityGradient" }, gradient, factor, factor2 } ); } public async ValueTask<IParticleSystemCachedEntity> removeLimitVelocityGradient( decimal gradient ) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "removeLimitVelocityGradient" }, gradient } ); } public async ValueTask<IParticleSystemCachedEntity> addDragGradient( decimal gradient, decimal factor, System.Nullable<decimal> factor2 = null ) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "addDragGradient" }, gradient, factor, factor2 } ); } public async ValueTask<IParticleSystemCachedEntity> removeDragGradient(decimal gradient) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "removeDragGradient" }, gradient } ); } public async ValueTask<IParticleSystemCachedEntity> addEmitRateGradient( decimal gradient, decimal factor, System.Nullable<decimal> factor2 = null ) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "addEmitRateGradient" }, gradient, factor, factor2 } ); } public async ValueTask<IParticleSystemCachedEntity> removeEmitRateGradient(decimal gradient) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "removeEmitRateGradient" }, gradient } ); } public async ValueTask<IParticleSystemCachedEntity> addStartSizeGradient( decimal gradient, decimal factor, System.Nullable<decimal> factor2 = null ) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "addStartSizeGradient" }, gradient, factor, factor2 } ); } public async ValueTask<IParticleSystemCachedEntity> removeStartSizeGradient(decimal gradient) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "removeStartSizeGradient" }, gradient } ); } public async ValueTask<Color3Gradient[]> getRampGradients() { return await EventHorizonBlazorInterop.FuncArrayClass<Color3Gradient>( entity => new Color3Gradient() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "getRampGradients" } } ); } public async ValueTask forceRefreshGradients() { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "forceRefreshGradients" } } ); } public async ValueTask<ParticleSystem> addRampGradient(decimal gradient, Color3 color) { return await EventHorizonBlazorInterop.FuncClass<ParticleSystem>( entity => new ParticleSystem() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "addRampGradient" }, gradient, color } ); } public async ValueTask<ParticleSystem> removeRampGradient(decimal gradient) { return await EventHorizonBlazorInterop.FuncClass<ParticleSystem>( entity => new ParticleSystem() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "removeRampGradient" }, gradient } ); } public async ValueTask<IParticleSystemCachedEntity> addColorGradient( decimal gradient, Color4 color1, Color4 color2 = null ) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "addColorGradient" }, gradient, color1, color2 } ); } public async ValueTask<IParticleSystemCachedEntity> removeColorGradient(decimal gradient) { return await EventHorizonBlazorInterop.FuncClass<IParticleSystemCachedEntity>( entity => new IParticleSystemCachedEntity() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "removeColorGradient" }, gradient } ); } public async ValueTask<decimal> getCapacity() { return await EventHorizonBlazorInterop.Func<decimal>( new object[] { new string[] { this.___guid, "getCapacity" } } ); } public async ValueTask<bool> isAlive() { return await EventHorizonBlazorInterop.Func<bool>( new object[] { new string[] { this.___guid, "isAlive" } } ); } public async ValueTask<bool> isStarted() { return await EventHorizonBlazorInterop.Func<bool>( new object[] { new string[] { this.___guid, "isStarted" } } ); } public async ValueTask start(System.Nullable<decimal> delay = null) { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "start" }, delay } ); } public async ValueTask stop(System.Nullable<bool> stopSubEmitters = null) { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "stop" }, stopSubEmitters } ); } public async ValueTask reset() { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "reset" } } ); } public async ValueTask recycleParticle(Particle particle) { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "recycleParticle" }, particle } ); } public async ValueTask fillDefines(string[] defines, decimal blendMode) { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "fillDefines" }, defines, blendMode } ); } public async ValueTask fillUniformsAttributesAndSamplerNames( string[] uniforms, string[] attributes, string[] samplers ) { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "fillUniformsAttributesAndSamplerNames" }, uniforms, attributes, samplers } ); } public async ValueTask animate(System.Nullable<bool> preWarmOnly = null) { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "animate" }, preWarmOnly } ); } public async ValueTask rebuild() { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "rebuild" } } ); } public async ValueTask<bool> isReady() { return await EventHorizonBlazorInterop.Func<bool>( new object[] { new string[] { this.___guid, "isReady" } } ); } public async ValueTask<decimal> render() { return await EventHorizonBlazorInterop.Func<decimal>( new object[] { new string[] { this.___guid, "render" } } ); } public async ValueTask dispose(System.Nullable<bool> disposeTexture = null) { await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "dispose" }, disposeTexture } ); } public async ValueTask<ParticleSystem> clone(string name, object newEmitter) { return await EventHorizonBlazorInterop.FuncClass<ParticleSystem>( entity => new ParticleSystem() { ___guid = entity.___guid }, new object[] { new string[] { this.___guid, "clone" }, name, newEmitter } ); } public async ValueTask<CachedEntity> serialize(System.Nullable<bool> serializeTexture = null) { return await EventHorizonBlazorInterop.Func<CachedEntity>( new object[] { new string[] { this.___guid, "serialize" }, serializeTexture } ); } #endregion }
1
0.61429
1
0.61429
game-dev
MEDIA
0.464279
game-dev
0.777489
1
0.777489
angelobreuer/Lavalink4NET
5,845
src/Lavalink4NET/Filters/Equalizer.cs
namespace Lavalink4NET.Filters; using System; using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [StructLayout(LayoutKind.Sequential, Size = EqualizerData.Size)] public sealed record class Equalizer : IEnumerable<float> { public const int Bands = 15; // 0-14 private readonly EqualizerData _data; public Equalizer() : this(data: default) { } private Equalizer(EqualizerData data) { _data = data; } public static Equalizer Default { get; } = new(); public float Band0 { get => this[0]; init => this[0] = value; } public float Band1 { get => this[1]; init => this[1] = value; } public float Band2 { get => this[2]; init => this[2] = value; } public float Band3 { get => this[3]; init => this[3] = value; } public float Band4 { get => this[4]; init => this[4] = value; } public float Band5 { get => this[5]; init => this[5] = value; } public float Band6 { get => this[6]; init => this[6] = value; } public float Band7 { get => this[7]; init => this[7] = value; } public float Band8 { get => this[8]; init => this[8] = value; } public float Band9 { get => this[9]; init => this[9] = value; } public float Band10 { get => this[10]; init => this[10] = value; } public float Band11 { get => this[11]; init => this[11] = value; } public float Band12 { get => this[12]; init => this[12] = value; } public float Band13 { get => this[13]; init => this[13] = value; } public float Band14 { get => this[14]; init => this[14] = value; } public float this[int band] { get => _data[band]; init => _data[band] = value; } public static Builder CreateBuilder(Equalizer equalizer) => new(equalizer._data); public static Builder CreateBuilder() => default; public IEnumerator<float> GetEnumerator() => new Enumerator(_data); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); public struct Builder { private EqualizerData _equalizer; internal Builder(EqualizerData data) { _equalizer = data; } public float this[int band] { get => _equalizer[band]; set => _equalizer[band] = value; } public float Band0 { get => this[0]; set => this[0] = value; } public float Band1 { get => this[1]; set => this[1] = value; } public float Band2 { get => this[2]; set => this[2] = value; } public float Band3 { get => this[3]; set => this[3] = value; } public float Band4 { get => this[4]; set => this[4] = value; } public float Band5 { get => this[5]; set => this[5] = value; } public float Band6 { get => this[6]; set => this[6] = value; } public float Band7 { get => this[7]; set => this[7] = value; } public float Band8 { get => this[8]; set => this[8] = value; } public float Band9 { get => this[9]; set => this[9] = value; } public float Band10 { get => this[10]; set => this[10] = value; } public float Band11 { get => this[11]; set => this[11] = value; } public float Band12 { get => this[12]; set => this[12] = value; } public float Band13 { get => this[13]; set => this[13] = value; } public float Band14 { get => this[14]; set => this[14] = value; } public readonly Equalizer Build() => new(_equalizer); } } internal struct EqualizerData { public const int Size = Equalizer.Bands * sizeof(float); public unsafe fixed float Data[Equalizer.Bands]; public unsafe ref float GetBand(int band) { if (band is < 0 or >= Equalizer.Bands) { throw new ArgumentOutOfRangeException( paramName: nameof(band), actualValue: band, message: $"The band index must be between zero and {Equalizer.Bands - 1}"); } return ref Data[band]; } public float this[int band] { get => GetBand(band); set => GetBand(band) = Math.Clamp(value, -0.25F, 1.0F); } } file sealed class Enumerator : IEnumerator<float> { private readonly EqualizerData _data; private int _index; public Enumerator(EqualizerData data) { _data = data; _index = -1; } public bool MoveNext() { var index = _index + 1; if (index < Equalizer.Bands) { _index = index; return true; } return false; } public void Reset() { _index = -1; } public void Dispose() { // no-op } public float Current { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => _data.GetBand(_index); } object IEnumerator.Current => Current; }
1
0.559853
1
0.559853
game-dev
MEDIA
0.691588
game-dev
0.755225
1
0.755225