📄 dudes.cpp
字号:
{
Game->LevelPtr()->selection->setcolor(Game->LevelPtr()->selectioncolor);
Game->Landscapes()->AddLSEntry(Game->LevelPtr()->selection);
Game->LevelPtr()->selection = 0;
}
while (tmp)
{
tmploc = ((landscape *)tmp)->location();
tmpval = tmploc.distanceto(Game->Aim());
if (tmpval < tmpdist)
{
tmpdist = tmpval;
newsel = tmp;
}
tmp = (qentry *) Game->DrawQueue()->next(LANDSCAPE |
DUDEHOLDER |
WEAPONHOLDER |
TELEPORTER);
}
if (newsel)
{
Game->LevelPtr()->selectioncolor = ((landscape *)newsel)->getcolor();
Game->LevelPtr()->selection = (landscape *) newsel;
Game->LevelPtr()->selection->RemoveLSEntry();
}
}
void DudesApp::OnEditMoveselectionbackward()
{
if (!Game->LevelPtr()->selection)
return;
view tmp = Game->LevelPtr()->selection->location();
tmp.setx(tmp.x()+tcsin(tmp.ydirection(),-Game->LevelPtr()->selectionstep));
tmp.setz(tmp.z()+tccos(tmp.ydirection(),-Game->LevelPtr()->selectionstep));
Game->LevelPtr()->selection->setto(tmp);
}
void DudesApp::OnEditMoveselectiondown()
{
if (!Game->LevelPtr()->selection)
return;
view tmp = Game->LevelPtr()->selection->location();
tmp.sety(tmp.y()-Game->LevelPtr()->selectionstep);
Game->LevelPtr()->selection->setto(tmp);
}
void DudesApp::OnEditMoveselectionfoward()
{
if (!Game->LevelPtr()->selection)
return;
view tmp = Game->LevelPtr()->selection->location();
tmp.setx(tmp.x()+tcsin(tmp.ydirection(),Game->LevelPtr()->selectionstep));
tmp.setz(tmp.z()+tccos(tmp.ydirection(),Game->LevelPtr()->selectionstep));
Game->LevelPtr()->selection->setto(tmp);
}
void DudesApp::OnEditMoveselectionleft()
{
if (!Game->LevelPtr()->selection)
return;
view tmp = Game->LevelPtr()->selection->location();
tmp.setx(tmp.x()+tcsin(tmp.ydirection()+(direction)TC_PI_2,Game->LevelPtr()->selectionstep));
tmp.setz(tmp.z()+tccos(tmp.ydirection()+(direction)TC_PI_2,Game->LevelPtr()->selectionstep));
Game->LevelPtr()->selection->setto(tmp);
}
void DudesApp::OnEditMoveselectionright()
{
if (!Game->LevelPtr()->selection)
return;
view tmp = Game->LevelPtr()->selection->location();
tmp.setx(tmp.x()+tcsin(tmp.ydirection()-(direction)TC_PI_2,Game->LevelPtr()->selectionstep));
tmp.setz(tmp.z()+tccos(tmp.ydirection()-(direction)TC_PI_2,Game->LevelPtr()->selectionstep));
Game->LevelPtr()->selection->setto(tmp);
}
void DudesApp::OnEditChangecolorforselection()
{
if (!Game->LevelPtr()->selection)
return;
CColorDialog dialog(Game->LevelPtr()->selection->getcolor(), NULL, NULL);
if (dialog.DoModal() == IDOK)
{
view tmploc = Game->LevelPtr()->selection->location();
LSEntryType *tmpls = Game->Landscapes()->GetLSEntry(tmploc);
Game->LevelPtr()->selectioncolor = dialog.GetColor();
if (tmpls)
tmpls->Color = dialog.GetColor();
}
}
void DudesApp::OnEditMoveselectionup()
{
if (!Game->LevelPtr()->selection)
return;
view tmp = Game->LevelPtr()->selection->location();
tmp.sety(tmp.y()+Game->LevelPtr()->selectionstep);
Game->LevelPtr()->selection->setto(tmp);
}
void DudesApp::OnEditRotateselection45degreesleft()
{
if (!Game->LevelPtr()->selection)
return;
view tmp = Game->LevelPtr()->selection->location();
tmp.setydir(tmp.ydirection()+(direction)TC_PI_4);
Game->LevelPtr()->selection->setto(tmp);
}
void DudesApp::OnEditRotateselection45degreesright()
{
if (!Game->LevelPtr()->selection)
return;
view tmp = Game->LevelPtr()->selection->location();
tmp.setydir(tmp.ydirection()-(direction)TC_PI_4);
Game->LevelPtr()->selection->setto(tmp);
}
void DudesApp::OnEditRotateselection90degreesleft()
{
if (!Game->LevelPtr()->selection)
return;
view tmp = Game->LevelPtr()->selection->location();
tmp.setydir(tmp.ydirection()+(direction)TC_PI_2);
Game->LevelPtr()->selection->setto(tmp);
}
void DudesApp::OnEditRotateselection90degreesright()
{
if (!Game->LevelPtr()->selection)
return;
view tmp = Game->LevelPtr()->selection->location();
tmp.setydir(tmp.ydirection()-(direction)TC_PI_2);
Game->LevelPtr()->selection->setto(tmp);
}
void DudesApp::OnEditDeleteselection()
{
if (!Game->LevelPtr()->selection)
return;
Game->LevelPtr()->selection->DeleteEntryAlso();
delete Game->LevelPtr()->selection;
Game->LevelPtr()->selection = 0;
}
void DudesApp::OnFileOpenlandscape()
{
CFileDialog dialog(TRUE, "MAP", "*.map",
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
NULL, NULL);
Game->PauseOn();
dialog.m_ofn.Flags |= OFN_NOCHANGEDIR;
if (dialog.DoModal() == IDOK)
{
OnFileSavelandscape();
Game->NewGame();
Game->Landscapes()->load((CString)dialog.GetPathName());
Game->LevelPtr()->selection = NULL;
view ctmp = Game->Landscapes()->GeneralArea();
Game->LevelPtr()->SetGuyTo(ctmp);
}
Game->PauseOff();
}
void DudesApp::OnFileSavelandscape()
{
OnEditUnselecttheselection();
Game->Landscapes()->save();
}
void DudesApp::OnFileSavelandscapeas()
{
OnEditUnselecttheselection();
CFileDialog dialog(FALSE, "MAP", getpath((CString)"landscpe.map"),
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
NULL, NULL);
Game->PauseOn();
dialog.m_ofn.Flags |= OFN_NOCHANGEDIR;
if (dialog.DoModal() == IDOK)
{
Game->LevelPtr()->landscapemap = (CString)dialog.GetPathName();
OnFileSavelandscape();
}
Game->PauseOff();
}
void DudesApp::OnEditUnselecttheselection()
{
if (!Game->LevelPtr()->selection)
return;
Game->LevelPtr()->selection->setcolor(Game->LevelPtr()->selectioncolor);
Game->Landscapes()->AddLSEntry(Game->LevelPtr()->selection);
Game->LevelPtr()->selection = NULL;
}
void DudesApp::OnEditAddnewmap()
{
CFileDialog dialog(FALSE, "MAP", getpath((CString)"landscpe.map"),
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
NULL, NULL);
Game->PauseOn();
dialog.m_ofn.Flags |= OFN_NOCHANGEDIR;
if (dialog.DoModal() == IDOK)
{
if (Game->LevelPtr()->selection)
{
Game->LevelPtr()->selection->setcolor(Game->LevelPtr()->selectioncolor);
Game->Landscapes()->AddLSEntry(Game->LevelPtr()->selection);
Game->LevelPtr()->selection = 0;
}
Game->NewGateway((CString)dialog.GetPathName());
coordinate ctmp = Game->Aim();
ctmp.sety(0.0f);
Game->LastLandscape()->setto(ctmp);
}
Game->PauseOff();
}
void DudesApp::OnEditAdddude()
{
CFileDialog dialog(TRUE, "DUD", (CString)"dudes\\*.dud",
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
NULL, NULL);
Game->PauseOn();
dialog.m_ofn.Flags |= OFN_NOCHANGEDIR;
if (dialog.DoModal() == IDOK)
{
if (Game->LevelPtr()->selection)
{
Game->LevelPtr()->selection->setcolor(Game->LevelPtr()->selectioncolor);
Game->Landscapes()->AddLSEntry(Game->LevelPtr()->selection);
Game->LevelPtr()->selection = 0;
}
Game->NewDudeholder((CString)dialog.GetPathName());
coordinate ctmp = Game->Aim();
ctmp.sety(0.0f);
Game->LastLandscape()->setto(ctmp);
SpeedDiag dialog;
if (dialog.DoModal() == IDOK)
{
short sptmp = (short)dialog.Position();
sptmp = (short) (10.0f * ((float) sptmp / 100.0f));
sptmp = (short) (10 - sptmp);
personal ptmp;
dudeholder *tmp = (dudeholder *) Game->LastLandscape();
ptmp.load(tmp->dudename());
if (ptmp.gender() == MALE)
sptmp += 10;
tmp->setspeed(sptmp);
}
}
Game->PauseOff();
}
void DudesApp::OnEditAddnextlevelteleporter()
{
CTeleportDiag dialog;
Game->PauseOn();
if (dialog.DoModal() == IDOK)
{
if (Game->LevelPtr()->selection)
{
Game->LevelPtr()->selection->setcolor(Game->LevelPtr()->selectioncolor);
Game->Landscapes()->AddLSEntry(Game->LevelPtr()->selection);
Game->LevelPtr()->selection = 0;
}
Game->NewTeleporter((short)(dialog.m_LevelNum));
coordinate ctmp = Game->Aim();
ctmp.sety(0.0f);
Game->LastLandscape()->setto(ctmp);
}
Game->PauseOff();
}
void DudesApp::OnEditAddhandheldweaponKnife()
{
if (Game->LevelPtr()->selection)
{
Game->LevelPtr()->selection->setcolor(Game->LevelPtr()->selectioncolor);
Game->Landscapes()->AddLSEntry(Game->LevelPtr()->selection);
Game->LevelPtr()->selection = 0;
}
Game->NewWeaponholder(KNIFE);
coordinate ctmp = Game->Aim();
ctmp.sety(0.0f);
Game->LastLandscape()->setto(ctmp);
}
void DudesApp::OnEditAddhandheldweaponShield()
{
if (Game->LevelPtr()->selection)
{
Game->LevelPtr()->selection->setcolor(Game->LevelPtr()->selectioncolor);
Game->Landscapes()->AddLSEntry(Game->LevelPtr()->selection);
Game->LevelPtr()->selection = 0;
}
Game->NewWeaponholder(SHIELD);
coordinate ctmp = Game->Aim();
ctmp.sety(0.0f);
Game->LastLandscape()->setto(ctmp);
}
void DudesApp::OnEditAddhandheldweaponSword()
{
if (Game->LevelPtr()->selection)
{
Game->LevelPtr()->selection->setcolor(Game->LevelPtr()->selectioncolor);
Game->Landscapes()->AddLSEntry(Game->LevelPtr()->selection);
Game->LevelPtr()->selection = 0;
}
Game->NewWeaponholder(SWORD);
coordinate ctmp = Game->Aim();
ctmp.sety(0.0f);
Game->LastLandscape()->setto(ctmp);
}
#endif
CWnd* DudesApp::GetMainWnd()
{
switch(keyboardcontrol)
{
case V1:
OnViewCircling();
break;
case V2:
OnViewDudeview();
break;
case V3:
OnViewHighdudeview();
break;
case V4:
OnViewLowdudeview();
break;
case V5:
OnViewAerial();
break;
case V6:
OnViewHighangle();
break;
case V7:
OnViewRightside();
break;
case V8:
OnViewLeftside();
break;
case V9:
OnViewFrontside();
break;
case V0:
OnViewBackside();
break;
}
return CWinApp::GetMainWnd();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -