-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeathKeep.cpp
212 lines (153 loc) · 4.76 KB
/
DeathKeep.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#pragma once
//#include "stdafx.h"
//#include "Form1.h"
///#include "stdafx.h"
#include "stdafx.h"
#include <iostream>
///#include "burger.h"
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <math.h>
#include <cstring>
#include <string>
#include <fstream>
#include <list>
#include <algorithm>
#include <vector>
#include "Vars.h"
#include <bitset>
////////////
#if 0;
#include <iso646.h>
#include <cstdio>
#include <stdio.h>
#include <windows.h>
#include <vcclr.h>
#include "resource.h"
#include <bitset>
#include <msclr\marshal_cppstd.h>
#include <direct.h>
#include <iomanip>
#include <sstream>
#include <math.h>
//#include "Form1.h"
////////////
#endif;
#include <iomanip>
#include <type_traits>
using namespace std;
//using namespace System::Windows::Forms;
extern void BuildFloor(long long val, unsigned int cube) {
}
extern void BuildWalls(unsigned int cube) {
//vertstr = "# Walls" + "\n";
}
extern void BuildCeiling(unsigned int cube) {
}
extern void PlaceObject(long long val) {
}
template <typename T>
T get_mask( size_t pos, size_t n )
{
return ~( ~static_cast<typename std::make_unsigned<T>::type>( 0 ) << n ) << pos;
}
extern int ValueSelector(unsigned long long a, unsigned int pos)
{
// unsigned long long a = 0xff00000050020000;
unsigned char b;
// std::cout << std::hex << a << std::endl;
//system("pause");
// for ( size_t i = 0; i < sizeof( a ); i += sizeof( b ) )
{
size_t pos1 = 8 * pos;
size_t n = 8 * sizeof( b );
auto mask = get_mask<unsigned long long>( pos1, n );
b = ( a & mask ) >> pos1;
// std::cout << "mask = " << std::hex << mask
// << ", value = " << std::hex << int(b) << std::endl;
// system("pause");
// system("pause");
}
return b;
}
#if 0;
extern void readValuesFromVoxel(System::Windows::Forms::DataGridView^ f, _ULonglong voxeldata, int floorN) {
//Throw known bits or bytes to the dataGrid9
#if 0;
_ULonglong temp = voxeldata;
std::bitset<64> bs(temp);
int val = floorN;
System::Windows::Forms::DataGridView^ dataGridView9;
dataGridView9 = f;
std::string stdString2 = bs.to_string();
System::String^ systemString2 = msclr::interop::marshal_as<System::String^>(stdString2);
unsigned char itemType, itemSpecs, brightness = 0;
char buffer3 [20];
char buffer4 [2];
itemType = ValueSelector(voxelArray[val].value1, 7); // Item type
itemSpecs = ValueSelector(voxelArray[val].value1, 5); // Item specifications
brightness = ValueSelector(voxelArray[val].value1, 1); // Light flicker inside the cube
//dataGridView9->Rows[4]->Cells[2]->Value = flickeringLight.ToString();
switch(brightness) {
case 0xF0:
dataGridView9->Rows[4]->Cells[2]->Value = "Flickering Light";
break;
case 0xE0:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 1";
break;
case 0xC0:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 2";
break;
case 0xA0:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 3";
break;
case 0x80:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 4";
break;
case 0x60:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 5";
break;
case 0x40:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 6";
break;
case 0x20:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 7";
break;
case 0xD0:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 8";
break;
case 0xB0:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 9";
break;
case 0x90:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 10";
break;
case 0x70:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 11";
break;
case 0x50:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 12";
break;
case 0x30:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 13";
break;
case 0x10:
dataGridView9->Rows[4]->Cells[2]->Value = "Brightness 14";
break;
default :
dataGridView9->Rows[4]->Cells[2]->Value = "N/A";
}
_i64toa (itemType, buffer3, 16);
systemString2 = msclr::interop::marshal_as<System::String^>(buffer3);
dataGridView9->Rows[0]->Cells[2]->Value = systemString2;
_i64toa (itemSpecs, buffer4, 16);
systemString2 = msclr::interop::marshal_as<System::String^>(buffer4);
dataGridView9->Rows[1]->Cells[2]->Value = systemString2;
bool doorPresent = (bool((1 << 9) & voxelArray[val].value1)); // Door exists
dataGridView9->Rows[2]->Cells[2]->Value = doorPresent.ToString(); // Door exists
bool doorLocked = (bool((1 << 11) & voxelArray[val].value1)); // Door is closed
dataGridView9->Rows[3]->Cells[2]->Value = doorLocked.ToString(); // Door is closed
#endif;
}
#endif;