Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
119 lines
2.6 KiB
C++
119 lines
2.6 KiB
C++
#pragma warning (disable:4786)
|
|
#include "ai test.hpp"
|
|
#include "ai test wnd.hpp"
|
|
|
|
|
|
CAITestWindow::CAITestWindow (void)
|
|
{
|
|
m_MouseDown = false;
|
|
}
|
|
CAITestWindow::~CAITestWindow (void)
|
|
{
|
|
}
|
|
|
|
|
|
void CAITestWindow::Render (HDC thedc,LPPAINTSTRUCT data)
|
|
{
|
|
int i;
|
|
CDIBSurface& surf = GetSurface ();
|
|
surf.Blt (0,0,surf.GetWidth(),surf.GetHeight(),&m_Map,0,0);
|
|
|
|
for (i=0;i<MAXPERSON;i++)
|
|
{
|
|
const CPoint& fred = g_Person[i].Location ();
|
|
surf.Fill (fred.x*DRAWCELLSIZE,fred.y*DRAWCELLSIZE,(fred.x+1)*DRAWCELLSIZE,(fred.y+1)*DRAWCELLSIZE,RGB (255,0,0));
|
|
}
|
|
// RenderEdges (surf,0);
|
|
// g_MapTree->RenderData (surf,256*DRAWCELLSIZE+2);
|
|
CDIBWindow::Render (thedc,data);
|
|
}
|
|
|
|
void CAITestWindow::InitialUpdate(void)
|
|
{
|
|
int x,y;
|
|
m_Map.Create (MAPSIZE*DRAWCELLSIZE,MAPSIZE*DRAWCELLSIZE,16);
|
|
|
|
for (y=0;y<MAPSIZE;y++)
|
|
{
|
|
for (x=0;x<MAPSIZE;x++)
|
|
{
|
|
int color = 255.0 * ((g_Map[x][y].weight/5.0)-1.0);
|
|
// if (g_Map[x][y].passable)
|
|
{
|
|
m_Map.Fill (x*DRAWCELLSIZE,y*DRAWCELLSIZE,(x+1)*DRAWCELLSIZE,(y+1)*DRAWCELLSIZE,RGB (color,color,color));
|
|
}
|
|
// else
|
|
{
|
|
// m_Map.Fill (x*DRAWCELLSIZE,y*DRAWCELLSIZE,(x+1)*DRAWCELLSIZE,(y+1)*DRAWCELLSIZE,RGB (color,0,0));
|
|
}
|
|
/*
|
|
if (g_Map[x][y].passable)
|
|
{
|
|
m_Map.Fill (x*DRAWCELLSIZE,y*DRAWCELLSIZE,(x+1)*DRAWCELLSIZE,(y+1)*DRAWCELLSIZE,0);
|
|
}
|
|
else
|
|
{
|
|
m_Map.Fill (x*DRAWCELLSIZE,y*DRAWCELLSIZE,(x+1)*DRAWCELLSIZE,(y+1)*DRAWCELLSIZE,RGB (255,255,255));
|
|
}
|
|
*/
|
|
}
|
|
}
|
|
}
|
|
|
|
void CAITestWindow::LButtonDown (int x,int y)
|
|
{
|
|
x/=DRAWCELLSIZE;
|
|
y/=DRAWCELLSIZE;
|
|
g_Person[0].SetDestination (x,y);
|
|
}
|
|
|
|
void CAITestWindow::RButtonDown (int x,int y)
|
|
{
|
|
m_MouseDown = true;
|
|
if (g_Map[x>>2][y>>2].passable)
|
|
m_Adding = false;
|
|
else
|
|
m_Adding = true;
|
|
MouseMove (x,y);
|
|
}
|
|
|
|
void CAITestWindow::LButtonUp (int x,int y)
|
|
{
|
|
}
|
|
|
|
void CAITestWindow::RButtonUp (int x,int y)
|
|
{
|
|
x/=DRAWCELLSIZE;
|
|
y/=DRAWCELLSIZE;
|
|
m_MouseDown = false;
|
|
}
|
|
|
|
void CAITestWindow::MouseMove (int x,int y)
|
|
{
|
|
if (!m_MouseDown)
|
|
return;
|
|
x/=DRAWCELLSIZE;
|
|
y/=DRAWCELLSIZE;
|
|
g_Map[x][y].passable = m_Adding;
|
|
if (g_Map[x][y].passable)
|
|
{
|
|
m_Map.Fill (x*DRAWCELLSIZE,y*DRAWCELLSIZE,(x+1)*DRAWCELLSIZE,(y+1)*DRAWCELLSIZE,0);
|
|
}
|
|
else
|
|
{
|
|
m_Map.Fill (x*DRAWCELLSIZE,y*DRAWCELLSIZE,(x+1)*DRAWCELLSIZE,(y+1)*DRAWCELLSIZE,RGB (255,255,255));
|
|
}
|
|
InvalidateRect (Window(),&CRect (x*DRAWCELLSIZE,y*DRAWCELLSIZE,(x+1)*DRAWCELLSIZE,(y+1)*DRAWCELLSIZE),false);
|
|
}
|
|
|
|
LRESULT CAITestWindow::WndProc (HWND thewnd,UINT themsg,WPARAM wParam,LPARAM lParam)
|
|
{
|
|
switch (themsg)
|
|
{
|
|
case WM_CLOSE:
|
|
PostQuitMessage (0);
|
|
break;
|
|
}
|
|
return CDIBWindow::WndProc (thewnd,themsg,wParam,lParam);
|
|
}
|