Merge remote-tracking branch 'origin/master' into liquid_container

liquid_container
Mark 2016-04-05 06:29:54 +02:00
commit d474b0dd6e
17 changed files with 83 additions and 48 deletions

View File

@ -37,6 +37,8 @@ func Initialize()
MuzzleDown = 16;
MuzzleOffset = -8;
loaded = false;
animation_set = {
AimMode = AIM_Position, // The aiming animation is done by adjusting the animation position to fit the angle
AnimationAim = "MusketAimArms",
@ -106,9 +108,7 @@ func ControlUseStart(object clonk, int x, int y)
// Callback from the clonk when loading is finished
public func FinishedLoading(object clonk)
{
// Change picture to indicate being loaded.
this.PictureTransformation = Trans_Mul(Trans_Translate(-3000, 3000, 4000),Trans_Rotate(-45,0,0,1),Trans_Rotate(130,0,1,0));
loaded = true;
SetLoaded();
if(holding) clonk->StartAim(this);
return holding; // false means stop here and reset the clonk
}
@ -197,6 +197,22 @@ func RejectCollect(id shotid, object shot)
if(!(shot->~IsGrenadeLauncherAmmo())) return true;
}
public func SetLoaded()
{
loaded = true;
// Change picture to indicate being loaded.
this.PictureTransformation = Trans_Mul(Trans_Translate(-3000, 3000, 4000),Trans_Rotate(-45,0,0,1),Trans_Rotate(130,0,1,0));
return;
}
public func IsLoaded() { return loaded; }
// Can only be stacked with same state: loaded vs. non-loaded.
public func CanBeStackedWith(object other)
{
return this->IsLoaded() == other->~IsLoaded() && inherited(other, ...);
}
public func IsWeapon() { return true; }
public func IsArmoryProduct() { return true; }

View File

@ -34,6 +34,8 @@ func Initialize()
MuskDown = 16;
MuskOffset = -8;
loaded = false;
animation_set = {
AimMode = AIM_Position, // The aiming animation is done by adjusting the animation position to fit the angle
AnimationAim = "MusketAimArms",
@ -104,8 +106,7 @@ func ControlUseStart(object clonk, int x, int y)
// Callback from the clonk when loading is finished
public func FinishedLoading(object clonk)
{
SetProperty("PictureTransformation",Trans_Mul(Trans_Translate(500,1000,-000),Trans_Rotate(130,0,1,0),Trans_Rotate(20,0,0,1)));
loaded = true;
SetLoaded();
if(holding) clonk->StartAim(this);
return holding; // false means stop here and reset the clonk
}
@ -181,6 +182,22 @@ func RejectCollect(id shotid, object shot)
if(!(shot->~IsMusketAmmo())) return true;
}
public func SetLoaded()
{
loaded = true;
// Change picture to indicate being loaded.
this.PictureTransformation = Trans_Mul(Trans_Translate(500,1000,-000),Trans_Rotate(130,0,1,0),Trans_Rotate(20,0,0,1));
return;
}
public func IsLoaded() { return loaded; }
// Can only be stacked with same state: loaded vs. non-loaded.
public func CanBeStackedWith(object other)
{
return this->IsLoaded() == other->~IsLoaded() && inherited(other, ...);
}
public func IsWeapon() { return true; }
public func IsArmoryProduct() { return true; }

View File

@ -86,6 +86,7 @@ private func InitMaterials(int amount)
PlaceObjects(Dynamite, 4 * amount, "Earth");
PlaceObjects(Loam, 4 * amount, "Earth");
PlaceObjects(Metal, 2 * amount, "Earth");
PlaceObjects(Cloth, amount, "Earth");
// Additional item spawns.
if (SCENPAR_GameMode == 2)
{
@ -98,28 +99,26 @@ private func InitMaterials(int amount)
// Place chests on several of the sky islands.
for (var count = 0; count < amount / 2; count++)
{
var pos = FindIslandLocation();
var pos = FindIslandLocation(true);
if (!pos)
continue;
var chest = CreateObjectAbove(Chest, pos.x, pos.y);
chest->CreateContents(Dynamite, 4);
chest->CreateContents(Club);
chest->CreateContents(Javelin);
chest->CreateContents(Club, 4);
chest->CreateContents(Musket)->CreateContents(LeadShot);
chest->CreateContents(Bow)->CreateContents(Arrow);
chest->CreateContents(Bread, 2);
chest->CreateContents(IronBomb);
chest->CreateContents(Cloth);
chest->CreateContents(Pickaxe);
if (!Random(2))
chest->CreateContents(GrenadeLauncher)->CreateContents(IronBomb);
chest->CreateContents(Musket)->CreateContents(LeadShot);
chest->CreateContents(Musket)->CreateContents(LeadShot);
chest->CreateContents(IronBomb, 4);
chest->CreateContents(GrenadeLauncher)->CreateContents(IronBomb);
chest->CreateContents(GrenadeLauncher)->CreateContents(IronBomb);
if (!Random(2))
chest->CreateContents(Boompack);
if (!Random(2))
chest->CreateContents(WallKit);
if (!Random(2))
chest->CreateContents(TeleGlove);
}
// Load all weapons in the chests.
for (var weapon in FindObjects(Find_Or(Find_ID(Musket), Find_ID(GrenadeLauncher))))
weapon->SetLoaded();
// Place some catapults.
for (var count = 0; count < amount / 4; count++)
{
@ -144,16 +143,19 @@ private func InitMaterials(int amount)
return;
}
private func FindIslandLocation()
private func FindIslandLocation(bool is_chest)
{
var pos;
for (var tries = 0; tries < 100; tries++)
var map_zoom = GetScenarioVal("MapZoom", "Landscape");
var pos = {x = inventorslab_location[0] * map_zoom, y = inventorslab_location[1] * map_zoom};
for (var tries = 0; tries < 200; tries++)
{
pos = FindLocation(Loc_Sky(), Loc_Wall(CNAT_Bottom));
if (!pos)
continue;
if (FindObject(Find_Category(C4D_Vehicle), Find_Distance(30, pos.x, pos.y)))
continue;
if (is_chest && FindObject(Find_Or(Find_ID(ParkourCheckpoint), Find_ID(Chest)), Find_Distance(30, pos.x, pos.y)))
continue;
break;
}
return pos;

View File

@ -36,9 +36,9 @@
#include "platform/StdRegistry.h"
#import <Cocoa/Cocoa.h>
#import "C4AppDelegate.h"
#import "C4EditorWindowController.h"
#import "C4DrawGLMac.h"
#import "platform/C4AppDelegate.h"
#import "editor/C4EditorWindowController.h"
#import "graphics/C4DrawGLMac.h"
// implementation of C4Console GUI for Mac OS X

View File

@ -15,7 +15,7 @@
#import <AppKit/AppKit.h>
#import <Quartz/Quartz.h>
#import <C4WindowController.h>
#import "platform/C4WindowController.h"
#ifdef USE_COCOA

View File

@ -22,9 +22,9 @@
#include "game/C4Game.h"
#import <Cocoa/Cocoa.h>
#import <C4EditorWindowController.h>
#import <C4DrawGLMac.h>
#import <C4AppDelegate.h>
#import "editor/C4EditorWindowController.h"
#import "graphics/C4DrawGLMac.h"
#import "platform/C4AppDelegate.h"
#ifdef USE_COCOA

View File

@ -27,7 +27,7 @@
#include <GL/glew.h>
#ifdef USE_COCOA
#import "ObjectiveCAssociated.h"
#import "platform/ObjectiveCAssociated.h"
#endif
#include "graphics/C4Draw.h"
#include "graphics/C4Shader.h"

View File

@ -28,9 +28,9 @@
#include "graphics/C4DrawGL.h"
#import "C4DrawGLMac.h"
#import "C4WindowController.h"
#import "C4AppDelegate+MainMenuActions.h"
#import "graphics/C4DrawGLMac.h"
#import "platform/C4WindowController.h"
#import "platform/C4AppDelegate+MainMenuActions.h"
#ifdef USE_COCOA

View File

@ -14,7 +14,7 @@
*/
#import <Cocoa/Cocoa.h>
#import "C4AppDelegate.h"
#import "platform/C4AppDelegate.h"
@interface C4AppDelegate (MainMenuActions)
- (IBAction) openScenario:(id)sender;

View File

@ -20,9 +20,9 @@
#include "game/C4Viewport.h"
#include "game/C4GraphicsSystem.h"
#import "C4AppDelegate+MainMenuActions.h"
#import "C4DrawGLMac.h"
#import "C4EditorWindowController.h"
#import "platform/C4AppDelegate+MainMenuActions.h"
#import "graphics/C4DrawGLMac.h"
#import "editor/C4EditorWindowController.h"
@implementation C4AppDelegate (MainMenuActions)

View File

@ -27,7 +27,7 @@
#import <Cocoa/Cocoa.h>
#ifdef USE_COCOA
#import "C4EditorWindowController.h"
#import "editor/C4EditorWindowController.h"
#endif
@interface C4AppDelegate: NSObject

View File

@ -20,8 +20,8 @@
#include "game/C4Application.h"
#include "game/C4Game.h"
#import "C4AppDelegate.h"
#import "C4AppDelegate+MainMenuActions.h"
#import "platform/C4AppDelegate.h"
#import "platform/C4AppDelegate+MainMenuActions.h"
#ifdef USE_SDL_MAINLOOP
#import "SDL/SDL.h"
#endif

View File

@ -27,8 +27,8 @@
#import <Cocoa/Cocoa.h>
#ifndef USE_CONSOLE
#import "C4WindowController.h"
#import "C4DrawGLMac.h"
#import "platform/C4WindowController.h"
#import "graphics/C4DrawGLMac.h"
bool C4AbstractApp::Copy(const StdStrBuf & text, bool fClipboard)
{

View File

@ -26,7 +26,7 @@
#ifdef __APPLE__
#import <CoreFoundation/CoreFoundation.h>
#import <CoreServices/CoreServices.h>
#import "ObjectiveCAssociated.h"
#import "platform/ObjectiveCAssociated.h"
#endif
class C4FileMonitor: public StdSchedulerProc, public C4InteractiveThread::Callback

View File

@ -312,7 +312,7 @@ extern int MK_ALT;
#define K_WIN_R SDL_SCANCODE_RGUI
#define K_PRINT SDL_SCANCODE_PRINTSCREEN
#elif defined(USE_COCOA)
#import "ObjectiveCAssociated.h"
#import "platform/ObjectiveCAssociated.h"
// FIXME
// declare as extern variables and initialize them in StdMacWindow.mm so as to not include objc headers
const int CocoaKeycodeOffset = 300;

View File

@ -22,10 +22,10 @@
#include "game/C4FullScreen.h"
#include "landscape/C4Landscape.h"
#import "C4WindowController.h"
#import "C4DrawGLMac.h"
#import "C4EditorWindowController.h"
#import "C4AppDelegate.h"
#import "platform/C4WindowController.h"
#import "graphics/C4DrawGLMac.h"
#import "editor/C4EditorWindowController.h"
#import "platform/C4AppDelegate.h"
#import "AppKit/NSOpenGL.h"
static SInt32 osVersion()

View File

@ -22,8 +22,8 @@
#include "game/C4FullScreen.h"
#import <AppKit/AppKit.h>
#import <C4WindowController.h>
#import <C4DrawGLMac.h>
#import "platform/C4WindowController.h"
#import "graphics/C4DrawGLMac.h"
#ifdef USE_COCOA