mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-01-25 18:57:23 -05:00
More refactoring
This commit is contained in:
parent
4a4dbbb0b9
commit
8e81f0cbbc
@ -21,7 +21,7 @@ namespace OpenDiablo2.Common.Interfaces
|
||||
|
||||
int CameraOffset { get; set; }
|
||||
|
||||
void Initialize(string text, eHero value, eSessionType sessionType);
|
||||
void Initialize(string characterName, eHero hero, eSessionType sessionType);
|
||||
void Update(long ms);
|
||||
IEnumerable<MapCellInfo> GetMapCellInfo(int cellX, int cellY, eRenderCellType renderCellType);
|
||||
void UpdateMapCellInfo(int cellX, int cellY, eRenderCellType renderCellType, IEnumerable<MapCellInfo> mapCellInfo);
|
||||
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||
namespace OpenDiablo2.Common.Models
|
||||
{
|
||||
|
||||
public class ImageFrame : IDisposable
|
||||
public sealed class ImageFrame : IDisposable
|
||||
{
|
||||
public UInt32 Flip { get; internal set; }
|
||||
public UInt32 Width { get; internal set; }
|
||||
@ -19,7 +19,7 @@ namespace OpenDiablo2.Common.Models
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ImageData = new Int16[0];
|
||||
ImageData = null;
|
||||
}
|
||||
|
||||
public UInt32 GetColor(int x, int y, Palette palette)
|
||||
|
@ -560,7 +560,7 @@ namespace OpenDiablo2.Common.Models
|
||||
if (bm.GetInt32() != 1)
|
||||
throw new OpenDiablo2Exception("This value isn't 1. It has to be 1.");
|
||||
|
||||
var totalSizeCoded = bm.GetInt32();
|
||||
bm.GetInt32(); // TotalSizeCoded
|
||||
var directionOffsets = new int[NumberOfDirections];
|
||||
for (var i = 0; i < NumberOfDirections; i++)
|
||||
directionOffsets[i] = bm.GetInt32();
|
||||
|
@ -71,8 +71,6 @@ namespace OpenDiablo2.Common.Models
|
||||
|
||||
public sealed class MPQDS1
|
||||
{
|
||||
static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public string MapFile { get; set; }
|
||||
|
||||
public Int32 Version { get; internal set; }
|
||||
@ -88,7 +86,7 @@ namespace OpenDiablo2.Common.Models
|
||||
public Int32 NumberOfTags { get; internal set; }
|
||||
public Int32 NumberOfGroups { get; internal set; }
|
||||
|
||||
public MPQDT1[] DT1s = new MPQDT1[33];
|
||||
public MPQDT1[] DT1s { get; internal set; } = new MPQDT1[33];
|
||||
public List<DS1LookupTable> LookupTable { get; internal set; }
|
||||
|
||||
public List<string> FileNames { get; internal set; } = new List<string>();
|
||||
@ -98,7 +96,6 @@ namespace OpenDiablo2.Common.Models
|
||||
public MPQDS1Object[] Objects { get; internal set; }
|
||||
public MPQDS1Group[] Groups { get; internal set; }
|
||||
|
||||
// TODO: DI magic please
|
||||
public MPQDS1(Stream stream, LevelPreset level, LevelDetail levelDetail, LevelType levelType, IEngineDataManager engineDataManager, IResourceManager resourceManager)
|
||||
{
|
||||
var br = new BinaryReader(stream);
|
||||
@ -120,17 +117,18 @@ namespace OpenDiablo2.Common.Models
|
||||
FileCount = br.ReadInt32();
|
||||
for (int i = 0; i < FileCount; i++)
|
||||
{
|
||||
var fn = "";
|
||||
var fn = new StringBuilder();
|
||||
while (true)
|
||||
{
|
||||
var b = br.ReadByte();
|
||||
if (b == 0)
|
||||
break;
|
||||
fn += (char)b;
|
||||
fn.Append((char)b);
|
||||
}
|
||||
if (fn.StartsWith("\\d2\\"))
|
||||
fn = fn.Substring(4);
|
||||
FileNames.Add(fn);
|
||||
var fnStr = fn.ToString();
|
||||
if (fnStr.StartsWith("\\d2\\"))
|
||||
fnStr = fnStr.Substring(4);
|
||||
FileNames.Add(fnStr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,7 +207,7 @@ namespace OpenDiablo2.Common.Models
|
||||
}
|
||||
|
||||
|
||||
for (int n = 0; n < layoutStream.Count(); n++)
|
||||
for (int n = 0; n < layoutStream.Count; n++)
|
||||
{
|
||||
for (var y = 0; y < Height; y++)
|
||||
{
|
||||
@ -290,13 +288,11 @@ namespace OpenDiablo2.Common.Models
|
||||
var dt1Mask = level.Dt1Mask;
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
var tilePath = levelType.File[i];
|
||||
var isMasked = ((dt1Mask >> i) & 1) == 1;
|
||||
if (!isMasked || levelType.File[i] == "0")
|
||||
continue;
|
||||
|
||||
DT1s[i] = resourceManager.GetMPQDT1("data\\global\\tiles\\" + levelType.File[i].Replace("/", "\\"));
|
||||
|
||||
}
|
||||
|
||||
LookupTable = new List<DS1LookupTable>();
|
||||
|
@ -85,11 +85,13 @@ namespace OpenDiablo2.Common.Models
|
||||
0xF0, 0x70, 0xB0, 0x30, 0xD0, 0x50, 0x90, 0x10, 0xE0, 0x60, 0xA0, 0x20, 0xC0, 0x40, 0x80, 0x00
|
||||
};
|
||||
|
||||
#pragma warning disable S3963 // "static" fields should be initialized inline (it'l complain even if you put it in static constructor)
|
||||
static PKLibDecompress()
|
||||
{
|
||||
sPosition1 = GenerateDecodeTable(sDistBits, sDistCode);
|
||||
sPosition2 = GenerateDecodeTable(sLenBits, sLenCode);
|
||||
}
|
||||
#pragma warning restore S3963 // "static" fields should be initialized inline
|
||||
|
||||
public PKLibDecompress(Stream input)
|
||||
{
|
||||
|
@ -22,7 +22,6 @@ namespace OpenDiablo2.Core
|
||||
|
||||
private IScene currentScene;
|
||||
private IScene nextScene = null;
|
||||
private ISprite mouseSprite;
|
||||
|
||||
private readonly MPQ[] MPQs;
|
||||
|
||||
@ -78,7 +77,7 @@ namespace OpenDiablo2.Core
|
||||
LoadPalettes();
|
||||
LoadSoundData();
|
||||
|
||||
mouseSprite = renderWindow.LoadSprite(ResourcePaths.CursorDefault, Palettes.Units);
|
||||
var mouseSprite = renderWindow.LoadSprite(ResourcePaths.CursorDefault, Palettes.Units);
|
||||
var cursor = renderWindow.LoadCursor(mouseSprite, 0, new Point(0, 3));
|
||||
renderWindow.MouseCursor = cursor;
|
||||
|
||||
|
@ -233,7 +233,7 @@ namespace OpenDiablo2.Core.GameState_
|
||||
|
||||
public void UpdateMapCellInfo(int cellX, int cellY, eRenderCellType renderCellType, IEnumerable<MapCellInfo> mapCellInfo)
|
||||
{
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SelectItem(Item item)
|
||||
@ -289,14 +289,12 @@ namespace OpenDiablo2.Core.GameState_
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((props.Prop4 & 0x80) > 0)
|
||||
if (((props.Prop4 & 0x80) > 0) && (orientation != 10 && orientation != 11))
|
||||
{
|
||||
if (orientation != 10 && orientation != 11)
|
||||
{
|
||||
map.CellInfo[cellType][cellX + (cellY * map.FileData.Width)] = new MapCellInfo { Ignore = true };
|
||||
return null;
|
||||
}
|
||||
map.CellInfo[cellType][cellX + (cellY * map.FileData.Width)] = new MapCellInfo { Ignore = true };
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
if (cellType == eRenderCellType.WallUpper || cellType == eRenderCellType.WallLower)
|
||||
{
|
||||
@ -324,15 +322,11 @@ namespace OpenDiablo2.Core.GameState_
|
||||
}
|
||||
|
||||
// This is also a thing apparently
|
||||
if ((props.Prop4 & 0x80) > 0)
|
||||
if (((props.Prop4 & 0x80) > 0) && (orientation != 10 && orientation != 11))
|
||||
{
|
||||
if (orientation != 10 && orientation != 11)
|
||||
{
|
||||
map.CellInfo[cellType][cellX + (cellY * map.FileData.Width)] = new MapCellInfo { Ignore = true };
|
||||
return null;
|
||||
}
|
||||
map.CellInfo[cellType][cellX + (cellY * map.FileData.Width)] = new MapCellInfo { Ignore = true };
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int frame = 0;
|
||||
@ -346,8 +340,6 @@ namespace OpenDiablo2.Core.GameState_
|
||||
return null;
|
||||
}
|
||||
|
||||
//throw new ApplicationException("Invalid tile id found!");
|
||||
|
||||
MPQDT1Tile tile = null;
|
||||
if (tiles.First().Animated)
|
||||
{
|
||||
@ -360,7 +352,7 @@ namespace OpenDiablo2.Core.GameState_
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tiles.Count() > 0)
|
||||
if (tiles.Any())
|
||||
{
|
||||
var totalRarity = tiles.Sum(q => q.RarityOrFrameIndex);
|
||||
var random = new Random(Seed + cellX + (map.FileData.Width * cellY));
|
||||
@ -419,7 +411,7 @@ namespace OpenDiablo2.Core.GameState_
|
||||
|
||||
public void Update(long ms)
|
||||
{
|
||||
animationTime += (float)ms / 1000f;
|
||||
animationTime += ms / 1000f;
|
||||
animationTime -= (float)Math.Truncate(animationTime);
|
||||
var seconds = ms / 1000f;
|
||||
|
||||
|
@ -1,9 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
/* OpenDiablo 2 - An open source re-implementation of Diablo 2 in C#
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenDiablo2.Common;
|
||||
using OpenDiablo2.Common.Interfaces;
|
||||
using OpenDiablo2.Common.Models;
|
||||
|
||||
@ -20,7 +31,7 @@ namespace OpenDiablo2.Core
|
||||
|
||||
public Item getItem(string code)
|
||||
{
|
||||
Item item = engineDataManager.Items.Where(x => x.Code == code).FirstOrDefault();
|
||||
Item item = engineDataManager.Items.FirstOrDefault(x => x.Code == code);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
@ -121,14 +121,14 @@ namespace OpenDiablo2.Core.Map_Engine
|
||||
|
||||
|
||||
foreach (var cellInfo in gameState.GetMapCellInfo((int)ax, (int)ay, eRenderCellType.Floor))
|
||||
renderWindow.DrawMapCell(cellInfo, 320 + (int)px + (int)ox + xOffset, 210 + (int)py + (int)oy);
|
||||
renderWindow.DrawMapCell(cellInfo, 320 + px + (int)ox + xOffset, 210 + py + (int)oy);
|
||||
|
||||
|
||||
foreach (var cellInfo in gameState.GetMapCellInfo((int)ax, (int)ay, eRenderCellType.WallLower))
|
||||
renderWindow.DrawMapCell(cellInfo, 320 + (int)px + (int)ox + xOffset, 210 + (int)py + (int)oy);
|
||||
renderWindow.DrawMapCell(cellInfo, 320 + px + (int)ox + xOffset, 210 + py + (int)oy);
|
||||
|
||||
foreach (var cellInfo in gameState.GetMapCellInfo((int)ax, (int)ay, eRenderCellType.WallUpper))
|
||||
renderWindow.DrawMapCell(cellInfo, 320 + (int)px + (int)ox + xOffset, 210 + (int)py + (int)oy);
|
||||
renderWindow.DrawMapCell(cellInfo, 320 + px + (int)ox + xOffset, 210 + py + (int)oy);
|
||||
|
||||
// TODO: We need to render the characters infront of, or behind the wall properly...
|
||||
if (ty == 1 && tx == 1)
|
||||
@ -141,7 +141,7 @@ namespace OpenDiablo2.Core.Map_Engine
|
||||
}
|
||||
|
||||
foreach (var cellInfo in gameState.GetMapCellInfo((int)ax, (int)ay, eRenderCellType.Roof))
|
||||
renderWindow.DrawMapCell(cellInfo, 320 + (int)px + (int)ox + xOffset, 210 + (int)py + (int)oy);
|
||||
renderWindow.DrawMapCell(cellInfo, 320 + px + (int)ox + xOffset, 210 + py + (int)oy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,6 @@ namespace OpenDiablo2.Core.Map_Engine
|
||||
|
||||
public void Generate()
|
||||
{
|
||||
var random = new Random(gameState.Seed);
|
||||
|
||||
var test = gameState.LoadSubMap(2, new Point(10000, 10000));
|
||||
var wildBorder = 5; // (4-15)
|
||||
// TODO: Is there no data file that explicitly defines this??
|
||||
var townMap = gameState.LoadMap(eLevelId.Act1_Town1, new Point(0, 0));
|
||||
|
@ -41,9 +41,9 @@ namespace OpenDiablo2.Core
|
||||
var numberOfElements = br.ReadUInt16();
|
||||
var hashTableSize = br.ReadUInt32();
|
||||
br.ReadByte(); // Version (always 0)
|
||||
var stringOffset = br.ReadUInt32();
|
||||
var numberOfLoopsOffset = br.ReadUInt32();
|
||||
var fileSize = br.ReadUInt32();
|
||||
br.ReadUInt32(); // StringOffset
|
||||
br.ReadUInt32(); // NumberOfLoopsOffset
|
||||
br.ReadUInt32(); // FileSize
|
||||
|
||||
var elementIndexes = new List<UInt16>();
|
||||
for (var elementIndex = 0; elementIndex < numberOfElements; elementIndex++)
|
||||
@ -72,16 +72,16 @@ namespace OpenDiablo2.Core
|
||||
|
||||
stream.Seek(hashEntry.IndexString, SeekOrigin.Begin);
|
||||
|
||||
var key = "";
|
||||
var key = new StringBuilder();
|
||||
while(true)
|
||||
{
|
||||
var b = br.ReadByte();
|
||||
if (b == 0)
|
||||
break;
|
||||
key += (char)b;
|
||||
key.Append((char)b);
|
||||
}
|
||||
|
||||
lookupTable[key] = value;
|
||||
lookupTable[key.ToString()] = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,9 @@ namespace OpenDiablo2.Core.UI
|
||||
public Point Location {
|
||||
get => location;
|
||||
set {
|
||||
#pragma warning disable S4275 // Getters and setters should access the expected fields
|
||||
previouslyContainedItem = location;
|
||||
#pragma warning restore S4275 // Getters and setters should access the expected fields
|
||||
location = value;
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ namespace OpenDiablo2.GameServer_
|
||||
|
||||
public void Update(int ms)
|
||||
{
|
||||
var seconds = (float)ms / 1000f;
|
||||
var seconds = ms / 1000f;
|
||||
foreach(var player in Players)
|
||||
{
|
||||
UpdatePlayerMovement(player, seconds);
|
||||
@ -84,7 +84,7 @@ namespace OpenDiablo2.GameServer_
|
||||
|
||||
var rads = (float)player.MovementDirection * 22 * (float)Deg2Rad;
|
||||
|
||||
var speed = (float)(player.MovementType == eMovementType.Running ? player.GetRunVelocity() : player.GetWalkVeloicty()) / 4f;
|
||||
var speed = (player.MovementType == eMovementType.Running ? player.GetRunVelocity() : player.GetWalkVeloicty()) / 4f;
|
||||
|
||||
var moveX = (float)Math.Cos(rads) * seconds * speed;
|
||||
var moveY = (float)Math.Sin(rads) * seconds * speed;
|
||||
|
@ -4585,194 +4585,194 @@ namespace SDL2
|
||||
SDLK_y = 'y',
|
||||
SDLK_z = 'z',
|
||||
|
||||
SDLK_CAPSLOCK = (int)SDL_Scancode.SDL_SCANCODE_CAPSLOCK | SDLK_SCANCODE_MASK,
|
||||
SDLK_CAPSLOCK = SDL_Scancode.SDL_SCANCODE_CAPSLOCK | SDLK_SCANCODE_MASK,
|
||||
|
||||
SDLK_F1 = (int)SDL_Scancode.SDL_SCANCODE_F1 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F2 = (int)SDL_Scancode.SDL_SCANCODE_F2 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F3 = (int)SDL_Scancode.SDL_SCANCODE_F3 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F4 = (int)SDL_Scancode.SDL_SCANCODE_F4 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F5 = (int)SDL_Scancode.SDL_SCANCODE_F5 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F6 = (int)SDL_Scancode.SDL_SCANCODE_F6 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F7 = (int)SDL_Scancode.SDL_SCANCODE_F7 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F8 = (int)SDL_Scancode.SDL_SCANCODE_F8 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F9 = (int)SDL_Scancode.SDL_SCANCODE_F9 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F10 = (int)SDL_Scancode.SDL_SCANCODE_F10 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F11 = (int)SDL_Scancode.SDL_SCANCODE_F11 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F12 = (int)SDL_Scancode.SDL_SCANCODE_F12 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F1 = SDL_Scancode.SDL_SCANCODE_F1 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F2 = SDL_Scancode.SDL_SCANCODE_F2 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F3 = SDL_Scancode.SDL_SCANCODE_F3 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F4 = SDL_Scancode.SDL_SCANCODE_F4 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F5 = SDL_Scancode.SDL_SCANCODE_F5 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F6 = SDL_Scancode.SDL_SCANCODE_F6 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F7 = SDL_Scancode.SDL_SCANCODE_F7 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F8 = SDL_Scancode.SDL_SCANCODE_F8 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F9 = SDL_Scancode.SDL_SCANCODE_F9 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F10 = SDL_Scancode.SDL_SCANCODE_F10 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F11 = SDL_Scancode.SDL_SCANCODE_F11 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F12 = SDL_Scancode.SDL_SCANCODE_F12 | SDLK_SCANCODE_MASK,
|
||||
|
||||
SDLK_PRINTSCREEN = (int)SDL_Scancode.SDL_SCANCODE_PRINTSCREEN | SDLK_SCANCODE_MASK,
|
||||
SDLK_SCROLLLOCK = (int)SDL_Scancode.SDL_SCANCODE_SCROLLLOCK | SDLK_SCANCODE_MASK,
|
||||
SDLK_PAUSE = (int)SDL_Scancode.SDL_SCANCODE_PAUSE | SDLK_SCANCODE_MASK,
|
||||
SDLK_INSERT = (int)SDL_Scancode.SDL_SCANCODE_INSERT | SDLK_SCANCODE_MASK,
|
||||
SDLK_HOME = (int)SDL_Scancode.SDL_SCANCODE_HOME | SDLK_SCANCODE_MASK,
|
||||
SDLK_PAGEUP = (int)SDL_Scancode.SDL_SCANCODE_PAGEUP | SDLK_SCANCODE_MASK,
|
||||
SDLK_PRINTSCREEN = SDL_Scancode.SDL_SCANCODE_PRINTSCREEN | SDLK_SCANCODE_MASK,
|
||||
SDLK_SCROLLLOCK = SDL_Scancode.SDL_SCANCODE_SCROLLLOCK | SDLK_SCANCODE_MASK,
|
||||
SDLK_PAUSE = SDL_Scancode.SDL_SCANCODE_PAUSE | SDLK_SCANCODE_MASK,
|
||||
SDLK_INSERT = SDL_Scancode.SDL_SCANCODE_INSERT | SDLK_SCANCODE_MASK,
|
||||
SDLK_HOME = SDL_Scancode.SDL_SCANCODE_HOME | SDLK_SCANCODE_MASK,
|
||||
SDLK_PAGEUP = SDL_Scancode.SDL_SCANCODE_PAGEUP | SDLK_SCANCODE_MASK,
|
||||
SDLK_DELETE = 127,
|
||||
SDLK_END = (int)SDL_Scancode.SDL_SCANCODE_END | SDLK_SCANCODE_MASK,
|
||||
SDLK_PAGEDOWN = (int)SDL_Scancode.SDL_SCANCODE_PAGEDOWN | SDLK_SCANCODE_MASK,
|
||||
SDLK_RIGHT = (int)SDL_Scancode.SDL_SCANCODE_RIGHT | SDLK_SCANCODE_MASK,
|
||||
SDLK_LEFT = (int)SDL_Scancode.SDL_SCANCODE_LEFT | SDLK_SCANCODE_MASK,
|
||||
SDLK_DOWN = (int)SDL_Scancode.SDL_SCANCODE_DOWN | SDLK_SCANCODE_MASK,
|
||||
SDLK_UP = (int)SDL_Scancode.SDL_SCANCODE_UP | SDLK_SCANCODE_MASK,
|
||||
SDLK_END = SDL_Scancode.SDL_SCANCODE_END | SDLK_SCANCODE_MASK,
|
||||
SDLK_PAGEDOWN = SDL_Scancode.SDL_SCANCODE_PAGEDOWN | SDLK_SCANCODE_MASK,
|
||||
SDLK_RIGHT = SDL_Scancode.SDL_SCANCODE_RIGHT | SDLK_SCANCODE_MASK,
|
||||
SDLK_LEFT = SDL_Scancode.SDL_SCANCODE_LEFT | SDLK_SCANCODE_MASK,
|
||||
SDLK_DOWN = SDL_Scancode.SDL_SCANCODE_DOWN | SDLK_SCANCODE_MASK,
|
||||
SDLK_UP = SDL_Scancode.SDL_SCANCODE_UP | SDLK_SCANCODE_MASK,
|
||||
|
||||
SDLK_NUMLOCKCLEAR = (int)SDL_Scancode.SDL_SCANCODE_NUMLOCKCLEAR | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_DIVIDE = (int)SDL_Scancode.SDL_SCANCODE_KP_DIVIDE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MULTIPLY = (int)SDL_Scancode.SDL_SCANCODE_KP_MULTIPLY | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MINUS = (int)SDL_Scancode.SDL_SCANCODE_KP_MINUS | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_PLUS = (int)SDL_Scancode.SDL_SCANCODE_KP_PLUS | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_ENTER = (int)SDL_Scancode.SDL_SCANCODE_KP_ENTER | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_1 = (int)SDL_Scancode.SDL_SCANCODE_KP_1 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_2 = (int)SDL_Scancode.SDL_SCANCODE_KP_2 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_3 = (int)SDL_Scancode.SDL_SCANCODE_KP_3 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_4 = (int)SDL_Scancode.SDL_SCANCODE_KP_4 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_5 = (int)SDL_Scancode.SDL_SCANCODE_KP_5 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_6 = (int)SDL_Scancode.SDL_SCANCODE_KP_6 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_7 = (int)SDL_Scancode.SDL_SCANCODE_KP_7 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_8 = (int)SDL_Scancode.SDL_SCANCODE_KP_8 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_9 = (int)SDL_Scancode.SDL_SCANCODE_KP_9 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_0 = (int)SDL_Scancode.SDL_SCANCODE_KP_0 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_PERIOD = (int)SDL_Scancode.SDL_SCANCODE_KP_PERIOD | SDLK_SCANCODE_MASK,
|
||||
SDLK_NUMLOCKCLEAR = SDL_Scancode.SDL_SCANCODE_NUMLOCKCLEAR | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_DIVIDE = SDL_Scancode.SDL_SCANCODE_KP_DIVIDE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MULTIPLY = SDL_Scancode.SDL_SCANCODE_KP_MULTIPLY | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MINUS = SDL_Scancode.SDL_SCANCODE_KP_MINUS | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_PLUS = SDL_Scancode.SDL_SCANCODE_KP_PLUS | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_ENTER = SDL_Scancode.SDL_SCANCODE_KP_ENTER | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_1 = SDL_Scancode.SDL_SCANCODE_KP_1 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_2 = SDL_Scancode.SDL_SCANCODE_KP_2 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_3 = SDL_Scancode.SDL_SCANCODE_KP_3 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_4 = SDL_Scancode.SDL_SCANCODE_KP_4 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_5 = SDL_Scancode.SDL_SCANCODE_KP_5 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_6 = SDL_Scancode.SDL_SCANCODE_KP_6 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_7 = SDL_Scancode.SDL_SCANCODE_KP_7 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_8 = SDL_Scancode.SDL_SCANCODE_KP_8 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_9 = SDL_Scancode.SDL_SCANCODE_KP_9 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_0 = SDL_Scancode.SDL_SCANCODE_KP_0 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_PERIOD = SDL_Scancode.SDL_SCANCODE_KP_PERIOD | SDLK_SCANCODE_MASK,
|
||||
|
||||
SDLK_APPLICATION = (int)SDL_Scancode.SDL_SCANCODE_APPLICATION | SDLK_SCANCODE_MASK,
|
||||
SDLK_POWER = (int)SDL_Scancode.SDL_SCANCODE_POWER | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_EQUALS = (int)SDL_Scancode.SDL_SCANCODE_KP_EQUALS | SDLK_SCANCODE_MASK,
|
||||
SDLK_F13 = (int)SDL_Scancode.SDL_SCANCODE_F13 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F14 = (int)SDL_Scancode.SDL_SCANCODE_F14 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F15 = (int)SDL_Scancode.SDL_SCANCODE_F15 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F16 = (int)SDL_Scancode.SDL_SCANCODE_F16 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F17 = (int)SDL_Scancode.SDL_SCANCODE_F17 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F18 = (int)SDL_Scancode.SDL_SCANCODE_F18 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F19 = (int)SDL_Scancode.SDL_SCANCODE_F19 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F20 = (int)SDL_Scancode.SDL_SCANCODE_F20 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F21 = (int)SDL_Scancode.SDL_SCANCODE_F21 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F22 = (int)SDL_Scancode.SDL_SCANCODE_F22 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F23 = (int)SDL_Scancode.SDL_SCANCODE_F23 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F24 = (int)SDL_Scancode.SDL_SCANCODE_F24 | SDLK_SCANCODE_MASK,
|
||||
SDLK_EXECUTE = (int)SDL_Scancode.SDL_SCANCODE_EXECUTE | SDLK_SCANCODE_MASK,
|
||||
SDLK_HELP = (int)SDL_Scancode.SDL_SCANCODE_HELP | SDLK_SCANCODE_MASK,
|
||||
SDLK_MENU = (int)SDL_Scancode.SDL_SCANCODE_MENU | SDLK_SCANCODE_MASK,
|
||||
SDLK_SELECT = (int)SDL_Scancode.SDL_SCANCODE_SELECT | SDLK_SCANCODE_MASK,
|
||||
SDLK_STOP = (int)SDL_Scancode.SDL_SCANCODE_STOP | SDLK_SCANCODE_MASK,
|
||||
SDLK_AGAIN = (int)SDL_Scancode.SDL_SCANCODE_AGAIN | SDLK_SCANCODE_MASK,
|
||||
SDLK_UNDO = (int)SDL_Scancode.SDL_SCANCODE_UNDO | SDLK_SCANCODE_MASK,
|
||||
SDLK_CUT = (int)SDL_Scancode.SDL_SCANCODE_CUT | SDLK_SCANCODE_MASK,
|
||||
SDLK_COPY = (int)SDL_Scancode.SDL_SCANCODE_COPY | SDLK_SCANCODE_MASK,
|
||||
SDLK_PASTE = (int)SDL_Scancode.SDL_SCANCODE_PASTE | SDLK_SCANCODE_MASK,
|
||||
SDLK_FIND = (int)SDL_Scancode.SDL_SCANCODE_FIND | SDLK_SCANCODE_MASK,
|
||||
SDLK_MUTE = (int)SDL_Scancode.SDL_SCANCODE_MUTE | SDLK_SCANCODE_MASK,
|
||||
SDLK_VOLUMEUP = (int)SDL_Scancode.SDL_SCANCODE_VOLUMEUP | SDLK_SCANCODE_MASK,
|
||||
SDLK_VOLUMEDOWN = (int)SDL_Scancode.SDL_SCANCODE_VOLUMEDOWN | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_COMMA = (int)SDL_Scancode.SDL_SCANCODE_KP_COMMA | SDLK_SCANCODE_MASK,
|
||||
SDLK_APPLICATION = SDL_Scancode.SDL_SCANCODE_APPLICATION | SDLK_SCANCODE_MASK,
|
||||
SDLK_POWER = SDL_Scancode.SDL_SCANCODE_POWER | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_EQUALS = SDL_Scancode.SDL_SCANCODE_KP_EQUALS | SDLK_SCANCODE_MASK,
|
||||
SDLK_F13 = SDL_Scancode.SDL_SCANCODE_F13 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F14 = SDL_Scancode.SDL_SCANCODE_F14 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F15 = SDL_Scancode.SDL_SCANCODE_F15 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F16 = SDL_Scancode.SDL_SCANCODE_F16 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F17 = SDL_Scancode.SDL_SCANCODE_F17 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F18 = SDL_Scancode.SDL_SCANCODE_F18 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F19 = SDL_Scancode.SDL_SCANCODE_F19 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F20 = SDL_Scancode.SDL_SCANCODE_F20 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F21 = SDL_Scancode.SDL_SCANCODE_F21 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F22 = SDL_Scancode.SDL_SCANCODE_F22 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F23 = SDL_Scancode.SDL_SCANCODE_F23 | SDLK_SCANCODE_MASK,
|
||||
SDLK_F24 = SDL_Scancode.SDL_SCANCODE_F24 | SDLK_SCANCODE_MASK,
|
||||
SDLK_EXECUTE = SDL_Scancode.SDL_SCANCODE_EXECUTE | SDLK_SCANCODE_MASK,
|
||||
SDLK_HELP = SDL_Scancode.SDL_SCANCODE_HELP | SDLK_SCANCODE_MASK,
|
||||
SDLK_MENU = SDL_Scancode.SDL_SCANCODE_MENU | SDLK_SCANCODE_MASK,
|
||||
SDLK_SELECT = SDL_Scancode.SDL_SCANCODE_SELECT | SDLK_SCANCODE_MASK,
|
||||
SDLK_STOP = SDL_Scancode.SDL_SCANCODE_STOP | SDLK_SCANCODE_MASK,
|
||||
SDLK_AGAIN = SDL_Scancode.SDL_SCANCODE_AGAIN | SDLK_SCANCODE_MASK,
|
||||
SDLK_UNDO = SDL_Scancode.SDL_SCANCODE_UNDO | SDLK_SCANCODE_MASK,
|
||||
SDLK_CUT = SDL_Scancode.SDL_SCANCODE_CUT | SDLK_SCANCODE_MASK,
|
||||
SDLK_COPY = SDL_Scancode.SDL_SCANCODE_COPY | SDLK_SCANCODE_MASK,
|
||||
SDLK_PASTE = SDL_Scancode.SDL_SCANCODE_PASTE | SDLK_SCANCODE_MASK,
|
||||
SDLK_FIND = SDL_Scancode.SDL_SCANCODE_FIND | SDLK_SCANCODE_MASK,
|
||||
SDLK_MUTE = SDL_Scancode.SDL_SCANCODE_MUTE | SDLK_SCANCODE_MASK,
|
||||
SDLK_VOLUMEUP = SDL_Scancode.SDL_SCANCODE_VOLUMEUP | SDLK_SCANCODE_MASK,
|
||||
SDLK_VOLUMEDOWN = SDL_Scancode.SDL_SCANCODE_VOLUMEDOWN | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_COMMA = SDL_Scancode.SDL_SCANCODE_KP_COMMA | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_EQUALSAS400 =
|
||||
(int)SDL_Scancode.SDL_SCANCODE_KP_EQUALSAS400 | SDLK_SCANCODE_MASK,
|
||||
SDL_Scancode.SDL_SCANCODE_KP_EQUALSAS400 | SDLK_SCANCODE_MASK,
|
||||
|
||||
SDLK_ALTERASE = (int)SDL_Scancode.SDL_SCANCODE_ALTERASE | SDLK_SCANCODE_MASK,
|
||||
SDLK_SYSREQ = (int)SDL_Scancode.SDL_SCANCODE_SYSREQ | SDLK_SCANCODE_MASK,
|
||||
SDLK_CANCEL = (int)SDL_Scancode.SDL_SCANCODE_CANCEL | SDLK_SCANCODE_MASK,
|
||||
SDLK_CLEAR = (int)SDL_Scancode.SDL_SCANCODE_CLEAR | SDLK_SCANCODE_MASK,
|
||||
SDLK_PRIOR = (int)SDL_Scancode.SDL_SCANCODE_PRIOR | SDLK_SCANCODE_MASK,
|
||||
SDLK_RETURN2 = (int)SDL_Scancode.SDL_SCANCODE_RETURN2 | SDLK_SCANCODE_MASK,
|
||||
SDLK_SEPARATOR = (int)SDL_Scancode.SDL_SCANCODE_SEPARATOR | SDLK_SCANCODE_MASK,
|
||||
SDLK_OUT = (int)SDL_Scancode.SDL_SCANCODE_OUT | SDLK_SCANCODE_MASK,
|
||||
SDLK_OPER = (int)SDL_Scancode.SDL_SCANCODE_OPER | SDLK_SCANCODE_MASK,
|
||||
SDLK_CLEARAGAIN = (int)SDL_Scancode.SDL_SCANCODE_CLEARAGAIN | SDLK_SCANCODE_MASK,
|
||||
SDLK_CRSEL = (int)SDL_Scancode.SDL_SCANCODE_CRSEL | SDLK_SCANCODE_MASK,
|
||||
SDLK_EXSEL = (int)SDL_Scancode.SDL_SCANCODE_EXSEL | SDLK_SCANCODE_MASK,
|
||||
SDLK_ALTERASE = SDL_Scancode.SDL_SCANCODE_ALTERASE | SDLK_SCANCODE_MASK,
|
||||
SDLK_SYSREQ = SDL_Scancode.SDL_SCANCODE_SYSREQ | SDLK_SCANCODE_MASK,
|
||||
SDLK_CANCEL = SDL_Scancode.SDL_SCANCODE_CANCEL | SDLK_SCANCODE_MASK,
|
||||
SDLK_CLEAR = SDL_Scancode.SDL_SCANCODE_CLEAR | SDLK_SCANCODE_MASK,
|
||||
SDLK_PRIOR = SDL_Scancode.SDL_SCANCODE_PRIOR | SDLK_SCANCODE_MASK,
|
||||
SDLK_RETURN2 = SDL_Scancode.SDL_SCANCODE_RETURN2 | SDLK_SCANCODE_MASK,
|
||||
SDLK_SEPARATOR = SDL_Scancode.SDL_SCANCODE_SEPARATOR | SDLK_SCANCODE_MASK,
|
||||
SDLK_OUT = SDL_Scancode.SDL_SCANCODE_OUT | SDLK_SCANCODE_MASK,
|
||||
SDLK_OPER = SDL_Scancode.SDL_SCANCODE_OPER | SDLK_SCANCODE_MASK,
|
||||
SDLK_CLEARAGAIN = SDL_Scancode.SDL_SCANCODE_CLEARAGAIN | SDLK_SCANCODE_MASK,
|
||||
SDLK_CRSEL = SDL_Scancode.SDL_SCANCODE_CRSEL | SDLK_SCANCODE_MASK,
|
||||
SDLK_EXSEL = SDL_Scancode.SDL_SCANCODE_EXSEL | SDLK_SCANCODE_MASK,
|
||||
|
||||
SDLK_KP_00 = (int)SDL_Scancode.SDL_SCANCODE_KP_00 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_000 = (int)SDL_Scancode.SDL_SCANCODE_KP_000 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_00 = SDL_Scancode.SDL_SCANCODE_KP_00 | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_000 = SDL_Scancode.SDL_SCANCODE_KP_000 | SDLK_SCANCODE_MASK,
|
||||
SDLK_THOUSANDSSEPARATOR =
|
||||
(int)SDL_Scancode.SDL_SCANCODE_THOUSANDSSEPARATOR | SDLK_SCANCODE_MASK,
|
||||
SDL_Scancode.SDL_SCANCODE_THOUSANDSSEPARATOR | SDLK_SCANCODE_MASK,
|
||||
SDLK_DECIMALSEPARATOR =
|
||||
(int)SDL_Scancode.SDL_SCANCODE_DECIMALSEPARATOR | SDLK_SCANCODE_MASK,
|
||||
SDLK_CURRENCYUNIT = (int)SDL_Scancode.SDL_SCANCODE_CURRENCYUNIT | SDLK_SCANCODE_MASK,
|
||||
SDL_Scancode.SDL_SCANCODE_DECIMALSEPARATOR | SDLK_SCANCODE_MASK,
|
||||
SDLK_CURRENCYUNIT = SDL_Scancode.SDL_SCANCODE_CURRENCYUNIT | SDLK_SCANCODE_MASK,
|
||||
SDLK_CURRENCYSUBUNIT =
|
||||
(int)SDL_Scancode.SDL_SCANCODE_CURRENCYSUBUNIT | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_LEFTPAREN = (int)SDL_Scancode.SDL_SCANCODE_KP_LEFTPAREN | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_RIGHTPAREN = (int)SDL_Scancode.SDL_SCANCODE_KP_RIGHTPAREN | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_LEFTBRACE = (int)SDL_Scancode.SDL_SCANCODE_KP_LEFTBRACE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_RIGHTBRACE = (int)SDL_Scancode.SDL_SCANCODE_KP_RIGHTBRACE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_TAB = (int)SDL_Scancode.SDL_SCANCODE_KP_TAB | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_BACKSPACE = (int)SDL_Scancode.SDL_SCANCODE_KP_BACKSPACE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_A = (int)SDL_Scancode.SDL_SCANCODE_KP_A | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_B = (int)SDL_Scancode.SDL_SCANCODE_KP_B | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_C = (int)SDL_Scancode.SDL_SCANCODE_KP_C | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_D = (int)SDL_Scancode.SDL_SCANCODE_KP_D | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_E = (int)SDL_Scancode.SDL_SCANCODE_KP_E | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_F = (int)SDL_Scancode.SDL_SCANCODE_KP_F | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_XOR = (int)SDL_Scancode.SDL_SCANCODE_KP_XOR | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_POWER = (int)SDL_Scancode.SDL_SCANCODE_KP_POWER | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_PERCENT = (int)SDL_Scancode.SDL_SCANCODE_KP_PERCENT | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_LESS = (int)SDL_Scancode.SDL_SCANCODE_KP_LESS | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_GREATER = (int)SDL_Scancode.SDL_SCANCODE_KP_GREATER | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_AMPERSAND = (int)SDL_Scancode.SDL_SCANCODE_KP_AMPERSAND | SDLK_SCANCODE_MASK,
|
||||
SDL_Scancode.SDL_SCANCODE_CURRENCYSUBUNIT | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_LEFTPAREN = SDL_Scancode.SDL_SCANCODE_KP_LEFTPAREN | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_RIGHTPAREN = SDL_Scancode.SDL_SCANCODE_KP_RIGHTPAREN | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_LEFTBRACE = SDL_Scancode.SDL_SCANCODE_KP_LEFTBRACE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_RIGHTBRACE = SDL_Scancode.SDL_SCANCODE_KP_RIGHTBRACE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_TAB = SDL_Scancode.SDL_SCANCODE_KP_TAB | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_BACKSPACE = SDL_Scancode.SDL_SCANCODE_KP_BACKSPACE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_A = SDL_Scancode.SDL_SCANCODE_KP_A | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_B = SDL_Scancode.SDL_SCANCODE_KP_B | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_C = SDL_Scancode.SDL_SCANCODE_KP_C | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_D = SDL_Scancode.SDL_SCANCODE_KP_D | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_E = SDL_Scancode.SDL_SCANCODE_KP_E | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_F = SDL_Scancode.SDL_SCANCODE_KP_F | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_XOR = SDL_Scancode.SDL_SCANCODE_KP_XOR | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_POWER = SDL_Scancode.SDL_SCANCODE_KP_POWER | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_PERCENT = SDL_Scancode.SDL_SCANCODE_KP_PERCENT | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_LESS = SDL_Scancode.SDL_SCANCODE_KP_LESS | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_GREATER = SDL_Scancode.SDL_SCANCODE_KP_GREATER | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_AMPERSAND = SDL_Scancode.SDL_SCANCODE_KP_AMPERSAND | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_DBLAMPERSAND =
|
||||
(int)SDL_Scancode.SDL_SCANCODE_KP_DBLAMPERSAND | SDLK_SCANCODE_MASK,
|
||||
SDL_Scancode.SDL_SCANCODE_KP_DBLAMPERSAND | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_VERTICALBAR =
|
||||
(int)SDL_Scancode.SDL_SCANCODE_KP_VERTICALBAR | SDLK_SCANCODE_MASK,
|
||||
SDL_Scancode.SDL_SCANCODE_KP_VERTICALBAR | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_DBLVERTICALBAR =
|
||||
(int)SDL_Scancode.SDL_SCANCODE_KP_DBLVERTICALBAR | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_COLON = (int)SDL_Scancode.SDL_SCANCODE_KP_COLON | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_HASH = (int)SDL_Scancode.SDL_SCANCODE_KP_HASH | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_SPACE = (int)SDL_Scancode.SDL_SCANCODE_KP_SPACE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_AT = (int)SDL_Scancode.SDL_SCANCODE_KP_AT | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_EXCLAM = (int)SDL_Scancode.SDL_SCANCODE_KP_EXCLAM | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MEMSTORE = (int)SDL_Scancode.SDL_SCANCODE_KP_MEMSTORE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MEMRECALL = (int)SDL_Scancode.SDL_SCANCODE_KP_MEMRECALL | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MEMCLEAR = (int)SDL_Scancode.SDL_SCANCODE_KP_MEMCLEAR | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MEMADD = (int)SDL_Scancode.SDL_SCANCODE_KP_MEMADD | SDLK_SCANCODE_MASK,
|
||||
SDL_Scancode.SDL_SCANCODE_KP_DBLVERTICALBAR | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_COLON = SDL_Scancode.SDL_SCANCODE_KP_COLON | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_HASH = SDL_Scancode.SDL_SCANCODE_KP_HASH | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_SPACE = SDL_Scancode.SDL_SCANCODE_KP_SPACE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_AT = SDL_Scancode.SDL_SCANCODE_KP_AT | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_EXCLAM = SDL_Scancode.SDL_SCANCODE_KP_EXCLAM | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MEMSTORE = SDL_Scancode.SDL_SCANCODE_KP_MEMSTORE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MEMRECALL = SDL_Scancode.SDL_SCANCODE_KP_MEMRECALL | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MEMCLEAR = SDL_Scancode.SDL_SCANCODE_KP_MEMCLEAR | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MEMADD = SDL_Scancode.SDL_SCANCODE_KP_MEMADD | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MEMSUBTRACT =
|
||||
(int)SDL_Scancode.SDL_SCANCODE_KP_MEMSUBTRACT | SDLK_SCANCODE_MASK,
|
||||
SDL_Scancode.SDL_SCANCODE_KP_MEMSUBTRACT | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MEMMULTIPLY =
|
||||
(int)SDL_Scancode.SDL_SCANCODE_KP_MEMMULTIPLY | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MEMDIVIDE = (int)SDL_Scancode.SDL_SCANCODE_KP_MEMDIVIDE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_PLUSMINUS = (int)SDL_Scancode.SDL_SCANCODE_KP_PLUSMINUS | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_CLEAR = (int)SDL_Scancode.SDL_SCANCODE_KP_CLEAR | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_CLEARENTRY = (int)SDL_Scancode.SDL_SCANCODE_KP_CLEARENTRY | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_BINARY = (int)SDL_Scancode.SDL_SCANCODE_KP_BINARY | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_OCTAL = (int)SDL_Scancode.SDL_SCANCODE_KP_OCTAL | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_DECIMAL = (int)SDL_Scancode.SDL_SCANCODE_KP_DECIMAL | SDLK_SCANCODE_MASK,
|
||||
SDL_Scancode.SDL_SCANCODE_KP_MEMMULTIPLY | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_MEMDIVIDE = SDL_Scancode.SDL_SCANCODE_KP_MEMDIVIDE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_PLUSMINUS = SDL_Scancode.SDL_SCANCODE_KP_PLUSMINUS | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_CLEAR = SDL_Scancode.SDL_SCANCODE_KP_CLEAR | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_CLEARENTRY = SDL_Scancode.SDL_SCANCODE_KP_CLEARENTRY | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_BINARY = SDL_Scancode.SDL_SCANCODE_KP_BINARY | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_OCTAL = SDL_Scancode.SDL_SCANCODE_KP_OCTAL | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_DECIMAL = SDL_Scancode.SDL_SCANCODE_KP_DECIMAL | SDLK_SCANCODE_MASK,
|
||||
SDLK_KP_HEXADECIMAL =
|
||||
(int)SDL_Scancode.SDL_SCANCODE_KP_HEXADECIMAL | SDLK_SCANCODE_MASK,
|
||||
SDL_Scancode.SDL_SCANCODE_KP_HEXADECIMAL | SDLK_SCANCODE_MASK,
|
||||
|
||||
SDLK_LCTRL = (int)SDL_Scancode.SDL_SCANCODE_LCTRL | SDLK_SCANCODE_MASK,
|
||||
SDLK_LSHIFT = (int)SDL_Scancode.SDL_SCANCODE_LSHIFT | SDLK_SCANCODE_MASK,
|
||||
SDLK_LALT = (int)SDL_Scancode.SDL_SCANCODE_LALT | SDLK_SCANCODE_MASK,
|
||||
SDLK_LGUI = (int)SDL_Scancode.SDL_SCANCODE_LGUI | SDLK_SCANCODE_MASK,
|
||||
SDLK_RCTRL = (int)SDL_Scancode.SDL_SCANCODE_RCTRL | SDLK_SCANCODE_MASK,
|
||||
SDLK_RSHIFT = (int)SDL_Scancode.SDL_SCANCODE_RSHIFT | SDLK_SCANCODE_MASK,
|
||||
SDLK_RALT = (int)SDL_Scancode.SDL_SCANCODE_RALT | SDLK_SCANCODE_MASK,
|
||||
SDLK_RGUI = (int)SDL_Scancode.SDL_SCANCODE_RGUI | SDLK_SCANCODE_MASK,
|
||||
SDLK_LCTRL = SDL_Scancode.SDL_SCANCODE_LCTRL | SDLK_SCANCODE_MASK,
|
||||
SDLK_LSHIFT = SDL_Scancode.SDL_SCANCODE_LSHIFT | SDLK_SCANCODE_MASK,
|
||||
SDLK_LALT = SDL_Scancode.SDL_SCANCODE_LALT | SDLK_SCANCODE_MASK,
|
||||
SDLK_LGUI = SDL_Scancode.SDL_SCANCODE_LGUI | SDLK_SCANCODE_MASK,
|
||||
SDLK_RCTRL = SDL_Scancode.SDL_SCANCODE_RCTRL | SDLK_SCANCODE_MASK,
|
||||
SDLK_RSHIFT = SDL_Scancode.SDL_SCANCODE_RSHIFT | SDLK_SCANCODE_MASK,
|
||||
SDLK_RALT = SDL_Scancode.SDL_SCANCODE_RALT | SDLK_SCANCODE_MASK,
|
||||
SDLK_RGUI = SDL_Scancode.SDL_SCANCODE_RGUI | SDLK_SCANCODE_MASK,
|
||||
|
||||
SDLK_MODE = (int)SDL_Scancode.SDL_SCANCODE_MODE | SDLK_SCANCODE_MASK,
|
||||
SDLK_MODE = SDL_Scancode.SDL_SCANCODE_MODE | SDLK_SCANCODE_MASK,
|
||||
|
||||
SDLK_AUDIONEXT = (int)SDL_Scancode.SDL_SCANCODE_AUDIONEXT | SDLK_SCANCODE_MASK,
|
||||
SDLK_AUDIOPREV = (int)SDL_Scancode.SDL_SCANCODE_AUDIOPREV | SDLK_SCANCODE_MASK,
|
||||
SDLK_AUDIOSTOP = (int)SDL_Scancode.SDL_SCANCODE_AUDIOSTOP | SDLK_SCANCODE_MASK,
|
||||
SDLK_AUDIOPLAY = (int)SDL_Scancode.SDL_SCANCODE_AUDIOPLAY | SDLK_SCANCODE_MASK,
|
||||
SDLK_AUDIOMUTE = (int)SDL_Scancode.SDL_SCANCODE_AUDIOMUTE | SDLK_SCANCODE_MASK,
|
||||
SDLK_MEDIASELECT = (int)SDL_Scancode.SDL_SCANCODE_MEDIASELECT | SDLK_SCANCODE_MASK,
|
||||
SDLK_WWW = (int)SDL_Scancode.SDL_SCANCODE_WWW | SDLK_SCANCODE_MASK,
|
||||
SDLK_MAIL = (int)SDL_Scancode.SDL_SCANCODE_MAIL | SDLK_SCANCODE_MASK,
|
||||
SDLK_CALCULATOR = (int)SDL_Scancode.SDL_SCANCODE_CALCULATOR | SDLK_SCANCODE_MASK,
|
||||
SDLK_COMPUTER = (int)SDL_Scancode.SDL_SCANCODE_COMPUTER | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_SEARCH = (int)SDL_Scancode.SDL_SCANCODE_AC_SEARCH | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_HOME = (int)SDL_Scancode.SDL_SCANCODE_AC_HOME | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_BACK = (int)SDL_Scancode.SDL_SCANCODE_AC_BACK | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_FORWARD = (int)SDL_Scancode.SDL_SCANCODE_AC_FORWARD | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_STOP = (int)SDL_Scancode.SDL_SCANCODE_AC_STOP | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_REFRESH = (int)SDL_Scancode.SDL_SCANCODE_AC_REFRESH | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_BOOKMARKS = (int)SDL_Scancode.SDL_SCANCODE_AC_BOOKMARKS | SDLK_SCANCODE_MASK,
|
||||
SDLK_AUDIONEXT = SDL_Scancode.SDL_SCANCODE_AUDIONEXT | SDLK_SCANCODE_MASK,
|
||||
SDLK_AUDIOPREV = SDL_Scancode.SDL_SCANCODE_AUDIOPREV | SDLK_SCANCODE_MASK,
|
||||
SDLK_AUDIOSTOP = SDL_Scancode.SDL_SCANCODE_AUDIOSTOP | SDLK_SCANCODE_MASK,
|
||||
SDLK_AUDIOPLAY = SDL_Scancode.SDL_SCANCODE_AUDIOPLAY | SDLK_SCANCODE_MASK,
|
||||
SDLK_AUDIOMUTE = SDL_Scancode.SDL_SCANCODE_AUDIOMUTE | SDLK_SCANCODE_MASK,
|
||||
SDLK_MEDIASELECT = SDL_Scancode.SDL_SCANCODE_MEDIASELECT | SDLK_SCANCODE_MASK,
|
||||
SDLK_WWW = SDL_Scancode.SDL_SCANCODE_WWW | SDLK_SCANCODE_MASK,
|
||||
SDLK_MAIL = SDL_Scancode.SDL_SCANCODE_MAIL | SDLK_SCANCODE_MASK,
|
||||
SDLK_CALCULATOR = SDL_Scancode.SDL_SCANCODE_CALCULATOR | SDLK_SCANCODE_MASK,
|
||||
SDLK_COMPUTER = SDL_Scancode.SDL_SCANCODE_COMPUTER | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_SEARCH = SDL_Scancode.SDL_SCANCODE_AC_SEARCH | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_HOME = SDL_Scancode.SDL_SCANCODE_AC_HOME | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_BACK = SDL_Scancode.SDL_SCANCODE_AC_BACK | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_FORWARD = SDL_Scancode.SDL_SCANCODE_AC_FORWARD | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_STOP = SDL_Scancode.SDL_SCANCODE_AC_STOP | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_REFRESH = SDL_Scancode.SDL_SCANCODE_AC_REFRESH | SDLK_SCANCODE_MASK,
|
||||
SDLK_AC_BOOKMARKS = SDL_Scancode.SDL_SCANCODE_AC_BOOKMARKS | SDLK_SCANCODE_MASK,
|
||||
|
||||
SDLK_BRIGHTNESSDOWN =
|
||||
(int)SDL_Scancode.SDL_SCANCODE_BRIGHTNESSDOWN | SDLK_SCANCODE_MASK,
|
||||
SDLK_BRIGHTNESSUP = (int)SDL_Scancode.SDL_SCANCODE_BRIGHTNESSUP | SDLK_SCANCODE_MASK,
|
||||
SDLK_DISPLAYSWITCH = (int)SDL_Scancode.SDL_SCANCODE_DISPLAYSWITCH | SDLK_SCANCODE_MASK,
|
||||
SDL_Scancode.SDL_SCANCODE_BRIGHTNESSDOWN | SDLK_SCANCODE_MASK,
|
||||
SDLK_BRIGHTNESSUP = SDL_Scancode.SDL_SCANCODE_BRIGHTNESSUP | SDLK_SCANCODE_MASK,
|
||||
SDLK_DISPLAYSWITCH = SDL_Scancode.SDL_SCANCODE_DISPLAYSWITCH | SDLK_SCANCODE_MASK,
|
||||
SDLK_KBDILLUMTOGGLE =
|
||||
(int)SDL_Scancode.SDL_SCANCODE_KBDILLUMTOGGLE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KBDILLUMDOWN = (int)SDL_Scancode.SDL_SCANCODE_KBDILLUMDOWN | SDLK_SCANCODE_MASK,
|
||||
SDLK_KBDILLUMUP = (int)SDL_Scancode.SDL_SCANCODE_KBDILLUMUP | SDLK_SCANCODE_MASK,
|
||||
SDLK_EJECT = (int)SDL_Scancode.SDL_SCANCODE_EJECT | SDLK_SCANCODE_MASK,
|
||||
SDLK_SLEEP = (int)SDL_Scancode.SDL_SCANCODE_SLEEP | SDLK_SCANCODE_MASK
|
||||
SDL_Scancode.SDL_SCANCODE_KBDILLUMTOGGLE | SDLK_SCANCODE_MASK,
|
||||
SDLK_KBDILLUMDOWN = SDL_Scancode.SDL_SCANCODE_KBDILLUMDOWN | SDLK_SCANCODE_MASK,
|
||||
SDLK_KBDILLUMUP = SDL_Scancode.SDL_SCANCODE_KBDILLUMUP | SDLK_SCANCODE_MASK,
|
||||
SDLK_EJECT = SDL_Scancode.SDL_SCANCODE_EJECT | SDLK_SCANCODE_MASK,
|
||||
SDLK_SLEEP = SDL_Scancode.SDL_SCANCODE_SLEEP | SDLK_SCANCODE_MASK
|
||||
}
|
||||
|
||||
/* Key modifiers (bitfield) */
|
||||
|
@ -91,8 +91,8 @@ namespace OpenDiablo2.SDL2_
|
||||
if (currentDirectionCache == null)
|
||||
return;
|
||||
|
||||
seconds += (float)ms / 1000f;
|
||||
var animationSeg = 15f / (float)currentDirectionCache.AnimationSpeed;
|
||||
seconds += ms / 1000f;
|
||||
var animationSeg = 15f / currentDirectionCache.AnimationSpeed;
|
||||
while (seconds >= animationSeg)
|
||||
{
|
||||
seconds -= animationSeg;
|
||||
|
@ -27,8 +27,6 @@ namespace OpenDiablo2.SDL2_
|
||||
{
|
||||
internal sealed class SDL2Label : ILabel
|
||||
{
|
||||
static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private readonly SDL2Font font;
|
||||
private readonly IntPtr renderer;
|
||||
internal IntPtr texture;
|
||||
|
@ -29,10 +29,7 @@ namespace OpenDiablo2.SDL2_
|
||||
public SDL2MusicPlayer()
|
||||
{
|
||||
if (SDL_mixer.Mix_OpenAudio(22050, SDL_mixer.MIX_DEFAULT_FORMAT, 2, 2048) < 0)
|
||||
{
|
||||
log.Error($"SDL_mixer could not initialize! SDL_mixer Error: {SDL.SDL_GetError()}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySong()
|
||||
|
@ -28,8 +28,6 @@ namespace OpenDiablo2.SDL2_
|
||||
{
|
||||
public sealed class SDL2RenderWindow : IRenderWindow, IMouseInfoProvider, IKeyboardInfoProvider
|
||||
{
|
||||
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private readonly IntPtr window, renderer;
|
||||
private readonly bool fullscreen;
|
||||
|
||||
@ -263,7 +261,6 @@ namespace OpenDiablo2.SDL2_
|
||||
public void Draw(ISprite sprite, int xSegments, int ySegments, int offset)
|
||||
{
|
||||
var spr = sprite as SDL2Sprite;
|
||||
var segSize = xSegments * ySegments;
|
||||
|
||||
for (var y = 0; y < ySegments; y++)
|
||||
{
|
||||
@ -360,7 +357,7 @@ namespace OpenDiablo2.SDL2_
|
||||
var frameSize = new Size(diffX, Math.Abs(diffY));
|
||||
|
||||
var srcRect = new SDL.SDL_Rect { x = 0, y = 0, w = frameSize.Width, h = Math.Abs(frameSize.Height) };
|
||||
var frameSizeMax = diffX * Math.Abs(diffY);
|
||||
//var frameSizeMax = diffX * Math.Abs(diffY);
|
||||
|
||||
|
||||
var texId = SDL.SDL_CreateTexture(renderer, SDL.SDL_PIXELFORMAT_ARGB8888, (int)SDL.SDL_TextureAccess.SDL_TEXTUREACCESS_STREAMING, frameSize.Width, frameSize.Height);
|
||||
|
@ -26,14 +26,12 @@ namespace OpenDiablo2.SDL2_
|
||||
{
|
||||
internal sealed class SDL2Sprite : ISprite
|
||||
{
|
||||
static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
internal readonly ImageSet source;
|
||||
private readonly IntPtr renderer;
|
||||
internal IntPtr texture = IntPtr.Zero;
|
||||
|
||||
public Point Location { get; set; } = new Point();
|
||||
public Size FrameSize { get; set; } = new Size();
|
||||
public Point Location { get; set; }
|
||||
public Size FrameSize { get; set; }
|
||||
|
||||
|
||||
private bool darken;
|
||||
@ -94,6 +92,7 @@ namespace OpenDiablo2.SDL2_
|
||||
|
||||
|
||||
TotalFrames = source.Frames.Count();
|
||||
Location = Point.Empty;
|
||||
FrameSize = new Size(Pow2((int)source.Frames.Max(x => x.Width)), Pow2((int)source.Frames.Max(x => x.Height)));
|
||||
}
|
||||
|
||||
@ -122,28 +121,28 @@ namespace OpenDiablo2.SDL2_
|
||||
|
||||
private unsafe void LoadFrame(int index)
|
||||
{
|
||||
var frame = source.Frames[index];
|
||||
var fullRect = new SDL.SDL_Rect { x = 0, y = 0, w = FrameSize.Width, h = FrameSize.Height };
|
||||
var sourceFrame = source.Frames[index];
|
||||
//var fullRect = new SDL.SDL_Rect { x = 0, y = 0, w = FrameSize.Width, h = FrameSize.Height };
|
||||
SDL.SDL_SetTextureBlendMode(texture, blend ? SDL.SDL_BlendMode.SDL_BLENDMODE_ADD : SDL.SDL_BlendMode.SDL_BLENDMODE_BLEND);
|
||||
|
||||
SDL.SDL_LockTexture(texture, IntPtr.Zero, out IntPtr pixels, out int pitch);
|
||||
try
|
||||
{
|
||||
UInt32* data = (UInt32*)pixels;
|
||||
var frameOffset = FrameSize.Height - frame.Height;
|
||||
var frameOffset = FrameSize.Height - sourceFrame.Height;
|
||||
var frameWidth = FrameSize.Width;
|
||||
var frameHeight = FrameSize.Height;
|
||||
for (var y = 0; y < frameHeight; y++)
|
||||
{
|
||||
for (int x = 0; x < frameWidth; x++)
|
||||
{
|
||||
if ((x >= frame.Width) || (y < frameOffset))
|
||||
if ((x >= sourceFrame.Width) || (y < frameOffset))
|
||||
{
|
||||
data[x + (y * (pitch / 4))] = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
var color = frame.GetColor(x, (int)(y - frameOffset), CurrentPalette);
|
||||
var color = sourceFrame.GetColor(x, (int)(y - frameOffset), CurrentPalette);
|
||||
if (darken)
|
||||
color = ((color & 0xFF000000) > 0) ? (color >> 1) & 0xFF7F7F7F | 0xFF000000 : 0;
|
||||
data[x + (y * (pitch / 4))] = color;
|
||||
|
@ -16,7 +16,7 @@ namespace OpenDiablo2.Scenes
|
||||
var types = ThisAssembly.GetTypes().Where(x => typeof(IScene).IsAssignableFrom(x) && x.IsClass);
|
||||
foreach (var type in types)
|
||||
{
|
||||
var att = type.GetCustomAttributes(true).First(x => typeof(SceneAttribute).IsAssignableFrom(x.GetType())) as SceneAttribute;
|
||||
var att = type.GetCustomAttributes(true).First(x => (x is SceneAttribute)) as SceneAttribute;
|
||||
builder
|
||||
.RegisterType(type)
|
||||
.Keyed<IScene>(att.SceneType)
|
||||
|
@ -54,8 +54,6 @@ namespace OpenDiablo2.Scenes
|
||||
|
||||
public void Update(long ms)
|
||||
{
|
||||
var seconds = ms / 1000f;
|
||||
|
||||
HandleMovement();
|
||||
|
||||
mapEngine.Update(ms);
|
||||
|
@ -9,7 +9,7 @@ using OpenDiablo2.Common.Interfaces;
|
||||
namespace OpenDiablo2.Scenes
|
||||
{
|
||||
[Scene(eSceneType.MainMenu)]
|
||||
public class MainMenu : IScene
|
||||
public sealed class MainMenu : IScene
|
||||
{
|
||||
private readonly IRenderWindow renderWindow;
|
||||
private readonly ISceneManager sceneManager;
|
||||
@ -66,7 +66,7 @@ namespace OpenDiablo2.Scenes
|
||||
for (int i = 0; i < scenesToLoad.Count(); i++)
|
||||
{
|
||||
renderWindow.Clear();
|
||||
renderWindow.Draw(loadingSprite, (int)((float)loadingSprite.TotalFrames * ((float)i / (float)scenesToLoad.Count())));
|
||||
renderWindow.Draw(loadingSprite, (int)(loadingSprite.TotalFrames * (i / (float)scenesToLoad.Count())));
|
||||
renderWindow.Sync();
|
||||
getScene(scenesToLoad[i]);
|
||||
}
|
||||
@ -107,7 +107,7 @@ namespace OpenDiablo2.Scenes
|
||||
|
||||
public void Update(long ms)
|
||||
{
|
||||
float seconds = (float)ms / 1000f;
|
||||
float seconds = ms / 1000f;
|
||||
logoFrame += seconds;
|
||||
while (logoFrame >= 1f)
|
||||
logoFrame -= 1f;
|
||||
|
@ -292,7 +292,7 @@ namespace OpenDiablo2.Scenes
|
||||
break;
|
||||
case eHeroStance.Approaching:
|
||||
{
|
||||
var framePct = (float)renderInfo.SpecialFrameTime / (float)renderInfo.ForwardWalkTimeMs;
|
||||
var framePct = renderInfo.SpecialFrameTime / (float)renderInfo.ForwardWalkTimeMs;
|
||||
renderWindow.Draw(renderInfo.ForwardWalkSprite, (int)(renderInfo.ForwardWalkSprite.TotalFrames * framePct));
|
||||
if (renderInfo.ForwardWalkSpriteOverlay != null)
|
||||
renderWindow.Draw(renderInfo.ForwardWalkSpriteOverlay, (int)(renderInfo.ForwardWalkSpriteOverlay.TotalFrames * framePct));
|
||||
@ -300,7 +300,7 @@ namespace OpenDiablo2.Scenes
|
||||
break;
|
||||
case eHeroStance.Selected:
|
||||
{
|
||||
var framePct = (float)renderInfo.SpecialFrameTime / (float)1000;
|
||||
var framePct = renderInfo.SpecialFrameTime / (float)1000;
|
||||
renderWindow.Draw(renderInfo.SelectedSprite, (int)(renderInfo.SelectedSprite.TotalFrames * framePct));
|
||||
if (renderInfo.SelectedSpriteOverlay != null)
|
||||
renderWindow.Draw(renderInfo.SelectedSpriteOverlay, (int)(renderInfo.SelectedSpriteOverlay.TotalFrames * framePct));
|
||||
@ -308,7 +308,7 @@ namespace OpenDiablo2.Scenes
|
||||
break;
|
||||
case eHeroStance.Retreating:
|
||||
{
|
||||
var framePct = (float)renderInfo.SpecialFrameTime / (float)renderInfo.BackWalkTimeMs;
|
||||
var framePct = renderInfo.SpecialFrameTime / (float)renderInfo.BackWalkTimeMs;
|
||||
renderWindow.Draw(renderInfo.BackWalkSprite, (int)(renderInfo.BackWalkSprite.TotalFrames * framePct));
|
||||
if (renderInfo.BackWalkSpriteOverlay != null)
|
||||
renderWindow.Draw(renderInfo.BackWalkSpriteOverlay, (int)(renderInfo.BackWalkSpriteOverlay.TotalFrames * framePct));
|
||||
@ -341,7 +341,7 @@ namespace OpenDiablo2.Scenes
|
||||
|
||||
public void Update(long ms)
|
||||
{
|
||||
float seconds = (float)ms / 1500f;
|
||||
float seconds = ms / 1500f;
|
||||
secondTimer += seconds;
|
||||
while (secondTimer >= 1f)
|
||||
secondTimer -= 1f;
|
||||
|
@ -33,7 +33,7 @@ namespace OpenDiablo2.ServiceBus
|
||||
var types = ThisAssembly.GetTypes().Where(x => typeof(IMessageFrame).IsAssignableFrom(x) && x.IsClass);
|
||||
foreach (var type in types)
|
||||
{
|
||||
var att = type.GetCustomAttributes(true).First(x => typeof(MessageFrameAttribute).IsAssignableFrom(x.GetType())) as MessageFrameAttribute;
|
||||
var att = type.GetCustomAttributes(true).First(x => (x is MessageFrameAttribute)) as MessageFrameAttribute;
|
||||
builder
|
||||
.RegisterType(type)
|
||||
.Keyed<IMessageFrame>(att.FrameType)
|
||||
|
@ -12,7 +12,7 @@ namespace OpenDiablo2.ServiceBus.Message_Frames.Client
|
||||
|
||||
public byte[] Data
|
||||
{
|
||||
get => new byte[] { (byte)Direction, (byte)MovementType };
|
||||
get => new byte[] { Direction, (byte)MovementType };
|
||||
set
|
||||
{
|
||||
Direction = value[0];
|
||||
|
@ -12,7 +12,7 @@ namespace OpenDiablo2.ServiceBus.Message_Frames.Server
|
||||
|
||||
public byte[] Data
|
||||
{
|
||||
get => BitConverter.GetBytes((Int32)PlayerToFocusOn);
|
||||
get => BitConverter.GetBytes(PlayerToFocusOn);
|
||||
set => PlayerToFocusOn = BitConverter.ToInt32(value, 0);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ namespace OpenDiablo2.ServiceBus
|
||||
|
||||
public void Send(IMessageFrame messageFrame, bool more = false)
|
||||
{
|
||||
var attr = messageFrame.GetType().GetCustomAttributes(true).First(x => typeof(MessageFrameAttribute).IsAssignableFrom(x.GetType())) as MessageFrameAttribute;
|
||||
var attr = messageFrame.GetType().GetCustomAttributes(true).First(x => (x is MessageFrameAttribute)) as MessageFrameAttribute;
|
||||
requestSocket.SendFrame(new byte[] { (byte)attr.FrameType }.Concat(messageFrame.Data).ToArray(), more);
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ namespace OpenDiablo2.ServiceBus
|
||||
|
||||
private void Send(IMessageFrame messageFrame, bool more = false)
|
||||
{
|
||||
var attr = messageFrame.GetType().GetCustomAttributes(true).First(x => typeof(MessageFrameAttribute).IsAssignableFrom(x.GetType())) as MessageFrameAttribute;
|
||||
var attr = messageFrame.GetType().GetCustomAttributes(true).First(x => (x is MessageFrameAttribute)) as MessageFrameAttribute;
|
||||
responseSocket.SendFrame(new byte[] { (byte)attr.FrameType }.Concat(messageFrame.Data).ToArray(), more);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ namespace OpenDiablo2
|
||||
{
|
||||
log.Warn($"Could not parse command line options.");
|
||||
globalConfiguration = new GlobalConfiguration { BaseDataPath = Directory.GetCurrentDirectory(), MouseMode = eMouseMode.Software };
|
||||
}); ;
|
||||
});
|
||||
|
||||
#if !DEBUG
|
||||
try
|
||||
@ -135,7 +135,9 @@ namespace OpenDiablo2
|
||||
{
|
||||
try
|
||||
{
|
||||
#pragma warning disable S3885 // "Assembly.Load" should be used (This warning is inccorect. Using .Load will fail.)
|
||||
var assembly = Assembly.LoadFrom(file);
|
||||
#pragma warning restore S3885 // "Assembly.Load" should be used
|
||||
containerBuilder.RegisterAssemblyModules(assembly);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user