What is easy to do eEventRestoreGame? 5 lines of code or a more prosaic thing with bits all over the project?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu/////////////////////////////////////////
// save/load game with screenshot code //
/////////////////////////////////////////
DynamicSprite *buttonSavePic1;
DynamicSprite *buttonSavePic2;
...
DynamicSprite *buttonSavePic24;
DynamicSprite *buttonSavePic25;
void SetSavePicToButton(Button *butSave, Button *butLoad, Label *label, DynamicSprite *pic, int save_id) {
if (pic != null) {
label.Text=Game.GetSaveSlotDescription(save_id);
butSave.NormalGraphic = pic.Graphic;
butSave.Visible=true;
RefreshGameSlots=0;
} else {
String filename = String.Format("$SAVEGAMEDIR$/agssave.%03d.lociv", save_id);
if (File.Exists(filename)) {
RefreshGameSlots=save_id;
}
}
}
function PrepareSaveGUI_Display(Button *saveSlotFrame, Button *butLoad, DynamicSprite *pic, int save_id)
{
if (pic != null) {
saveSlotFrame.NormalGraphic = pic.Graphic;
saveSlotFrame.Visible=true;
}
if (File.Exists(String.Format("$SAVEGAMEDIR$/agssave.%03d.lociv",save_id))) {
butLoad.Clickable=true; //clickable
butLoad.NormalGraphic=2644; //bright blue
butLoad.TextColor=51199; //normal light
RefreshGameSlots=0;
} else {
butLoad.Clickable=false; //not clickable
butLoad.NormalGraphic=9780; //greyed out
butLoad.TextColor=33808; //dark
}
}
function PrepareSaveGUI(int slot)
{
if (InStartupMenu) {
buttonSave1.Clickable=false; //not clickable
buttonSave2.Clickable=false;
...
buttonSave24.Clickable=false;
buttonSave25.Clickable=false;
buttonSave1.NormalGraphic=9780; //greyed out
buttonSave2.NormalGraphic=9780;
...
buttonSave24.NormalGraphic=9780;
buttonSave25.NormalGraphic=9780;
buttonSave1.TextColor=33808; //dark
buttonSave2.TextColor=33808;
...
buttonSave24.TextColor=33808;
buttonSave25.TextColor=33808;
} else {
buttonSave1.Clickable=true; //clickable
buttonSave2.Clickable=true;
...
buttonSave24.Clickable=true;
buttonSave25.Clickable=true;
buttonSave1.NormalGraphic=2644; //bright blue
buttonSave2.NormalGraphic=2644;
...
buttonSave24.TextColor=51199;
buttonSave25.TextColor=51199;
}
buttonSavePic1 = DynamicSprite.CreateFromSaveGame(1, 171, 96);
buttonSavePic2 = DynamicSprite.CreateFromSaveGame(2, 171, 96);
...
buttonSavePic24 = DynamicSprite.CreateFromSaveGame(24, 171, 96);
buttonSavePic25 = DynamicSprite.CreateFromSaveGame(25, 171, 96);
SetSavePicToButton(buttonSaveSlot1, buttonLoad1, LabelDescr1, buttonSavePic1, 1);
SetSavePicToButton(buttonSaveSlot2, buttonLoad2, LabelDescr2, buttonSavePic2, 2);
...
SetSavePicToButton(buttonSaveSlot24, buttonLoad24, LabelDescr24, buttonSavePic24, 24);
SetSavePicToButton(buttonSaveSlot25, buttonLoad25, LabelDescr25, buttonSavePic25, 25);
PrepareSaveGUI_Display(buttonSaveSlot1, buttonLoad1, buttonSavePic1, 1);
PrepareSaveGUI_Display(buttonSaveSlot2, buttonLoad2, buttonSavePic2, 2);
...
PrepareSaveGUI_Display(buttonSaveSlot24, buttonLoad24, buttonSavePic24, 24);
PrepareSaveGUI_Display(buttonSaveSlot25, buttonLoad25, buttonSavePic25, 25);
}
function SaveTheGame(int slot, String desc)
{
SaveGameSlot(slot, desc);
}
function LoadTheGame(int slot)
{
RestoreCheck=true;
RestoreSlotNm=slot;
}
void OnSaveButtonClick(Button *butSave, Button *butLoad, Label *label, DynamicSprite *pic, int save_id) {
gSaveLoad.Visible=false;
DateTime *dt = DateTime.Now;
String month=String.Format("%02d",dt.Month);
switch(month) {
case "01": month="JAN"; break;
case "02": month="FEB"; break;
case "03": month="MAR"; break;
case "04": month="APR"; break;
case "05": month="MAY"; break;
case "06": month="JUN"; break;
case "07": month="JUL"; break;
case "08": month="AUG"; break;
case "09": month="SEP"; break;
case "10": month="OCT"; break;
case "11": month="NOV"; break;
case "12": month="DEC"; break;
}
String SaveDesc=String.Format("#%d %02d:%02d %02d-%03s-%02d", save_id, dt.Hour, dt.Minute, dt.DayOfMonth, month, dt.Year);
SaveGameSlot(save_id, SaveDesc);
aCameraSnap.Play(eAudioPriorityNormal, eOnce);
pic = DynamicSprite.CreateFromSaveGame(save_id, 171, 96);
Wait(GetGameSpeed()*1);
gSaveLoad.Visible=true;
if (pic!= null) {
butSave.NormalGraphic = pic.Graphic;
butSave.Visible=true;
butLoad.Visible=true;
label.Text=Game.GetSaveSlotDescription(save_id);
}
RefreshGameSlots=save_id;
}
//all the different buttonSave_OnClicks:
function buttonSave1_OnClick(GUIControl *control, MouseButton button)
{
if (buttonSavePic1!=null) buttonSavePic1.Delete();
buttonSavePic1= DynamicSprite.CreateFromSaveGame(1, 171, 96);
OnSaveButtonClick(buttonSaveSlot1, buttonLoad1, LabelDescr1, buttonSavePic1, 1);
}
function buttonSave2_OnClick(GUIControl *control, MouseButton button)
{
if (buttonSavePic2!=null) buttonSavePic2.Delete();
buttonSavePic2= DynamicSprite.CreateFromSaveGame(2, 171, 96);
OnSaveButtonClick(buttonSaveSlot2, buttonLoad2, LabelDescr2, buttonSavePic2, 2);
}
...
function buttonSave24_OnClick(GUIControl *control, MouseButton button)
{
if (buttonSavePic24!=null) buttonSavePic24.Delete();
buttonSavePic24= DynamicSprite.CreateFromSaveGame(24, 171, 96);
OnSaveButtonClick(buttonSaveSlot24, buttonLoad24, LabelDescr24, buttonSavePic24, 24);
}
function buttonSave25_OnClick(GUIControl *control, MouseButton button)
{
if (buttonSavePic25!=null) buttonSavePic25.Delete();
buttonSavePic25= DynamicSprite.CreateFromSaveGame(25, 171, 96);
OnSaveButtonClick(buttonSaveSlot25, buttonLoad25, LabelDescr25, buttonSavePic25, 25);
}
// LOAD gSaveLoaad load button functions
function buttonLoad1_OnClick(GUIControl *control, MouseButton button)
{
LoadTheGame(1);
}
function buttonLoad2_OnClick(GUIControl *control, MouseButton button)
{
LoadTheGame(2);
}
...
function buttonLoad24_OnClick(GUIControl *control, MouseButton button)
{
LoadTheGame(24);
}
function buttonLoad25_OnClick(GUIControl *control, MouseButton button)
{
LoadTheGame(25);
}
...
function repeatedly_execute()
{
...
if (RefreshGameSlots!=0) {
PrepareSaveGUI(RefreshGameSlots);
}
if (RestoreCheck) {
if (gSaveLoad.Visible) {
gSaveLoad.Visible=false;
} else {
RestoreGameSlot(RestoreSlotNm);
RestoreSlotNm=0;
RestoreCheck=false;
}
}
...
}
function repeatedly_execute_always()
{
...
int gFloatingText_X=0;
int gFloatingText_Y=0;
// Position the floating text
if (ConversationIsOn) {
gFloatingText.X = 0;
gFloatingText.Y = 120;
} else {
if (mouse.Mode==eModeInteract) {
if ((gFloatingText.X+gFloatingText.Width)>SCREEN_WIDTH) {
Display("changing x for interact...");
gFloatingText_X = mouse.x - 64 - 5 - gFloatingText.Width; //past right-hand edge
Display("changed x for interact, it is now %d",gFloatingText_X);
gFloatingText_Y = mouse.y-30;
} else {
gFloatingText_X = mouse.x+17;
gFloatingText_Y = mouse.y-30;
}
} else {
if ((gFloatingText.X+gFloatingText.Width)>SCREEN_WIDTH) { //<--THIS CODE BLOCK RUNS.....
Display("changing x for any mode but interact...");
gFloatingText_X = mouse.x - 64 - gFloatingText.Width; //past right-hand edge
Display("TEMP VAR changed x for any mode but interact, it is now %d",gFloatingText_X);
Display("1 gfloatingtext x is %d",gFloatingText_X);
gFloatingText_Y = mouse.y-18;
} else {
gFloatingText_X = mouse.x;
gFloatingText_Y = mouse.y-18;
}
}
}
if ((gFloatingText.X+gFloatingText.Width)>SCREEN_WIDTH) Display("BEFORE ASSIGNMENT TO .X gfloatingtext x is %d from %d",gFloatingText_X, gFloatingText.X);
gFloatingText.X=gFloatingText_X;
gFloatingText.Y=gFloatingText_Y;
if ((gFloatingText.X+gFloatingText.Width)>SCREEN_WIDTH) Display("MIDDLE gfloatingtext x is %d from %d",gFloatingText_X, gFloatingText.X);
...
SayAtBubble(talk_x, talk_y-(bubbleSprite.GetNumberOfLines*8), "&777 line"); //will push the speech bubble up by number of lines used in speechbubble * 8 pixels for each
InventoryItem *a;
InventoryItem *b;
//use i on j
for (int i=0;i<=Game.InventoryItemCount;i++) {
a = invCustomInv.ItemAtIndex[i];
for (int j=0;j<=Game.InventoryItemCount;j++) {
b = invCustomInv.ItemAtIndex[j];
player.ActiveInventory=a;
Display("player.ActiveInventory.Name is %s while i is %d",player.ActiveInventory.Name, i);
Display("combining object index %s (%d/%d) with %s (%d/%d)",a.Name, i, Game.InventoryItemCount, b.Name, j, Game.InventoryItemCount);
Display("modeusinv interaction with %s is %d",b.Name, b.IsInteractionAvailable(eModeUseinv));
b.RunInteraction(eModeUseinv);
}
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.074 seconds with 14 queries.